[Python-ideas] Add OrderedSet now that OrderedDict is in collections

Mart Sõmermaa mrts.pydev at gmail.com
Fri May 8 09:58:10 CEST 2009


On Sun, Apr 12, 2009 at 1:22 AM, Mart Sõmermaa <mrts.pydev at gmail.com> 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?



More information about the Python-ideas mailing list