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/042336.html below:

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

[Python-Dev] PEP 326 (quick location possibility)Tim Peters tim.one at comcast.net
Thu Jan 29 13:49:52 EST 2004
[Skip]
> Perhaps a stupid observation, but empty lists, dicts, strings and
> tuples appear to compare larger than any int or float:

Why do you presume it's numbers that are getting compared in a min/max
search loop?  Sometimes it's tuples, sometimes lists, sometimes strings,
sometimes instances of a user-defined class (etc).

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

Sorry, they can't.  If so happens that every string compares less than every
tuple -- you really expect sensible code to be written that way?  The
brittleness compounds if you try.  Extending that example, it so happens
that every Unicode string compares *larger* than every tuple, so apart from
the inherent obscurity of relying on accidental crap like that, it can break
when your input data changes a little.


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