I know that this is a badly written code. But why does this behave this way?
class A:
def __init__(self, f, l):
self.first = f
self.last = l
@property
def first(self):
return self._first
@first.setter
def first(self, new):
self._first = new
a = A("ab", "cd")
print(a.first)
Why does this return "ab"? Shouldn't the @property getter method be invoked on a.first and raise an attribute error?