作用域可以指定成任何名字,但在Web应用程序中提供“session”和“request”便于使用。
Scopes can be given any name, but "session" and "request" are provided out of the box for use in web applications.
如果一个名字声明为全局,那么所有的引用与赋值直接进入包含模块全局名字的中间作用域。
If a name is declared global then all references and assignments go directly to the middle scope containing the module's global names.
通常情况下,局部作用域引用当前函数的局部名字。
Usually the local scope references the local names of the (textually) current function.
注:3.5讨论连接性的问题。作用域,声明点和名字隐藏的概念在3.3 中讨论。
Note: 3.5 discusses linkage issues. The notions of scope, point of declaration and name hiding are discussed in 3.3.
通常情况下,每个特定的名字仅在程序中某些被称为该名字的作用域的不连续区域中有效。
In general, each particular name is valid only within some possibly discontiguous portion of program text called its scope.
如果变量在封闭作用域内被引用了,删除它的名字就是非法的。
If a variable is referenced in an enclosing scope, it is illegal to delete the name.
在函数中局部声明的名字将屏蔽在全局作用域(第2.3.6节)内声明的同名名字。
A name declared local to a function hides the same name declared in the global scope (Section 2.3.6, p. 54).
在这个作用域或嵌套在这个作用域里的其他作用域中,名字print 的任何使用都将解释为这个print 函数实例。
Any use of the name print at this scopeor a scope nested in this scopewill resolve to this instance.
在这个作用域或嵌套在这个作用域里的其他作用域中,名字print 的任何使用都将解释为这个print 函数实例。
Any use of the name print at this scopeor a scope nested in this scopewill resolve to this instance.
应用推荐