Python 3.0, rich comparisons and sorting order

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Wed Sep 22 00:13:20 CEST 2004


Carlos Ribeiro wrote:

> Just to make it clear, here it is how it works now:
> 
>>>> a = [ 3.5, -1.0, "", (0,1), None, "z"]
>>>> a.sort()
>>>> a
> [None, -1.0, 3.5, '', 'z', (0, 1)]

Add a complex to that list and watch the result.

Not all lists are sortable *now*. The change in Python 3.0 is to make it
much more obvious that you *can't* just sort a list of unknown types.

Tim Delaney



More information about the Python-list mailing list