这是你想要的吗?
class C(object): def __init__(self): self._x = None @property def x(self): """I'm the 'x' property.""" return self._x @x.setter def x(self, value): self._x = value
取自http://docs.python.org/library/functions.html#property。

这是你想要的吗?
class C(object): def __init__(self): self._x = None @property def x(self): """I'm the 'x' property.""" return self._x @x.setter def x(self, value): self._x = value
取自http://docs.python.org/library/functions.html#property。
上一篇 清单上的Python append()与+运算符,为什么它们给出不同的结果?
下一篇 / usr / bin / python3:查找'virtualenvwrapper.hook_loader'的规范时出错(:没有名为“virtualenvwrapper”的模块)