[Python-ideas] collections.sortedset proposal
Nick Coghlan
ncoghlan at gmail.com
Wed Dec 26 15:32:02 CET 2012
On Wed, Dec 26, 2012 at 8:59 PM, Paul Colomiets <paul at colomiets.name> wrote:
> 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"?
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.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list