[Python-ideas] collections.sortedset proposal

Paul Colomiets paul at colomiets.name
Wed Dec 26 16:09:27 CET 2012


Hi Nick,

On Wed, Dec 26, 2012 at 4:32 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> The problem with heap queue (as implemented in python) as priority
>> queue or list of timers is that it does not support deletion of the
>> tasks (at least not in efficient manner). For other use cases, e.g.
>> for a leader board heapq doesn't allow efficient slicing.
>>
>> Or do you mean "heap queue" is a nice name for the data structure that
>> redis calls "sorted set"?
>
> I mean if what you want is a heap queue with a more efficient
> heappop() implementation (due to a different underlying data
> structure), then it's probably clearer to call it that.
>

The underlying data structure is skiplists not heap. It would be
strange to call it heap-something.  But, yes, for the discussion,
similarity with heapqueue may be a better starting point.

--
Paul



More information about the Python-ideas mailing list