Well, it's a lot of overhead for a very small bit of convenience. I say let's not do this, it would just encourage people to settle for a slower version. Not everything needs to be OO, you know! On Thu, Jan 14, 2016 at 8:06 AM, Joao S. O. Bueno <jsbueno@python.org.br> wrote:
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-...
js -><- _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido)