Skip to content

Commit 445e991

Browse files
github-actions[bot]mattwang44
authored andcommitted
sync with cpython ea26c885
1 parent 7f34be2 commit 445e991

File tree

5 files changed

+2148
-2100
lines changed

5 files changed

+2148
-2100
lines changed

library/array.po

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ msgid ""
1010
msgstr ""
1111
"Project-Id-Version: Python 3.14\n"
1212
"Report-Msgid-Bugs-To: \n"
13-
"POT-Creation-Date: 2025-07-30 00:18+0000\n"
13+
"POT-Creation-Date: 2026-01-12 00:16+0000\n"
1414
"PO-Revision-Date: 2021-11-23 18:40+0800\n"
1515
"Last-Translator: Benson Chen <[email protected]>\n"
1616
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -27,13 +27,14 @@ msgid ":mod:`!array` --- Efficient arrays of numeric values"
2727
msgstr ":mod:`!array` --- 高效率的數值型陣列"
2828

2929
#: ../../library/array.rst:11
30+
#, fuzzy
3031
msgid ""
3132
"This module defines an object type which can compactly represent an array of "
3233
"basic values: characters, integers, floating-point numbers. Arrays are "
33-
"sequence types and behave very much like lists, except that the type of "
34-
"objects stored in them is constrained. The type is specified at object "
35-
"creation time by using a :dfn:`type code`, which is a single character. The "
36-
"following type codes are defined:"
34+
"mutable :term:`sequence` types and behave very much like lists, except that "
35+
"the type of objects stored in them is constrained. The type is specified at "
36+
"object creation time by using a :dfn:`type code`, which is a single "
37+
"character. The following type codes are defined:"
3738
msgstr ""
3839
"這個模組定義了一個物件型別,可以簡潔的表達一個包含基本數值的陣列:字元、整"
3940
"數、浮點數。陣列是一個非常類似 list(串列)的序列型別,除了陣列會限制儲存的物"
@@ -280,13 +281,14 @@ msgstr ""
280281
"之中來將初始項目新增至陣列。"
281282

282283
#: ../../library/array.rst:96
284+
#, fuzzy
283285
msgid ""
284-
"Array objects support the ordinary sequence operations of indexing, slicing, "
285-
"concatenation, and multiplication. When using slice assignment, the "
286-
"assigned value must be an array object with the same type code; in all other "
287-
"cases, :exc:`TypeError` is raised. Array objects also implement the buffer "
288-
"interface, and may be used wherever :term:`bytes-like objects <bytes-like "
289-
"object>` are supported."
286+
"Array objects support the ordinary :ref:`mutable <typesseq-mutable>` :term:"
287+
"`sequence` operations of indexing, slicing, concatenation, and "
288+
"multiplication. When using slice assignment, the assigned value must be an "
289+
"array object with the same type code; in all other cases, :exc:`TypeError` "
290+
"is raised. Array objects also implement the buffer interface, and may be "
291+
"used wherever :term:`bytes-like objects <bytes-like object>` are supported."
290292
msgstr ""
291293
"陣列支援常見的序列操作,包含索引 (indexing)、切片 (slicing)、串接 "
292294
"(concatenation)、相乘 (multiplication) 等。當使用切片進行賦值時,賦值的陣列必"
@@ -361,10 +363,9 @@ msgstr "回傳 *x* 在陣列中出現了幾次。"
361363
#: ../../library/array.rst:154
362364
msgid ""
363365
"Append items from *iterable* to the end of the array. If *iterable* is "
364-
"another array, it must have *exactly* the same type code; if "
365-
"not, :exc:`TypeError` will be raised. If *iterable* is not an array, it "
366-
"must be iterable and its elements must be the right type to be appended to "
367-
"the array."
366+
"another array, it must have *exactly* the same type code; if not, :exc:"
367+
"`TypeError` will be raised. If *iterable* is not an array, it must be "
368+
"iterable and its elements must be the right type to be appended to the array."
368369
msgstr ""
369370
"從 *iterable* 中新增元素到陣列的尾端,如果 *iterable* 是另一個陣列,它必須有"
370371
"完全相同的 type code,如果不同會導致 :exc:`TypeError`。如果 *iterable* 不是一"
@@ -374,8 +375,8 @@ msgstr ""
374375
#: ../../library/array.rst:162
375376
msgid ""
376377
"Appends items from the :term:`bytes-like object`, interpreting its content "
377-
"as an array of machine values (as if it had been read from a file using "
378-
"the :meth:`fromfile` method)."
378+
"as an array of machine values (as if it had been read from a file using the :"
379+
"meth:`fromfile` method)."
379380
msgstr ""
380381
"從 :term:`bytes-like object` 中新增元素。讀取時會將其內容當作一個機器數值組成"
381382
"的陣列(就像從檔案中使用 :meth:`fromfile` 方法讀出的資料)。"
@@ -411,9 +412,9 @@ msgid ""
411412
"an array of some other type."
412413
msgstr ""
413414
"用給定的 Unicode 字串擴展這個陣列。陣列的 type code 必須是 ``u`` 或 ``'w'``;"
414-
"其他的型別會導致 :exc:`ValueError` 被引發。使用 "
415-
"``array.frombytes(unicodestring.encode(enc))`` 來新增 Unicode 資料到一個其他"
416-
"型別的陣列。"
415+
"其他的型別會導致 :exc:`ValueError` 被引發。使用 ``array."
416+
"frombytes(unicodestring.encode(enc))`` 來新增 Unicode 資料到一個其他型別的陣"
417+
"。"
417418

418419
#: ../../library/array.rst:194
419420
msgid ""

library/itertools.po

Lines changed: 68 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ msgid ""
66
msgstr ""
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), ..."
158158
msgstr "(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``"
162163
msgstr "``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:"
511512
msgstr ""
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
518519
msgid ""
@@ -591,9 +592,10 @@ msgstr ""
591592
"[('roses', 'red'), ('violets', 'blue'), ('sugar', 'sweet')]"
592593

593594
#: ../../library/itertools.rst:183
595+
#, fuzzy
594596
msgid ""
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
667669
msgid ""
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``."
672674
msgstr ""
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
837839
msgid ""
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::"
841843
msgstr ""
842844
"建立一個疊代器,回傳從 *start* 開始的等差的值。可以與 :func:`map` 一起使用來"
843845
"產生連續的資料點,或與 :func:`zip` 一起使用來增加序列號。大致等價於: ::"
@@ -1017,9 +1019,9 @@ msgstr ""
10171019
#: ../../library/itertools.rst:420
10181020
msgid ""
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::"
10231025
msgstr ""
10241026
"回傳的群組本身是一個與 :func:`groupby` 共享底層可疊代物件的疊代器。由於來源是"
10251027
"共享的,當 :func:`groupby` 物件前進時,前一個群組將不再可見。因此,如果之後需"
@@ -1232,11 +1234,11 @@ msgstr ""
12321234

12331235
#: ../../library/itertools.rst:536
12341236
msgid ""
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*."
12371239
msgstr ""
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
12421244
msgid ""
@@ -1249,13 +1251,13 @@ msgstr ""
12491251
#: ../../library/itertools.rst:543
12501252
msgid ""
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``."
12551257
msgstr ""
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
12611263
msgid ""
@@ -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."
15261527
msgstr ""
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
15341535
msgid "Return *n* independent iterators from a single iterable."
@@ -1606,9 +1607,9 @@ msgstr ""
16061607
msgid ""
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."
16121613
msgstr ""
16131614
"當輸入的 *iterable* 已經是一個 tee 疊代物件時,回傳的 tuple(元組)中所有成員"
16141615
"都會被建立,就如同它們是由上游的 :func:`tee` 呼叫所產生的一樣。這個「展平步"
@@ -1658,19 +1659,19 @@ msgid ""
16581659
"even if the original *iterable* is threadsafe."
16591660
msgstr ""
16601661
"``tee`` 疊代器不是執行緒安全 (threadsafe) 的。當同時使用由同一個 :func:`tee` "
1661-
"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引"
1662-
"發 :exc:`RuntimeError`。"
1662+
"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:"
1663+
"`RuntimeError`。"
16631664

16641665
#: ../../library/itertools.rst:758
16651666
msgid ""
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`."
16701671
msgstr ""
16711672
"此 itertool 可能需要大量的輔助儲存空間(取決於需要儲存多少臨時資料)。通常如"
1672-
"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使"
1673-
"用 :func:`list` 會比 :func:`tee` 更快。"
1673+
"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:"
1674+
"`list` 會比 :func:`tee` 更快。"
16741675

16751676
#: ../../library/itertools.rst:766
16761677
msgid "Make an iterator that aggregates elements from each of the *iterables*."
@@ -1736,9 +1737,9 @@ msgstr ""
17361737

17371738
#: ../../library/itertools.rst:798
17381739
msgid ""
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`)."
17421743
msgstr ""
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()``."
17671768
msgstr ""
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
17761777
msgid ""
@@ -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::"
17911792
msgstr ""
1792-
"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index "
1793-
"的 :pypi:`more-itertools` 專案中安裝: ::"
1793+
"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :"
1794+
"pypi:`more-itertools` 專案中安裝: ::"
17941795

17951796
#: ../../library/itertools.rst:829
17961797
msgid "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
18181820
msgid ""
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
21562169
msgid "The following recipes have a more mathematical flavor:"
21572170
msgstr "以下的應用技巧具有更多的數學風格:"
21582171

2159-
#: ../../library/itertools.rst:1010
2172+
#: ../../library/itertools.rst:1020
21602173
msgid ""
21612174
"def multinomial(*counts):\n"
21622175
" \"Number of distinct arrangements of a multiset.\"\n"

0 commit comments

Comments
 (0)