[Tutor] question on getattr..
Kevin Liang
kevin@vcn.bc.ca
Thu, 11 May 2000 11:14:34 -0400
Hi,
I'm stumped on a line of code about the getattr function..
class wrapper:
def __init__(self,object):
self.wrapped = object
def __getattr__(self, attrname):
print 'Trace:', attrname
return getattr(self.wrapped, attrname)
I know you need the last line to acutally use built-in functions for lists,
dictionaries, etc.. (e.g. append something), but what does it mean ? Why is a return needed ? I keep thinking its supposed to print something..
--
"Do not go where the path may lead, go instead where there is no
path and leave a trail" -Ralph Waldo Emerson