Re: [Python-Dev] Attribute lookup ambiguity

2010-03-23 Thread Greg Ewing
Pascal Chambon wrote: All I've found is "If the class also defines __getattr__(), the latter will not be called unless __getattribute__() either calls it explicitly or raises an AttributeError Hmmm. Well, it still implies that there is some mechanism outside of __getattribute__ that will catc

Re: [Python-Dev] Attribute lookup ambiguity

2010-03-23 Thread Pascal Chambon
Greg Ewing a écrit : Pascal Chambon wrote: I don't follow you there - in my mind, the default __getattribute__ could simply have wrapped all its operations inside soem kind of "try..catch AttributeError:" mechanism, and thus been able to fallback to __getattr__ in any way. But then it woul

Re: [Python-Dev] Attribute lookup ambiguity

2010-03-22 Thread Greg Ewing
Pascal Chambon wrote: I don't follow you there - in my mind, the default __getattribute__ could simply have wrapped all its operations inside soem kind of "try..catch AttributeError:" mechanism, and thus been able to fallback to __getattr__ in any way. But then it would be incorrect to say t

Re: [Python-Dev] Attribute lookup ambiguity

2010-03-22 Thread Pascal Chambon
Michael Foord a écrit : On 20/03/2010 12:00, Pascal Chambon wrote: But the point which for me is still unclear, is : does the default implementation of __getattribute__ (the one of "object") call __getattr__ by himself, or does it rely on its caller for that, by raising an AttributeError ?

Re: [Python-Dev] Attribute lookup ambiguity

2010-03-20 Thread Greg Ewing
Michael Foord wrote: Well, the documentation you pointed to specifies that __getattr__ will be called if __getattribute__ raises an AttributeError, it just doesn't specify that it is done by object.__getattribute__ (which it isn't). If __getattribute__ raises an exception, it won't get a chan

Re: [Python-Dev] Attribute lookup ambiguity

2010-03-20 Thread Nick Coghlan
Michael Foord wrote: > Well, the documentation you pointed to specifies that __getattr__ will > be called if __getattribute__ raises an AttributeError, it just doesn't > specify that it is done by object.__getattribute__ (which it isn't). And as for why not: because __getattribute__ implementation

Re: [Python-Dev] Attribute lookup ambiguity

2010-03-20 Thread Michael Foord
On 20/03/2010 12:00, Pascal Chambon wrote: Michael Foord a écrit : On 19/03/2010 18:58, Pascal Chambon wrote: Hello I've already crossed a bunch of articles detailing python's attribute lookup semantic (__dict__, descriptors, order of base class traversing...), but I have never seen, so far

Re: [Python-Dev] Attribute lookup ambiguity

2010-03-20 Thread Pascal Chambon
Michael Foord a écrit : On 19/03/2010 18:58, Pascal Chambon wrote: Hello I've already crossed a bunch of articles detailing python's attribute lookup semantic (__dict__, descriptors, order of base class traversing...), but I have never seen, so far, an explanation of WHICH method did waht,

Re: [Python-Dev] Attribute lookup ambiguity

2010-03-19 Thread Michael Foord
On 19/03/2010 18:58, Pascal Chambon wrote: Hello I've already crossed a bunch of articles detailing python's attribute lookup semantic (__dict__, descriptors, order of base class traversing...), but I have never seen, so far, an explanation of WHICH method did waht, exactly. I assumed that