Why Python3

Martin v. Loewis martin at v.loewis.de
Tue Jun 29 02:12:14 EDT 2010


> 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?)

However, that's true for many other values that *where* ordered in 2.x.
Which is greater, (1,2) or [1,2]? It's meaningless mathematically.

Likewise (if you claim that comparing lists and tuples is like comparing
apples and oranges) - how should these be ordered:
file("/etc/passwd"), file("/etc/group"), and sys.stdin?

> 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.

And indeed, that's available, by means of the key= argument to list.sort.

Regards,
Martin



More information about the Python-list mailing list