99# Fred <fred.wei@foxmail.com>, 2018
1010# 刘玉龙 <banbooliu@gmail.com>, 2018
1111# Junkai Shao <skaifun.dev@gmail.com>, 2018
12- # zkonge <zkonge@outlook.com>, 2019
13- # Freesand Leo <yuqinju@163.com>, 2020
12+ # Freesand Leo <yuqinju@163.com>, 2019
1413# jaystone776 <1732865113@qq.com>, 2021
1514#
1615#, fuzzy
@@ -514,31 +513,31 @@ msgstr "循环的技巧"
514513msgid ""
515514"When looping through dictionaries, the key and corresponding value can be "
516515"retrieved at the same time using the :meth:`items` method. ::"
517- msgstr "当在字典中循环时 ,用 :meth:`items` 方法可将关键字和对应的值同时取出 :: "
516+ msgstr "在字典中循环时 ,用 :meth:`items` 方法可同时取出键和对应的值: "
518517
519518#: ../../tutorial/datastructures.rst:579
520519msgid ""
521520"When looping through a sequence, the position index and corresponding value "
522521"can be retrieved at the same time using the :func:`enumerate` function. ::"
523- msgstr "当在序列中循环时 ,用 :func:`enumerate` 函数可以将索引位置和其对应的值同时取出 :: "
522+ msgstr "在序列中循环时 ,用 :func:`enumerate` 函数可以同时取出位置索引和对应的值: "
524523
525524#: ../../tutorial/datastructures.rst:589
526525msgid ""
527526"To loop over two or more sequences at the same time, the entries can be "
528527"paired with the :func:`zip` function. ::"
529- msgstr "当同时在两个或更多序列中循环时,可以用 :func:`zip` 函数将其内元素一一匹配。 :: "
528+ msgstr "同时循环两个或多个序列时,用 :func:`zip` 函数可以将其内的元素一一匹配: "
530529
531530#: ../../tutorial/datastructures.rst:601
532531msgid ""
533532"To loop over a sequence in reverse, first specify the sequence in a forward "
534533"direction and then call the :func:`reversed` function. ::"
535- msgstr "当逆向循环一个序列时 ,先正向定位序列,然后调用 :func:`reversed` 函数 :: "
534+ msgstr "逆向循环序列时 ,先正向定位序列,然后调用 :func:`reversed` 函数: "
536535
537536#: ../../tutorial/datastructures.rst:613
538537msgid ""
539538"To loop over a sequence in sorted order, use the :func:`sorted` function "
540539"which returns a new sorted list while leaving the source unaltered. ::"
541- msgstr "如果要按某个指定顺序循环一个序列 ,可以用 :func:`sorted` 函数,它可以在不改动原序列的基础上返回一个新的排好序的序列 :: "
540+ msgstr "按指定顺序循环序列 ,可以用 :func:`sorted` 函数,在不改动原序列的基础上,返回一个重新的序列: "
542541
543542#: ../../tutorial/datastructures.rst:627
544543msgid ""
@@ -547,14 +546,14 @@ msgid ""
547546"idiomatic way to loop over unique elements of the sequence in sorted order. "
548547"::"
549548msgstr ""
550- "对一个序列使用 :func:`set` 将去除重复的元素。 对一个序列使用 :func:`sorted` 加 :func:`set` "
551- "则是按排序后顺序循环遍历序列中唯一元素的一种惯用方式。 :: "
549+ "使用 :func:`set` 去除序列中的重复元素。使用 :func:`sorted` 加 :func:`set` "
550+ "则按排序后的顺序,循环遍历序列中的唯一元素: "
552551
553552#: ../../tutorial/datastructures.rst:640
554553msgid ""
555554"It is sometimes tempting to change a list while you are looping over it; "
556555"however, it is often simpler and safer to create a new list instead. ::"
557- msgstr "有时可能会想在循环时修改列表内容,一般来说改为创建一个新列表是比较简单且安全的 :: "
556+ msgstr "一般来说,在循环中修改列表的内容时,创建新列表比较简单,且安全: "
558557
559558#: ../../tutorial/datastructures.rst:657
560559msgid "More on Conditions"
@@ -564,7 +563,7 @@ msgstr "深入条件控制"
564563msgid ""
565564"The conditions used in ``while`` and ``if`` statements can contain any "
566565"operators, not just comparisons."
567- msgstr "``while`` 和 ``if`` 条件句中可以使用任意操作,而不仅仅是比较操作 。"
566+ msgstr "``while`` 和 ``if`` 条件句不只可以进行比较,还可以使用任意运算符 。"
568567
569568#: ../../tutorial/datastructures.rst:662
570569msgid ""
@@ -574,14 +573,15 @@ msgid ""
574573"mutable objects like lists. All comparison operators have the same "
575574"priority, which is lower than that of all numerical operators."
576575msgstr ""
577- "比较操作符 ``in`` 和 ``not in`` 校验一个值是否在(或不在)一个序列里 。操作符 ``is`` 和 ``is not`` "
578- "比较两个对象是不是同一个对象,这只对像列表这样的可变对象比较重要。所有的比较操作符都有相同的优先级,且这个优先级比数值运算符低 。"
576+ "比较操作符 ``in`` 和 ``not in`` 校验序列是否存在某个值 。操作符 ``is`` 和 ``is not`` "
577+ "比较两个对象是不是同一个对象,这只对列表等可变对象有用。比较操作符的优先级都是一样的,不过,它们的优先级低于数值运算符 。"
579578
580579#: ../../tutorial/datastructures.rst:668
581580msgid ""
582581"Comparisons can be chained. For example, ``a < b == c`` tests whether ``a``"
583582" is less than ``b`` and moreover ``b`` equals ``c``."
584- msgstr "比较操作可以传递。例如 ``a < b == c`` 会校验是否 ``a`` 小于 ``b`` 并且 ``b`` 等于 ``c``。"
583+ msgstr ""
584+ "比较操作可以实现链式操作。例如,``a < b == c`` 校验 ``a`` 是否小于 ``b``,并且 ``b`` 是否等于 ``c``。"
585585
586586#: ../../tutorial/datastructures.rst:671
587587msgid ""
@@ -592,9 +592,9 @@ msgid ""
592592"lowest, so that ``A and not B or C`` is equivalent to ``(A and (not B)) or "
593593"C``. As always, parentheses can be used to express the desired composition."
594594msgstr ""
595- "比较操作可以通过布尔运算符 ``and`` 和 ``or`` 来组合,并且比较操作(或其他任何布尔运算 )的结果都可以用 ``not`` "
596- "来取反 。这些操作符的优先级低于比较操作符;在它们之中 ,``not`` 优先级最高, ``or`` 优先级最低,因此 ``A and not B or "
597- "C`` 等价于 ``(A and (not B)) or C``。和之前一样,你也可以在这种式子里使用圆括号 。"
595+ "比较操作可以用布尔运算符 ``and`` 和 ``or`` 组合,并且,比较操作(或其他布尔运算 )的结果都可以用 ``not`` "
596+ "取反 。这些操作符的优先级低于比较操作符;其中 ,``not`` 优先级最高, ``or`` 优先级最低,因此, ``A and not B or C`` "
597+ "等价于 ``(A and (not B)) or C``。和之前一样,也可以在这种表达式里使用圆括号 。"
598598
599599#: ../../tutorial/datastructures.rst:678
600600msgid ""
@@ -605,15 +605,15 @@ msgid ""
605605"expression ``C``. When used as a general value and not as a Boolean, the "
606606"return value of a short-circuit operator is the last evaluated argument."
607607msgstr ""
608- "布尔运算符 ``and`` 和 ``or`` 也被称为 *短路* 运算符:它们的参数从左至右解析,一旦可以确定结果解析就会停止 。例如,如果 ``A`` "
609- "和 ``C`` 为真而 ``B`` 为假,那么 ``A and B and C`` 不会解析 "
610- "``C``。当用作普通值而非布尔值时,短路操作符的返回值通常是最后一个变量 。"
608+ "布尔运算符 ``and`` 和 ``or`` 也称为 *短路* 运算符:其参数从左至右解析,一旦可以确定结果,解析就会停止 。例如,如果 ``A`` 和 "
609+ "``C`` 为真, ``B`` 为假,那么 ``A and B and C`` 不会解析 "
610+ "``C``。用作普通值而不是布尔值时,短路操作符返回的值通常是最后一个变量 。"
611611
612612#: ../../tutorial/datastructures.rst:685
613613msgid ""
614614"It is possible to assign the result of a comparison or other Boolean "
615615"expression to a variable. For example, ::"
616- msgstr "也可以把比较操作或逻辑表达式的结果赋值给一个变量 ,例如:"
616+ msgstr "还可以把比较操作或逻辑表达式的结果赋值给一个变量 ,例如:"
617617
618618#: ../../tutorial/datastructures.rst:693
619619msgid ""
@@ -622,13 +622,12 @@ msgid ""
622622"an-expression>` ``:=``. This avoids a common class of problems encountered "
623623"in C programs: typing ``=`` in an expression when ``==`` was intended."
624624msgstr ""
625- "请注意 Python 与 C 不同,在表达式内部赋值必须显式地使用 :ref:`海象运算符 <why-can-t-i-use-an-"
626- "assignment-in-an-expression>` ``:=`` 来完成。 这避免了 C 程序中常见的一种问题:想要在表达式中写 ``==`` "
627- "时却写成了 ``=``。"
625+ "注意,Python 与 C 不同,在表达式内部赋值必须显式使用 :ref:`海象运算符 <why-can-t-i-use-an-assignment-"
626+ "in-an-expression>` ``:=``。 这避免了 C 程序中常见的问题:要在表达式中写 ``==`` 时,却写成了 ``=``。"
628627
629628#: ../../tutorial/datastructures.rst:703
630629msgid "Comparing Sequences and Other Types"
631- msgstr "序列和其它类型的比较 "
630+ msgstr "序列和其他类型的比较 "
632631
633632#: ../../tutorial/datastructures.rst:704
634633msgid ""
@@ -645,11 +644,11 @@ msgid ""
645644"order individual characters. Some examples of comparisons between sequences "
646645"of the same type::"
647646msgstr ""
648- "序列对象通常可以与相同序列类型的其他对象比较 。 这种比较使用 *字典式* "
649- "顺序:首先比较开头的两个对应元素,如果两者不相等则比较结果就由此确定;如果两者相等则比较之后的两个元素 ,以此类推,直到有一个序列被耗尽。 "
650- "如果要比较的两个元素本身又是相同类型的序列 ,则会递归地执行字典式顺序比较。 如果两个序列中所有的对应元素都相等,则两个序列也将被视为相等 。 "
651- "如果一个序列是另一个的初始子序列,则较短的序列就被视为较小(较少)。 对于字符串来说,字典式顺序是使用 Unicode 码位序号对单个字符排序。 "
652- "下面是一些相同类型序列之间比较的例子:: "
647+ "序列对象通常与相同序列类型的其他对象比较 。 这种比较使用 *字典式* "
648+ "顺序:首先,比较开头的两个对应元素,如果两者不相等,则比较结果就由此确定;如果两者相等,则比较之后的两个元素 ,以此类推,直到有一个序列被耗尽。 "
649+ "如果要比较的两个元素是相同类型的序列 ,则会递归地执行字典式顺序比较。 如果两个序列中所有的对应元素都相等,则两个序列相等 。 "
650+ "如果一个序列是另一个的初始子序列,则较短的序列就被视为较小(较少)。 对于字符串来说,字典式顺序是使用 Unicode "
651+ "码位序号对单个字符排序。下面列出了一些相同类型序列进行比较的例子: "
653652
654653#: ../../tutorial/datastructures.rst:724
655654msgid ""
@@ -659,9 +658,9 @@ msgid ""
659658"equals 0.0, etc. Otherwise, rather than providing an arbitrary ordering, "
660659"the interpreter will raise a :exc:`TypeError` exception."
661660msgstr ""
662- "注意对不同类型对象来说,只要待比较对象提供了合适的比较方法 ,就可以使用 ``<`` 和 ``>`` "
663- "来比较 。例如,混合数值类型是通过他们的数值进行比较的 ,所以 0 等于 0.0,等等。否则,解释器将抛出一个 :exc:`TypeError` "
664- "异常,而不是随便给出一个结果 。"
661+ "注意,对不同类型的对象来说,只要待比较的对象提供了合适的比较方法 ,就可以使用 ``<`` 和 ``>`` "
662+ "进行比较 。例如,混合数值类型通过数值进行比较 ,所以, 0 等于 0.0,等等。否则,解释器将抛出 :exc:`TypeError` "
663+ "异常,不会随便给出一个结果 。"
665664
666665#: ../../tutorial/datastructures.rst:732
667666msgid "Footnotes"
@@ -671,4 +670,4 @@ msgstr "脚注"
671670msgid ""
672671"Other languages may return the mutated object, which allows method chaining,"
673672" such as ``d->insert(\" a\" )->remove(\" b\" )->sort();``."
674- msgstr "别的语言可能会返回一个可变对象,他们允许方法连续执行 ,例如 ``d->insert(\" a\" )->remove(\" b\" )->sort();``。"
673+ msgstr "别的语言可能会返回可变对象,允许方法连续执行 ,例如, ``d->insert(\" a\" )->remove(\" b\" )->sort();``。"
0 commit comments