Re:A Hodgepodge of Python
by BrandonM on Thursday September 15, 2011 @09:11PM
(#3002740)
I use defaultdict a lot. It's useful not only for counters, but also for sets, lists, dicts, and even other defaultdicts. It usually results in very succinct code compared to alternatives:
(I'm aware that digraphs could be done as a single flat dict; it's just a trivial example to show defaultdict nesting.)
[ Parent
| on HN ]
There are no comments on this comment yet.