为什么下面的代码:
exec("""
a = 3
def b():
nonlocal a
a = a + 1
b() #error occurs even without this call
print(a)
"""
)
)
给出这个错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 4
SyntaxError: no binding for nonlocal 'a' found
这是满足文本/代码比率的更多文本。