how do I catch changes to a mutable object ie:
class test(object):
def __init__(self):
self.x = []
def __getattr__(self, atr):
print 'retrieving atr %s' % atr
return self.__dict__[atr]
def __setattr__(self, atr, val):
print 'setting atr %s to value % s' % (atr, val)
self.__dict__[atr] = val
>>> instance = test()
>>> instance.x.append(1)
>>>
# doesn't print anything, b/c the change is made in place
# any ideas of how to catch that?