You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/birkenfeld'closed_at=<Date2008-01-21.16:52:00.379>created_at=<Date2004-07-26.09:39:38.000>labels= ['easy', 'docs']
title='Enclosing Scope missing from namespace in Tutorial'updated_at=<Date2008-01-21.16:52:00.378>user='https://bugs.python.org/brianvanden'
In the docs to Python 2.3.4 (#53, May 25 2004,
21:17:02), Section 4.6 of the Python Tutorial says:
The execution of a function introduces a new symbol
table used for the local 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 global symbol table, and then in the table of
built-in names. Thus, global variables cannot be
directly assigned a value within a function (unless
named in a
global statement), although they may be referenced.
This doesn't make it clear that in the following sort
of case, the nested def can 'see' the varriables in the
topmost function:
. . . whereas variable references first look in the
local symbol table, then in the local scope of the
enclosing function defs (if any), then in the global
symbol table, . . .
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: