File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -1011,7 +1011,9 @@ The :keyword:`nonlocal` statement causes the listed identifiers to refer to
1011
1011
previously bound variables in the nearest enclosing scope excluding globals.
1012
1012
This is important because the default behavior for binding is to search the
1013
1013
local namespace first. The statement allows encapsulated code to rebind
1014
- variables outside of the local scope besides the global (module) scope.
1014
+ variables outside of the local scope besides the global scope. A :exc: `SyntaxError `
1015
+ will be raised if the nearest enclosing scope is the global (module) scope.
1016
+
1015
1017
1016
1018
Names listed in a :keyword: `nonlocal ` statement, unlike those listed in a
1017
1019
:keyword: `global ` statement, must refer to pre-existing bindings in an
You can’t perform that action at this time.
0 commit comments