|
7 | 7 | msgstr ""
|
8 | 8 | "Project-Id-Version: Python 3.13\n"
|
9 | 9 | "Report-Msgid-Bugs-To: \n"
|
10 |
| -"POT-Creation-Date: 2024-09-23 07:52+0800\n" |
| 10 | +"POT-Creation-Date: 2025-02-19 00:13+0000\n" |
11 | 11 | "PO-Revision-Date: 2018-05-23 14:36+0000\n"
|
12 | 12 | "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
|
13 | 13 | "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
|
@@ -42,8 +42,8 @@ msgstr "0.32"
|
42 | 42 | msgid ""
|
43 | 43 | "In this document, we'll take a tour of Python's features suitable for "
|
44 | 44 | "implementing programs in a functional style. After an introduction to the "
|
45 |
| -"concepts of functional programming, we'll look at language features such " |
46 |
| -"as :term:`iterator`\\s and :term:`generator`\\s and relevant library modules " |
| 45 | +"concepts of functional programming, we'll look at language features such as :" |
| 46 | +"term:`iterator`\\s and :term:`generator`\\s and relevant library modules " |
47 | 47 | "such as :mod:`itertools` and :mod:`functools`."
|
48 | 48 | msgstr ""
|
49 | 49 |
|
@@ -364,10 +364,9 @@ msgid ""
|
364 | 364 | "iterator argument and will return the largest or smallest element. The "
|
365 | 365 | "``\"in\"`` and ``\"not in\"`` operators also support iterators: ``X in "
|
366 | 366 | "iterator`` is true if X is found in the stream returned by the iterator. "
|
367 |
| -"You'll run into obvious problems if the iterator is " |
368 |
| -"infinite; :func:`max`, :func:`min` will never return, and if the element X " |
369 |
| -"never appears in the stream, the ``\"in\"`` and ``\"not in\"`` operators " |
370 |
| -"won't return either." |
| 367 | +"You'll run into obvious problems if the iterator is infinite; :func:`max`, :" |
| 368 | +"func:`min` will never return, and if the element X never appears in the " |
| 369 | +"stream, the ``\"in\"`` and ``\"not in\"`` operators won't return either." |
371 | 370 | msgstr ""
|
372 | 371 |
|
373 | 372 | #: ../../howto/functional.rst:256
|
@@ -445,9 +444,8 @@ msgstr ""
|
445 | 444 | msgid ""
|
446 | 445 | "Applying :func:`iter` to a dictionary always loops over the keys, but "
|
447 | 446 | "dictionaries have methods that return other iterators. If you want to "
|
448 |
| -"iterate over values or key/value pairs, you can explicitly call " |
449 |
| -"the :meth:`~dict.values` or :meth:`~dict.items` methods to get an " |
450 |
| -"appropriate iterator." |
| 447 | +"iterate over values or key/value pairs, you can explicitly call the :meth:" |
| 448 | +"`~dict.values` or :meth:`~dict.items` methods to get an appropriate iterator." |
451 | 449 | msgstr ""
|
452 | 450 |
|
453 | 451 | #: ../../howto/functional.rst:302
|
@@ -797,9 +795,9 @@ msgstr ""
|
797 | 795 |
|
798 | 796 | #: ../../howto/functional.rst:539
|
799 | 797 | msgid ""
|
800 |
| -"In Python 2.5 there's a simple way to pass values into a " |
801 |
| -"generator. :keyword:`yield` became an expression, returning a value that can " |
802 |
| -"be assigned to a variable or otherwise operated on::" |
| 798 | +"In Python 2.5 there's a simple way to pass values into a generator. :keyword:" |
| 799 | +"`yield` became an expression, returning a value that can be assigned to a " |
| 800 | +"variable or otherwise operated on::" |
803 | 801 | msgstr ""
|
804 | 802 |
|
805 | 803 | #: ../../howto/functional.rst:543
|
@@ -827,9 +825,8 @@ msgstr ""
|
827 | 825 | msgid ""
|
828 | 826 | "Values are sent into a generator by calling its :meth:`send(value) "
|
829 | 827 | "<generator.send>` method. This method resumes the generator's code and the "
|
830 |
| -"``yield`` expression returns the specified value. If the " |
831 |
| -"regular :meth:`~generator.__next__` method is called, the ``yield`` returns " |
832 |
| -"``None``." |
| 828 | +"``yield`` expression returns the specified value. If the regular :meth:" |
| 829 | +"`~generator.__next__` method is called, the ``yield`` returns ``None``." |
833 | 830 | msgstr ""
|
834 | 831 |
|
835 | 832 | #: ../../howto/functional.rst:561
|
@@ -889,18 +886,18 @@ msgstr ""
|
889 | 886 | msgid ""
|
890 | 887 | ":meth:`~generator.close` raises a :exc:`GeneratorExit` exception inside the "
|
891 | 888 | "generator to terminate the iteration. On receiving this exception, the "
|
892 |
| -"generator's code must either raise :exc:`GeneratorExit` " |
893 |
| -"or :exc:`StopIteration`; catching the exception and doing anything else is " |
894 |
| -"illegal and will trigger a :exc:`RuntimeError`. :meth:`~generator.close` " |
895 |
| -"will also be called by Python's garbage collector when the generator is " |
896 |
| -"garbage-collected." |
| 889 | +"generator's code must either raise :exc:`GeneratorExit` or :exc:" |
| 890 | +"`StopIteration`; catching the exception and doing anything else is illegal " |
| 891 | +"and will trigger a :exc:`RuntimeError`. :meth:`~generator.close` will also " |
| 892 | +"be called by Python's garbage collector when the generator is garbage-" |
| 893 | +"collected." |
897 | 894 | msgstr ""
|
898 | 895 |
|
899 | 896 | #: ../../howto/functional.rst:613
|
900 | 897 | msgid ""
|
901 | 898 | "If you need to run cleanup code when a :exc:`GeneratorExit` occurs, I "
|
902 |
| -"suggest using a ``try: ... finally:`` suite instead of " |
903 |
| -"catching :exc:`GeneratorExit`." |
| 899 | +"suggest using a ``try: ... finally:`` suite instead of catching :exc:" |
| 900 | +"`GeneratorExit`." |
904 | 901 | msgstr ""
|
905 | 902 |
|
906 | 903 | #: ../../howto/functional.rst:616
|
@@ -942,8 +939,8 @@ msgstr ":func:`map(f, iterA, iterB, ...) <map>` 回傳一個元素為序列的
|
942 | 939 | msgid ""
|
943 | 940 | "``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], iterB[2]), ...``."
|
944 | 941 | msgstr ""
|
945 |
| -"``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], " |
946 |
| -"iterB[2]), ...``。" |
| 942 | +"``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], iterB[2]), ..." |
| 943 | +"``。" |
947 | 944 |
|
948 | 945 | #: ../../howto/functional.rst:644
|
949 | 946 | msgid "You can of course achieve the same effect with a list comprehension."
|
@@ -1014,11 +1011,11 @@ msgid ""
|
1014 | 1011 | ">>> import random\n"
|
1015 | 1012 | ">>> # Generate 8 random numbers between [0, 10000)\n"
|
1016 | 1013 | ">>> rand_list = random.sample(range(10000), 8)\n"
|
1017 |
| -">>> rand_list \n" |
| 1014 | +">>> rand_list\n" |
1018 | 1015 | "[769, 7953, 9828, 6431, 8442, 9878, 6213, 2207]\n"
|
1019 |
| -">>> sorted(rand_list) \n" |
| 1016 | +">>> sorted(rand_list)\n" |
1020 | 1017 | "[769, 2207, 6213, 6431, 7953, 8442, 9828, 9878]\n"
|
1021 |
| -">>> sorted(rand_list, reverse=True) \n" |
| 1018 | +">>> sorted(rand_list, reverse=True)\n" |
1022 | 1019 | "[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]"
|
1023 | 1020 | msgstr ""
|
1024 | 1021 |
|
@@ -1253,11 +1250,10 @@ msgstr ""
|
1253 | 1250 | #: ../../howto/functional.rst:829
|
1254 | 1251 | msgid ""
|
1255 | 1252 | "The :mod:`operator` module contains a set of functions corresponding to "
|
1256 |
| -"Python's operators. Some examples are :func:`operator.add(a, b) " |
1257 |
| -"<operator.add>` (adds two values), :func:`operator.ne(a, b) <operator.ne>` " |
1258 |
| -"(same as ``a != b``), and :func:`operator.attrgetter('id') " |
1259 |
| -"<operator.attrgetter>` (returns a callable that fetches the ``.id`` " |
1260 |
| -"attribute)." |
| 1253 | +"Python's operators. Some examples are :func:`operator.add(a, b) <operator." |
| 1254 | +"add>` (adds two values), :func:`operator.ne(a, b) <operator.ne>` (same as " |
| 1255 | +"``a != b``), and :func:`operator.attrgetter('id') <operator.attrgetter>` " |
| 1256 | +"(returns a callable that fetches the ``.id`` attribute)." |
1261 | 1257 | msgstr ""
|
1262 | 1258 |
|
1263 | 1259 | #: ../../howto/functional.rst:835
|
@@ -1409,10 +1405,9 @@ msgstr ""
|
1409 | 1405 | msgid ""
|
1410 | 1406 | "The elements within each tuple remain in the same order as *iterable* "
|
1411 | 1407 | "returned them. For example, the number 1 is always before 2, 3, 4, or 5 in "
|
1412 |
| -"the examples above. A similar " |
1413 |
| -"function, :func:`itertools.permutations(iterable, r=None) " |
1414 |
| -"<itertools.permutations>`, removes this constraint on the order, returning " |
1415 |
| -"all possible arrangements of length *r*::" |
| 1408 | +"the examples above. A similar function, :func:`itertools." |
| 1409 | +"permutations(iterable, r=None) <itertools.permutations>`, removes this " |
| 1410 | +"constraint on the order, returning all possible arrangements of length *r*::" |
1416 | 1411 | msgstr ""
|
1417 | 1412 |
|
1418 | 1413 | #: ../../howto/functional.rst:915
|
@@ -1471,11 +1466,11 @@ msgstr ""
|
1471 | 1466 |
|
1472 | 1467 | #: ../../howto/functional.rst:940
|
1473 | 1468 | msgid ""
|
1474 |
| -"The :func:`itertools.combinations_with_replacement(iterable, r) " |
1475 |
| -"<itertools.combinations_with_replacement>` function relaxes a different " |
1476 |
| -"constraint: elements can be repeated within a single tuple. Conceptually an " |
1477 |
| -"element is selected for the first position of each tuple and then is " |
1478 |
| -"replaced before the second element is selected. ::" |
| 1469 | +"The :func:`itertools.combinations_with_replacement(iterable, r) <itertools." |
| 1470 | +"combinations_with_replacement>` function relaxes a different constraint: " |
| 1471 | +"elements can be repeated within a single tuple. Conceptually an element is " |
| 1472 | +"selected for the first position of each tuple and then is replaced before " |
| 1473 | +"the second element is selected. ::" |
1479 | 1474 | msgstr ""
|
1480 | 1475 |
|
1481 | 1476 | #: ../../howto/functional.rst:946
|
@@ -1576,8 +1571,8 @@ msgstr "functools 模組"
|
1576 | 1571 | msgid ""
|
1577 | 1572 | "The :mod:`functools` module contains some higher-order functions. A **higher-"
|
1578 | 1573 | "order function** takes one or more functions as input and returns a new "
|
1579 |
| -"function. The most useful tool in this module is " |
1580 |
| -"the :func:`functools.partial` function." |
| 1574 | +"function. The most useful tool in this module is the :func:`functools." |
| 1575 | +"partial` function." |
1581 | 1576 | msgstr ""
|
1582 | 1577 |
|
1583 | 1578 | #: ../../howto/functional.rst:1004
|
@@ -1620,14 +1615,14 @@ msgid ""
|
1620 | 1615 | ":func:`functools.reduce(func, iter, [initial_value]) <functools.reduce>` "
|
1621 | 1616 | "cumulatively performs an operation on all the iterable's elements and, "
|
1622 | 1617 | "therefore, can't be applied to infinite iterables. *func* must be a function "
|
1623 |
| -"that takes two elements and returns a single " |
1624 |
| -"value. :func:`functools.reduce` takes the first two elements A and B " |
1625 |
| -"returned by the iterator and calculates ``func(A, B)``. It then requests " |
1626 |
| -"the third element, C, calculates ``func(func(A, B), C)``, combines this " |
1627 |
| -"result with the fourth element returned, and continues until the iterable is " |
1628 |
| -"exhausted. If the iterable returns no values at all, a :exc:`TypeError` " |
1629 |
| -"exception is raised. If the initial value is supplied, it's used as a " |
1630 |
| -"starting point and ``func(initial_value, A)`` is the first calculation. ::" |
| 1618 | +"that takes two elements and returns a single value. :func:`functools." |
| 1619 | +"reduce` takes the first two elements A and B returned by the iterator and " |
| 1620 | +"calculates ``func(A, B)``. It then requests the third element, C, " |
| 1621 | +"calculates ``func(func(A, B), C)``, combines this result with the fourth " |
| 1622 | +"element returned, and continues until the iterable is exhausted. If the " |
| 1623 | +"iterable returns no values at all, a :exc:`TypeError` exception is raised. " |
| 1624 | +"If the initial value is supplied, it's used as a starting point and " |
| 1625 | +"``func(initial_value, A)`` is the first calculation. ::" |
1631 | 1626 | msgstr ""
|
1632 | 1627 |
|
1633 | 1628 | #: ../../howto/functional.rst:1039
|
@@ -1683,11 +1678,10 @@ msgstr ""
|
1683 | 1678 |
|
1684 | 1679 | #: ../../howto/functional.rst:1075
|
1685 | 1680 | msgid ""
|
1686 |
| -"A related function is :func:`itertools.accumulate(iterable, " |
1687 |
| -"func=operator.add) <itertools.accumulate>`. It performs the same " |
1688 |
| -"calculation, but instead of returning only the final " |
1689 |
| -"result, :func:`~itertools.accumulate` returns an iterator that also yields " |
1690 |
| -"each partial result::" |
| 1681 | +"A related function is :func:`itertools.accumulate(iterable, func=operator." |
| 1682 | +"add) <itertools.accumulate>`. It performs the same calculation, but instead " |
| 1683 | +"of returning only the final result, :func:`~itertools.accumulate` returns an " |
| 1684 | +"iterator that also yields each partial result::" |
1691 | 1685 | msgstr ""
|
1692 | 1686 |
|
1693 | 1687 | #: ../../howto/functional.rst:1080
|
|
0 commit comments