Python order warts (and others)

Ian Bicking ianb at colorstudy.com
Fri Nov 22 18:03:06 EST 2002


On Fri, 2002-11-22 at 14:38, David Mertz wrote:
> But those warts are only matters of syntax.  I might have spelled those
> things differently, but there is no deep semantic issue.  The
> "incommensurability of complex numbers" is a much worse semantic
> problem.  I used to be able to sort lists, now I cannot.  Or at least
> without first checking all the contents of the lists before I try to
> sort (or maybe catching errors and recovering somehow).  It's ugly.

It sounds like what you're looking for is ordering, not comparison,
i.e., a function like cmp that never throws an exception and given two
objects will always produce the same result -- predictable and
repeatable, but otherwise potentially arbitrary.

Such a function would seem to be a better solution than a new complex
class.  Unlike comparison you could also specify that the results would
be consistent across Python versions.

  Ian






More information about the Python-list mailing list