On Tue, 14 Jun 2011 13:16:47 +0200, Peter Otten wrote in Message-Id: <it7fu4$rc5$1...@solani.org>:
> Your way is usually faster than > >> dict[key] = dict.get(key, 0) + 1 Thanks Peter, ran it through Timeit and you're right. It's probably also easier to read the conditional version, even if it is longer. > You may also consider > > http://docs.python.org/library/collections.html#collections.defaultdict > http://docs.python.org/library/collections.html#collections.Counter Useful functions, thanks again. -- http://mail.python.org/mailman/listinfo/python-list