【发布时间】:2014-07-04 15:59:48
【问题描述】:
我尝试使用 PythonDecoratorLibrary 中的属性定义(示例 3)。 => https://wiki.python.org/moin/PythonDecoratorLibrary#Property_Definition
import sys
def property(function):
keys = 'fget', 'fset', 'fdel'
[...]
另外导入 sys 后出现此错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in Angle
File "<stdin>", line 12, in property
TypeError: property() got an unexpected keyword argument 'doc'
第 12 行是:function(),因为 sys 导入 :)
我在 Windows 上的 python 版本是 3.4.1。
【问题讨论】:
-
换一种说法只是删除属性函数定义,因为它是一个内置函数
标签: python python-3.x properties