@@ -290,6 +290,9 @@ msgid ""
290290":keyword:`import` statements and function definitions bind the module or "
291291"function name in the local scope."
292292msgstr ""
293+ "Python 的一个特殊之处在于 -- 如果不存在生效的 :keyword:`global` 语句 -- 对名称的赋值总是进入最内层作用域。 "
294+ "赋值不会复制数据 --- 它们只是将名称绑定到对象。 删除也是如此:语句 ``del x`` 会从局部命名空间的引用中移除对 ``x`` 的绑定。 "
295+ "事实上,所有引入新名称的操作都使用局部作用域:特别地,:keyword:`import` 语句和函数定义会在局部作用域中绑定模块或函数名称。"
293296
294297#: ../../tutorial/classes.rst:154
295298msgid ""
@@ -298,6 +301,8 @@ msgid ""
298301":keyword:`nonlocal` statement indicates that particular variables live in an"
299302" enclosing scope and should be rebound there."
300303msgstr ""
304+ ":keyword:`global` 语句可被用来表明特定变量生存于全局作用域并且应当在其中被重新绑定;:keyword:`nonlocal` "
305+ "语句表明特定变量生存于外层作用域中并且应当在其中被重新绑定。"
301306
302307#: ../../tutorial/classes.rst:162
303308msgid "Scopes and Namespaces Example"
@@ -309,8 +314,8 @@ msgid ""
309314"namespaces, and how :keyword:`global` and :keyword:`nonlocal` affect "
310315"variable binding::"
311316msgstr ""
312- " 这是一个演示如何引用不同作用域和名称空间的示例,以及如何 :keyword:`global` 和 :keyword:`nonlocal` "
313- "影响变量绑定 ::"
317+ " 这是一个演示如何引用不同作用域和名称空间的示例,以及 :keyword:`global` 和 :keyword:`nonlocal` "
318+ "会如何影响变量绑定 ::"
314319
315320#: ../../tutorial/classes.rst:191
316321msgid "The output of the example code is:"
@@ -323,6 +328,8 @@ msgid ""
323328"changed *scope_test*\\ 's binding of *spam*, and the :keyword:`global` "
324329"assignment changed the module-level binding."
325330msgstr ""
331+ "请注意 *局部* 赋值(这是默认状态)不会改变 *scope_test* 对 *spam* 的绑定。 :keyword:`nonlocal` 赋值会改变"
332+ " *scope_test* 对 *spam* 的绑定,而 :keyword:`global` 赋值会改变模块层级的绑定。"
326333
327334#: ../../tutorial/classes.rst:205
328335msgid ""
0 commit comments