@@ -55,17 +55,18 @@ msgid ""
5555":keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute for the "
5656"``switch`` or ``case`` statements found in other languages."
5757msgstr ""
58- "if 语句包含零个或多个 :keyword:`elif` 子句,及可选的 :keyword:`else` 子句。关键字 "
59- "':keyword:`!elif`' 是 'else if' 的缩写,适用于避免过多的缩进。可以把 :keyword:`!if` ... "
60- ":keyword:`!elif` ... :keyword:`!elif` ... 序列看作是其他语言中 ``switch`` 或 ``case`` "
58+ "if 语句包含零个或多个 :keyword:`elif` 子句及可选的 :keyword:`else` 子句。关键字 "
59+ "':keyword:`!elif`' 是 'else if' 的缩写,适用于避免过多的缩进。:keyword:`!if` ... "
60+ ":keyword:`!elif` ... :keyword:`!elif` ... 序列可以当作其他语言中 ``switch`` 或 ``case`` "
6161"语句的替代品。"
6262
6363#: ../../tutorial/controlflow.rst:39
6464msgid ""
6565"If you're comparing the same value to several constants, or checking for "
6666"specific types or attributes, you may also find the :keyword:`!match` "
6767"statement useful. For more details see :ref:`tut-match`."
68- msgstr "把一个值与多个常量进行比较,或检查特定类型与属性,:keyword:`!match` 语句更实用。详见 :ref:`tut-match`。"
68+ msgstr ""
69+ "如果要把一个值与多个常量进行比较,或者检查特定类型或属性,:keyword:`!match` 语句更实用。详见 :ref:`tut-match`。"
6970
7071#: ../../tutorial/controlflow.rst:46
7172msgid ":keyword:`!for` Statements"
@@ -90,7 +91,7 @@ msgid ""
9091"Code that modifies a collection while iterating over that same collection "
9192"can be tricky to get right. Instead, it is usually more straight-forward to"
9293" loop over a copy of the collection or to create a new collection::"
93- msgstr "遍历某个集合的同时修改该集合的内容,很难获取想要的结果。要在遍历时修改集合的内容,应该遍历该集合的副本或创建新的集合 :"
94+ msgstr "遍历集合时修改集合的内容,会很容易生成错误的结果。因此不能直接进行循环,而是应遍历该集合的副本或创建新的集合 :"
9495
9596#: ../../tutorial/controlflow.rst:94
9697msgid "The :func:`range` Function"
@@ -267,7 +268,7 @@ msgstr "使用 ``|`` (“ or ”)在一个模式中可以组合多个字面
267268msgid ""
268269"Patterns can look like unpacking assignments, and can be used to bind "
269270"variables::"
270- msgstr "模式的形式可以类似于解包赋值 ,并可被用于绑定变量:"
271+ msgstr "模式的形式类似解包赋值 ,并可被用于绑定变量:"
271272
272273#: ../../tutorial/controlflow.rst:296
273274msgid ""
@@ -278,8 +279,8 @@ msgid ""
278279" which makes it conceptually similar to the unpacking assignment ``(x, y) = "
279280"point``."
280281msgstr ""
281- "请仔细研究此代码! 第一个模式有两个字面值,可以看作是上面所示字面值模式的扩展。 但接下来的两个模式结合了一个字面值和一个变量,而变量 *绑定 * "
282- "了一个来自目标的值 ( ``point``)。 第四个模式捕获了两个值,这使得它在概念上类似于解包赋值 ``(x, y) = point``。"
282+ "请仔细研究此代码! 第一个模式有两个字面值,可以看作是上面所示字面值模式的扩展。但接下来的两个模式结合了一个字面值和一个变量,而变量 **绑定* * "
283+ "了一个来自目标的值( ``point``)。 第四个模式捕获了两个值,这使得它在概念上类似于解包赋值 ``(x, y) = point``。"
283284
284285#: ../../tutorial/controlflow.rst:303
285286msgid ""
@@ -297,8 +298,9 @@ msgid ""
297298" \" y\" ), the following patterns are all equivalent (and all bind the ``y`` "
298299"attribute to the ``var`` variable)::"
299300msgstr ""
300- "可在 dataclass 等支持属性排序的内置类中使用位置参数。还可在类中设置 ``__match_args__`` 特殊属性为模式的属性定义指定位置。"
301- " 如果它被设为 (\" x\" , \" y\" ),则以下模式均为等价的,并且都把 ``y`` 属性绑定到 ``var`` 变量:"
301+ "可在 dataclass 等支持属性排序的内置类中使用位置参数。还可在类中设置 ``__match_args__`` "
302+ "特殊属性为模式的属性定义指定位置。如果它被设为 (\" x\" , \" y\" ),则以下模式均为等价的,并且都把 ``y`` 属性绑定到 ``var`` "
303+ "变量:"
302304
303305#: ../../tutorial/controlflow.rst:335
304306msgid ""
@@ -326,7 +328,7 @@ msgid ""
326328"guard is false, ``match`` goes on to try the next case block. Note that "
327329"value capture happens before the guard is evaluated::"
328330msgstr ""
329- "可以向模式添加 ``if`` 子句,称为“守护项”。 如果守护项的值为假,则 ``match`` 继续匹配下一个 case "
331+ "为模式添加成为守护项的 ``if`` 子句。 如果守护项的值为假,则 ``match`` 继续匹配下一个 case "
330332"语句块。注意,值的捕获发生在守护项被求值之前:"
331333
332334#: ../../tutorial/controlflow.rst:367
@@ -338,7 +340,7 @@ msgid ""
338340"Like unpacking assignments, tuple and list patterns have exactly the same "
339341"meaning and actually match arbitrary sequences. An important exception is "
340342"that they don't match iterators or strings."
341- msgstr "类似于解包赋值,元组和列表模式具有完全相同的含义并且实际上能匹配任意序列。 一个重要的例外是它们不能匹配迭代器或字符串 。"
343+ msgstr "与解包赋值类似,元组和列表模式具有完全相同的含义,并且实际上能匹配任意序列。 但它们不能匹配迭代器或字符串 。"
342344
343345#: ../../tutorial/controlflow.rst:373
344346msgid ""
@@ -347,8 +349,8 @@ msgid ""
347349"also be ``_``, so ``(x, y, *_)`` matches a sequence of at least two items "
348350"without binding the remaining items."
349351msgstr ""
350- "序列模式支持扩展解包操作: ``[x, y, *rest]`` 和 ``(x, y, *rest)`` 的作用类似于解包赋值。 在 ``*`` "
351- "之后的名称也可以为 ``_``,因此 ``(x, y, *_)`` 可以匹配包含至少两个条目的序列而不必绑定其余的条目 。"
352+ "序列模式支持扩展解包操作: ``[x, y, *rest]`` 和 ``(x, y, *rest)`` 的作用类似于解包赋值。 在 ``*`` "
353+ "之后的名称也可以为 ``_``,因此, ``(x, y, *_)`` 可以匹配包含至少两个条目的序列,而不必绑定其余的条目 。"
352354
353355#: ../../tutorial/controlflow.rst:378
354356msgid ""
@@ -357,13 +359,13 @@ msgid ""
357359"sequence patterns, extra keys are ignored. An unpacking like ``**rest`` is "
358360"also supported. (But ``**_`` would be redundant, so it not allowed.)"
359361msgstr ""
360- "映射模式: ``{\" bandwidth\" : b, \" latency\" : l}`` 会从一个字典中捕获 ``\" bandwidth\" `` 和 "
361- "``\" latency\" `` 的值。 与序列模式不同,额外的键会被忽略。 解包操作例如 ``**rest`` 也受到支持。 ( 但 ``**_`` "
362- "是冗余的,因而不被允许。) "
362+ "映射模式: ``{\" bandwidth\" : b, \" latency\" : l}`` 从字典中捕获 ``\" bandwidth\" `` 和 "
363+ "``\" latency\" `` 的值。与序列模式不同,额外的键会被忽略。``**rest`` 等解包操作也支持。 但 ``**_`` "
364+ "是冗余的,不允许使用。 "
363365
364366#: ../../tutorial/controlflow.rst:383
365367msgid "Subpatterns may be captured using the ``as`` keyword::"
366- msgstr "子模式可使用 ``as`` 关键字来捕获:: "
368+ msgstr "使用 ``as`` 关键字可以捕获子模式: "
367369
368370#: ../../tutorial/controlflow.rst:387
369371msgid ""
0 commit comments