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

Michael Lenzen m.lenzen at gmail.com
Sat Jul 18 06:57:06 CEST 2009

I posted this in the wrong thread before, sorry.

A Counter class is NOT a multiset/bag, it allows negative and zero 
elements.  This makes as much sense to me as having negative elements in 
a Set.  This is all besides the fact that Counter is nothing more than 
defaultdict(int) so it should be removed regardless of whether or not 
bags are added.

-Michael Lenzen

On 07/17/2009 09:58 PM, Nick Coghlan wrote:
> 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.
> A Counter class (aka bag/multiset) and an OrderedDict class were added
> to collections for 3.1. These classes will also be available in 2.7.
> Counter *is* a bag implementation, while OrderedDict can trivially be
> used as the basis for an OrderedSet implementation.
> Cheers,
> Nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090717/ebbcbf39/attachment.html>

More information about the Python-ideas mailing list