Using Properties in Python classes cause “maximum recursion depth exceeded” [duplicate]

You are using the same name for the getter, setter and attribute. When setting up a property, you must rename the attribute locally; the convention is to prefix it with an underscore.

class Test(object):
    def __init__(self, value):
        self._x =  value

    @property
    def x(self):
        return self._x

Leave a Comment