Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
kbsletten
· 7y ago · 0 comments
To be fair, getValueOrDefault is strictly more powerful than defaultdict because you can vary the initial value by the key.
Comments
[–]
detaro
7y ago
dict.get() does the same in Python (optional second parameter for a default value). But I've wondered too why there isn't a form of the default dict that can take parameters like the key for the factory function.