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

Nick Coghlan ncoghlan at gmail.com
Sat Jul 18 04:58:18 CEST 2009


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.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------



More information about the Python-ideas mailing list