New submission from Daniel Wong:
heapq already provides a bunch of functions for manipulating lists that
preserve (or create) a heap invariant. My change adds two classes for
representing heaps. These classes ensure that operations that violate the heap
invariant are not possible (through the
Daniel Wong added the comment:
Hey Serhiy,
Are you suggesting that I put my new classes in a new module and rename them? I
think it'd be better to keep them in heapq, unless someone intended to add more
classes to your proposed queue module, because heap functionality would be
spread be
Daniel Wong added the comment:
Ah, Serhiy is pointing out that there's already a class named PriorityQueue in
the queue module. I didn't know that exists.
Now that I've had a chance to look at it, queue.PriorityQueue is like my Heap
class, but there are some interesting diffe
Daniel Wong added the comment:
from the peanut gallery:
This looks right to me; you are seeing that PriorityQueue is trying to compare
dicts, because that's how tuple comparison works: it is lexicographic. Since
the first element of the two tuples that you are trying to insert have the
Daniel Wong added the comment:
btw, I have a related patch: http://bugs.python.org/issue17834 Chances of it
being accepted aren't looking good right now though.
--
___
Python tracker
<http://bugs.python.org/is