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

Mark Shannon mark at hotpy.org
Tue Sep 10 00:36:15 CEST 2013


On 09/09/13 22:25, Benjamin Peterson wrote:
> 2013/9/9 Mark Shannon <mark at hotpy.org>:
>> 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?
>
> You want to be looking things up on the class, not an instance.
>
Sorry, I meant 'type of the superclass' rather than 'superclass'.

I was suggesting that super().m should be 
type(type(self).__mro__[1]).__getattribute__('m')
rather than type(self).__mro__[1].__dict__['m']
(ignoring descriptor __get__ calls)

Unfortunately this brings its own problems, due to __getattribute__ 
doing its own traversal of the mro.
So, scratch point 1.

Cheers,
Mark.





More information about the Python-Dev mailing list