Hi,
I'm new; greetings all!
I'm wondering if the following program should work. I think it should
print 'Hello, World', but instead it produces a TypeError. Is this a
bug in decorators, a feature of them, or a mistake or misunderstanding
on my part?
TIA, Bob
def getdec (f):
dec = decorator (f)
return dec. docall
class decorator:
def __init__ (self, f):
self. f = f
def docall (self, *a):
return self. f (*a)
class test:
@ getdec
def doit (self, message):
print message
if __name__ == '__main__':
foo = test ()
foo. doit ('Hello, world')
def getdec (f):
dec = decorator (f)
return dec. docall
class decorator:
def __init__ (self, f):
self. f = f
def docall (self, *a):
return self. f (*a)
class test:
@ getdec
def doit (self, message):
print message
if __name__ == '__main__':
foo = test ()
foo. doit ('Hello, world')
--
http://mail.python.org/mailman/listinfo/python-list