66msgstr ""
77"Project-Id-Version : Python 3.14\n "
88"Report-Msgid-Bugs-To : \n "
9- "POT-Creation-Date : 2025-09-08 15:25+0800 \n "
9+ "POT-Creation-Date : 2026-01-12 00:16+0000 \n "
1010"PO-Revision-Date : 2024-08-16 15:01+0800\n "
1111"
Last-Translator :
Adrian Liaw <[email protected] >\n "
1212"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -158,7 +158,8 @@ msgid "(p0, p1, ..., p_n-1), ..."
158158msgstr "(p0, p1, ..., p_n-1), ..."
159159
160160#: ../../library/itertools.rst:50
161- msgid "``batched('ABCDEFG', n=2) → AB CD EF G``"
161+ #, fuzzy
162+ msgid "``batched('ABCDEFG', n=3) → ABC DEF G``"
162163msgstr "``batched('ABCDEFG', n=2) → AB CD EF G``"
163164
164165#: ../../library/itertools.rst:51
@@ -509,10 +510,10 @@ msgid ""
509510"www.ramseysolutions.com/real-estate/amortization-schedule>`_, accumulate the "
510511"interest and apply payments:"
511512msgstr ""
512- "*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定 "
513- "為 :func: `max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續 "
514- "的乘積。 也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) "
515- "<https://www. ramseysolutions.com/real-estate/amortization-schedule>`_ :"
513+ "*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定為 :func: "
514+ "`max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續的乘積。 "
515+ "也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) <https://www. "
516+ "ramseysolutions.com/real-estate/amortization-schedule>`_ :"
516517
517518#: ../../library/itertools.rst:136
518519msgid ""
@@ -591,9 +592,10 @@ msgstr ""
591592"[('roses', 'red'), ('violets', 'blue'), ('sugar', 'sweet')]"
592593
593594#: ../../library/itertools.rst:183
595+ #, fuzzy
594596msgid ""
595597"def batched(iterable, n, *, strict=False):\n"
596- " # batched('ABCDEFG', 2 ) → AB CD EF G\n"
598+ " # batched('ABCDEFG', 3 ) → ABC DEF G\n"
597599" if n < 1:\n"
598600" raise ValueError('n must be at least one')\n"
599601" iterator = iter(iterable)\n"
@@ -666,9 +668,9 @@ msgstr "從輸入 *iterable* 中回傳長度為 *r* 的元素的子序列。"
666668#: ../../library/itertools.rst:227
667669msgid ""
668670"The output is a subsequence of :func:`product` keeping only entries that are "
669- "subsequences of the *iterable*. The length of the output is given "
670- "by :func: `math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ "
671- "n`` or zero when ``r > n``."
671+ "subsequences of the *iterable*. The length of the output is given by :func: "
672+ "`math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero "
673+ "when ``r > n``."
672674msgstr ""
673675"輸出是 :func:`product` 的子序列,僅保留作為 *iterable* 子序列的條目。輸出的長"
674676"度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / r! / (n - r)!"
@@ -836,8 +838,8 @@ msgstr ""
836838#: ../../library/itertools.rst:323
837839msgid ""
838840"Make an iterator that returns evenly spaced values beginning with *start*. "
839- "Can be used with :func:`map` to generate consecutive data points or "
840- "with : func:`zip` to add sequence numbers. Roughly equivalent to::"
841+ "Can be used with :func:`map` to generate consecutive data points or with : "
842+ "func:`zip` to add sequence numbers. Roughly equivalent to::"
841843msgstr ""
842844"建立一個疊代器,回傳從 *start* 開始的等差的值。可以與 :func:`map` 一起使用來"
843845"產生連續的資料點,或與 :func:`zip` 一起使用來增加序列號。大致等價於: ::"
@@ -1017,9 +1019,9 @@ msgstr ""
10171019#: ../../library/itertools.rst:420
10181020msgid ""
10191021"The returned group is itself an iterator that shares the underlying iterable "
1020- "with :func:`groupby`. Because the source is shared, when "
1021- "the :func: `groupby` object is advanced, the previous group is no longer "
1022- "visible. So, if that data is needed later, it should be stored as a list::"
1022+ "with :func:`groupby`. Because the source is shared, when the :func: "
1023+ "`groupby` object is advanced, the previous group is no longer visible. So, "
1024+ "if that data is needed later, it should be stored as a list::"
10231025msgstr ""
10241026"回傳的群組本身是一個與 :func:`groupby` 共享底層可疊代物件的疊代器。由於來源是"
10251027"共享的,當 :func:`groupby` 物件前進時,前一個群組將不再可見。因此,如果之後需"
@@ -1232,11 +1234,11 @@ msgstr ""
12321234
12331235#: ../../library/itertools.rst:536
12341236msgid ""
1235- "Return successive *r* length `permutations of elements <https://"
1236- "www. britannica.com/science/permutation>`_ from the *iterable*."
1237+ "Return successive *r* length `permutations of elements <https://www. "
1238+ "britannica.com/science/permutation>`_ from the *iterable*."
12371239msgstr ""
1238- "回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 <https://"
1239- "www.britannica. com/science/permutation>`_ 。"
1240+ "回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 <https://www.britannica. "
1241+ "com/science/permutation>`_ 。"
12401242
12411243#: ../../library/itertools.rst:539
12421244msgid ""
@@ -1249,13 +1251,13 @@ msgstr ""
12491251#: ../../library/itertools.rst:543
12501252msgid ""
12511253"The output is a subsequence of :func:`product` where entries with repeated "
1252- "elements have been filtered out. The length of the output is given "
1253- "by :func: `math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or "
1254- "zero when ``r > n``."
1254+ "elements have been filtered out. The length of the output is given by :func: "
1255+ "`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero when "
1256+ "``r > n``."
12551257msgstr ""
1256- "輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度 "
1257- "由 : func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 "
1258- "``r > n`` 時為零。"
1258+ "輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度由 : "
1259+ "func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r "
1260+ "> n`` 時為零。"
12591261
12601262#: ../../library/itertools.rst:548
12611263msgid ""
@@ -1520,15 +1522,14 @@ msgid ""
15201522"the input iterator and there is no way to access it. This could be an issue "
15211523"if an application wants to further consume the input iterator after "
15221524"*takewhile* has been run to exhaustion. To work around this problem, "
1523- "consider using `more-itertools before_and_after() <https://more-"
1524- "itertools.readthedocs.io/en/stable/"
1525- "api.html#more_itertools.before_and_after>`_ instead."
1525+ "consider using `more-itertools before_and_after() <https://more-itertools."
1526+ "readthedocs.io/en/stable/api.html#more_itertools.before_and_after>`_ instead."
15261527msgstr ""
15271528"注意,第一個不符合條件判斷的元素將從輸入疊代器中被消耗,且無法再存取它。如果"
15281529"應用程式希望在 *takewhile* 耗盡後進一步消耗輸入疊代器,這可能會是個問題。為了"
15291530"解決這個問題,可以考慮使用 `more-itertools 中的 before_and_after() <https://"
1530- "more-itertools.readthedocs.io/en/stable/"
1531- "api.html#more_itertools. before_and_after>`_ 作為替代。"
1531+ "more-itertools.readthedocs.io/en/stable/api.html#more_itertools. "
1532+ "before_and_after>`_ 作為替代。"
15321533
15331534#: ../../library/itertools.rst:691
15341535msgid "Return *n* independent iterators from a single iterable."
@@ -1606,9 +1607,9 @@ msgstr ""
16061607msgid ""
16071608"When the input *iterable* is already a tee iterator object, all members of "
16081609"the return tuple are constructed as if they had been produced by the "
1609- "upstream :func:`tee` call. This \" flattening step\" allows "
1610- "nested :func: `tee` calls to share the same underlying data chain and to have "
1611- "a single update step rather than a chain of calls."
1610+ "upstream :func:`tee` call. This \" flattening step\" allows nested :func: "
1611+ "`tee` calls to share the same underlying data chain and to have a single "
1612+ "update step rather than a chain of calls."
16121613msgstr ""
16131614"當輸入的 *iterable* 已經是一個 tee 疊代物件時,回傳的 tuple(元組)中所有成員"
16141615"都會被建立,就如同它們是由上游的 :func:`tee` 呼叫所產生的一樣。這個「展平步"
@@ -1658,19 +1659,19 @@ msgid ""
16581659"even if the original *iterable* is threadsafe."
16591660msgstr ""
16601661"``tee`` 疊代器不是執行緒安全 (threadsafe) 的。當同時使用由同一個 :func:`tee` "
1661- "呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引 "
1662- "發 :exc: `RuntimeError`。"
1662+ "呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc: "
1663+ "`RuntimeError`。"
16631664
16641665#: ../../library/itertools.rst:758
16651666msgid ""
16661667"This itertool may require significant auxiliary storage (depending on how "
16671668"much temporary data needs to be stored). In general, if one iterator uses "
1668- "most or all of the data before another iterator starts, it is faster to "
1669- "use : func:`list` instead of :func:`tee`."
1669+ "most or all of the data before another iterator starts, it is faster to use : "
1670+ "func:`list` instead of :func:`tee`."
16701671msgstr ""
16711672"此 itertool 可能需要大量的輔助儲存空間(取決於需要儲存多少臨時資料)。通常如"
1672- "果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使 "
1673- "用 :func: `list` 會比 :func:`tee` 更快。"
1673+ "果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func: "
1674+ "`list` 會比 :func:`tee` 更快。"
16741675
16751676#: ../../library/itertools.rst:766
16761677msgid "Make an iterator that aggregates elements from each of the *iterables*."
@@ -1736,9 +1737,9 @@ msgstr ""
17361737
17371738#: ../../library/itertools.rst:798
17381739msgid ""
1739- "If one of the iterables is potentially infinite, then "
1740- "the :func: `zip_longest` function should be wrapped with something that "
1741- "limits the number of calls (for example :func:`islice` or :func:`takewhile`)."
1740+ "If one of the iterables is potentially infinite, then the :func: "
1741+ "`zip_longest` function should be wrapped with something that limits the "
1742+ "number of calls (for example :func:`islice` or :func:`takewhile`)."
17421743msgstr ""
17431744"如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來包"
17441745"裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。"
@@ -1761,16 +1762,16 @@ msgid ""
17611762"``chain.from_iterable`` is related to the concept of flattening. The "
17621763"recipes also give ideas about ways that the tools can be combined — for "
17631764"example, how ``starmap()`` and ``repeat()`` can work together. The recipes "
1764- "also show patterns for using itertools with the :mod:`operator` "
1765- "and :mod: `collections` modules as well as with the built-in itertools such "
1766- "as ``map()``, ``filter()``, ``reversed()``, and ``enumerate()``."
1765+ "also show patterns for using itertools with the :mod:`operator` and :mod: "
1766+ "`collections` modules as well as with the built-in itertools such as "
1767+ "``map()``, ``filter()``, ``reversed()``, and ``enumerate()``."
17671768msgstr ""
17681769"itertools 應用技巧的主要目的是教學。這些應用技巧展示了對單個工具進行思考的各"
17691770"種方式 —— 例如,``chain.from_iterable`` 與攤平 (flattening) 的概念相關。這些"
17701771"應用技巧還提供了組合使用工具的想法 —— 例如,``starmap()`` 和 ``repeat()`` 如"
1771- "何一起工作。另外還展示了將 itertools 與 :mod:`operator` "
1772- "和 :mod: `collections` 模組一同使用以及與內建 itertools(如 ``map()``、"
1773- "``filter()``、`` reversed()`` 和 ``enumerate()``)一同使用的模式。"
1772+ "何一起工作。另外還展示了將 itertools 與 :mod:`operator` 和 :mod: "
1773+ "`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter ()``、"
1774+ "``reversed()`` 和 ``enumerate()``)一同使用的模式。"
17741775
17751776#: ../../library/itertools.rst:820
17761777msgid ""
@@ -1789,8 +1790,8 @@ msgid ""
17891790"Substantially all of these recipes and many, many others can be installed "
17901791"from the :pypi:`more-itertools` project found on the Python Package Index::"
17911792msgstr ""
1792- "幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上 "
1793- "的 : pypi:`more-itertools` 專案中安裝: ::"
1793+ "幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 : "
1794+ "pypi:`more-itertools` 專案中安裝: ::"
17941795
17951796#: ../../library/itertools.rst:829
17961797msgid "python -m pip install more-itertools"
@@ -1811,16 +1812,17 @@ msgstr ""
18111812"可疊代物件一次性引入記憶體,能保持優異的記憶體性能。以\\ `函式風格 "
18121813"(functional style) <https://www.cs.kent.ac.uk/people/staff/dat/miranda/"
18131814"whyfp90.pdf>`_ 將工具連接在一起,能將程式碼的數量維持在較少的情況。透過優先使"
1814- "用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和"
1815- "\\ : term:`產生器 <generator>`,則能保持高速度。"
1815+ "用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和\\ : "
1816+ "term:`產生器 <generator>`,則能保持高速度。"
18161817
18171818#: ../../library/itertools.rst:839
1819+ #, fuzzy
18181820msgid ""
18191821"from collections import Counter, deque\n"
18201822"from contextlib import suppress\n"
18211823"from functools import reduce\n"
18221824"from math import comb, prod, sumprod, isqrt\n"
1823- "from operator import itemgetter, getitem, mul, neg\n"
1825+ "from operator import is_not, itemgetter, getitem, mul, neg\n"
18241826"\n"
18251827"def take(n, iterable):\n"
18261828" \" Return first n items of the iterable as a list.\" \n"
@@ -1960,6 +1962,17 @@ msgid ""
19601962" slices = starmap(slice, combinations(range(len(seq) + 1), 2))\n"
19611963" return map(getitem, repeat(seq), slices)\n"
19621964"\n"
1965+ "def derangements(iterable, r=None):\n"
1966+ " \" Produce r length permutations without fixed points.\" \n"
1967+ " # derangements('ABCD') → BADC BCDA BDAC CADB CDAB CDBA DABC DCAB DCBA\n"
1968+ " # Algorithm credited to Stefan Pochmann\n"
1969+ " seq = tuple(iterable)\n"
1970+ " pos = tuple(range(len(seq)))\n"
1971+ " have_moved = map(map, repeat(is_not), repeat(pos), permutations(pos, "
1972+ "r=r))\n"
1973+ " valid_derangements = map(all, have_moved)\n"
1974+ " return compress(permutations(seq, r=r), valid_derangements)\n"
1975+ "\n"
19631976"def iter_index(iterable, value, start=0, stop=None):\n"
19641977" \" Return indices where a value occurs in a sequence or iterable.\" \n"
19651978" # iter_index('AABCADEAF', 'A') → 0 1 4 7\n"
@@ -2152,11 +2165,11 @@ msgstr ""
21522165" while True:\n"
21532166" yield function()"
21542167
2155- #: ../../library/itertools.rst:1008
2168+ #: ../../library/itertools.rst:1018
21562169msgid "The following recipes have a more mathematical flavor:"
21572170msgstr "以下的應用技巧具有更多的數學風格:"
21582171
2159- #: ../../library/itertools.rst:1010
2172+ #: ../../library/itertools.rst:1020
21602173msgid ""
21612174"def multinomial(*counts):\n"
21622175" \" Number of distinct arrangements of a multiset.\" \n"
0 commit comments