News for hackers. Stuff that matters.
Re:A Hodgepodge of Python by randlet on Thursday September 15, 2011 @09:01PM (#3002714)
You can use the Counter class from the collections module[1] for that as well.

  >>> from collections import Counter
  >>> c = Counter()
  >>> c['foo']
  0
  >>> c['bar'] +=1
  >>> c['bar']
  1
  >>> 
[1] http://docs.python.org/dev/library/collections.html#collecti...

There are no comments on this comment yet.