Hi everybody,
Try the following program:
def f():
def f_nested():
exec a=2
print a
f()
It yields an error.
$ python nested_exec.py
File nested_exec.py, line 3
exec a=2
SyntaxError: unqualified exec is not allowed in function
On Tue, 2009-01-13 at 16:13 +0100, TP wrote:
Hi everybody,
Try the following program:
def f():
def f_nested():
exec a=2
print a
f()
It yields an error.
$ python nested_exec.py
File nested_exec.py, line 3
exec
TP wrote:
...
def f():
def f_nested():
exec a=2
print a
f()
... What is the problem? Why?
What it wants is you to provide the in context portion of the
exec statement. I expect the reason it fails is that there is no
dictionary that is available as locals that