I\'d like for an attribute call like object.x to return the results of some method, say object.other.other_method(). How can I do this?
object.x
object.other.other_method()
Edi
Use the property decorator
class Test(object): # make sure you inherit from object @property def x(self): return 4 p = Test() p.x # returns 4
Mucking with the __dict__ is dirty, especially when @property is available.