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

2013-09-19 Thread Eric Snow
On Thu, Sep 19, 2013 at 3:49 AM, Ronald Oussoren wrote: > On 14 Sep, 2013, at 8:30, Nick Coghlan wrote: > > However, I agree the current wording only conveys that to the handful > > of people that already know exactly when in the attribute lookup > > sequence that step occurs, which is a rather n

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

2013-09-19 Thread Eric Snow
On Thu, Sep 19, 2013 at 4:12 AM, Nick Coghlan wrote: > On 19 Sep 2013 20:00, "Paul Moore" wrote: > > > > On 19 September 2013 10:32, Ronald Oussoren > 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 clas

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

2013-09-19 Thread Eric Snow
On Thu, Sep 19, 2013 at 4:04 AM, Ronald Oussoren wrote: > The C code uses PyDict_GetItem and AFAIK that doesn't look for a > __getitem__ > implementation in a subclass. > Yeah, the PyDict_* API is definitely not subclass friendly. :( -eric ___ Python-D

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

2013-09-19 Thread Ronald Oussoren
On 14 Sep, 2013, at 8:30, Nick Coghlan wrote: > > >>> but the *primary* purpose is to >>> customise the retrieval of objects that will be checked to see if they're >>> descriptors. >> >> If that's the case, the PEP should make that clear. > > Technically, that's what "Currently object.__geta

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

2013-09-19 Thread Ronald Oussoren
On 19 Sep, 2013, at 12:12, Nick Coghlan wrote: > > On 19 Sep 2013 20:00, "Paul Moore" wrote: > > > > On 19 September 2013 10:32, Ronald Oussoren 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 cla

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

2013-09-19 Thread Nick Coghlan
On 19 Sep 2013 20:00, "Paul Moore" wrote: > > On 19 September 2013 10:32, Ronald Oussoren 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 overr

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

2013-09-19 Thread Ronald Oussoren
On 19 Sep, 2013, at 12:00, Paul Moore wrote: > On 19 September 2013 10:32, Ronald Oussoren 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,

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

2013-09-19 Thread Paul Moore
On 19 September 2013 10:32, Ronald Oussoren 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

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

2013-09-19 Thread Ronald Oussoren
On 14 Sep, 2013, at 8:30, Nick Coghlan wrote: [... interesting text that I'll respond to later ...] > > So my proposed name is based on the idea that what Ronald is after > with the PEP is a hook that *only* gets invoked when the interpreter > is doing this hunt for descriptors, but *not* for

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

2013-09-19 Thread Ronald Oussoren
On 13 Sep, 2013, at 18:19, Steve Dower wrote: > From: Steven D'Aprano >> On Fri, Sep 13, 2013 at 04:26:06AM +, Steve Dower wrote: >> >>> Last I checked, looking up in the instance dict us exactly what it >>> does. Even the example you posted is doing that. >> >> The example from the PEP sh

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

2013-09-19 Thread Ronald Oussoren
On 13 Sep, 2013, at 14:23, Steven D'Aprano wrote: > On Fri, Sep 13, 2013 at 08:42:46PM +1000, Nick Coghlan wrote: >> Perhaps "__getdescriptor__" would work as the method name? Yes, it can >> technically return a non-descriptor, > > So technically that name is, um, what's the term... oh yes, "a

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

2013-09-19 Thread Ronald Oussoren
On 13 Sep, 2013, at 12:42, Nick Coghlan wrote: > Perhaps "__getdescriptor__" would work as the method name? Yes, it can > technically return a non-descriptor, but the *primary* purpose is to > customise the retrieval of objects that will be checked to see if they're > descriptors. It *won't*

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

2013-09-13 Thread Nick Coghlan
On 13 September 2013 22:23, Steven D'Aprano wrote: > On Fri, Sep 13, 2013 at 08:42:46PM +1000, Nick Coghlan wrote: >> Perhaps "__getdescriptor__" would work as the method name? Yes, it can >> technically return a non-descriptor, > > So technically that name is, um, what's the term... oh yes, "a li

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

2013-09-13 Thread Steve Dower
From: Steven D'Aprano > On Fri, Sep 13, 2013 at 04:26:06AM +, Steve Dower wrote: > >> Last I checked, looking up in the instance dict us exactly what it >> does. Even the example you posted is doing that. > > The example from the PEP shows: > > return cls.__dict__[name] > > not "self.__dict

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

2013-09-13 Thread Steven D'Aprano
On Fri, Sep 13, 2013 at 08:42:46PM +1000, Nick Coghlan wrote: > Perhaps "__getdescriptor__" would work as the method name? Yes, it can > technically return a non-descriptor, So technically that name is, um, what's the term... oh yes, "a lie". :-) > but the *primary* purpose is to > customise t

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

2013-09-13 Thread Nick Coghlan
Perhaps "__getdescriptor__" would work as the method name? Yes, it can technically return a non-descriptor, but the *primary* purpose is to customise the retrieval of objects that will be checked to see if they're descriptors. It *won't* be invoked when looking for ordinary attributes in an instanc

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

2013-09-12 Thread Steven D'Aprano
On Fri, Sep 13, 2013 at 04:26:06AM +, Steve Dower wrote: > Last I checked, looking up in the instance dict us exactly what it > does. Even the example you posted is doing that. The example from the PEP shows: return cls.__dict__[name] not "self.__dict__[name]". It is true that "the ins

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

2013-09-12 Thread Steve Dower
ne of those. Cheers, Steve Sent from my Windows Phone From: Steven D'Aprano<mailto:st...@pearwood.info> Sent: ‎9/‎12/‎2013 21:00 To: python-dev@python.org<mailto:python-dev@python.org> Subject: Re: [Python-Dev] PEP 447: add type.__locallookup__ O

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

2013-09-12 Thread Steven D'Aprano
On Fri, Sep 13, 2013 at 03:04:49AM +, Steve Dower wrote: > What about __getlocalattribute__ or __getattributenorecurse__? Long, > but this isn't going to be used often. This has nothing to do with locals, nor does it have anything to do with recursion, so both those names are misleading.

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

2013-09-12 Thread Steve Dower
r the top post.) Sent from my Windows Phone From: Steven D'Aprano<mailto:st...@pearwood.info> Sent: ‎9/‎12/‎2013 16:09 To: python-dev@python.org<mailto:python-dev@python.org> Subject: Re: [Python-Dev] PEP 447: add type.__locallookup__ On Thu, Sep 12,

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

2013-09-12 Thread Ronald Oussoren
> On 12 sep. 2013, at 17:30, "R. David Murray" wrote: > >> On Thu, 12 Sep 2013 16:42:39 +0200, Ronald Oussoren >> wrote: >> >>> On 9 Sep, 2013, at 20:23, Jan Kaliszewski wrote: >>> >>> Is '__locallookup__' a really good name? In Python, *local* -- >>> especially in context of *lookups* --

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

2013-09-12 Thread Steven D'Aprano
On Thu, Sep 12, 2013 at 04:42:39PM +0200, Ronald Oussoren wrote: > I don't particularly like __locallookup__ either, but haven't found a > better name yet. "__lookup_in_class__" was the best alternative I > could come up with, and that feels different than other special > methods. The name in

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

2013-09-12 Thread Ronald Oussoren
On 9 Sep, 2013, at 23:18, Mark Shannon 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 mak

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

2013-09-12 Thread R. David Murray
On Thu, 12 Sep 2013 16:42:39 +0200, Ronald Oussoren wrote: > > On 9 Sep, 2013, at 20:23, Jan Kaliszewski wrote: > > > Is '__locallookup__' a really good name? In Python, *local* -- > > especially in context of *lookups* -- usually associates with > > locals() i.e. a namespace of a function/met

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

2013-09-12 Thread Ronald Oussoren
On 9 Sep, 2013, at 17:43, Mark Shannon wrote: > I would like time to investigate this further, but at the moment I think it > will either make attribute lookup poorly defined or slow. > > Of the top of my head, the problem as a I see it is basically this: > Currently, type.__getattribute__() i

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

2013-09-12 Thread Ronald Oussoren
On 9 Sep, 2013, at 20:23, Jan Kaliszewski wrote: > Is '__locallookup__' a really good name? In Python, *local* -- especially in > context of *lookups* -- usually associates with locals() i.e. a namespace of > a function/method execution frame or a namespace of a class, during > *definition* o

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

2013-09-10 Thread Armin Rigo
Hi Mark, On Mon, Sep 9, 2013 at 11:18 PM, Mark Shannon wrote: > 5. Other implementations. What do the Jython/IronPython/PyPy developers > think? Thanks for asking :-) I'm fine with staying out of language design issues like this one, and I believe it's the general concensus in PyPy. Whatever g

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

2013-09-09 Thread Mark Shannon
On 09/09/13 22:25, Benjamin Peterson wrote: 2013/9/9 Mark Shannon : 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 int

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

2013-09-09 Thread Benjamin Peterson
2013/9/9 Mark Shannon : > 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. >> > >

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

2013-09-09 Thread Mark Shannon
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

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

2013-09-09 Thread Benjamin Peterson
Since the main problem is super(), maybe we can just add a __super__ method to get a custom super implementation? 2013/9/9 Ethan Furman : > 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? > > > *Bum

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

2013-09-09 Thread Yury Selivanov
Yes, I don't like the 'local' prefix too. How about '__dictlookup__'? It's just more self-describing. Yury On 2013-09-09, at 2:23 PM, Jan Kaliszewski wrote: > Is '__locallookup__' a really good name? In Python, *local* -- especially in > context of *lookups* -- usually associates with locals(

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

2013-09-09 Thread Jan Kaliszewski
Is '__locallookup__' a really good name? In Python, *local* -- especially in context of *lookups* -- usually associates with locals() i.e. a namespace of a function/method execution frame or a namespace of a class, during *definition* of that class... So '__locallookup__' can be confusing. Wh

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

2013-09-09 Thread Antoine Pitrou
On Mon, 09 Sep 2013 09:05:57 -0700 Ethan Furman wrote: > On 09/09/2013 08:43 AM, Mark Shannon wrote: > > I would like time to investigate this further, but at the moment I think it > > will either make attribute lookup poorly > > defined or slow. > > > > Of the top of my head, the problem as a I

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

2013-09-09 Thread Ethan Furman
On 09/09/2013 08:43 AM, Mark Shannon wrote: I would like time to investigate this further, but at the moment I think it will either make attribute lookup poorly defined or slow. Of the top of my head, the problem as a I see it is basically this: Currently, type.__getattribute__() is a fixed poi

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

2013-09-09 Thread Mark Shannon
I would like time to investigate this further, but at the moment I think it will either make attribute lookup poorly defined or slow. Of the top of my head, the problem as a I see it is basically this: Currently, type.__getattribute__() is a fixed point in the lookup of attributes. The proposal

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

2013-09-09 Thread Mark Shannon
I'll look into it this evening. On 09/09/13 17:03, Guido van Rossum wrote: OK, how much time do you need? --Guido van Rossum (sent from Android phone) On Sep 9, 2013 8:44 AM, "Mark Shannon" mailto:m...@hotpy.org>> wrote: I would like time to investigate this further, but at the moment I

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

2013-09-09 Thread Guido van Rossum
OK, how much time do you need? --Guido van Rossum (sent from Android phone) On Sep 9, 2013 8:44 AM, "Mark Shannon" wrote: > I would like time to investigate this further, but at the moment I think > it will either make attribute lookup poorly defined or slow. > > Of the top of my head, the probl

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

2013-09-09 Thread Guido van Rossum
Let's just accept this PEP. It looks like a nice addition to the metaclass machinery and I don't think we'll get much more useful feedback by waiting. On Mon, Sep 9, 2013 at 7:30 AM, Ethan Furman wrote: > On 07/30/2013 11:17 PM, Ronald Oussoren wrote: > >> >> And something I forgot to ask: is a

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

2013-09-09 Thread Ethan Furman
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. -- ~Ethan~ ___ Python-Dev mailing list Python-Dev@python.org

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

2013-07-30 Thread Ronald Oussoren
On 29 Jul, 2013, at 14:49, Ronald Oussoren wrote: > Hi, > > This PEP proposed to add a __locallookup__ slot to type objects, > which is used by _PyType_Lookup and super_getattro instead of peeking > in the tp_dict of classes. The PEP text explains why this is needed. > > Differences with the

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

2013-07-29 Thread Antoine Pitrou
Le Mon, 29 Jul 2013 15:26:41 +0200, Ronald Oussoren a écrit : > > On 29 Jul, 2013, at 15:07, Ronald Oussoren > wrote: > > > > > On 29 Jul, 2013, at 14:58, Antoine Pitrou > > wrote: > > > >> > >> Hi, > >> > >> Le Mon, 29 Jul 2013 14:49:18 +0200, > >> Ronald Oussoren a écrit : > >>> Hi, > >

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

2013-07-29 Thread Ronald Oussoren
On 29 Jul, 2013, at 15:07, Ronald Oussoren wrote: > > On 29 Jul, 2013, at 14:58, Antoine Pitrou wrote: > >> >> Hi, >> >> Le Mon, 29 Jul 2013 14:49:18 +0200, >> Ronald Oussoren a écrit : >>> Hi, >>> >>> This PEP proposed to add a __locallookup__ slot to type objects, >>> which is used by _

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

2013-07-29 Thread Ronald Oussoren
On 29 Jul, 2013, at 14:58, Antoine Pitrou wrote: > > Hi, > > Le Mon, 29 Jul 2013 14:49:18 +0200, > Ronald Oussoren a écrit : >> Hi, >> >> This PEP proposed to add a __locallookup__ slot to type objects, >> which is used by _PyType_Lookup and super_getattro instead of peeking >> in the tp_dic

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

2013-07-29 Thread Antoine Pitrou
Hi, Le Mon, 29 Jul 2013 14:49:18 +0200, Ronald Oussoren a écrit : > Hi, > > This PEP proposed to add a __locallookup__ slot to type objects, > which is used by _PyType_Lookup and super_getattro instead of peeking > in the tp_dict of classes. The PEP text explains why this is needed. > > Diffe

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

2013-07-29 Thread Ronald Oussoren
Hi, This PEP proposed to add a __locallookup__ slot to type objects, which is used by _PyType_Lookup and super_getattro instead of peeking in the tp_dict of classes. The PEP text explains why this is needed. Differences with the previous version: * Better explanation of why this is a useful add