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

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

[Python-Dev] PEP 326 (quick location possibility)Raymond Hettinger python at rcn.com
Thu Jan 29 10:24:27 EST 2004
> Indeed, I had a bug within the past few years in a find-the-minimum
search
> loop, using an initial value 10x larger than anything I thought I'd
ever
> see.  A few months later, the inputs in one case happened *all* to be
> larger
> than that, so it returned the bogus initial value as if it were a
sensible
> result.  Hilarity ensued.  There are few enough bugs in my code at
this
> age
> that I take very seriously any principled gimmick that could prevent
> repeating one.  

Alex Martelli had proposed extending the key= idea to min() and max().
The idea is to let those functions completely encapsulate the logic
of searching for minimum and maximum elements:

   bestplayer = min(players, key=attrgetter('points'))

This would work equally well with other objective functions.


Raymond Hettinger


#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################

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