A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-June/073611.html below:

[Python-Dev] Instance variable access and descriptors

[Python-Dev] Instance variable access and descriptors [Python-Dev] Instance variable access and descriptorsArmin Rigo arigo at tunes.org
Mon Jun 11 13:06:13 CEST 2007
Hi Eyal,

On Sun, Jun 10, 2007 at 04:13:38AM +0300, Eyal Lotem wrote:
> I must be missing something, as I really see no reason to keep the
> existing semantics other than backwards compatibility (which can be
> achieved by introducing a __fastattr__ or such).
> 
> Can you explain under which situations or find any example situation
> where the existing semantics are desirable?

The existing semantics are essential when dealing with metaclasses.
Many of the descriptors of the 'type' class would stop working without
it.  For example, the fact that 'x.__class__' normally gives the type of
'x' for any object x relies on this.  Reading the '__dict__' attribute
of types is also based on this.  Before proposing changes, be sure you
understand exactly how the following works:

    >>> object.__class__
    <type 'type'>
    >>> object.__dict__['__class__']
    <attribute '__class__' of 'object' objects>

    >>> class A(object):
    ...     pass
    >>> A.__dict__
    <dictproxy object at 0xb7c98e6c>
    >>> A.__dict__['__dict__']
    <attribute '__dict__' of 'A' objects>


A bientot,

Armin.
More information about the Python-Dev mailing list

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