Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
naiquevin
on Dec 26, 2012
|
parent
|
context
|
favorite
| on:
Python alternatives for PHP functions
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: