On Fri, 7 Oct 2016 04:01 pm, ast wrote:
>
> "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("
"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
On Thu, 6 Oct 2016 05:53 pm, ast wrote:
[...]
> * For instance methods, there is no decorator:
>
> def funct2(self, a, b):
> ...
>
> self is automatically filled with the instance when we call
> funct2 from an instance and not filled if funct2 is called from
> a class.
> But there is no decorato
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
Hello,
In a class there are three possible types of methods,
the static methods, the class methods and the
instance methods
* Class methods are decorated, eg:
@classmethod
def func(cls, a, b):
...
I read that the decorator tranforms 'func' as a descriptor,
and when this descriptor is read, it