I want to write a custom class that behaves like dict - so, I am inheriting from dict.
dict
My question, though, is: Do I need to create a priva
Don’t inherit from Python built-in dict, ever! for example update method woldn't use __setitem__, they do a lot for optimization. Use UserDict.
update
__setitem__
from collections import UserDict class MyDict(UserDict): def __delitem__(self, key): pass def __setitem__(self, key, value): pass