Accessors in Python (getters and setters)
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Thu Jul 20 16:16:03 EDT 2006
Diez B. Roggisch a écrit :
>> You mean:
>>
>> class Pythonic(object):
>> def __init__(self):
>> self._is_active = True
>>
>> @apply
>> def is_active():
>> def fget(self): return self._is_active
>> def fset(self): raise SomeException('sorry, read-only')
>> return property(**locals())
>
>
> Neat!
http://wiki.python.org/moin/PythonDecoratorLibrary
> That slipped my attention over all this noisy and pointless
> discussion...
indeed.
More information about the Python-list
mailing list