- , : property:
class C(object):
@property
def x(self):
"This is a property object, not a function"
return self._x
@x.setter
def x(self, val):
self._x = val
>>> c = C()
>>> c.x = 1
>>> c.x
1
>>> C.x
<property object at 0x2396100>
>>> C.x.__doc__
'This is a property object, not a function'
>>> C.x.getter.__doc__
'Descriptor to change the getter on a property.'
>>> C.x.setter.__doc__
'Descriptor to change the setter on a property.'
>>> C.x.deleter.__doc__
'Descriptor to change the deleter on a property.'
property ( ) , x - . , fget, fset fdel , property.setter property.deleter (, , ).
- , . , , , (, , -, property ).