I think it is easier for me to explain what I'm trying to achieve with a simple example. Consider the following code:
class Person(object):
def __init__(self):
self._age = None
self._gender = None
def age(self, value):
self._age = value
return self
def gender(self, value):
self._gender = value
return self
p = Person().age(10).gender("male")
assert p.age == 10
assert p.gender == "male"
Obviously the assertion fails because the attributes refers to the methods rather than the variables. I have tried messing with the __getattribute__ method so that it resolves "age" to "_age" but I can't seem to find a way where both cases works and I'm not entirely sure that it is possible at all but Python has surprised me before.