Comprehensive update to PADS
I just updated my PADS library of Python algorithms to Python 2.7. So it will no longer run on older versions of Python, but on the other hand it now appears to pass all the compatibility checks for Python 3 (although I haven't tried actually running it in Python 3).
My favorite things about upgrading from 2.6 to 2.7 are set expressions, set comprehensions and dict comprehensions. That is, you can write {1,2,3}
and get a set object containing the elements 1,2,3, you can write {i:(i^1,i^2,i^4) for i in range(8)}
to make a dictionary that maps each integer from 0 to 7 to its three cube neighbors (that is, in van Rossum's format for representing graphs, the graph of the cube), and you can write expressions like {v for v in avail if len(avail[v]) == 1}
to make a set of the elements mapped by avail to a one-element list.
Most of my changes involved replacing the old Set package with the slightly-less-old built-in set type, and using the new comprehension syntax. One minor issue that caused me a little difficulty was that it used to be possible to compare None with other objects, which allowed it to be used as a flag value in certain cases and which also allowed expressions like map(min,L1,L2) to find the minima of items in the same positions of two lists even when the lists had different lengths, but now that causes a compatibility warning. Another thing that took me a while to figure out was issue 11796, which means that set and dict comprehensions (and in Python 3 list comprehensions) are not really usable when you're initializing class variables, because they mostly can't see the other class variables.