[Python-ideas] Proposal for extending the collections module - bags / multisets, ordered sets / unique lists

Michael Lenzen m.lenzen at gmail.com
Tue Jul 21 05:40:40 CEST 2009


On 07/17/2009 08:54 PM, Michael Lenzen wrote:
> In a nutshell, I want to add 2 new classes (and respective frozen
> varients) to the collections module, namely a bag (multiset) class and a
> setlist (ordered set/unique list) class. I know this has been floated
> before, but I think it merits more consideration.

So I have pared down my proposition to just adding bag and setlist 
classes, without the additional ABCs, modifications to set and 
collection factory.  I know I still haven't posted use cases, but I'm 
hoping supporters of this will post some too.  I haven't given up on the 
idea of a unified Collections interface and a collection factory, but 
baby steps are probably better.

My implementation is here:
http://python-data-structures.googlecode.com/svn/trunk/collections_.py

It is a drop in replacement for collections, so
 >>> import collections_ as collections
or
 >>> from collections_ import bag, setlist

If I should post this to another more appropriate list, just let me know 
where.

I plan on creating a package and submitting it to pypi , but I would 
like other people to test it first.

-Michael Lenzen



More information about the Python-ideas mailing list