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.