En Mon, 06 Jul 2009 19:49:41 -0300, MRAB <pyt...@mrabarnett.plus.com>
escribió:
Chris Rebert wrote:

 from collections import defaultdict
 counts = defaultdict(lambda: 0)

Better is:
counts = defaultdict(int)

For speed? This is even faster:
zerogen = itertools.repeat(0).next
counts = defaultdict(zerogen)

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to