Skip to content

Commit

Permalink
bpo-39431: Also mention nonlocal in assignment quirk (GH-17375)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanavas786 authored and terryjreedy committed Jan 23, 2020
1 parent 99e6c26 commit 7142df5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Doc/tutorial/classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7142df5

Please sign in to comment.