>>>>> "TP" == Tim Peters <tim.one@comcast.net> writes: TP> That is, it creates a Heap type that's just a list with some TP> extra methods. Note that the "pop" method can't be named "pop"! TP> If you try, you'll soon get unbounded recursion because the TP> heapq functions need list.pop to access the list meaning of TP> "pop". TP> Guido suggested a long time ago that such a class could be added TP> to heapq, and I like it a lot in real life. You can't use all of the regular list methods, right? If I'd called append() an a Heap(), it wouldn't maintain the heap invariant. I would think the same is true of insert() and lots of other methods. If we add a Heap class, which seems quite handy, maybe we should disable methods that don't work. Interesting to note that if you disable the invalid methods of list, then you've got a subclass of list that is not a subtype. Jeremy
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