"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
"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
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
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
"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
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