[Python-Dev] Dinamically set __call__ method
ethan at stoneleaf.us
Sun Nov 9 21:16:17 CET 2014
On 11/09/2014 03:38 AM, Gregory Ewing wrote:
> Ethan Furman wrote:
>> And the thing going on is the normal python behavior (in __getattribute__, I believe) of examining the returned
>> attribute to see if it is a descriptor, and if so invoking it.
> Only if you look it up through the instance, though.
> Normally, if you look up an attribute on a class,
> the descriptor protocol doesn't get triggered.
Hrmm, maybe we're not talking about the same thing. I was responding to your comment:
> (BTW, I'm actually surprised that this technique makes c callable.
> There must be more going on that just "look up __call__ in the class
> object", because evaluating C.__call__ just returns the descriptor
> and doesn't invoking the descriptor mechanism.)
which seems to clash with what you just said.
More information about the Python-list