99# Zephyr Waitzman <[email protected] >, 201810101111# zkonge, 2019
12- # chen_chao <[email protected] >, 20191312# MuSheng Chen <[email protected] >, 20191413# Freesand Leo <[email protected] >, 201914+ # chen_chao <[email protected] >, 20191515#
1616#, fuzzy
1717msgid ""
@@ -20,7 +20,7 @@ msgstr ""
2020"Report-Msgid-Bugs-To : \n "
2121"POT-Creation-Date : 2019-01-01 10:14+0900\n "
2222"PO-Revision-Date : 2017-02-16 17:44+0000\n "
23- "Last-Translator : Freesand Leo <yuqinju@163 .com>, 2019\n "
23+ "Last-Translator : chen_chao <wenbushi@gmail .com>, 2019\n "
2424"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2525"MIME-Version : 1.0\n "
2626"Content-Type : text/plain; charset=UTF-8\n "
@@ -1333,53 +1333,55 @@ msgid ""
13331333"useful in functional-style code because they save you from writing trivial "
13341334"functions that perform a single operation."
13351335msgstr ""
1336+ "前面已经提到了 :mod:`operator` 模块。它包含一系列对应于 Python "
1337+ "操作符的函数。在函数式风格的代码中,这些函数通常很有用,可以帮你省下不少时间,避免写一些琐碎的仅仅执行一个简单操作的函数。"
13361338
13371339#: ../../howto/functional.rst:1087
13381340msgid "Some of the functions in this module are:"
1339- msgstr ""
1341+ msgstr "这个模块里的一些函数: "
13401342
13411343#: ../../howto/functional.rst:1089
13421344msgid ""
13431345"Math operations: ``add()``, ``sub()``, ``mul()``, ``floordiv()``, ``abs()``,"
13441346" ..."
1345- msgstr ""
1347+ msgstr "数学运算: ``add()``,``sub()``,``mul()``,``floordiv()``,``abs()``, ... "
13461348
13471349#: ../../howto/functional.rst:1090
13481350msgid "Logical operations: ``not_()``, ``truth()``."
1349- msgstr ""
1351+ msgstr "逻辑运算: ``not_()``,``truth()``。 "
13501352
13511353#: ../../howto/functional.rst:1091
13521354msgid "Bitwise operations: ``and_()``, ``or_()``, ``invert()``."
1353- msgstr ""
1355+ msgstr "位运算: ``and_()``,``or_()``,``invert()``。 "
13541356
13551357#: ../../howto/functional.rst:1092
13561358msgid ""
13571359"Comparisons: ``eq()``, ``ne()``, ``lt()``, ``le()``, ``gt()``, and ``ge()``."
1358- msgstr ""
1360+ msgstr "比较: ``eq()``,``ne()``,``lt()``,``le()``,``gt()``,和 ``ge()``。 "
13591361
13601362#: ../../howto/functional.rst:1093
13611363msgid "Object identity: ``is_()``, ``is_not()``."
1362- msgstr ""
1364+ msgstr "确认对象: ``is_()``,``is_not()``。 "
13631365
13641366#: ../../howto/functional.rst:1095
13651367msgid "Consult the operator module's documentation for a complete list."
1366- msgstr ""
1368+ msgstr "全部函数列表可以参考 operator 模块的文档。 "
13671369
13681370#: ../../howto/functional.rst:1099
13691371msgid "Small functions and the lambda expression"
1370- msgstr ""
1372+ msgstr "小函数和 lambda 表达式 "
13711373
13721374#: ../../howto/functional.rst:1101
13731375msgid ""
13741376"When writing functional-style programs, you'll often need little functions "
13751377"that act as predicates or that combine elements in some way."
1376- msgstr ""
1378+ msgstr "编写函数式风格程序时,你会经常需要很小的函数,作为谓词函数或者以某种方式来组合元素。 "
13771379
13781380#: ../../howto/functional.rst:1104
13791381msgid ""
13801382"If there's a Python built-in or a module function that's suitable, you don't"
13811383" need to define a new function at all::"
1382- msgstr ""
1384+ msgstr "如果合适的 Python 内置的或者其他模块中的函数,你就一点也不需要定义新的函数:: "
13831385
13841386#: ../../howto/functional.rst:1110
13851387msgid ""
@@ -1389,18 +1391,20 @@ msgid ""
13891391"parameters, and creates an anonymous function that returns the value of the "
13901392"expression::"
13911393msgstr ""
1394+ "如果不存在你需要的函数,你就必须自己编写。一个编写小函数的方式是使用 :keyword:`lambda` 表达式。``lambda`` "
1395+ "接受一组参数以及组合这些参数的表达式,它会创建一个返回表达式值的匿名函数::"
13921396
13931397#: ../../howto/functional.rst:1119
13941398msgid ""
13951399"An alternative is to just use the ``def`` statement and define a function in"
13961400" the usual way::"
1397- msgstr ""
1401+ msgstr "另一种替代方案就是通常的使用 ``def`` 语句来定义函数:: "
13981402
13991403#: ../../howto/functional.rst:1128
14001404msgid ""
14011405"Which alternative is preferable? That's a style question; my usual course "
14021406"is to avoid using ``lambda``."
1403- msgstr ""
1407+ msgstr "哪一种更受青睐呢?这是一个风格问题;我通常的做法是避免使用 ``lambda``。 "
14041408
14051409#: ../../howto/functional.rst:1131
14061410msgid ""
@@ -1411,65 +1415,68 @@ msgid ""
14111415" ``lambda`` statement, you'll end up with an overly complicated expression "
14121416"that's hard to read. Quick, what's the following code doing? ::"
14131417msgstr ""
1418+ "我这么偏好的一个原因是,``lambda`` 能够定义的函数非常受限。函数的结果必须能够作为单独的表达式来计算,这意味着你不能使用多路 ``if... "
1419+ "elif... else`` 比较,或者 ``try... except`` 语句。如果你尝试在 ``lambda`` "
1420+ "语句中做太多事情,你最终会把表达式过于复杂以至于难以阅读。你能快速的说出下面的代码做了什么事情吗?::"
14141421
14151422#: ../../howto/functional.rst:1141
14161423msgid ""
14171424"You can figure it out, but it takes time to disentangle the expression to "
14181425"figure out what's going on. Using a short nested ``def`` statements makes "
14191426"things a little bit better::"
1420- msgstr ""
1427+ msgstr "你可以弄明白,不过要花上时间来理清表达式来搞清楚发生了什么。使用一个简短的嵌套的 ``def`` 语句可以让情况变得更好:: "
14211428
14221429#: ../../howto/functional.rst:1151
14231430msgid "But it would be best of all if I had simply used a ``for`` loop::"
1424- msgstr ""
1431+ msgstr "如果我仅仅使用一个 ``for`` 循环会更好:: "
14251432
14261433#: ../../howto/functional.rst:1157
14271434msgid "Or the :func:`sum` built-in and a generator expression::"
1428- msgstr ""
1435+ msgstr "或者使用内置的 :func:`sum` 和一个生成器表达式:: "
14291436
14301437#: ../../howto/functional.rst:1161
14311438msgid ""
14321439"Many uses of :func:`functools.reduce` are clearer when written as ``for`` "
14331440"loops."
1434- msgstr ""
1441+ msgstr "许多使用 :func:`functools.reduce` 的情形可以更清晰地写成 ``for`` 循环的形式。 "
14351442
14361443#: ../../howto/functional.rst:1163
14371444msgid ""
14381445"Fredrik Lundh once suggested the following set of rules for refactoring uses"
14391446" of ``lambda``:"
1440- msgstr ""
1447+ msgstr "Fredrik Lundh 曾经建议以下一组规则来重构 ``lambda`` 的使用: "
14411448
14421449#: ../../howto/functional.rst:1166
14431450msgid "Write a lambda function."
1444- msgstr ""
1451+ msgstr "写一个 lambda 函数。 "
14451452
14461453#: ../../howto/functional.rst:1167
14471454msgid "Write a comment explaining what the heck that lambda does."
1448- msgstr ""
1455+ msgstr "写一句注释来说明这个 lambda 究竟干了什么。 "
14491456
14501457#: ../../howto/functional.rst:1168
14511458msgid ""
14521459"Study the comment for a while, and think of a name that captures the essence"
14531460" of the comment."
1454- msgstr ""
1461+ msgstr "研究一会这个注释,然后想出一个抓住注释本质的名字。 "
14551462
14561463#: ../../howto/functional.rst:1170
14571464msgid "Convert the lambda to a def statement, using that name."
1458- msgstr ""
1465+ msgstr "用这个名字,把这个 lambda 改写成 def 语句。 "
14591466
14601467#: ../../howto/functional.rst:1171
14611468msgid "Remove the comment."
1462- msgstr ""
1469+ msgstr "把注释去掉。 "
14631470
14641471#: ../../howto/functional.rst:1173
14651472msgid ""
14661473"I really like these rules, but you're free to disagree about whether this "
14671474"lambda-free style is better."
1468- msgstr ""
1475+ msgstr "我非常喜欢这些规则,不过你完全有权利争辩这种消除 lambda 的风格是不是更好。 "
14691476
14701477#: ../../howto/functional.rst:1178
14711478msgid "Revision History and Acknowledgements"
1472- msgstr ""
1479+ msgstr "修订记录和致谢 "
14731480
14741481#: ../../howto/functional.rst:1180
14751482msgid ""
@@ -1478,6 +1485,9 @@ msgid ""
14781485" Ian Bicking, Nick Coghlan, Nick Efford, Raymond Hettinger, Jim Jewett, Mike"
14791486" Krell, Leandro Lameiro, Jussi Salmela, Collin Winter, Blake Winton."
14801487msgstr ""
1488+ "作者要感谢以下人员对本文各种草稿给予的建议,更正和协助:Ian Bicking,Nick Coghlan, Nick Efford, Raymond "
1489+ "Hettinger, Jim Jewett, Mike Krell,Leandro Lameiro, Jussi Salmela, Collin "
1490+ "Winter, Blake Winton。"
14811491
14821492#: ../../howto/functional.rst:1185
14831493msgid "Version 0.1: posted June 30 2006."
0 commit comments