[Python-ideas] collections.sortedset proposal

Nick Coghlan ncoghlan at gmail.com
Wed Dec 26 11:12:11 CET 2012


On Wed, Dec 26, 2012 at 7:59 PM, Paul Colomiets <paul at colomiets.name> wrote:
> Hi,
>
> On Wed, Dec 26, 2012 at 9:58 AM, Terry Reedy <tjreedy at udel.edu> wrote:
>>> SortedSet (name borrowed from Redis) is a basically a mapping of
>>> (unique) keys to scores, that allows fast slicing by ordinal number
>>> and by score.
>>
>>
>> Since a set, in general, is not a mapping, I do not understand what you
>> mean. If you mean a mapping from sorted position to item, then I would call
>> it a sortedlist.
>>
>
> Ok. My description is vague. Here is one from Redis documentation:
>
> Redis Sorted Sets are, similarly to Redis Sets, non repeating
> collections of Strings. The difference is that every member of a
> Sorted Set is associated with score, that is used in order to take the
> sorted set ordered, from the smallest to the greatest score. While
> members are unique, scores may be repeated.

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

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list