Vladimir

10%
Flag icon
The default_factory of a defaultdict is only invoked to provide default values for __getitem__ calls, and not for the other methods. For example, if dd is a defaultdict, and k is a missing key, dd[k] will call the default_factory to create a default value, but dd.get(k) still returns None, and k in dd is False.
Fluent Python: Clear, Concise, and Effective Programming
Rate this book
Clear rating
Open Preview