[Python-Dev] Re: heapq method names

Raymond Hettinger python@rcn.com
Mon, 26 Aug 2002 10:55:15 -0400


From: "Tim Peters" <tim.one@comcast.net>
> If you want simpler names, I'm finding this little module quite pleasant to
> use:
> 
> """
> import heapq
> 
> class Heap(list):
>     def __init__(self, iterable=[]):
>         self.extend(iterable)
>     push    = heapq.heappush
>     popmin  = heapq.heappop
>     replace = heapq.heapreplace
>     heapify = heapq.heapify
> """

And perhaps:
   def __iter__(self):
       while True:
            yield self.popmin()

Raymond Hettinger