atom编辑器中的Python@Property自动完成

atom编辑器中的Python@Property自动完成,python,python-3.x,atom-editor,Python,Python 3.x,Atom Editor,我使用atom在python中定义了一个@property。所以自动完成给了他们这个: def test(): doc = "The test property." def fget(self): return self._test def fset(self, value): self._test = value def fdel(self): del self._test re

我使用atom在python中定义了一个@property。所以自动完成给了他们这个:

    def test():
    doc = "The test property."
    def fget(self):
        return self._test
    def fset(self, value):
        self._test = value
    def fdel(self):
        del self._test
    return locals()
test = property(**test())
其中test是我定义的名称。我不明白这个代码是做什么的,我该如何使用它? 在python中使用它而不是使用getter和setter的传统方式有什么区别吗


如果您能提供一些帮助,我将不胜感激。

您的文本编辑器只是向您展示了在不使用装饰器的情况下使用
属性的另一种方法。官方Python文档中的示例也显示了这一点
property本身是一个类,它接受以下关键字参数:
fget
fset
fdel
doc
。在您的示例中,您让
test
返回与关键字参数匹配的所有函数,然后使用解包将它们作为参数输入。这在文档中显示