diff options
author | pbhd <p-bauer-schriesheim@t-online.de> | 2019-05-29 03:38:03 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-05-29 03:38:03 (GMT) |
commit | e1f95e77e0647aff602e0660ba3c282b71045875 (patch) | |
tree | ae70e5c236495f9f52149620e886ec0272812439 /Doc/tutorial | |
parent | 8b09500345d998f3ff1e363a5210bc87f42ff306 (diff) | |
download | cpython-e1f95e77e0647aff602e0660ba3c282b71045875.zip cpython-e1f95e77e0647aff602e0660ba3c282b71045875.tar.gz cpython-e1f95e77e0647aff602e0660ba3c282b71045875.tar.bz2 |
bpo-36739: Update controlflow.rst (GH-12983)
in addition to global-statement also mention nonlocal-statement
(in the paragraph describing access to variables which are non local to a function
Diffstat (limited to 'Doc/tutorial')
-rw-r--r-- | Doc/tutorial/controlflow.rst | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index 813b7ca..81a28a6 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -279,9 +279,11 @@ variables of the function. More precisely, all variable assignments in a function store the value in the local symbol table; whereas variable references first look in the local symbol table, then in the local symbol tables of enclosing functions, then in the global symbol table, and finally in the table -of built-in names. Thus, global variables cannot be directly assigned a value -within a function (unless named in a :keyword:`global` statement), although they -may be referenced. +of built-in names. Thus, global variables and variables of enclosing functions +cannot be directly assigned a value within a function (unless, for global +variables, named in a :keyword:`global` statement, or, for variables of enclosing +functions, named in a :keyword:`nonlocal` statement), although they may be +referenced. The actual parameters (arguments) to a function call are introduced in the local symbol table of the called function when it is called; thus, arguments are |