Re:Map.merge() – One method to rule them all
by kbsletten on Sunday March 31, 2019 @10:27AM
(#19535734)
To be fair, getValueOrDefault is strictly more powerful than defaultdict because you can vary the initial value by the key.
[ Parent
| on HN ]
Re:Map.merge() – One method to rule them all
by detaro on Sunday March 31, 2019 @10:42AM
(#19535830)
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.