Kaydet (Commit) ae7ef57c authored tarafından Raymond Hettinger's avatar Raymond Hettinger

GvR pointed out that only enclosing function bodies are part of nested scopes.

üst fb1db4cd
...@@ -3553,11 +3553,11 @@ the namespace. ...@@ -3553,11 +3553,11 @@ the namespace.
Although scopes are determined statically, they are used dynamically. Although scopes are determined statically, they are used dynamically.
At any time during execution, there are at least three nested scopes whose At any time during execution, there are at least three nested scopes whose
namespaces are directly accessible: the innermost scope, which is searched namespaces are directly accessible: the innermost scope, which is searched
first, contains the local names; the namespaces of any enclosing code first, contains the local names; the namespaces of any enclosing
blocks (a module, function, or class definition) which are searched starting functions, which are searched starting with the nearest enclosing scope;
with the nearest enclosing scope; the middle scope, searched next, contains the middle scope, searched next, contains the current module's global names;
the current module's global names; and the outermost scope (searched last) and the outermost scope (searched last) is the namespace containing built-in
is the namespace containing built-in names. names.
If a name is declared global, then all references and assignments go If a name is declared global, then all references and assignments go
directly to the middle scope containing the module's global names. directly to the middle scope containing the module's global names.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment