[Python-ideas] Adding a thin wrapper class around the functions in stdlib.heapq
greg.ewing at canterbury.ac.nz
Tue Nov 21 23:55:51 EST 2017
Chris Angelico wrote:
> So the question is more: why, with Python being the way it is, do the
> heap functions operate on a list? I think heapq.heapify is the answer:
> in linear time, it heapifies a list *in place*.
There's no reason a Heap object couldn't accomodate that
case. E.g. the constructor could optionally accept an
existing list to heapify and wrap.
More information about the Python-ideas