[Python-Dev] Re: heapq method names
26 Aug 2002 08:32:02 -0400
> 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