Python 3.0, rich comparisons and sorting order

Istvan Albert ialbert at mailblocks.com
Tue Sep 21 14:26:54 EDT 2004


Carlos Ribeiro wrote:

> sort() should work regardless of the list elements, and return a
> reasonable result, even if not strictly correct in the numerical
> sense.

If the objects cannot be compared then there is no
reasonable result. Getting them back in whatever order is not one.
You're better off not sorting then. If half of your objects are
sortable and the rest are not what should the result be?

I don't think it is a bad idea disallowing the sort
in those circumstances.

Istvan.






More information about the Python-list mailing list