Message259213
I just bumped into this issue because I was shown by a colleague that my implementation of immutable objects (by replacing __dict__ with an ImmutableDict that inherits from dict and blocks write accesses) is ineffective - ouch!
I'd expect that Python either rejects subclasses of dict for obj.__dict__ or actually implements accessing correctly. Especially since the enum module created the impression for me that replacing __dict__ is a viable approach (enum.py uses __prepare__ in the meta class to provide a different dict class for enum types, just found https://www.python.org/dev/peps/pep-3115/).
Interestingly the PEP 3115 example code notes the following:
# Note that we replace the classdict with a regular
# dict before passing it to the superclass, so that we
# don't continue to record member names after the class
# has been created. |
|
Date |
User |
Action |
Args |
2016-01-29 16:16:30 | torsten | set | recipients:
+ torsten, gangesmaster, ajaksu2, r.david.murray, matthieu.labbe, eric.snow, kushal.das |
2016-01-29 16:16:30 | torsten | set | messageid: <1454084190.38.0.567967446933.issue1475692@psf.upfronthosting.co.za> |
2016-01-29 16:16:30 | torsten | link | issue1475692 messages |
2016-01-29 16:16:30 | torsten | create | |
|