"Steve D'Aprano" <steve+pyt...@pearwood.info> a écrit dans le message de news:57f6673a$0$1598$c3e8da3$54964...@news.astraweb.com...
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.



yes, it is clear, thanks to all
(I didn't know that functions were descriptors with a __get__ method)
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to