On Sun, 29 Jul 2007 15:22:47 -0700, [EMAIL PROTECTED] wrote: > I create a variable in a decorator. i want to be able to access that > variable in the function to be decorated. How to do this?
Pass it as argument to the function: def deco(func): eggs = 42 def decorated(*args, **kwargs): kwargs['spam'] = eggs func(*args, **kwargs) return decorated @deco def test(parrot, spam): print parrot, spam Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list