I have a class like this:
class A:
def __init__(self):
self.size=0
def change_size(self,new):
self.size=new
I want to add an attribute to the change_size method to say what it changes - i.e. so that
A(blah)
blah.change_size.modifies
returns
'size'
is this possible? I have tried:
class A:
def __init__(self):
self.size=0
def change_size(self,new):
self.change_size.modifies = 'size'
self.size=new
nope
class A:
def __init__(self):
self.size=0
self.change_size.modifies = 'size'
def change_size(self,new):
self.size=new
nope
class A:
def __init__(self):
self.size=0
def change_size(self,new,modifies='size'):
self.size=new
none of which seem to work.
self.change_size
is a wrapper that passesself
to the method, not the method itself. You'll need to do this through the class, not an instance.