> Use the exec statement without the in-clause to get the desired effect:
>
> >>> def f():
> ...     a = "a"
> ...     exec "a = 'B'"
> ...     print a
> ...
> >>> f()
> B
> <snip>

Well... I *do* realize that. But this is *not* my problem. I have a
function with another nested one. If I used "exec ..." instead of "exec
... in some_dict, some_dict" I would get the "SyntaxError: unqualified
exec is not allowed in function 'f' it contains a nested function with
free variables".

To be honest, the message cited above is the answer to the question
"Why have I put those globals(), locals() in the exec statments?".

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to