Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 927ccd2

Browse files
committed
update for nonlocal keyword
1 parent 0e13c94 commit 927ccd2

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Doc/glossary.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,14 @@ Glossary
422422
modules, respectively.
423423

424424
nested scope
425+
425426
The ability to refer to a variable in an enclosing definition. For
426427
instance, a function defined inside another function can refer to
427-
variables in the outer function. Note that nested scopes work only for
428-
reference and not for assignment which will always write to the innermost
429-
scope. In contrast, local variables both read and write in the innermost
430-
scope. Likewise, global variables read and write to the global namespace.
428+
variables in the outer function. Note that nested scopes by default work
429+
only for reference and not for assignment. Local variables both read and
430+
write in the innermost scope. Likewise, global variables read and write
431+
to the global namespace. The :keyword:`nonlocal` allows writing to outer
432+
scopes.
431433

432434
new-style class
433435
Old name for the flavor of classes now used for all class objects. In

0 commit comments

Comments
 (0)