How to sort a list? NOT a newbie question.
Greg Ewing
greg at cosc.canterbury.ac.nz
Mon Sep 17 20:08:52 EDT 2001
Chris Barker wrote:
>
> Python is more general purpose, so the list sort() method has to do the
> same thing as the comparison operators.
I don't think that's true. The sort() method could first look
for a __cmp__ method, and __cmp__ for complex numbers could
impose an arbitary ordering, independently of what <, >, <=,
>= do.
--
Greg Ewing, Computer Science Dept, University of Canterbury,
Christchurch, New Zealand
To get my email address, please visit my web page:
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list