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

This works fine too,

   dict((k, []) for k in keys)
Although I later realized what I really needed was defaultdict[1]

   d = defaultdict(list)
[1]: http://docs.python.org/2/library/collections.html#collection...



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

Search: