[Python-Dev] __dict__ strangeness

Armin Rigo arigo at tunes.org
Sun Mar 19 21:44:01 CET 2006


Hi,

On Sat, Mar 18, 2006 at 06:57:12PM +0100, Georg Brandl wrote:
> >> >>> class D(object):
> >> ...     __dict__ = {}
> >> ...
> >> >>> d = D()
> >> >>> d.a = 1
> >> >>> d.__dict__
> >> {}
> >> >>> d.__dict__ = {}
> >> >>> d.a
> >> 1
> > 
> > Yep, that's the bug, fully reproducible in 2.3 and 2.4.

IMHO this is not a bug, it's expected behavior.  I don't see what you
could "fix" without hacking the Python 2.2 descriptor model -- which is
possible, but probably not what we *should* do.  See zseil's
explanations on the SF tracker.


A bientot,

Armin


More information about the Python-Dev mailing list