作用域可以指定成任何名字,但在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.
类的定义对名字空间玩弄了一些小技巧,为了全面了解所发生的事情,你必须了解作用域与名字空间的工作方式。
Class definitions play some neat tricks with namespaces and you need to know how scopes and namespaces work to fully understand what's going on.
在函数之外,局部作用域引用全局作用域相同的名字空间:模块的名字空间。
Outside functions the local scope references the same namespace as the global scope: the module's namespace.
注: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.
块(6.3)中声明的名字是局部于这个块的。它的潜在作用域从其声明点(3.3.1)开始,到其声明区域的结尾结束。
A name declared in a block (6.3) is local to that block. Its potential scope begins at its point of declaration (3.3.1) and ends at the end of its declarative region.
如果变量在封闭作用域内被引用了,删除它的名字就是非法的。
If a variable is referenced in an enclosing scope, it is illegal to delete the name.
在标准库中定义的名字具有名字空间作用 域(7.3)。
The names defined in the library have namespace scope (7.3).
一般,得到工作于名字空间、函数、类作用域的优秀的静态断言要比多使用一个难看的宏要值得。
The general conclusion was that the good of a static assert working at namespace, function, and class scope outweighed the ugliness of a macro.
在函数中局部声明的名字将屏蔽在全局作用域(第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).
通常情况下,每个特定的名字仅在程序中某些被称为该名字的作用域的不连续区域中有效。
In general, each particular name is valid only within some possibly discontiguous portion of program text called its scope.
在这个作用域或嵌套在这个作用域里的其他作用域中,名字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.
应用推荐