-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I must agree with Agthorr that the interface to heapq could use some work. I wrote a simple wrapper around the heapq functions to give myself a heapq object (with methods like push, pop, etc.) Here's that object: class heap(list): __slots__ = () def __init__(self, seq): list.__init__(self, seq) heapify(self) def pop(self): lastelt = list.pop(self) if self: returnitem = self[0] self[0] = lastelt _siftup(self, 0) else: returnitem = lastelt return returnitem replace = heapreplace push = heappush Is there any possibility of such an interface going into the heapq module? I find it much cleaner and easier to read than the "functions operating on sequences" interface heapq currently offers. I've got unit tests for the object written, if it is something that will possibly go into the standard library. Jeremy -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+omDOqkDiu+Bs+JIRAu0wAJ9xpx+7nH0fNiZzJhl34tWUbHN4HgCfZx9G 38IgV4lSY6adYyLEufWG6mk= =NVlh -----END PGP SIGNATURE-----
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