One can add a method to a python class with:
class foo(object):
pass
def donothing(self):
pass
foo.y = donothing
Then one would call the method with:
f = foo()
f.y()
Is there a way to add @property
to the def
as well, so to call it with
f.y
?
You can just add the @property before the method definition