Re: static, class and instance methods (Reposting On Python-List Prohibited)

2016-10-06 Thread ast
"Gregory Ewing" a écrit dans le message de news:e5mgi9fp1b...@mid.individual.net... Lawrence D’Oliveiro wrote: Every function is already a descriptor. Which you can see with a simple experiment: >>> def f(self): ... print("self =", self) ... I thought yesterday that every thing was cle

Re: static, class and instance methods (Reposting On Python-List Prohibited)

2016-10-06 Thread ast
"Steve D'Aprano" 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

Re: static, class and instance methods (Reposting On Python-List Prohibited)

2016-10-06 Thread Steve D'Aprano
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 proto

Re: static, class and instance methods (Reposting On Python-List Prohibited)

2016-10-06 Thread Peter Otten
ast wrote: > > "Lawrence D’Oliveiro" a écrit dans le message de > news:f5314bdd-a98f-4a16-b546-bd8efe4dd...@googlegroups.com... >> On Thursday, October 6, 2016 at 7:54:08 PM UTC+13, ast wrote: >>> But there is no decorator, why ? Is python doing the conversion >>> of funct2 to a descriptor itsel

Re: static, class and instance methods (Reposting On Python-List Prohibited)

2016-10-06 Thread ast
"Lawrence D’Oliveiro" a écrit dans le message de news:f5314bdd-a98f-4a16-b546-bd8efe4dd...@googlegroups.com... On Thursday, October 6, 2016 at 7:54:08 PM UTC+13, ast wrote: But there is no decorator, why ? Is python doing the conversion of funct2 to a descriptor itself, behind the scene ? E

Re: static, class and instance methods (Reposting On Python-List Prohibited)

2016-10-06 Thread Gregory Ewing
Lawrence D’Oliveiro wrote: Every function is already a descriptor. Which you can see with a simple experiment: >>> def f(self): ... print("self =", self) ... >>> g = f.__get__(17, None) >>> g >>> g() self = 17 -- Greg -- https://mail.python.org/mailman/listinfo/python-list