Subclassing Python dictionary to override __setitem__
I’m answering my own question, since I eventually decided that I really do want to subclass Dict, rather than creating a new mapping class, and UserDict still defers to the underlying Dict object in some cases, rather than using the provided __setitem__. After reading and re-reading the Python 2.6.4 source (mostly Objects/dictobject.c, but I grepped … Read more