[Python-checkins] r67594 - python/branches/py3k/Doc/tutorial/classes.rst

georg.brandl python-checkins at python.org
Fri Dec 5 19:06:58 CET 2008


Author: georg.brandl
Date: Fri Dec  5 19:06:58 2008
New Revision: 67594

Log:
#4549: Mention nonlocal statement in tutorial section about scoping.


Modified:
   python/branches/py3k/Doc/tutorial/classes.rst

Modified: python/branches/py3k/Doc/tutorial/classes.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/classes.rst	(original)
+++ python/branches/py3k/Doc/tutorial/classes.rst	Fri Dec  5 19:06:58 2008
@@ -119,12 +119,11 @@
 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


More information about the Python-checkins mailing list