# This Python code is illegal
def foo():
x = 1
def bar(a):
return x + a
exec "x = x + 1"
SyntaxError: unqualified exec is not allowed in function 'foo' it
contains a nested function with free variables
Use of dynamic features problematic in inner functions
# This code doesn't work
def foo(y):
x = 1
def bar(a):
return eval("x+a") # name 'x' not defined
return bar(y)