On Fri, Nov 23, 2012 at 11:14 PM, wrote:
> Why isn't 'a' defined?
> Shouldn't you be able to define the global variables with a dict passed to
> eval?
> Is there an other way to do this, beside the two obvious: defining 'a' before
> calling gp_function and using a as an argument in gp_function?
I am trying to set the parameter 'a' below so that it can be used when I call
eval:
>>> def gp_function():
... return 1+a
...
>>> print eval("gp_function()", {'a':123, 'gp_function':gp_function})
Traceback (most recent call last):
File "", line 1, in
File "", line 1, in
File "", lin