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/2013-September/128776.html below:

[Python-Dev] PEP 447: add type.__locallookup__

[Python-Dev] PEP 447: add type.__locallookup__ [Python-Dev] PEP 447: add type.__locallookup__Ronald Oussoren ronaldoussoren at mac.com
Thu Sep 19 12:04:48 CEST 2013
On 19 Sep, 2013, at 12:00, Paul Moore <p.f.moore at gmail.com> wrote:

> On 19 September 2013 10:32, Ronald Oussoren <ronaldoussoren at mac.com> wrote:
>> The first time a method is called the bridge looks for an Objective-C selector
>> with the same name and adds that to the class dictionary. This works fine for normal
>> method lookups, by overriding __getattribute__, but causes problems with super:
>> super happily ignores __getattribute__ and peeks in the class __dict__ which may
>> not yet contain the name we're looking for and that can result in incorrect results
>> (both incorrect AttributeErrors and totally incorrect results when the name is
>> not yet present in the parent class' __dict__ but is in the grandparent's __dict__).
> 
> As an alternative approach, could you use a custom dict subclass as
> the class __dict__, and catch the peeking in the class __dict__ that
> way? Or is this one of those places where only a real dict will do?

The C code uses PyDict_GetItem and AFAIK that doesn't look for a __getitem__ 
implementation in a subclass.

Ronald

> 
> Paul

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