File tree 2 files changed +18
-2
lines changed
Filter options
2 files changed +18
-2
lines changed
Original file line number Diff line number Diff line change @@ -154,6 +154,12 @@ msgid ""
154
154
"variables, the compiler will flag this by raising a :exc:`SyntaxError` "
155
155
"exception."
156
156
msgstr ""
157
+ "此项改变的一个附带影响是在特定条件下函数作用域内部 ``from module import *`` 和 ``exec`` 语句将不允许使用。 "
158
+ "Python 参考手册已经写明 ``from module import *`` 仅在模块最高层级上是可用的,但此前 CPython "
159
+ "解释器从未强制实施此规则。 作为嵌套作用域具体实现的一部分,将 Python 源码转为字节码的编译器会生成不同的代码来访问某个包含作用域内的变量。 "
160
+ "``from module import *`` 和 ``exec`` 会使得编译器无法正确执行,因为它们会向局部命名空间添加在编译时还不存在的名称。 "
161
+ "为此,如果一个函数包含带有自由变量的函数定义或 :keyword:`lambda` 表达式,编译器将通过引发 :exc:`SyntaxError` "
162
+ "异常来提示。"
157
163
158
164
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/whatsnew/2.1.rst:96
159
165
msgid "To make the preceding explanation a bit clearer, here's an example::"
@@ -165,13 +171,15 @@ msgid ""
165
171
"would define a new local variable named ``x`` whose value should be accessed"
166
172
" by :func:`g`."
167
173
msgstr ""
174
+ "包含 ``exec`` 语句的第 4 行有语法错误,因为 ``exec`` 将定义一个名为 ``x`` 的新局部变量,它的值应当被 :func:`g` "
175
+ "访问。"
168
176
169
177
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/whatsnew/2.1.rst:109
170
178
msgid ""
171
179
"This shouldn't be much of a limitation, since ``exec`` is rarely used in "
172
180
"most Python code (and when it is used, it's often a sign of a poor design "
173
181
"anyway)."
174
- msgstr ""
182
+ msgstr "这应该不会是太大的限制,因为 ``exec`` 在多数 Python 代码中都极少被使用(而当它被使用时,往往也是个存在糟糕设计的信号)。 "
175
183
176
184
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/whatsnew/2.1.rst:113
177
185
msgid ""
Original file line number Diff line number Diff line change @@ -1048,6 +1048,12 @@ msgid ""
1048
1048
"variables, the compiler will flag this by raising a :exc:`SyntaxError` "
1049
1049
"exception."
1050
1050
msgstr ""
1051
+ "此项改变的一个附带影响是在特定条件下函数作用域内部 ``from module import *`` 和 ``exec`` 语句将不允许使用。 "
1052
+ "Python 参考手册已经写明 ``from module import *`` 仅在模块最高层级上是可用的,但此前 CPython "
1053
+ "解释器从未强制实施此规则。 作为嵌套作用域具体实现的一部分,将 Python 源码转为字节码的编译器会生成不同的代码来访问某个包含作用域内的变量。 "
1054
+ "``from module import *`` 和 ``exec`` 会使得编译器无法正确执行,因为它们会向局部命名空间添加在编译时还不存在的名称。 "
1055
+ "为此,如果一个函数包含带有自由变量的函数定义或 :keyword:`lambda` 表达式,编译器将通过引发 :exc:`SyntaxError` "
1056
+ "异常来提示。"
1051
1057
1052
1058
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/whatsnew/2.2.rst:907
1053
1059
msgid "To make the preceding explanation a bit clearer, here's an example::"
@@ -1059,13 +1065,15 @@ msgid ""
1059
1065
"would define a new local variable named ``x`` whose value should be accessed"
1060
1066
" by :func:`g`."
1061
1067
msgstr ""
1068
+ "包含 ``exec`` 语句的第 4 行有语法错误,因为 ``exec`` 将定义一个名为 ``x`` 的新局部变量,它的值应当被 :func:`g` "
1069
+ "访问。"
1062
1070
1063
1071
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/whatsnew/2.2.rst:920
1064
1072
msgid ""
1065
1073
"This shouldn't be much of a limitation, since ``exec`` is rarely used in "
1066
1074
"most Python code (and when it is used, it's often a sign of a poor design "
1067
1075
"anyway)."
1068
- msgstr ""
1076
+ msgstr "这应该不会是太大的限制,因为 ``exec`` 在多数 Python 代码中都极少被使用(而当它被使用时,往往也是个存在糟糕设计的信号)。 "
1069
1077
1070
1078
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/whatsnew/2.2.rst:927
1071
1079
msgid ":pep:`227` - Statically Nested Scopes"
You can’t perform that action at this time.
0 commit comments