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[0]: return item return heapreplace(heap, item) def heapiter(heap): "Return a destructive iterator over the heap's elements, smallest-to-largest" try: while 1: yield heappop(heap) except IndexError: pass Raymond -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20040612/75c74107/attachment.html
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