Hacker News new | past | comments | ask | show | jobs | submit login

Always glad to see tips, tricks, and otherwise for Python. But for anyone checking out Python who sees how useful the defaultdict construct is but doesn't necessarily need nested attributes, the Counter class[0] has been available for some time now. If you just want to keep track of, well, counts, it's very handy and versatile.

[0] https://docs.python.org/3.1/library/collections.html#collect...




Totally true, I'll add that in




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: