@@ -1078,12 +1078,14 @@ msgid ""
10781078"variable without :keyword:`!global`, although free variables may refer to "
10791079"globals without being declared global."
10801080msgstr ""
1081+ ":keyword:`global` 语句是作用于整个当前代码块的声明。 它意味着所列出的标识符将被解读为全局变量。 要给全局变量赋值不可能不用到 "
1082+ ":keyword:`!global` 关键字,不过自由变量也可以指向全局变量而不必声明为全局变量。"
10811083
10821084#: ../../reference/simple_stmts.rst:943
10831085msgid ""
10841086"Names listed in a :keyword:`global` statement must not be used in the same "
10851087"code block textually preceding that :keyword:`!global` statement."
1086- msgstr ""
1088+ msgstr "在 :keyword:`global` 语句中列出的名称不得在同一代码块内该 :keyword:`!global` 语句之前的位置中使用。 "
10871089
10881090#: ../../reference/simple_stmts.rst:946
10891091msgid ""
@@ -1092,13 +1094,15 @@ msgid ""
10921094"definition, function definition, :keyword:`import` statement, or variable "
10931095"annotation."
10941096msgstr ""
1097+ "在 :keyword:`global` 语句中列出的名称不得被定义为正式形参,不也得出现于 :keyword:`for` "
1098+ "循环的控制目标、:keyword:`class` 定义、函数定义、:keyword:`import` 语句或变量标注之中。"
10951099
10961100#: ../../reference/simple_stmts.rst:953
10971101msgid ""
10981102"The current implementation does not enforce some of these restrictions, but "
10991103"programs should not abuse this freedom, as future implementations may "
11001104"enforce them or silently change the meaning of the program."
1101- msgstr ""
1105+ msgstr "当前的实现并未强制要求所有的上述限制,但程序不应当滥用这样的自由,因为未来的实现可能会改为强制要求,并静默地改变程序的含义。 "
11021106
11031107#: ../../reference/simple_stmts.rst:962
11041108msgid ""
@@ -1111,10 +1115,14 @@ msgid ""
11111115" containing the function call. The same applies to the :func:`eval` and "
11121116":func:`compile` functions."
11131117msgstr ""
1118+ "**程序员注意事项:** :keyword:`global` 是对解析器的指令。 它仅对与 :keyword:`!global` "
1119+ "语句同时被解析的代码起作用。 特别地,包含在提供给内置 :func:`exec` 函数字符串或代码对象中的 :keyword:`!global` "
1120+ "语句并不会影响 *包含* 该函数调用的代码块,而包含在这种字符串中的代码也不会受到包含该函数调用的代码中的 :keyword:`!global` "
1121+ "语句影响。 这同样适用于 :func:`eval` 和 :func:`compile` 函数。"
11141122
11151123#: ../../reference/simple_stmts.rst:974
11161124msgid "The :keyword:`!nonlocal` statement"
1117- msgstr ""
1125+ msgstr ":keyword:`!nonlocal` 语句 "
11181126
11191127#: ../../reference/simple_stmts.rst:986
11201128msgid ""
@@ -1124,6 +1132,8 @@ msgid ""
11241132" local namespace first. The statement allows encapsulated code to rebind "
11251133"variables outside of the local scope besides the global (module) scope."
11261134msgstr ""
1135+ ":keyword:`nonlocal` 语句会使得所列出的名称指向之前在最近的包含作用域中绑定的除全局变量以外的变量。 "
1136+ "这种功能很重要,因为绑定的默认行为是先搜索局部命名空间。 这个语句允许被封装的代码重新绑定局部作用域以外且非全局(模块)作用域当中的变量。"
11271137
11281138#: ../../reference/simple_stmts.rst:996
11291139msgid ""
0 commit comments