[Python-Dev] PEP 326 (quick location possibility)
Skip Montanaro
skip at pobox.com
Thu Jan 29 13:31:35 EST 2004
Tim> In 2.3, None compares less than anything else;
Perhaps a stupid observation, but empty lists, dicts, strings and tuples
appear to compare larger than any int or float:
>>> lst = [(), [], {}, "", 1e308, sys.maxint, 0, -sys.maxint, -1e308, None]
>>> lst.sort()
>>> lst.reverse()
>>> lst
[(), '', [], {}, 1e+308, 2147483647, 0, -2147483647, -1e+308, None]
>>> absmax = lst[0]
>>> absmin = lst[-1]
>>> print absmax
()
>>> print absmin
None
I realize this is implementation-dependent (and I'm sure Tim already knows
all this stuff). People wanting absolute min and max objects could use
something like the above to generate such stuff when needed.
pep-326-not-really-needed-ly, y'rs,
Skip
More information about the Python-Dev
mailing list