decorator and function local variable

Grzegorz Smith gregtech at wp.pl
Mon Feb 20 18:02:54 EST 2006


Hi all. I have got situation that I need make parameter injection into
function and I want that parametet be a local variable of that function.
eg. something like
def decorator():
	<code>
@decorator
def myfun():
   a = 20

and in myfun i can use b wariable like that:
b = "ok it's working"
I try to use sample decorators from:
http://www.python.org/moin/PythonDecoratorLibrary 
but unsuccesfully. Does anyone know hot to achieve this? Or is it possible?
Thanks for any help



More information about the Python-list mailing list