My code:
class MyClass:
def __init__(self):
self.value = 0
def set_value(self, value):
self.value = 5
def get_value(self):
return self.value
value = property(get_value, set_value)
a = MyClass()
I get the following output:
RecursionError: maximum recursion depth exceeded
My question: Why do I get this output? Why does Python call MyClass.value.__set__ instead of just setting the instance variable to 0?
I mean the property object is a class variable and when initializing the a
-instance I do not do anything with the class variable. Hope you know what I mean.