@@ -222,27 +222,27 @@ msgid ""
222222"Although scopes are determined statically, they are used dynamically. At any"
223223" time during execution, there are 3 or 4 nested scopes whose namespaces are "
224224"directly accessible:"
225- msgstr "虽然作用域是静态地确定的,但它们会被动态地使用。 在执行期间的任何时刻,会有 3 或 4 个命名空间可被直接访问的嵌套作用域: "
225+ msgstr "作用域虽然是静态确定的,但会被动态使用。执行期间的任何时刻,都会有 3 或 4 个命名空间可被直接访问的嵌套作用域: "
226226
227227#: ../../tutorial/classes.rst:120
228228msgid "the innermost scope, which is searched first, contains the local names"
229- msgstr "最先搜索的最内部作用域包含局部名称 "
229+ msgstr "最内部作用域,包含局部名称,并会首先在其中进行搜索 "
230230
231231#: ../../tutorial/classes.rst:121
232232msgid ""
233233"the scopes of any enclosing functions, which are searched starting with the "
234234"nearest enclosing scope, contains non-local, but also non-global names"
235- msgstr "从最近的封闭作用域开始搜索的任何封闭函数的作用域包含非局部名称,也包括非全局名称 "
235+ msgstr "封闭函数的作用域,包含非局部名称和非全局名称,从最近的封闭作用域开始搜索 "
236236
237237#: ../../tutorial/classes.rst:123
238238msgid "the next-to-last scope contains the current module's global names"
239- msgstr "倒数第二个作用域包含当前模块的全局名称 "
239+ msgstr "倒数第二个作用域,包含当前模块的全局名称 "
240240
241241#: ../../tutorial/classes.rst:124
242242msgid ""
243243"the outermost scope (searched last) is the namespace containing built-in "
244244"names"
245- msgstr "最外面的作用域( 最后搜索)是包含内置名称的命名空间 "
245+ msgstr "最外部的作用域,包含内置名称的命名空间, 最后搜索"
246246
247247#: ../../tutorial/classes.rst:126
248248msgid ""
@@ -254,9 +254,9 @@ msgid ""
254254"create a *new* local variable in the innermost scope, leaving the "
255255"identically named outer variable unchanged)."
256256msgstr ""
257- "如果一个名称被声明为全局变量 ,则所有引用和赋值将直接指向包含该模块的全局名称的中间作用域。 要重新绑定在最内层作用域以外找到的变量,可以使用 "
258- ":keyword:`nonlocal` 语句声明为非本地变量。 "
259- "如果没有被声明为非本地变量,这些变量将是只读的(尝试写入这样的变量只会在最内层作用域中创建一个 * 新的* 局部变量,而同名的外部变量保持不变)。 "
257+ "如果把名称声明为全局变量 ,则所有引用和赋值将直接指向包含该模块的全局名称的中间作用域。 要重新绑定在最内层作用域以外找到的变量,可以使用 "
258+ ":keyword:`nonlocal` 语句把该变量声明为非局部变量。未声明为非局部变量的变量是只读的,(尝试写入这种变量只会在最内层作用域中创建一个 "
259+ "** 新的** 局部变量,而同名的外部变量保持不变。) "
260260
261261#: ../../tutorial/classes.rst:133
262262msgid ""
@@ -265,8 +265,8 @@ msgid ""
265265"namespace as the global scope: the module's namespace. Class definitions "
266266"place yet another namespace in the local scope."
267267msgstr ""
268- "通常,当前局部作用域将(按字面文本)引用当前函数的局部名称。 在函数以外,局部作用域将引用与全局作用域相一致的命名空间 :模块的命名空间。 "
269- "类定义将在局部命名空间内再放置另一个命名空间 。"
268+ "通常,当前局部作用域将(按字面文本)引用当前函数的局部名称。在函数之外,局部作用域引用与全局作用域一致的命名空间 :模块的命名空间。 "
269+ "类定义在局部命名空间内再放置另一个命名空间 。"
270270
271271#: ../../tutorial/classes.rst:138
272272msgid ""
@@ -278,9 +278,8 @@ msgid ""
278278" at \" compile\" time, so don't rely on dynamic name resolution! (In fact, "
279279"local variables are already determined statically.)"
280280msgstr ""
281- "重要的是应该意识到作用域是按字面文本来确定的:在一个模块内定义的函数的全局作用域就是该模块的命名空间,无论该函数从什么地方或以什么别名被调用。 "
282- "另一方面,实际的名称搜索是在运行时动态完成的 --- 但是,Python 正在朝着“编译时静态名称解析”的方向发展,因此不要过于依赖动态名称解析! "
283- "(事实上,局部变量已经是被静态确定了。)"
281+ "划重点,作用域是按字面文本确定的:模块内定义的函数的全局作用域就是该模块的命名空间,无论该函数从什么地方或以什么别名被调用。另一方面,实际的名称搜索是在运行时动态完成的。但是,Python"
282+ " 正在朝着“编译时静态名称解析”的方向发展,因此不要过于依赖动态名称解析!(局部变量已经是被静态确定了。)"
284283
285284#: ../../tutorial/classes.rst:146
286285msgid ""
@@ -293,10 +292,10 @@ msgid ""
293292"scope: in particular, :keyword:`import` statements and function definitions "
294293"bind the module or function name in the local scope."
295294msgstr ""
296- "Python 的一个特殊规定是这样的 -- 如果不存在生效的 :keyword:`global` 或 :keyword:`nonlocal` 语句 -- "
297- " 则对名称的赋值总是会进入最内层作用域。 赋值不会复制数据 --- 它们只是将名称绑定到对象。 删除也是如此:语句 ``del x`` "
298- "会从局部作用域所引用的命名空间中移除对 ``x`` 的绑定。 事实上, 所有引入新名称的操作都是使用局部作用域:特别地, :keyword:`import`"
299- " 语句和函数定义会在局部作用域中绑定模块或函数名称。"
295+ "Python 有一个特殊规定。 如果不存在生效的 :keyword:`global` 或 :keyword:`nonlocal` "
296+ "语句, 则对名称的赋值总是会进入最内层作用域。赋值不会复制数据,只是将名称绑定到对象。 删除也是如此:语句 ``del x`` "
297+ "从局部作用域引用的命名空间中移除对 ``x`` 的绑定。所有引入新名称的操作都是使用局部作用域:尤其是 :keyword:`import` "
298+ "语句和函数定义会在局部作用域中绑定模块或函数名称。"
300299
301300#: ../../tutorial/classes.rst:154
302301msgid ""
@@ -305,8 +304,8 @@ msgid ""
305304":keyword:`nonlocal` statement indicates that particular variables live in an"
306305" enclosing scope and should be rebound there."
307306msgstr ""
308- ":keyword:`global` 语句可被用来表明特定变量生存于全局作用域并且应当在其中被重新绑定 ;:keyword:`nonlocal` "
309- "语句表明特定变量生存于外层作用域中并且应当在其中被重新绑定 。"
307+ ":keyword:`global` 语句用于表明特定变量在全局作用域里,并应在全局作用域中重新绑定 ;:keyword:`nonlocal` "
308+ "语句表明特定变量在外层作用域中,并应在外层作用域中重新绑定 。"
310309
311310#: ../../tutorial/classes.rst:162
312311msgid "Scopes and Namespaces Example"
0 commit comments