@@ -13,7 +13,7 @@ msgid ""
1313msgstr ""
1414"Project-Id-Version : Python 3.9\n "
1515"Report-Msgid-Bugs-To : \n "
16- "POT-Creation-Date : 2020-06-13 03:21 +0000\n "
16+ "POT-Creation-Date : 2020-07-28 03:46 +0000\n "
1717"PO-Revision-Date : 2017-02-16 23:39+0000\n "
1818"
Last-Translator :
Freesand Leo <[email protected] >, 2020\n "
1919"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -905,11 +905,11 @@ msgstr ""
905905"注意此特性是在句法层面定义的,但是在编译时实现。在运行时拼接字符串表达式必须使用 '+' 运算符。还要注意字面值拼接时每个部分可以使用不同的引号风格 "
906906"(甚至混合使用原始字符串和三引号字符串),格式化字符串字面值也可与普通字符串字面值拼接。"
907907
908- #: ../../reference/lexical_analysis.rst:646
908+ #: ../../reference/lexical_analysis.rst:648
909909msgid "Formatted string literals"
910910msgstr "格式化字符串字面值"
911911
912- #: ../../reference/lexical_analysis.rst:650
912+ #: ../../reference/lexical_analysis.rst:652
913913msgid ""
914914"A :dfn:`formatted string literal` or :dfn:`f-string` is a string literal "
915915"that is prefixed with ``'f'`` or ``'F'``. These strings may contain "
@@ -921,29 +921,27 @@ msgstr ""
921921"前缀的字符串字面值。这种字符串可包含替换字段,即以 ``{}`` "
922922"标示的表达式。而其他字符串字面值总是一个常量,格式化字符串字面值实际上是会在运行时被求值的表达式。"
923923
924- #: ../../reference/lexical_analysis.rst:656
924+ #: ../../reference/lexical_analysis.rst:658
925925msgid ""
926926"Escape sequences are decoded like in ordinary string literals (except when a"
927927" literal is also marked as a raw string). After decoding, the grammar for "
928928"the contents of the string is:"
929929msgstr "转义序列会像在普通字符串字面值中一样被解码 (除非字面值还被标示为原始字符串)。解码之后,字符串内容所用的语法如下:"
930930
931- #: ../../reference/lexical_analysis.rst:670
931+ #: ../../reference/lexical_analysis.rst:672
932932msgid ""
933933"The parts of the string outside curly braces are treated literally, except "
934934"that any doubled curly braces ``'{{'`` or ``'}}'`` are replaced with the "
935935"corresponding single curly brace. A single opening curly bracket ``'{'`` "
936- "marks a replacement field, which starts with a Python expression. After the"
937- " expression, there may be a conversion field, introduced by an exclamation "
938- "point ``'!'``. A format specifier may also be appended, introduced by a "
939- "colon ``':'``. A replacement field ends with a closing curly bracket "
940- "``'}'``."
936+ "marks a replacement field, which starts with a Python expression. To display"
937+ " both the expression text and its value after evaluation, (useful in "
938+ "debugging), an equal sign ``'='`` may be added after the expression. A "
939+ "conversion field, introduced by an exclamation point ``'!'`` may follow. A "
940+ "format specifier may also be appended, introduced by a colon ``':'``. A "
941+ "replacement field ends with a closing curly bracket ``'}'``."
941942msgstr ""
942- "字符串在花括号以外的部分按其字面值处理,除了双重花括号 ``'{{'`` 或 ``'}}'`` 会被替换为相应的单个花括号。单个左花括号 ``'{'``"
943- " 标示一个替换字段,它以一个 Python 表达式打头,表达式之后可能有一个以叹号 ``'!'`` 标示的转换字段。之后还可能带有一个以冒号 "
944- "``':'`` 标示的格式说明符。替换字段以一个右花括号 ``'}'`` 作为结束。"
945943
946- #: ../../reference/lexical_analysis.rst:679
944+ #: ../../reference/lexical_analysis.rst:682
947945msgid ""
948946"Expressions in formatted string literals are treated like regular Python "
949947"expressions surrounded by parentheses, with a few exceptions. An empty "
@@ -957,7 +955,7 @@ msgstr ""
957955"空表达式不被允许,:keyword:`lambda` 和赋值表达式 ``:=`` 必须显式地加上圆括号。 "
958956"替换表达式可以包含换行(例如在三重引号字符串中),但是不能包含注释。 每个表达式会在格式化字符串字面值所包含的位置按照从左至右的顺序被求值。"
959957
960- #: ../../reference/lexical_analysis.rst:688
958+ #: ../../reference/lexical_analysis.rst:691
961959msgid ""
962960"Prior to Python 3.7, an :keyword:`await` expression and comprehensions "
963961"containing an :keyword:`async for` clause were illegal in the expressions in"
@@ -966,7 +964,22 @@ msgstr ""
966964"在 Python 3.7 之前, :keyword:`await` 表达式包含 :keyword:`async for` "
967965"子句的推导式不允许在格式化字符串字面值表达式中使用,这是因为具体实现存在一个问题。"
968966
969- #: ../../reference/lexical_analysis.rst:693
967+ #: ../../reference/lexical_analysis.rst:696
968+ msgid ""
969+ "When the equal sign ``'='`` is provided, the output will have the expression"
970+ " text, the ``'='`` and the evaluated value. Spaces after the opening brace "
971+ "``'{'``, within the expression and after the ``'='`` are all retained in the"
972+ " output. By default, the ``'='`` causes the :func:`repr` of the expression "
973+ "to be provided, unless there is a format specified. When a format is "
974+ "specified it defaults to the :func:`str` of the expression unless a "
975+ "conversion ``'!r'`` is declared."
976+ msgstr ""
977+
978+ #: ../../reference/lexical_analysis.rst:704
979+ msgid "The equal sign ``'='`` was added in Python 3.8."
980+ msgstr ""
981+
982+ #: ../../reference/lexical_analysis.rst:707
970983msgid ""
971984"If a conversion is specified, the result of evaluating the expression is "
972985"converted before formatting. Conversion ``'!s'`` calls :func:`str` on the "
@@ -975,7 +988,7 @@ msgstr ""
975988"如果指定了转换符,表达式的求值结果会先转换再格式化。转换符 ``'!s'`` 即对结果调用 :func:`str`,``'!r'`` 为调用 "
976989":func:`repr`,而 ``'!a'`` 为调用 :func:`ascii`。"
977990
978- #: ../../reference/lexical_analysis.rst:697
991+ #: ../../reference/lexical_analysis.rst:711
979992msgid ""
980993"The result is then formatted using the :func:`format` protocol. The format "
981994"specifier is passed to the :meth:`__format__` method of the expression or "
@@ -986,7 +999,7 @@ msgstr ""
986999"在此之后结果会使用 :func:`format` 协议进行格式化。格式说明符会被传入表达式或转换结果的 :meth:`__format__` "
9871000"方法。如果省略格式说明符则会传入一个空字符串。然后格式化结果会包含在整个字符串最终的值当中。"
9881001
989- #: ../../reference/lexical_analysis.rst:703
1002+ #: ../../reference/lexical_analysis.rst:717
9901003msgid ""
9911004"Top-level format specifiers may include nested replacement fields. These "
9921005"nested fields may include their own conversion fields and :ref:`format "
@@ -998,112 +1011,112 @@ msgstr ""
9981011"<formatspec>`,但不可再包含更深层嵌套的替换字段。 这里的 :ref:`格式说明符微语言 <formatspec>` 与 "
9991012":meth:`str.format` 方法所使用的微语言一致。"
10001013
1001- #: ../../reference/lexical_analysis.rst:709
1014+ #: ../../reference/lexical_analysis.rst:723
10021015msgid ""
10031016"Formatted string literals may be concatenated, but replacement fields cannot"
10041017" be split across literals."
10051018msgstr "格式化字符串字面值可以拼接,但是一个替换字段不能拆分到多个字面值。"
10061019
1007- #: ../../reference/lexical_analysis.rst:712
1020+ #: ../../reference/lexical_analysis.rst:726
10081021msgid "Some examples of formatted string literals::"
10091022msgstr "一些格式化字符串字面值的示例::"
10101023
1011- #: ../../reference/lexical_analysis.rst:731
1024+ #: ../../reference/lexical_analysis.rst:758
10121025msgid ""
10131026"A consequence of sharing the same syntax as regular string literals is that "
10141027"characters in the replacement fields must not conflict with the quoting used"
10151028" in the outer formatted string literal::"
10161029msgstr "与正常字符串字面值采用相同语法导致的一个结果就是替换字段中的字符不能与外部的格式化字符串字面值所用的引号相冲突::"
10171030
1018- #: ../../reference/lexical_analysis.rst:738
1031+ #: ../../reference/lexical_analysis.rst:765
10191032msgid ""
10201033"Backslashes are not allowed in format expressions and will raise an error::"
10211034msgstr "格式表达式中不允许有反斜杠,这会引发错误::"
10221035
1023- #: ../../reference/lexical_analysis.rst:743
1036+ #: ../../reference/lexical_analysis.rst:770
10241037msgid ""
10251038"To include a value in which a backslash escape is required, create a "
10261039"temporary variable."
10271040msgstr "想包含需要用反斜杠转义的值,可以创建一个临时变量。"
10281041
1029- #: ../../reference/lexical_analysis.rst:750
1042+ #: ../../reference/lexical_analysis.rst:777
10301043msgid ""
10311044"Formatted string literals cannot be used as docstrings, even if they do not "
10321045"include expressions."
10331046msgstr "格式化字符串字面值不可用作文档字符串,即便其中没有包含表达式。"
10341047
1035- #: ../../reference/lexical_analysis.rst:761
1048+ #: ../../reference/lexical_analysis.rst:788
10361049msgid ""
10371050"See also :pep:`498` for the proposal that added formatted string literals, "
10381051"and :meth:`str.format`, which uses a related format string mechanism."
10391052msgstr "另请参见 :pep:`498` 了解加入格式化字符串字面值的提议,以及使用了相关的格式字符串机制的 :meth:`str.format`。"
10401053
1041- #: ../../reference/lexical_analysis.rst:768
1054+ #: ../../reference/lexical_analysis.rst:795
10421055msgid "Numeric literals"
10431056msgstr "数字字面值"
10441057
1045- #: ../../reference/lexical_analysis.rst:774
1058+ #: ../../reference/lexical_analysis.rst:801
10461059msgid ""
10471060"There are three types of numeric literals: integers, floating point numbers,"
10481061" and imaginary numbers. There are no complex literals (complex numbers can "
10491062"be formed by adding a real number and an imaginary number)."
10501063msgstr "数字字面值有三种类型: 整型数、浮点数和虚数。没有专门的复数字面值 (复数可由一个实数加一个虚数合成)。"
10511064
1052- #: ../../reference/lexical_analysis.rst:778
1065+ #: ../../reference/lexical_analysis.rst:805
10531066msgid ""
10541067"Note that numeric literals do not include a sign; a phrase like ``-1`` is "
10551068"actually an expression composed of the unary operator '``-``' and the "
10561069"literal ``1``."
10571070msgstr "注意数字字面值并不包含正负号;``-1`` 这样的负数实际上是由单目运算符 '``-``' 和字面值 ``1`` 合成的。"
10581071
1059- #: ../../reference/lexical_analysis.rst:792
1072+ #: ../../reference/lexical_analysis.rst:819
10601073msgid "Integer literals"
10611074msgstr "整型数字面值"
10621075
1063- #: ../../reference/lexical_analysis.rst:794
1076+ #: ../../reference/lexical_analysis.rst:821
10641077msgid "Integer literals are described by the following lexical definitions:"
10651078msgstr "整型数字面值由以下词法定义进行描述:"
10661079
1067- #: ../../reference/lexical_analysis.rst:808
1080+ #: ../../reference/lexical_analysis.rst:835
10681081msgid ""
10691082"There is no limit for the length of integer literals apart from what can be "
10701083"stored in available memory."
10711084msgstr "整型数字面值的长度没有限制,能一直大到占满可用内存。"
10721085
1073- #: ../../reference/lexical_analysis.rst:811
1086+ #: ../../reference/lexical_analysis.rst:838
10741087msgid ""
10751088"Underscores are ignored for determining the numeric value of the literal. "
10761089"They can be used to group digits for enhanced readability. One underscore "
10771090"can occur between digits, and after base specifiers like ``0x``."
10781091msgstr ""
10791092"在确定数字大小时字面值中的下划线会被忽略。它们可用来将数码分组以提高可读性。一个下划线可放在数码之间,也可放在基数说明符例如 ``0x`` 之后。"
10801093
1081- #: ../../reference/lexical_analysis.rst:815
1094+ #: ../../reference/lexical_analysis.rst:842
10821095msgid ""
10831096"Note that leading zeros in a non-zero decimal number are not allowed. This "
10841097"is for disambiguation with C-style octal literals, which Python used before "
10851098"version 3.0."
10861099msgstr "注意非零的十进制数开头不允许有额外的零。这是为了避免与 Python 在版本 3.0 之前所使用的 C 风格八进制字面值相混淆。"
10871100
1088- #: ../../reference/lexical_analysis.rst:819
1101+ #: ../../reference/lexical_analysis.rst:846
10891102msgid "Some examples of integer literals::"
10901103msgstr "一些整型数字面值的示例如下::"
10911104
1092- #: ../../reference/lexical_analysis.rst:825
1093- #: ../../reference/lexical_analysis.rst:857
1105+ #: ../../reference/lexical_analysis.rst:852
1106+ #: ../../reference/lexical_analysis.rst:884
10941107msgid "Underscores are now allowed for grouping purposes in literals."
10951108msgstr "允许在字面值中使用下划线进行分组。"
10961109
1097- #: ../../reference/lexical_analysis.rst:836
1110+ #: ../../reference/lexical_analysis.rst:863
10981111msgid "Floating point literals"
10991112msgstr "浮点数字面值"
11001113
1101- #: ../../reference/lexical_analysis.rst:838
1114+ #: ../../reference/lexical_analysis.rst:865
11021115msgid ""
11031116"Floating point literals are described by the following lexical definitions:"
11041117msgstr "浮点数字面值由以下词法定义进行描述:"
11051118
1106- #: ../../reference/lexical_analysis.rst:848
1119+ #: ../../reference/lexical_analysis.rst:875
11071120msgid ""
11081121"Note that the integer and exponent parts are always interpreted using radix "
11091122"10. For example, ``077e010`` is legal, and denotes the same number as "
@@ -1114,19 +1127,19 @@ msgstr ""
11141127"注意整型数部分和指数部分在解析时总是以 10 为基数。例如,``077e010`` 是合法的,且表示的数值与 ``77e10`` "
11151128"相同。浮点数字面值允许的范围依赖于具体实现。对于整型数字面值,支持以下划线进行分组。"
11161129
1117- #: ../../reference/lexical_analysis.rst:853
1130+ #: ../../reference/lexical_analysis.rst:880
11181131msgid "Some examples of floating point literals::"
11191132msgstr "一些浮点数字面值的示例如下::"
11201133
1121- #: ../../reference/lexical_analysis.rst:866
1134+ #: ../../reference/lexical_analysis.rst:893
11221135msgid "Imaginary literals"
11231136msgstr "虚数字面值"
11241137
1125- #: ../../reference/lexical_analysis.rst:868
1138+ #: ../../reference/lexical_analysis.rst:895
11261139msgid "Imaginary literals are described by the following lexical definitions:"
11271140msgstr "虚数字面值由以下词法定义进行描述:"
11281141
1129- #: ../../reference/lexical_analysis.rst:873
1142+ #: ../../reference/lexical_analysis.rst:900
11301143msgid ""
11311144"An imaginary literal yields a complex number with a real part of 0.0. "
11321145"Complex numbers are represented as a pair of floating point numbers and have"
@@ -1137,23 +1150,23 @@ msgstr ""
11371150"一个虚数字面值将生成一个实部为 0.0 的复数。复数是以一对浮点数来表示的,它们的取值范围相同。要创建一个实部不为零的复数,就加上一个浮点数,例如 "
11381151"``(3+4j)``。一些虚数字面值的示例如下::"
11391152
1140- #: ../../reference/lexical_analysis.rst:885
1153+ #: ../../reference/lexical_analysis.rst:912
11411154msgid "Operators"
11421155msgstr "运算符"
11431156
1144- #: ../../reference/lexical_analysis.rst:889
1157+ #: ../../reference/lexical_analysis.rst:916
11451158msgid "The following tokens are operators:"
11461159msgstr "以下形符属于运算符:"
11471160
1148- #: ../../reference/lexical_analysis.rst:902
1161+ #: ../../reference/lexical_analysis.rst:929
11491162msgid "Delimiters"
11501163msgstr "分隔符"
11511164
1152- #: ../../reference/lexical_analysis.rst:906
1165+ #: ../../reference/lexical_analysis.rst:933
11531166msgid "The following tokens serve as delimiters in the grammar:"
11541167msgstr "以下形符在语法中归类为分隔符:"
11551168
1156- #: ../../reference/lexical_analysis.rst:915
1169+ #: ../../reference/lexical_analysis.rst:942
11571170msgid ""
11581171"The period can also occur in floating-point and imaginary literals. A "
11591172"sequence of three periods has a special meaning as an ellipsis literal. The "
@@ -1162,22 +1175,22 @@ msgid ""
11621175msgstr ""
11631176"句点也可出现于浮点数和虚数字面值中。连续三个句点有表示一个省略符的特殊含义。以上列表的后半部分为增强赋值操作符,在词法中作为分隔符,但也起到运算作用。"
11641177
1165- #: ../../reference/lexical_analysis.rst:920
1178+ #: ../../reference/lexical_analysis.rst:947
11661179msgid ""
11671180"The following printing ASCII characters have special meaning as part of "
11681181"other tokens or are otherwise significant to the lexical analyzer:"
11691182msgstr "以下可打印 ASCII 字符作为其他形符的组成部分时具有特殊含义,或是对词法分析器有重要意义:"
11701183
1171- #: ../../reference/lexical_analysis.rst:927
1184+ #: ../../reference/lexical_analysis.rst:954
11721185msgid ""
11731186"The following printing ASCII characters are not used in Python. Their "
11741187"occurrence outside string literals and comments is an unconditional error:"
11751188msgstr "以下可打印 ASCII 字符不在 Python 词法中使用。如果出现于字符串字面值和注释之外将无条件地引发错误:"
11761189
1177- #: ../../reference/lexical_analysis.rst:936
1190+ #: ../../reference/lexical_analysis.rst:963
11781191msgid "Footnotes"
11791192msgstr "脚注"
11801193
1181- #: ../../reference/lexical_analysis.rst:937
1194+ #: ../../reference/lexical_analysis.rst:964
11821195msgid "https://www.unicode.org/Public/11.0.0/ucd/NameAliases.txt"
11831196msgstr "https://www.unicode.org/Public/11.0.0/ucd/NameAliases.txt"
0 commit comments