P
Peter Luciak
Hi,
I need to do something like this:
def my():
a,b=1,2
func = "lambda x: a*x+b"
map(eval(func),[1,2,3])
my()
NameError: global name 'a' is not defined
Why do I have to make a,b global for this to work?
Thanks,
P.
I need to do something like this:
def my():
a,b=1,2
func = "lambda x: a*x+b"
map(eval(func),[1,2,3])
my()
NameError: global name 'a' is not defined
Why do I have to make a,b global for this to work?
Thanks,
P.