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

Ronald Oussoren ronaldoussoren at mac.com
Thu Sep 12 16:33:12 CEST 2013


On 9 Sep, 2013, at 23:18, Mark Shannon <mark at hotpy.org> wrote:

> On 09/09/13 15:30, Ethan Furman wrote:
>> On 07/30/2013 11:17 PM, Ronald Oussoren wrote:
>>> 
>>> And something I forgot to ask: is anyone willing to be the
>>> BDFL-Delegate for
>>> PEP 447?
>> 
>> *Bump*.
>> 
>> It would be nice if this could make into 3.4.
>> 
> 
> IMO, there are some issues that need to be addressed before PEP 447 should be accepted.
> 
> 1. Is there even a problem at all, or is this just a bug in super?
> Why doesn't super() respect the __getattribute__ method of the superclass?

Because __getattribute__ looks in the instance __dict__ before walking the MRO, while super does not.

> 
> 2. Is this the best way to solve the problem (if there is a problem)?
> Would a __super__ special method be sufficient and less intrusive.

One reason for the __locallookup__ method is to make normal and super attribute lookup more simular, adding a __super__ special method would lead to code duplication: both __getattribute__ and __super__ would either contain simular code, or would call out to a shared method anyway.

> 
> 3. Are the proposed semantics OK?
> I think they are, but very low level changes such as these can have unforeseen consequences. For example, PEP 3135 and issue 12370.
> 
> 4. What is the performance impact. pybench really doesn't count as a benchmark.

What kind of benchmark would you like to see?  BTW. I ran more than pybench, I also ran the part of the performance benchmark that worked on py3k at the time.

Ronald


More information about the Python-Dev mailing list