This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author torsten
Recipients ajaksu2, eric.snow, gangesmaster, kushal.das, matthieu.labbe, r.david.murray, torsten
Date 2016-01-29.16:16:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1454084190.38.0.567967446933.issue1475692@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-01-29 16:16:30torstensetrecipients: + torsten, gangesmaster, ajaksu2, r.david.murray, matthieu.labbe, eric.snow, kushal.das
2016-01-29 16:16:30torstensetmessageid: <1454084190.38.0.567967446933.issue1475692@psf.upfronthosting.co.za>
2016-01-29 16:16:30torstenlinkissue1475692 messages
2016-01-29 16:16:30torstencreate