@@ -116,7 +116,7 @@ msgstr ":func:`range` 和 :func:`len` 组合在一起,可以按索引迭代序
116116msgid ""
117117"In most such cases, however, it is convenient to use the :func:`enumerate` "
118118"function, see :ref:`tut-loopidioms`."
119- msgstr "不过,大多数情况下,使用 :func:`enumerate` 函数更便捷,请参阅 :ref:`tut-loopidioms` 。"
119+ msgstr "不过,大多数情况下,:func:`enumerate` 函数更便捷,详见 :ref:`tut-loopidioms` 。"
120120
121121#: ../../tutorial/controlflow.rst:132
122122msgid "A strange thing happens if you just print a range::"
@@ -140,15 +140,15 @@ msgid ""
140140":keyword:`for` statement is such a construct, while an example of a function"
141141" that takes an iterable is :func:`sum`::"
142142msgstr ""
143- "这样的对象称为可迭代对象 :term:`iterable`,函数或程序结构可从该对象中获取连续项 ,直到所有元素全部迭代完毕。:keyword:`for`"
144- " 语句就是这样的架构,:func:`sum` 是一种把可迭代对象作为参数的函数:"
143+ "这种对象称为可迭代对象 :term:`iterable`,函数或程序结构可通过该对象获取连续项 ,直到所有元素全部迭代完毕。:keyword:`for` "
144+ "语句就是这样的架构,:func:`sum` 是一种把可迭代对象作为参数的函数:"
145145
146146#: ../../tutorial/controlflow.rst:151
147147msgid ""
148148"Later we will see more functions that return iterables and take iterables as"
149149" arguments. Lastly, maybe you are curious about how to get a list from a "
150150"range. Here is the solution::"
151- msgstr "后文将介绍更多返回可迭代对象 ,或把可迭代对象当作参数的函数。 最后,介绍一种用 range 生成列表解决方案:"
151+ msgstr "下文介绍更多返回可迭代对象 ,或把可迭代对象当作参数的函数。 最后,介绍一种用 range 生成列表解决方案:"
152152
153153#: ../../tutorial/controlflow.rst:158
154154msgid ""
@@ -160,7 +160,7 @@ msgstr ":func:`list` 详见 :ref:`tut-structures`。"
160160msgid ""
161161":keyword:`!break` and :keyword:`!continue` Statements, and :keyword:`!else` "
162162"Clauses on Loops"
163- msgstr ":keyword:`!break` 和 :keyword:`!continue` 语句,循环中的 :keyword:`!else` 子句"
163+ msgstr "循环中的 :keyword:`!break`、 :keyword:`!continue` 语句及 :keyword:`!else` 子句"
164164
165165#: ../../tutorial/controlflow.rst:166
166166msgid ""
@@ -177,8 +177,8 @@ msgid ""
177177"loop is terminated by a :keyword:`break` statement. This is exemplified by "
178178"the following loop, which searches for prime numbers::"
179179msgstr ""
180- "循环语句支持 :keyword:`!else` 子句;:keyword:`for` 循环中,可迭代对象的元素全部循环完毕时 ,或 "
181- ":keyword:`while` 循环的条件为假时,执行该子句, :keyword:`break` 语句终止循环时,不执行该子句。 "
180+ "循环语句支持 :keyword:`!else` 子句;:keyword:`for` 循环中,可迭代对象中的元素全部循环完毕时 ,或 "
181+ ":keyword:`while` 循环的条件为假时,执行该子句; :keyword:`break` 语句终止循环时,不执行该子句。 "
182182"请看下面这个查找素数的循环示例:"
183183
184184#: ../../tutorial/controlflow.rst:193
@@ -197,8 +197,8 @@ msgid ""
197197"``break`` occurs. For more on the :keyword:`!try` statement and exceptions, "
198198"see :ref:`tut-handling`."
199199msgstr ""
200- "与 :keyword:`if` 语句相比,循环的 ``else`` 子句更像 :keyword:`try` 语句的 ``else`` 子句: "
201- ":keyword:`try` 语句的 ``else`` 子句在未触发异常时执行,循环的 ``else`` 子句则在未运行 ``break`` "
200+ "与 :keyword:`if` 语句相比,循环的 ``else`` 子句更像 :keyword:`try` 的 ``else`` 子句: "
201+ ":keyword:`try` 的 ``else`` 子句在未触发异常时执行,循环的 ``else`` 子句则在未运行 ``break`` "
202202"时执行。:keyword:`!try` 语句和异常详见 :ref:`tut-handling`。"
203203
204204#: ../../tutorial/controlflow.rst:203
@@ -219,7 +219,7 @@ msgstr ":keyword:`pass` 语句不执行任何操作。语法上需要一个语
219219
220220#: ../../tutorial/controlflow.rst:232
221221msgid "This is commonly used for creating minimal classes::"
222- msgstr "这段代码创建了一个最小的类 :"
222+ msgstr "下面这段代码创建了一个最小的类 :"
223223
224224#: ../../tutorial/controlflow.rst:238
225225msgid ""
@@ -228,7 +228,7 @@ msgid ""
228228"to keep thinking at a more abstract level. The :keyword:`!pass` is silently"
229229" ignored::"
230230msgstr ""
231- ":keyword:`pass` 还可以用作函数或条件子句内的占位符 ,让开发者聚焦更抽象的层次。此时,:keyword:`!pass` 直接就被忽略了 :"
231+ ":keyword:`pass` 还可以用作函数或条件子句的占位符 ,让开发者聚焦更抽象的层次。此时,程序直接忽略 :keyword:`!pass`:"
232232
233233#: ../../tutorial/controlflow.rst:249
234234msgid "Defining Functions"
@@ -277,7 +277,7 @@ msgid ""
277277msgstr ""
278278"函数在 *执行* "
279279"时使用函数局部变量符号表,所有函数变量赋值都存在局部符号表中;引用变量时,首先,在局部符号表里查找变量,然后,是外层函数局部符号表,再是全局符号表,最后是内置名称符号表。因此,尽管可以引用全局变量和外层函数的变量,但最好不要在函数内直接赋值(除非是"
280- " :keyword:`global` 语句定义的全局变量,或 :keyword:`nonlocal` 语句定义的外层函数的变量 )。"
280+ " :keyword:`global` 语句定义的全局变量,或 :keyword:`nonlocal` 语句定义的外层函数变量 )。"
281281
282282#: ../../tutorial/controlflow.rst:294
283283msgid ""
@@ -287,7 +287,7 @@ msgid ""
287287"*reference*, not the value of the object). [#]_ When a function calls "
288288"another function, a new local symbol table is created for that call."
289289msgstr ""
290- "调用函数时,函数把实际参数(实参)引入到被调函数的局部符号表中;因此,实参是通过 *按值调用* 传递的(其中 *值* 始终是对象 "
290+ "调用函数时,函数把实际参数(实参)引入到被调函数的局部符号表中;因此,实参是通过 *按值调用* 传递的(*值* 始终是对象 "
291291"*引用*,而不是对象的值)。[#]_ 函数调用另一个函数时,会为该调用创建新的局部符号表。"
292292
293293#: ../../tutorial/controlflow.rst:300
@@ -310,8 +310,8 @@ msgid ""
310310":func:`print`::"
311311msgstr ""
312312"``fib`` 不返回值,因此,其他语言不把它当作函数,而是当作过程。事实上,没有 :keyword:`return` "
313- "语句的函数也返回值,只不过这个值比较无趣,返回的是 ``None`` (是一个内置名称)。一般来说,解释器不会输出单独的返回值 ``None`` "
314- ",如需查看这个值 ,可以使用 :func:`print`:"
313+ "语句的函数也返回值,只不过这个值比较是 ``None`` (是一个内置名称)。一般来说,解释器不会输出单独的返回值 ``None`` "
314+ ",如需查看该值 ,可以使用 :func:`print`:"
315315
316316#: ../../tutorial/controlflow.rst:322
317317msgid ""
@@ -381,20 +381,20 @@ msgstr "该函数可以用以下方式调用:"
381381msgid ""
382382"giving only the mandatory argument: ``ask_ok('Do you really want to "
383383"quit?')``"
384- msgstr "只给出必选参数 :``ask_ok('Do you really want to quit?')``"
384+ msgstr "只给出必选实参 :``ask_ok('Do you really want to quit?')``"
385385
386386#: ../../tutorial/controlflow.rst:390
387387msgid ""
388388"giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', "
389389"2)``"
390- msgstr "给出一个可选参数 :``ask_ok('OK to overwrite the file?', 2)``"
390+ msgstr "给出一个可选实参 :``ask_ok('OK to overwrite the file?', 2)``"
391391
392392#: ../../tutorial/controlflow.rst:392
393393msgid ""
394394"or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come"
395395" on, only yes or no!')``"
396396msgstr ""
397- "给出所有参数 :``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or "
397+ "给出所有实参 :``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or "
398398"no!')``"
399399
400400#: ../../tutorial/controlflow.rst:395
@@ -451,11 +451,11 @@ msgid ""
451451"of the following ways::"
452452msgstr ""
453453"该函数接受一个必选参数(``voltage``)和三个可选参数(``state``, ``action`` 和 "
454- "``type``)。该函数可用下面列出的方式调用 :"
454+ "``type``)。该函数可用下列方式调用 :"
455455
456456#: ../../tutorial/controlflow.rst:465
457457msgid "but all the following calls would be invalid::"
458- msgstr "以下函数调用方式都是无效的 :"
458+ msgstr "以下调用函数的方式都无效 :"
459459
460460#: ../../tutorial/controlflow.rst:472
461461msgid ""
@@ -513,7 +513,7 @@ msgid ""
513513" position or keyword, or by keyword."
514514msgstr ""
515515"默认情况下,参数可以按位置或显式关键字传递给 Python "
516- "函数。为了让代码易读和代码性能 ,最好限制参数的传递方式,这样,开发者只需查看函数定义,即可确定参数项是仅按位置、按位置或关键字,还是仅按关键字传递。"
516+ "函数。为了让代码易读、高效 ,最好限制参数的传递方式,这样,开发者只需查看函数定义,即可确定参数项是仅按位置、按位置或关键字,还是仅按关键字传递。"
517517
518518#: ../../tutorial/controlflow.rst:538
519519msgid "A function definition may look like:"
@@ -579,7 +579,7 @@ msgstr "函数示例"
579579msgid ""
580580"Consider the following example function definitions paying close attention "
581581"to the markers ``/`` and ``*``::"
582- msgstr "请看下面示例的函数定义 ,注意 ``/`` 和 ``*`` 标记:"
582+ msgstr "请看下面的函数定义示例 ,注意 ``/`` 和 ``*`` 标记:"
583583
584584#: ../../tutorial/controlflow.rst:603
585585msgid ""
@@ -635,7 +635,7 @@ msgstr "换句话说,仅限位置形参的名称可以在 ``**kwds`` 中使用
635635
636636#: ../../tutorial/controlflow.rst:681
637637msgid "Recap"
638- msgstr "复盘 "
638+ msgstr "小结 "
639639
640640#: ../../tutorial/controlflow.rst:683
641641msgid ""
@@ -654,8 +654,7 @@ msgid ""
654654"meaning, if you want to enforce the order of the arguments when the function"
655655" is called or if you need to take some positional parameters and arbitrary "
656656"keywords."
657- msgstr ""
658- "使用仅限位置形参,可以让用户无法使用形参名。形参名没有实际意义时,强制调用函数的实参顺序时,或同时接收位置形参和任意关键字时,这种方式很有用。"
657+ msgstr "使用仅限位置形参,可以让用户无法使用形参名。形参名没有实际意义时,强制调用函数的实参顺序时,或同时接收位置形参和关键字时,这种方式很有用。"
659658
660659#: ../../tutorial/controlflow.rst:694
661660msgid ""
@@ -681,8 +680,8 @@ msgid ""
681680"wrapped up in a tuple (see :ref:`tut-tuples`). Before the variable number "
682681"of arguments, zero or more normal arguments may occur. ::"
683682msgstr ""
684- "调用函数时,使用任意数量的实参是最不常用的选项。这些实参包含在一个元组里 (详见 :ref:`tut-tuples` "
685- ")。在可变数量的实参前,可能有零个或多个普通参数 :"
683+ "调用函数时,使用任意数量的实参是最少见的选项。这些实参包含在元组中 (详见 :ref:`tut-tuples` "
684+ ")。在可变数量的实参之前,可能有若干个普通参数 :"
686685
687686#: ../../tutorial/controlflow.rst:717
688687msgid ""
0 commit comments