[Python-ideas] Add OrderedSet now that OrderedDict is in collections
Terry Reedy
tjreedy at udel.edu
Fri May 8 20:12:02 CEST 2009
Mart Sõmermaa wrote:
> On Sun, Apr 12, 2009 at 1:22 AM, Mart Sõmermaa <mrts.pydev-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:
>> There was a somewhat ancient discussion on OrderedDict and OrderedSet
>> before: http://mail.python.org/pipermail/python-dev/2005-March/051915.html
>>
>> The resolution seemed to be that neither of them should be in stdlib. Now
>> that OrderedDict is in and Raymond Hettinger has created a solid OrderedSet
>> implementation: http://code.activestate.com/recipes/576694/ , could the
>> latter also be included in collections?
>
> So, let's review what we have in terms of data structures:
>
> Structure Stable Unique Python type
> -------------------------------------------
> Multiset no no -
> Set no yes set
> Map no yes dict
> List yes no list, tuple
> Ordered set yes yes -
> Ordered map yes yes collections.OrderedDict
>
> where "stable" means that input order is retained.
>
> As Multiset is arguably quite useless, only Ordered set is missing
> from "total" coverage of data structures. And it is practical as well.
>
> Am I really the only one who would like to see this in stdlib?
What are the use cases? An 'ordered set' is basically a list + set.
More information about the Python-ideas
mailing list