[Python-ideas] Adding a thin wrapper class around the functions in stdlib.heapq
stephanh42 at gmail.com
Wed Nov 22 06:23:54 EST 2017
I thought the purpose of heapq was to have a ready-made example
for instructors on how an API can be improved by applying object-oriented
I think adding a HeapQueue class would be a great idea. Obviously the
would need to continue existing for backward compatibility.
2017-11-22 12:09 GMT+01:00 Antoine Pitrou <solipsis at pitrou.net>:
> On Wed, 22 Nov 2017 00:22:00 -0600
> Nick Timkovich <prometheus235 at gmail.com>
> > Functions are great. I'm a big fan of functions. However,
> > 1. Once there are several that all have the same thing as an argument:
> > thing_operation1(thing, arg), thing_operation2(thing, arg)...it's about
> > time to bind them together.
> > 2. And especially for the heap "soft-datatype": once it's heapified,
> > naively modifying it with other methods will ruin the heap invariant.
> > actual list you pass around can't be treated as a list.**
> A third reason: documentation and discoverability. If I type
> help(some_heapified_list) at the prompt, I get the usual documentation
> for list methods, not the documentation of heapq functions...
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas