[Python-Dev] heapq API
raymond.hettinger at verizon.net
Sat Jun 12 04:38:56 EDT 2004
Please give feedback on two proposed new functions heappushpop(heap,
item) and heapiter(heap). Both are intended to make the API more
closely fit the way heaps are actually used and to take maximum
advantage of the implementation.
The first is equivalent to:
def heappushpop(heap, item):
"Pushes the item onto the heap and then pops the smallest value"
if not heap or item < heap:
return heapreplace(heap, item)
"Return a destructive iterator over the heap's elements,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev