how can I execute a function string
rajarshi at presidency.com
Tue Jan 13 02:17:28 CET 2004
I have some code that generates a function on the fly in a string.
At a later point in time I want to execute this function (which also
requires a parameters to be passed to it). So the code is something like
s = """ def function(x):
funcstring = generate_func()
retval = ....
That is, retval should have the value returned from the evaluation of the
function in the string funcstring.
Is this possible by means of simple function calls or does this involve
some sort of black magic?
More information about the Python-list