V
vsoler
I have a class that is a wrapper:
class wrapper:
def __init__(self, object):
self.wrapped = object
def __getattr__(self, attrname):
print 'Trace: ', attrname
#print arguments to attrname, how?
return getattr(self.wrapped, attrname)
I can run it this way:
I am able to capture the attribute name to x (that is, append).
However, I do not know how to capture and print all of its arguments
(in this case number 4).
How should I proceed?
Thank you
class wrapper:
def __init__(self, object):
self.wrapped = object
def __getattr__(self, attrname):
print 'Trace: ', attrname
#print arguments to attrname, how?
return getattr(self.wrapped, attrname)
I can run it this way:
[1, 2, 3, 4]x = wrapper([1,2,3])
x.append(4) Trace: append
x.wrapped
I am able to capture the attribute name to x (that is, append).
However, I do not know how to capture and print all of its arguments
(in this case number 4).
How should I proceed?
Thank you