@@ -1117,11 +1117,15 @@ msgid ""
11171117"the use of ``async`` and ``await`` as variable names. The lowest supported "
11181118"version is ``(3, 4)``; the highest is ``sys.version_info[0:2]``."
11191119msgstr ""
1120+ "此外,将 ``feature_version`` 设为元组 ``(major, minor)`` 将会尝试使用该will attempt to "
1121+ "parse using that Python 版本的语法来进行解析。 目前 ``major`` 必须等于 ``3``。 例如,设置 "
1122+ "``feature_version=(3, 4)`` 将允许使用 ``async`` 和 ``await`` 作为变量名。 最低受支持版本为 ``(3,"
1123+ " 4)``;最高则为 ``sys.version_info[0:2]``。"
11201124
11211125#: ../../library/ast.rst:1920
11221126msgid ""
11231127"If source contains a null character ('\\ 0'), :exc:`ValueError` is raised."
1124- msgstr ""
1128+ msgstr "如果源包含一个空字符 (' \\ 0'),则会引发 :exc:`ValueError`。 "
11251129
11261130#: ../../library/ast.rst:1923
11271131msgid ""
@@ -1132,12 +1136,15 @@ msgid ""
11321136"node for a return statement, but it cannot be compiled alone (it needs to be"
11331137" inside a function node)."
11341138msgstr ""
1139+ "请注意成功将源代码解析为 AST 对象并不能保证该源代码提供了可被执行的有效 Python 代码,因为编译步骤还可能引发其他的 "
1140+ ":exc:`SyntaxError` 异常。 例如,对于源代码 ``return 42`` 可以生成一条有效的 return 语句 AST "
1141+ "节点,但它不能被单独编译(它必须位于一个函数节点之内)。"
11351142
11361143#: ../../library/ast.rst:1930
11371144msgid ""
11381145"In particular, :func:`ast.parse` won't do any scoping checks, which the "
11391146"compilation step does."
1140- msgstr ""
1147+ msgstr "特别地,:func:`ast.parse` 不会执行任何作用域检查,这是由编译步骤来做的。 "
11411148
11421149#: ../../library/ast.rst:1934 ../../library/ast.rst:1973
11431150msgid ""
@@ -1148,27 +1155,30 @@ msgstr "足够复杂或是巨大的字符串可能导致Python解释器的崩溃
11481155
11491156#: ../../library/ast.rst:1938
11501157msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``."
1151- msgstr ""
1158+ msgstr "增加了 ``type_comments``, ``mode='func_type'`` 和 ``feature_version``。 "
11521159
11531160#: ../../library/ast.rst:1944
11541161msgid ""
11551162"Unparse an :class:`ast.AST` object and generate a string with code that "
11561163"would produce an equivalent :class:`ast.AST` object if parsed back with "
11571164":func:`ast.parse`."
11581165msgstr ""
1166+ "反向解析一个 :class:`ast.AST` 对象并生成一个包含当再次使用 :func:`ast.parse` 解析时将产生同样的 "
1167+ ":class:`ast.AST` 对象的代码的字符串。"
11591168
11601169#: ../../library/ast.rst:1949
11611170msgid ""
11621171"The produced code string will not necessarily be equal to the original code "
11631172"that generated the :class:`ast.AST` object (without any compiler "
11641173"optimizations, such as constant tuples/frozensets)."
11651174msgstr ""
1175+ "所产生的代码字符串将不一定与生成 :class:`ast.AST` 对象的原始代码完全一致(不带任何编译器优化,例如常量元组/冻结集合等)。"
11661176
11671177#: ../../library/ast.rst:1954
11681178msgid ""
11691179"Trying to unparse a highly complex expression would result with "
11701180":exc:`RecursionError`."
1171- msgstr ""
1181+ msgstr "尝试反向解析一个高度复杂的表达式可能会导致 :exc:`RecursionError`。 "
11721182
11731183#: ../../library/ast.rst:1962
11741184msgid ""
@@ -1177,6 +1187,8 @@ msgid ""
11771187"following Python literal structures: strings, bytes, numbers, tuples, lists,"
11781188" dicts, sets, booleans, ``None`` and ``Ellipsis``."
11791189msgstr ""
1190+ "安全地对表达式节点或者包含 Python 字面值或容器表示形式的字符串进行求值。 所提供的字符串或节点可能只由下列 Python "
1191+ "字面值结构组成:字符串、字节串、数值、元组、列表、字典、集合、布尔值、``None`` 和 ``Ellipsis``。"
11801192
11811193#: ../../library/ast.rst:1967
11821194msgid ""
@@ -1185,6 +1197,8 @@ msgid ""
11851197"capable of evaluating arbitrarily complex expressions, for example involving"
11861198" operators or indexing."
11871199msgstr ""
1200+ "这可被用于安全地对包含不受信任来源的 Python 值的字符串进行求值而不必解析这些值本身。 "
1201+ "它并不能对任意的复杂表达式进行求值,例如涉及运算符或索引操作的表达式。"
11881202
11891203#: ../../library/ast.rst:1977
11901204msgid ""
0 commit comments