We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf34b77 commit a2c78d4Copy full SHA for a2c78d4
Doc/reference/simple_stmts.rst
@@ -1011,7 +1011,9 @@ The :keyword:`nonlocal` statement causes the listed identifiers to refer to
1011
previously bound variables in the nearest enclosing scope excluding globals.
1012
This is important because the default behavior for binding is to search the
1013
local namespace first. The statement allows encapsulated code to rebind
1014
-variables outside of the local scope besides the global (module) scope.
+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
+
1017
1018
Names listed in a :keyword:`nonlocal` statement, unlike those listed in a
1019
:keyword:`global` statement, must refer to pre-existing bindings in an
0 commit comments