Immutability

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Wed Jun 28 22:23:41 EDT 2006


Bruno Desthuilliers a écrit :
> Georg Brandl a écrit :
(snip)
>>
>> That's another sign that property isn't intended to be used as a 
>> decorator.
>> Normally, decorators wrap functions with other functions.
> 
> 
> Normally, decorators take a function and return anything appropriate.
 >
>> property doesn't
>> return a function but a descriptor object.

So do classmethod.

 >>> classmethod(fun).__get__
<method-wrapper object at 0x4041e1ec>
 >>>
 >>> classmethod(fun)()
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: 'classmethod' object is not callable



More information about the Python-list mailing list