[Python-ideas] Higher leavel heapq
Joao S. O. Bueno
jsbueno at python.org.br
Thu Jan 14 11:06:46 EST 2016
Hi,
the heapq stdlib module is really handy, but a little low level -
in that it accepts a sequence, possibly only a list, as the heap-object,
and that object have to be handled independently, outside the functions
provided in there. (One can't otherwise insert or delete elements of that list,
without destroying the heap, for example).
It would be simple to have a higher level class that would do just
that, and simplify the use
of an ordered container - what about having an extra class there?
I have the snippet bellow I wrote on stack-overflow a couple years ago -
it is very handy.With a little more boiler plate and code hardening,
maybe it could
be a nice thing for the stdlib?
What do you say?
http://stackoverflow.com/questions/8875706/python-heapq-with-custom-compare-predicate/8875823#8875823
js
-><-
More information about the Python-ideas
mailing list