[Python-Dev] variable name resolution in exec is incorrect
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu May 27 05:35:35 CEST 2010
On 27/05/10 12:37, Colin H wrote:
> This is a major use
> case for exec() - defining code from strings (e.g. enabling you to
> store python code in the database), and using it at runtime. It seems
> to me this must have been the point of locals in the first place.
I suspect that originally it just fell out of the
implementation. The function in the interpreter that
executes code objects requires two namespaces as
arguments, and they were both exposed via exec just
in case anyone found a use for them.
--
Greg
More information about the Python-Dev
mailing list