On Sun, 27 Jun 2010 20:12:10 -0400, Terry Reedy wrote: > 7. Order comparisonS > > In early Python1, I believe all objects could be (arbitrarily) compared > and sorted. When Guido added the complex type, he decided not to add an > arbitrary order, as he thought that could mask bugs.
I should point out that this wasn't a mere whimsy on Guido's part. Mathematically, supporting larger-than and less-than comparisons on complex numbers *is* a bug -- they're simply meaningless mathematically. (Which is greater, 2-1i or -1+2i?) What Python needs[1] is a "sorting" operator, which is allowed to return a consistent if arbitrary sort order (perhaps lexicographic sort order?), separate from the ordinary > and < operators. This would allow the caller to sort lists of arbitrary items for display purposes, without implying anything about the relative size of items. [1] For some definition of "need". -- Steven -- http://mail.python.org/mailman/listinfo/python-list