[Python-Dev] Instance variable access and descriptors

Steven Bethard steven.bethard at gmail.com
Sat Jun 9 23:51:57 CEST 2007


On 6/9/07, Eyal Lotem <eyal.lotem at gmail.com> wrote:
> I believe that this should be changed, so that Python first looks for
> the attribute in the instance's dict and only then through the dict's
> mro.
[snip]
> What do you think?

Are you suggesting that the following code should print "43" instead of "42"?
::

    >>> class C(object):
    ...     x = property(lambda self: self._x)
    ...     def __init__(self):
    ...         self._x = 42
    ...
    >>> c = C()
    >>> c.__dict__['x'] = 43
    >>> c.x
    42

If so, this is a pretty substantial backwards incompatibility, and you
should probably post this to python-ideas first to hash things out. If
people like it there, the right target is probably Python 3000, not
Python 2.x.

STeVe
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy


More information about the Python-Dev mailing list