__getattr__と__setattr__
>>> class wrapper: ... def __init__(self, object): ... self.wrapped = object ... def __getattr__(self, attrname): ... print("Trace", attrname) ... return getattr(self.wrapped, attrname) ... >>> lst = wrapper([1,2,3]) >>> lst.append(4) Trace append >>> lst.wrapped [1, 2, 3, 4]