A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-January/042334.html below:

[Python-Dev] PEP 326 (quick location possibility)

[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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4