Hacker News new | ask | show | jobs
by kbsletten 2641 days ago
To be fair, getValueOrDefault is strictly more powerful than defaultdict because you can vary the initial value by the key.
1 comments

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.