> In the `heapq' module, I'm a little bothered by the fact modules names have > `heap' as a prefix in their name. If the methods have been installed as > standard list methods, it would be quite understandable, but it has been > decided otherwise. > > The most usual way of using a module is: > > import MODULE > ... > MODULE.METHOD(ARGUMENTS) > > rather than: > > from MODULE import METHOD > ... > METHOD(ARGUMENTS) > > and we should name METHODs accordingly, not repeating the MODULE as prefix. > This is a rather common usage, almost everywhere in the Python library. > > So my suggestion of changing now, before `heapq' gets released for real: > > heappush -> push > heappop -> pop > heapreplace -> replace > > I guess that `heapify' is OK as it stands. > > The example should be changed accordingly, that is, using `import heapq' > instead of `from heapq import such-and-such', using `heapq.push' instead of > `heappush' and `heapq.pop' instead of `heappop'. -1. The nmes 'push', 'pop' and 'replace' are too generic. The module seems to "invite" the ``from heapq import heappush, heappop'' syntax, and I'd like to honor that. --Guido van Rossum (home page: http://www.python.org/~guido/)
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