class Ponto(object):
def __init__(self, x):
self.x = x
@property
def x(self):
return self.x
@x.setter
def x(self, valor):
self.x = valor
When I run the script it generates:
Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> x = Ponto(2) File "C:/Users/ThiagoDEV/AppData/Local/Programs/Python/Python36/OOP39.py", line 3, in __init__ self.x = x File "C:/Users/ThiagoDEV/AppData/Local/Programs/Python/Python36/OOP39.py", line 9, in x self.x = valor File "C:/Users/ThiagoDEV/AppData/Local/Programs/Python/Python36/OOP39.py", line 9, in x self.x = valor File "C:/Users/ThiagoDEV/AppData/Local/Programs/Python/Python36/OOP39.py", line 9, in x self.x = valor [Previous line repeated 491 more times] RecursionError: maximum recursion depth exceeded while calling a Python object