Jython @property SyntaxError: mismatched input '' expecting CLASS

牧云@^-^@ 提交于 2019-12-06 15:39:43

It's a bug of jython 2.5.2, see this issue.

Fixed in jython version 2.5.3, try 2.5.3, it works.

You can only execute one statement in the interactive interpreter, otherwise it's a syntax error. Have you tried executing the whole thing?

>>> 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
    @x.deleter
    def x(self):
        del self._x

Or just save this to a file, and run the file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!