On Thu, 6 Oct 2016 08:03 pm, ast wrote:

> Consider this function:
> 
> def add(a, b):
>     return a+b
> 
> You say that a function is always stored as
> a descriptor object, so when I execute
> 
> sum = f(4, 6)
> 
> from which class it is supposed to come from ?


It doesn't. The descriptor protocol only gets called by classes, so when you
call a function directly, the special __get__ method isn't used.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to