I was reading property(), which I understand is attribute access goes through the method specified in property(). But I got "RuntimeError: maximum recursion depth exceeded", when executed the following code.
class Property(object):
def __init__(self):
self.x = "Raj"
def gettx(self):
print "getting x"
return self.x
def settx(self, val):
print "Setting x"
self.x = val
def dellx(self):
print "deleting"
return self.x
x = property(gettx, settx, dellx, "I'm object property")
p = Property()
print "p.x", p.x
p.x = "R"
print "p.x:", p.x
Is it not possible to apply property in this way. Because it worked fine when 'self.x' changed to self._x and self.__x.