99# Zephyr Waitzman <[email protected] >, 201810101111# Freesand Leo <[email protected] >, 201912- # chen_chao <[email protected] >, 20191312# zkonge, 2019
13+ # chen_chao <[email protected] >, 20191414#
1515#, fuzzy
1616msgid ""
@@ -19,7 +19,7 @@ msgstr ""
1919"Report-Msgid-Bugs-To : \n "
2020"POT-Creation-Date : 2019-01-01 10:14+0900\n "
2121"PO-Revision-Date : 2017-02-16 17:44+0000\n "
22- "Last-Translator : zkonge , 2019\n "
22+ "
Last-Translator :
chen_chao <[email protected] > , 2019\n"
2323"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2424"MIME-Version : 1.0\n "
2525"Content-Type : text/plain; charset=UTF-8\n "
@@ -1064,7 +1064,7 @@ msgstr ""
10641064
10651065#: ../../howto/functional.rst:819
10661066msgid "Calling functions on elements"
1067- msgstr "在元素上调用函数 "
1067+ msgstr "对元素使用函数 "
10681068
10691069#: ../../howto/functional.rst:821
10701070msgid ""
@@ -1194,7 +1194,7 @@ msgstr ""
11941194
11951195#: ../../howto/functional.rst:947
11961196msgid "Grouping elements"
1197- msgstr "对元素分组 "
1197+ msgstr "为元素分组 "
11981198
11991199#: ../../howto/functional.rst:949
12001200msgid ""
@@ -1204,6 +1204,8 @@ msgid ""
12041204"element returned by the iterable. If you don't supply a key function, the "
12051205"key is simply each element itself."
12061206msgstr ""
1207+ "我要讨论的最后一个函数,:func:`itertools.groupby(iter,key_func=None) "
1208+ "<itertools.groupby>`,是最复杂的函数。``key_func(elem)``是一个可以对迭代器返回的每个元素计算键值的函数。如果你不提供这个键值函数,它就会简化成每个元素自身。"
12071209
12081210#: ../../howto/functional.rst:954
12091211msgid ""
@@ -1212,6 +1214,8 @@ msgid ""
12121214"2-tuples containing a key value and an iterator for the elements with that "
12131215"key."
12141216msgstr ""
1217+ ":func:`~itertools.groupby` 从所依据的可迭代对象中连续地收集具有相同值的元素,然后返回一个长度为2的元组的数据流, "
1218+ "每个元组包含键值以及对应这个键值的元素所组成的迭代器。"
12151219
12161220#: ../../howto/functional.rst:982
12171221msgid ""
@@ -1220,10 +1224,13 @@ msgid ""
12201224"also use the underlying iterable, so you have to consume the results of "
12211225"iterator-1 before requesting iterator-2 and its corresponding key."
12221226msgstr ""
1227+ ":func:`~itertools.groupby` "
1228+ "假定了所依据的可迭代对象的内容已经根据键值排序。注意,返回的迭代器也会使用所依据的可迭代对象,所以在请求迭代器 2和相应的键之前你必须先消耗迭代器 1 "
1229+ "的结果。"
12231230
12241231#: ../../howto/functional.rst:989
12251232msgid "The functools module"
1226- msgstr ""
1233+ msgstr "functools 模块 "
12271234
12281235#: ../../howto/functional.rst:991
12291236msgid ""
@@ -1232,6 +1239,9 @@ msgid ""
12321239"and returns a new function. The most useful tool in this module is the "
12331240":func:`functools.partial` function."
12341241msgstr ""
1242+ "Python 2.5 中的 :mod:`functools` 模块 "
1243+ "包含了一些高阶函数。**高阶函数**接受一个或多个函数作为输入,返回新的函数。这个模块中最有用的工具是:func:`functools.partial`"
1244+ " 函数。"
12351245
12361246#: ../../howto/functional.rst:996
12371247msgid ""
@@ -1242,6 +1252,9 @@ msgid ""
12421252"filling in a value for one of ``f()``'s parameters. This is called "
12431253"\" partial function application\" ."
12441254msgstr ""
1255+ "对于用函数式风格编写的程序,有时你会希望通过给定部分参数,将已有的函数构变形称新的函数。考虑一个 Python 函数 ``f(a, b, "
1256+ "c)``;你希望创建一个和 ``f(1, b, c)`` 等价的新函数 ``g(b, c)``;也就是说你给定了 ``f()`` "
1257+ "的一个参数的值。这就是所谓的“部分函数应用”。"
12451258
12461259#: ../../howto/functional.rst:1002
12471260msgid ""
@@ -1250,10 +1263,12 @@ msgid ""
12501263"resulting object is callable, so you can just call it to invoke ``function``"
12511264" with the filled-in arguments."
12521265msgstr ""
1266+ ":func:`~functools.partial` 接受参数 ``(function, arg1, arg2, ..., kwarg1=value1,"
1267+ " kwarg2=value2)``。它会返回一个可调用的对象,所以你能够直接调用这个结果以使用给定参数的 ``function``。"
12531268
12541269#: ../../howto/functional.rst:1007
12551270msgid "Here's a small but realistic example::"
1256- msgstr ""
1271+ msgstr "这里有一个很小但很现实的例子:: "
12571272
12581273#: ../../howto/functional.rst:1019
12591274msgid ""
@@ -1269,19 +1284,29 @@ msgid ""
12691284"raised. If the initial value is supplied, it's used as a starting point and"
12701285" ``func(initial_value, A)`` is the first calculation. ::"
12711286msgstr ""
1287+ ":func:`functools.reduce(func, iter, [initial_value]) "
1288+ "<functools.reduce>`持续地在可迭代对象的所有元素上执行操作,因此它不能够用在无限的可迭代对象上。*func* "
1289+ "必须是一个接受两个元素并返回一个值的函数。:func:`functools.reduce` 接受迭代器返回的前两个元素 A 和 B 并计算 "
1290+ "``func(A, B)``。然后它会请求第三个元素,C,计算 ``func(func(A, B), "
1291+ "C)``,然后把这个结果再和第四个元素组合并返回,如此继续下去直到消耗整个可迭代对象。如果输入的可迭代对象完全不返回任何值,:exc:`TypeError`"
1292+ " 异常就会抛出。如果提供了初值(initial value),它会被用作起始值,也就是先计算 ``func(initial_value, A)。::"
12721293
12731294#: ../../howto/functional.rst:1043
12741295msgid ""
12751296"If you use :func:`operator.add` with :func:`functools.reduce`, you'll add up"
12761297" all the elements of the iterable. This case is so common that there's a "
12771298"special built-in called :func:`sum` to compute it:"
12781299msgstr ""
1300+ "如果你在 :func:`functools.reduce` 中使用 "
1301+ ":func:`operator.add`,你就会把可迭代对象中的所有元素加起来.这种情况非常常见, 所以 Python 有一个特殊的内置函数 "
1302+ ":func:`sum`:"
12791303
12801304#: ../../howto/functional.rst:1055
12811305msgid ""
12821306"For many uses of :func:`functools.reduce`, though, it can be clearer to just"
12831307" write the obvious :keyword:`for` loop::"
12841308msgstr ""
1309+ "不过, 对于很多使用 :func:`functools.reduce` 的情形, 使用明显的 :keyword:`for` 循环会更清晰::"
12851310
12861311#: ../../howto/functional.rst:1067
12871312msgid ""
@@ -1291,10 +1316,13 @@ msgid ""
12911316":func:`accumulate` returns an iterator that also yields each partial "
12921317"result::"
12931318msgstr ""
1319+ "一个相关的函数是 :func:`itertools.accumulate(iterable, func=operator.add) "
1320+ "<itertools.accumulate>` 。它执行同样的计算, 不过相对于只返回最终结果,:func:`accumulate` "
1321+ "会返回一个迭代器来输出所有中间结果::"
12941322
12951323#: ../../howto/functional.rst:1080
12961324msgid "The operator module"
1297- msgstr ""
1325+ msgstr "operator 模块 "
12981326
12991327#: ../../howto/functional.rst:1082
13001328msgid ""
0 commit comments