A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-August/028315.html below:

[Python-Dev] Re: heapq method names

[Python-Dev] Re: heapq method names [Python-Dev] Re: heapq method namesFrançois Pinard pinard@iro.umontreal.ca
26 Aug 2002 08:32:02 -0400
[Tim Peters]

> Note that it's common to use the bisect module in the

>     from bisect import bisect_right, bisect, insort

> way too, rather than spell out bisect.bisect (etc) each time.  That's "the
> other" module that (conceptually) adds new methods to lists.

Wow!  You just put the finger on it...  I wondered a few times why this
module never attracted me! :-) :-)

> If you want simpler names, I'm finding this little module quite pleasant
> to use: [...]  That is, it creates a Heap type that's just a list with
> some extra methods.

Very elegant indeed.  Something like this was discussed earlier, but faded
out of my memory.  Thanks for the tip, Tim!

> Note that the "pop" method can't be named "pop"!  If you try, you'll soon
> get unbounded recursion because the heapq functions need list.pop to access
> the list meaning of "pop".

Sold!  `popmin' is adequate and clear.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard



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