Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d5d73ea

Browse files
committed
[po] auto sync bot
1 parent 75d45a4 commit d5d73ea

1 file changed

Lines changed: 52 additions & 22 deletions

File tree

howto/functional.po

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# Fei Yin <[email protected]>, 2018
99
# Zephyr Waitzman <[email protected]>, 2018
1010
# Kder <[email protected]>, 2018
11-
# yuxin wang <[email protected]>, 2019
1211
# Freesand Leo <[email protected]>, 2019
1312
# chen_chao <[email protected]>, 2019
1413
#
@@ -84,7 +83,8 @@ msgid ""
8483
"instructions that tell the computer what to do with the program's input. C,"
8584
" Pascal, and even Unix shells are procedural languages."
8685
msgstr ""
87-
"大多数的编程语言都是过程式的,所谓程序就是一连串告诉计算机怎样处理程序输入的指令。C、Pascal 甚至 Unix shells 都是过程式语言。"
86+
"大多数的编程语言都是 **过程式** 的,所谓程序就是一连串告诉计算机怎样处理程序输入的指令。C、Pascal 甚至 Unix shells "
87+
"都是过程式语言。"
8888

8989
#: ../../howto/functional.rst:28
9090
msgid ""
@@ -358,7 +358,7 @@ msgid ""
358358
msgstr ""
359359
"迭代器是一个表示数据流的对象;这个对象每次只返回一个元素。Python 迭代器必须支持 :meth:`~iterator.__next__` "
360360
"方法;这个方法不接受参数,并总是返回数据流中的下一个元素。如果数据流中没有元素,:meth:`~iterator.__next__` 会抛出 "
361-
":exc:`StopIteration` 异常。迭代器未必是有限的;完全有理由构造一个输出无限的数据流的迭代器。"
361+
":exc:`StopIteration` 异常。迭代器未必是有限的;完全有理由构造一个输出无限数据流的迭代器。"
362362

363363
#: ../../howto/functional.rst:192
364364
msgid ""
@@ -371,7 +371,7 @@ msgid ""
371371
msgstr ""
372372
"内置的 :func:`iter` 函数接受任意对象并试图返回一个迭代器来输出对象的内容或元素,并会在对象不支持迭代的时候抛出 "
373373
":exc:`TypeError` 异常。Python 有几种内置数据类型支持迭代,最常见的就是列表和字典。如果一个对象能生成迭代器,那么它就会被称作 "
374-
":term:`可迭代的`。"
374+
":term:`可迭代的`(:term:`iterable`)。"
375375

376376
#: ../../howto/functional.rst:199
377377
msgid "You can experiment with the iteration interface manually:"
@@ -523,11 +523,8 @@ msgid ""
523523
" infinite stream or a very large amount of data. Generator expressions are "
524524
"preferable in these situations."
525525
msgstr ""
526-
"通过列表推导式,你会获得一个 Python 列表;``stripped_list`` 就是一个包\n"
527-
"含所有结果行的列表,并不是迭代器。生成器表达时会返回一个迭代器,它在必\n"
528-
"要的时候计算结果,避免一次性丘处所有的值。这意味着,如果迭代器返回一个\n"
529-
"无限数据流或者大量的数据,列表推导式就不太好用了。这些情况下生成器表达\n"
530-
"式更受青睐。"
526+
"通过列表推导式,你会获得一个 Python 列表;``stripped_list`` "
527+
"就是一个包含所有结果行的列表,并不是迭代器。生成器表达时会返回一个迭代器,它在必要的时候计算结果,避免一次性丘处所有的值。这意味着,如果迭代器返回一个无限数据流或者大量的数据,列表推导式就不太好用了。这些情况下生成器表达式会更受青睐。"
531528

532529
#: ../../howto/functional.rst:359
533530
msgid ""
@@ -606,7 +603,7 @@ msgid ""
606603
"Generators are a special class of functions that simplify the task of "
607604
"writing iterators. Regular functions compute a value and return it, but "
608605
"generators return an iterator that returns a stream of values."
609-
msgstr ""
606+
msgstr "生成器是一类用来简化编写迭代器工作的特殊函数。普通的函数计算并返回一个值,而生成器返回一个能返回数据流的迭代器。"
610607

611608
#: ../../howto/functional.rst:437
612609
msgid ""
@@ -620,17 +617,22 @@ msgid ""
620617
"function where it left off? This is what generators provide; they can be "
621618
"thought of as resumable functions."
622619
msgstr ""
620+
"毫无疑问,你已经对如何在 Python 和 C 中调用普通函数很熟悉了,这时候函数会获得一个创建局部变量的私有命名空间。当函数到达 ``return``"
621+
" "
622+
"表达式时,局部变量会被销毁然后把返回给调用者。之后调用同样的函数时会创建一个新的私有命名空间和一组全新的局部变量。但是,如果在退出一个函数时不扔掉局部变量会如何呢?如果稍后你能够从退出函数的地方重新恢复又如何呢?这就是生成器所提供的;他们可以被看成可恢复的函数。"
623623

624624
#: ../../howto/functional.rst:446
625625
msgid "Here's the simplest example of a generator function:"
626-
msgstr ""
626+
msgstr "这里有简单的生成器函数示例::"
627627

628628
#: ../../howto/functional.rst:452
629629
msgid ""
630630
"Any function containing a :keyword:`yield` keyword is a generator function; "
631631
"this is detected by Python's :term:`bytecode` compiler which compiles the "
632632
"function specially as a result."
633633
msgstr ""
634+
"任何包含了 :keyword:`yield` 关键词的函数都是生成器函数;Python 的 :term:`bytecode` "
635+
"编译器会检测到并因此而特殊处理。"
634636

635637
#: ../../howto/functional.rst:456
636638
msgid ""
@@ -643,16 +645,20 @@ msgid ""
643645
"preserved. On the next call to the generator's :meth:`~generator.__next__` "
644646
"method, the function will resume executing."
645647
msgstr ""
648+
"当你调用一个生成器函数,它并不会返回单独的值,而是返回一个支持生成器协议的生成器对象。当执行 ``yield`` 表达式时,生成器会输出 ``i`` "
649+
"的值,就像 ``return`` 表达式一样。``yield`` 和 ``return`` 最大的区别在于,到达``yield`` "
650+
"的时候生成器的执行状态会挂起并保留局部变量。在下一次调用生成器 :meth:`~generator.__next__` 方法的时候,函数会恢复执行。"
646651

647652
#: ../../howto/functional.rst:465
648653
msgid "Here's a sample usage of the ``generate_ints()`` generator:"
649-
msgstr ""
654+
msgstr "这里有一个 ``generate_ints()`` 生成器的示例:"
650655

651656
#: ../../howto/functional.rst:482
652657
msgid ""
653658
"You could equally write ``for i in generate_ints(5)``, or ``a, b, c = "
654659
"generate_ints(3)``."
655660
msgstr ""
661+
"同样,你可以写出 ``for i in generate_ints(5)``,或者 ``a, b, c = generate_ints(3)``。"
656662

657663
#: ../../howto/functional.rst:485
658664
msgid ""
@@ -661,6 +667,8 @@ msgid ""
661667
"method. Once this happens, or the bottom of the function is reached, the "
662668
"procession of values ends and the generator cannot yield any further values."
663669
msgstr ""
670+
"在生成器函数里面,``return value`` 会触发从 :meth:`~generator.__next__` 方法抛出 "
671+
"``StopIteration(value)`` 异常。一旦抛出这个异常,或者函数结束,处理数据的过程就会停止,生成器也不会再生成新的值。"
664672

665673
#: ../../howto/functional.rst:490
666674
msgid ""
@@ -671,6 +679,9 @@ msgid ""
671679
"method increment ``self.count`` and return it. However, for a moderately "
672680
"complicated generator, writing a corresponding class can be much messier."
673681
msgstr ""
682+
"你可以手动编写自己的类来达到生成器的效果,把生成器的所有局部变量作为实例的成员变量存储起来。比如,返回一个整数列表可以通过把 "
683+
"``self.count``设为0,然后通过 :meth:`~iterator.__next__` 方法增加 ``self.count`` "
684+
"然后返回。然而,对于一个中等复杂程度的生成器,写出一个相应的类可能会相当繁杂。"
674685

675686
#: ../../howto/functional.rst:498
676687
msgid ""
@@ -679,6 +690,8 @@ msgid ""
679690
" examples. Here's one generator that implements an in-order traversal of a "
680691
"tree using generators recursively. ::"
681692
msgstr ""
693+
"包含在 Python 库中的测试套件 :source:`Lib/test/test_generators.py` "
694+
"里有很多非常有趣的例子。这里是一个用生成器事先树的递归中序遍历示例。::"
682695

683696
#: ../../howto/functional.rst:514
684697
msgid ""
@@ -688,10 +701,12 @@ msgid ""
688701
"knight to every square of an NxN chessboard without visiting any square "
689702
"twice)."
690703
msgstr ""
704+
"另外两个 ``test_generators.py`` 中的例子给出了 N 皇后问题(在 NxN 的棋盘上放置 N "
705+
"个皇后,任何一个都不能吃掉另一个),以及马的遍历路线(在NxN 的棋盘上给马找出一条不重复的走过所有格子的路线)的解。"
691706

692707
#: ../../howto/functional.rst:522
693708
msgid "Passing values into a generator"
694-
msgstr ""
709+
msgstr "向生成器传递值"
695710

696711
#: ../../howto/functional.rst:524
697712
msgid ""
@@ -1389,7 +1404,7 @@ msgstr "引用文献"
13891404

13901405
#: ../../howto/functional.rst:1202
13911406
msgid "General"
1392-
msgstr ""
1407+
msgstr "通用文献"
13931408

13941409
#: ../../howto/functional.rst:1204
13951410
msgid ""
@@ -1401,32 +1416,39 @@ msgid ""
14011416
"examples, but many of the design approaches described in these chapters are "
14021417
"applicable to functional-style Python code."
14031418
msgstr ""
1419+
"**Structure and Interpretation of Computer Programs**, Harold Abelson, "
1420+
"Gerald Jay Sussman 和 Julie Sussman 所著。全文可见 https://mitpress.mit.edu/sicp/ "
1421+
"。在这部计算机科学的经典教科书中,第二和第三章讨论了使用序列和流来在组织程序内部的数据传递。书中的示例采用Scheme "
1422+
"语言,但其中这些章节中描述的很多设计方法同样适用于函数式风格 的Python 代码。"
14041423

14051424
#: ../../howto/functional.rst:1212
14061425
msgid ""
14071426
"http://www.defmacro.org/ramblings/fp.html: A general introduction to "
14081427
"functional programming that uses Java examples and has a lengthy historical "
14091428
"introduction."
14101429
msgstr ""
1430+
"http://www.defmacro.org/ramblings/fp.html: 一个使用 Java 示例的函数式编程的总体介绍,有很长的历史说明。"
14111431

14121432
#: ../../howto/functional.rst:1215
14131433
msgid ""
14141434
"https://en.wikipedia.org/wiki/Functional_programming: General Wikipedia "
14151435
"entry describing functional programming."
14161436
msgstr ""
1437+
"https://en.wikipedia.org/wiki/Functional_programming: 一般性的函数式编程的 Wikipedia "
1438+
"条目。"
14171439

14181440
#: ../../howto/functional.rst:1218
14191441
msgid "https://en.wikipedia.org/wiki/Coroutine: Entry for coroutines."
1420-
msgstr ""
1442+
msgstr "https://en.wikipedia.org/wiki/Coroutine: 协程条目。"
14211443

14221444
#: ../../howto/functional.rst:1220
14231445
msgid ""
14241446
"https://en.wikipedia.org/wiki/Currying: Entry for the concept of currying."
1425-
msgstr ""
1447+
msgstr "https://en.wikipedia.org/wiki/Currying: 函数柯里化条目。"
14261448

14271449
#: ../../howto/functional.rst:1223
14281450
msgid "Python-specific"
1429-
msgstr ""
1451+
msgstr "Python 相关"
14301452

14311453
#: ../../howto/functional.rst:1225
14321454
msgid ""
@@ -1435,6 +1457,9 @@ msgid ""
14351457
"text processing, in the section titled \"Utilizing Higher-Order Functions in"
14361458
" Text Processing\"."
14371459
msgstr ""
1460+
"http://gnosis.cx/TPiP/:David Mertz 书中的第一章 :title-reference:`Text Processing "
1461+
"in Python`,\\\"Utilizing Higher-Order Functions in Text Processing\\\" "
1462+
"标题部分讨论了文本处理的函数式编程。"
14381463

14391464
#: ../../howto/functional.rst:1230
14401465
msgid ""
@@ -1446,29 +1471,34 @@ msgid ""
14461471
"and `part 3 "
14471472
"<https://www.ibm.com/developerworks/linux/library/l-prog3/index.html>`__,"
14481473
msgstr ""
1474+
"Mertz 还在 IBM 的 DeveloperWorks 站点上关于函数式编程写了一系列共3篇文章;参见`part "
1475+
"1<https://www.ibm.com/developerworks/linux/library/l-prog/index.html>`__,`part2<https://www.ibm.com/developerworks/linux/library/l-prog2/index.html>`__,"
1476+
" 和`part "
1477+
"3<https://www.ibm.com/developerworks/linux/library/l-prog3/index.html>`__,"
14491478

14501479
#: ../../howto/functional.rst:1238
14511480
msgid "Python documentation"
1452-
msgstr ""
1481+
msgstr "Python 文档"
14531482

14541483
#: ../../howto/functional.rst:1240
14551484
msgid "Documentation for the :mod:`itertools` module."
1456-
msgstr ""
1485+
msgstr ":mod:`itertools` 模块文档。"
14571486

14581487
#: ../../howto/functional.rst:1242
14591488
msgid "Documentation for the :mod:`functools` module."
1460-
msgstr ""
1489+
msgstr ":mod:`functools` 模块文档。"
14611490

14621491
#: ../../howto/functional.rst:1244
14631492
msgid "Documentation for the :mod:`operator` module."
1464-
msgstr ""
1493+
msgstr ":mod:`operator` 模块文档。"
14651494

14661495
#: ../../howto/functional.rst:1246
14671496
msgid ":pep:`289`: \"Generator Expressions\""
1468-
msgstr ""
1497+
msgstr ":pep:`289`: \"Generator Expressions\""
14691498

14701499
#: ../../howto/functional.rst:1248
14711500
msgid ""
14721501
":pep:`342`: \"Coroutines via Enhanced Generators\" describes the new "
14731502
"generator features in Python 2.5."
14741503
msgstr ""
1504+
":pep:`342`: \"Coroutines via Enhanced Generators\" 描述了 Python 2.5 中新的生成器特性。"

0 commit comments

Comments
 (0)