991010# df2dc1c92e792f7ae8417c51df43db8f_594d92a <0f49be28017426edb1db1a2ab6e67088_717605>, 2021
1111# ppcfish <[email protected] >, 202112- # WH-2099 <[email protected] >, 20211312# Freesand Leo <[email protected] >, 20211413# jaystone776 <[email protected] >, 20221514#
@@ -180,7 +179,7 @@ msgid ""
180179"loop is terminated by a :keyword:`break` statement. This is exemplified by "
181180"the following loop, which searches for prime numbers::"
182181msgstr ""
183- "循环语句支持 :keyword:`!else` 子句;:keyword:`for` 循环中,可迭代对象中的元素全部循环完毕时 ,或 "
182+ "循环语句支持 :keyword:`!else` 子句;:keyword:`for` 循环中,可迭代对象中的元素全部循环完毕 ,或 "
184183":keyword:`while` 循环的条件为假时,执行该子句;:keyword:`break` 语句终止循环时,不执行该子句。 "
185184"请看下面这个查找素数的循环示例:"
186185
@@ -245,32 +244,30 @@ msgid ""
245244" it can also extract components (sequence elements or object attributes) "
246245"from the value into variables."
247246msgstr ""
248- "match 语句接受一个表达式并将它的值与以一个或多个 case 语句块形式给出的一系列模式进行比较。 这在表面上很类似 C, Java 或 "
249- "JavaScript (以及许多其他语言) 中的 switch 语句 ,但它还能够从值中提取子部分 ( 序列元素或对象属性) 并赋值给变量。"
247+ "match 语句接受一个表达式并把它的值与以一个或多个 case 语句块形式给出的一系列模式进行比较。match 语句与 "
248+ "C、Java、 JavaScript 等其他编程语言中的 switch 语句很相似 ,但它还能够从值中提取子部分( 序列元素或对象属性) 并赋值给变量。"
250249
251250#: ../../tutorial/controlflow.rst:259
252251msgid ""
253252"The simplest form compares a subject value against one or more literals::"
254- msgstr "最简单的形式是将一个目标值与一个或多个字面值进行比较:: "
253+ msgstr "最简单的形式是将一个目标值与一个或多个字面值进行比较: "
255254
256255#: ../../tutorial/controlflow.rst:272
257256msgid ""
258257"Note the last block: the \" variable name\" ``_`` acts as a *wildcard* and "
259258"never fails to match. If no case matches, none of the branches is executed."
260- msgstr ""
261- "请注意最后一个代码块: \" 变量名\" ``_`` 被作为 *通配符* 并必定会匹配成功。 如果没有任何 case "
262- "语句匹配成功,则任何分支都不会被执行。"
259+ msgstr "注意最后一个代码块:“变量名” ``_`` 被作为 *通配符* 并必定会匹配成功。 如果没有 case 语句匹配成功,则不会执行任何分支。"
263260
264261#: ../../tutorial/controlflow.rst:275
265262msgid ""
266263"You can combine several literals in a single pattern using ``|`` (\" or\" )::"
267- msgstr "你可以使用 ``|`` (“ or ”)在一个模式中组合几个字面值:: "
264+ msgstr "使用 ``|`` (“ or ”)在一个模式中可以组合多个字面值: "
268265
269266#: ../../tutorial/controlflow.rst:280
270267msgid ""
271268"Patterns can look like unpacking assignments, and can be used to bind "
272269"variables::"
273- msgstr "模式的形式可以类似于解包赋值,并可被用于绑定变量:: "
270+ msgstr "模式的形式可以类似于解包赋值,并可被用于绑定变量: "
274271
275272#: ../../tutorial/controlflow.rst:296
276273msgid ""
@@ -289,7 +286,7 @@ msgid ""
289286"If you are using classes to structure your data you can use the class name "
290287"followed by an argument list resembling a constructor, but with the ability "
291288"to capture attributes into variables::"
292- msgstr "如果你使用类来结构化你的数据,你可以使用类名之后跟一个类似于构造器的参数列表,这样能够捕获属性放入到变量中:: "
289+ msgstr "如果使用类实现数据结构,可在类名后加一个类似于构造器的参数列表,这样做可以把属性放到变量里: "
293290
294291#: ../../tutorial/controlflow.rst:324
295292msgid ""
@@ -300,9 +297,8 @@ msgid ""
300297" \" y\" ), the following patterns are all equivalent (and all bind the ``y`` "
301298"attribute to the ``var`` variable)::"
302299msgstr ""
303- "你可以在某些为其属性提供了排序的内置类(例如 dataclass)中使用位置参数。 你也可以通过在你的类中设置 ``__match_args__`` "
304- "特殊属性来为模式中的属性定义一个专门的位置。 如果它被设为 (\" x\" , \" y\" ),则以下模式均为等价的(并且都是将 ``y`` 属性绑定到 "
305- "``var`` 变量)::"
300+ "可在 dataclass 等支持属性排序的内置类中使用位置参数。还可在类中设置 ``__match_args__`` 特殊属性为模式的属性定义指定位置。"
301+ " 如果它被设为 (\" x\" , \" y\" ),则以下模式均为等价的,并且都把 ``y`` 属性绑定到 ``var`` 变量:"
306302
307303#: ../../tutorial/controlflow.rst:335
308304msgid ""
@@ -314,28 +310,28 @@ msgid ""
314310"(recognized by the \" (...)\" next to them like ``Point`` above) are never "
315311"assigned to."
316312msgstr ""
317- "读取模式的推荐方式是将它们看做是你会在赋值操作左侧放置的内容的扩展形式,以便理解各个变量将会被设置的值。 只有单独的名称 ( 例如上面的 ``var``) "
318- " 会被 match 语句所赋值。 带点号的名称 (例如 ``foo.bar``)、属性名称 ( 例如上面的 ``x=`` 和 ``y=``) 或类名称 "
319- "( 通过其后的 \" (...)\" 来识别,例如上面的 ``Point``) 都绝不会被赋值。"
313+ "读取模式的推荐方式是将它们看做是你会在赋值操作左侧放置的内容的扩展形式,以便理解各个变量将会被设置的值。 只有单独的名称( 例如上面的 "
314+ "``var``) 会被 match 语句所赋值。 带点号的名称 (例如 ``foo.bar``)、属性名称( 例如上面的 ``x=`` 和 "
315+ "``y=``)或类名称( 通过其后的 \" (...)\" 来识别,例如上面的 ``Point``) 都绝不会被赋值。"
320316
321317#: ../../tutorial/controlflow.rst:342
322318msgid ""
323319"Patterns can be arbitrarily nested. For example, if we have a short list of"
324320" points, we could match it like this::"
325- msgstr "模式可以任意地嵌套。 例如,如果我们有一个由点组成的短列表,则可以这样匹配它:: "
321+ msgstr "模式可以任意地嵌套。例如,如果有一个由点组成的短列表,则可使用如下方式进行匹配: "
326322
327323#: ../../tutorial/controlflow.rst:357
328324msgid ""
329325"We can add an ``if`` clause to a pattern, known as a \" guard\" . If the "
330326"guard is false, ``match`` goes on to try the next case block. Note that "
331327"value capture happens before the guard is evaluated::"
332328msgstr ""
333- "我们可以向一个模式添加 ``if`` 子句,称为“守护项”。 如果守护项为假值 ,则 ``match`` 将继续尝试下一个 case 语句块。 "
334- "请注意值的捕获发生在守护项被求值之前。:: "
329+ "可以向模式添加 ``if`` 子句,称为“守护项”。 如果守护项的值为假 ,则 ``match`` 继续匹配下一个 case "
330+ "语句块。注意,值的捕获发生在守护项被求值之前: "
335331
336332#: ../../tutorial/controlflow.rst:367
337333msgid "Several other key features of this statement:"
338- msgstr "此语句的一些其他关键特性: "
334+ msgstr "match 语句的其他特性: "
339335
340336#: ../../tutorial/controlflow.rst:369
341337msgid ""
0 commit comments