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?
Edi
This will only call other_method
once when it is created
object.__dict__['x']=object.other.other_method()
Instead you could do this
object.x = property(object.other.other_method)
Which calls other_method
everytime object.x
is accessed
Of course you aren't really using object
as a variable name, are you?