Thank you Chris and Peter.

The source file we're generating has one main function (go) with some
supporting functions and classes as well. Will there be any problems
referencing additional functions or classes defined in the source that
gets passed to exec ... as long as references to those functions and
classes happen within the generated module? 

I assume that one downside to the exec() approach is that there is no
persistent namespace for this code's functions and classes, eg. after
the exec() completes, its namespace disappears and is not available to
code that follows?

The Python documentation also warns: "Be aware that the return and yield
statements may not be used outside of function definitions even within
the context of code passed to the exec() function. The return value is
None."

Malcolm
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to