The documentation states: """Objects such as modules and instances have an updateable __dict__ attribute; however, other objects may have write restrictions on their __dict__ attributes (for example, classes use a dictproxy to prevent direct dictionary updates).""" However, it's not clear from that *why* direct dictionary updates are undesirable. This not only prevents you from getting a reference to the real class dict (which is the apparent goal), but is also the fundamental reason why you can't use a metaclass to put, say, an OrderedDict in its place - because the type constructor has to copy the dict that was used in class preparation into a new dict rather than using the one that was actually returned by __prepare__. [Also, the name of the type used for this is mappingproxy, not dictproxy]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4