]> granicus.if.org Git - python/commitdiff
#4549: Mention nonlocal statement in tutorial section about scoping.
authorGeorg Brandl <georg@python.org>
Fri, 5 Dec 2008 18:06:58 +0000 (18:06 +0000)
committerGeorg Brandl <georg@python.org>
Fri, 5 Dec 2008 18:06:58 +0000 (18:06 +0000)
Doc/tutorial/classes.rst

index 5831f6c20ad0dc5e012d3e4307175d6dd930676e..d6e8ca1c2fd59b8dee36560fa4ef9eccb1123a11 100644 (file)
@@ -119,12 +119,11 @@ contains the current module's global names; and the outermost scope (searched
 last) is the namespace containing built-in names.
 
 If a name is declared global, then all references and assignments go directly to
-the middle scope containing the module's global names. Otherwise, all variables
-found outside of the innermost scope are read-only (an attempt to write to such
-a variable will simply create a *new* local variable in the innermost scope,
-leaving the identically named outer variable unchanged).
-
-.. XXX mention nonlocal
+the middle scope containing the module's global names.  To rebind variables
+found outside of the innermost scope, the :keyword:`nonlocal` statement can be
+used; if not declared nonlocal, those variable are read-only (an attempt to
+write to such a variable will simply create a *new* local variable in the
+innermost scope, leaving the identically named outer variable unchanged).
 
 Usually, the local scope references the local names of the (textually) current
 function.  Outside functions, the local scope references the same namespace as