Counter Class -- Bag/Multiset

Raymond Hettinger python at rcn.com
Thu Jan 22 19:11:37 CET 2009


The collections module in Python 2.7 and Python 3.1 has gotten a new
Counter class that works like bags and multisets in other languages.

I've adapted it for Python2.5/2.6 so people can start using it right
away:
  http://docs.python.org/dev/library/collections.html#counter-objects

Here's a link to the docs for the new class:
  http://code.activestate.com/recipes/576611/


Raymond



More information about the Python-list mailing list