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/073600.html below:

[Python-Dev] Fwd: Instance variable access and descriptors

[Python-Dev] Fwd: Instance variable access and descriptors [Python-Dev] Fwd: Instance variable access and descriptorsPhillip J. Eby pje at telecommunity.com
Sun Jun 10 20:28:23 CEST 2007
At 11:27 AM 6/10/2007 +0100, Gustavo Carneiro wrote:
>   I have to agree with you.  If removing support for 
> self.__dict__['propertyname'] (where propertyname is also the name 
> of a descriptor) is the price to pay for significant speedup, so be 
> it.  People doing that are asking for trouble anyway!

How so?  This order of lookup is explicitly defined by the precedence 
rules of PEP 252:

"""When a dynamic attribute (one defined in a regular object's
__dict__) has the same name as a static attribute (one defined
by a meta-object in the inheritance graph rooted at the regular
object's __class__), the static attribute has precedence if it
is a descriptor that defines a __set__ method (see below);
otherwise (if there is no __set__ method) the dynamic attribute
has precedence.  In other words, for data attributes (those
with a __set__ method), the static definition overrides the
dynamic definition, but for other attributes, dynamic overrides
static."""

I fail to see how relying on explicitly-documented language behavior 
is "asking for trouble". 

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