A note on heapq module
Steven Bethard
steven.bethard at gmail.com
Thu Jan 18 18:41:48 EST 2007
More information about the Python-list mailing list
Thu Jan 18 18:41:48 EST 2007
- Previous message (by thread): A note on heapq module
- Next message (by thread): A note on heapq module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
bearophileHUGS at lycos.com wrote: > Steven Bethard wrote: >> The current code fails when using unbound methods however:: > > I don't like your solution, this class was already slow enough. Don't > use unbound methods with this class :-) > Maybe there's a (better) solution to your problem: to make Heap a > function (or classmethod) that return sone of two possibile objects > created by one of two different classes that have different methods... That's probably viable. Maybe you should just have two separate classes: Heap and KeyedHeap. The inplace= parameter doesn't really make sense for a KeyedHeap anway, so you could just have:: Heap(sequence=None, inplace=False) KeyedHeap(key, sequence=None) Of course, this approach ends up with a bunch of code duplication again. STeVe
- Previous message (by thread): A note on heapq module
- Next message (by thread): A note on heapq module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list