How to sort a list? NOT a newbie question.

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Sep 17 21:04:44 EDT 2001


> But what would the point be? The current implementation is telling you
> that there is no meaningful sort order that it can impose.

The point would be to make sort() impose an ordering on
everything, arbitrary where necessary. That's what the
original poster was asking for, and I was pointing out
that the new rich-comps stuff doesn't make it impossible.

Whether it's a good idea or not is another question.
Personally I can't see how it would hurt anything, and
it can sometimes be useful.

But if you want to be purist about it, I'd suggest that
sort() should refuse to compare objects of different types,
either. Presently it's quite happy to impose an arbitrary
ordering in that case.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Python-list mailing list