[Python-ideas] collections.sortedset proposal

Paul Colomiets paul at colomiets.name
Wed Dec 26 11:59:40 CET 2012


Hi Nick,

On Wed, Dec 26, 2012 at 12:12 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Perhaps you mean a heap queue? The standard library doesn't have a
> separate type for that, it just has some functions for treating a list
> as a heap: http://docs.python.org/2/library/heapq.html
>

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"?

--
Paul



More information about the Python-ideas mailing list