summaryrefslogtreecommitdiffstats
path: root/Doc/tutorial/classes.rst
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-01-23 18:22:36 (GMT)
committerGitHub <noreply@github.com>2020-01-23 18:22:36 (GMT)
commit5a2356be1a3f4a9b2e509a16062016b7d9dee7e9 (patch)
treee48b077f6fb334bc6b4135ffb5ead226f44f10c8 /Doc/tutorial/classes.rst
parent993811ffe75c2573f97fb3fd1414b34609b8c8db (diff)
downloadcpython-5a2356be1a3f4a9b2e509a16062016b7d9dee7e9.zip
cpython-5a2356be1a3f4a9b2e509a16062016b7d9dee7e9.tar.gz
cpython-5a2356be1a3f4a9b2e509a16062016b7d9dee7e9.tar.bz2
bpo-39431: Also mention nonlocal in assignment quirk (GH-17375)
(cherry picked from commit 7142df5ea23b4ce0efb72746b4b3b65414e8dcb1) Co-authored-by: Shanavas M <shanavas.m2@gmail.com>
Diffstat (limited to 'Doc/tutorial/classes.rst')
-rw-r--r--Doc/tutorial/classes.rst8
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst
index 0c0dca9..f781fec 100644
--- a/Doc/tutorial/classes.rst
+++ b/Doc/tutorial/classes.rst
@@ -143,10 +143,10 @@ language definition is evolving towards static name resolution, at "compile"
time, so don't rely on dynamic name resolution! (In fact, local variables are
already determined statically.)
-A special quirk of Python is that -- if no :keyword:`global` statement is in
-effect -- assignments to names always go into the innermost scope. Assignments
-do not copy data --- they just bind names to objects. The same is true for
-deletions: the statement ``del x`` removes the binding of ``x`` from the
+A special quirk of Python is that -- if no :keyword:`global` or :keyword:`nonlocal`
+statement is in effect -- assignments to names always go into the innermost scope.
+Assignments do not copy data --- they just bind names to objects. The same is true
+for deletions: the statement ``del x`` removes the binding of ``x`` from the
namespace referenced by the local scope. In fact, all operations that introduce
new names use the local scope: in particular, :keyword:`import` statements and
function definitions bind the module or function name in the local scope.