Navigation Menu

Skip to content

Commit

Permalink
bpo-36739: Update controlflow.rst (GH-12983)
Browse files Browse the repository at this point in the history
in addition to global-statement also mention nonlocal-statement
(in the paragraph describing access to variables which are non local to a function
(cherry picked from commit e1f95e7)

Co-authored-by: pbhd <p-bauer-schriesheim@t-online.de>
  • Loading branch information
miss-islington and pbhd committed May 29, 2019
1 parent 3708316 commit cee95fe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Doc/tutorial/controlflow.rst
Expand Up @@ -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
Expand Down

0 comments on commit cee95fe

Please sign in to comment.