Proposal: min(None, x) and max(None, x) return x
Erik Max Francis
max at alcyone.com
Sat Nov 23 01:21:47 EST 2002
Alex Martelli wrote:
> Indeed, you can sort a list containing, say, a None, a string, an
> integer and a float -- but if you add to the list a fifth element
> that is a complex, POOF, you can't sort it any more. That didn't
> use to be so, if I recall correctly, in Python 1.5.2, but has
> been that way for quite a while now. Why comparing string 'plak'
> with the number 23 is OK, but comparing it with 23j isn't, kind
> of escapes me -- but apparently property (2) was deemed less
> desirable than the ability to forbid e.g. comparing 23j with 42j.
> To the point of changing Python's previous behavior, no less:-(.
Well, it was obviously done for mathematical reasons -- there is
explicitly no ordering defined for complex numbers. In the light of
Python's inclination to allow comparison of arbitrary, heterogeneous
types, it certainly does have the feel of a wart, despite its
mathematical correctness.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ The little I know, I owe to my ignorance.
\__/ Sacha Guitry
Bosskey.net: Counter-Strike / http://www.bosskey.net/cs/
A personal guide to Counter-Strike.
More information about the Python-list
mailing list