Skip to content

Commit e0a96fe

Browse files
github-actions[bot]mattwang44
authored andcommitted
sync with cpython f7af8bc5
1 parent 48b62a9 commit e0a96fe

File tree

8 files changed

+858
-825
lines changed

8 files changed

+858
-825
lines changed

c-api/init.po

+315-309
Large diffs are not rendered by default.

faq/programming.po

+5-4
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,8 @@ msgid ""
807807
"example, given the function definition::"
808808
msgstr ""
809809
":term:`參數 <parameter>`\\ 由出現在函式定義中的名稱定義,而\\ :term:`引數 "
810-
"<argument>`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的\\ :term:"
811-
"引數種類 <parameter>`。例如,給定以下函式定義: ::"
810+
"<argument>`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的"
811+
"\\ :term:`引數種類 <parameter>`。例如,給定以下函式定義: ::"
812812

813813
#: ../../faq/programming.rst:423
814814
msgid ""
@@ -3029,8 +3029,9 @@ msgid ""
30293029
"To test for \"true inheritance\", scan the :term:`MRO` of the class:"
30303030
msgstr ""
30313031
"請注意,:func:`isinstance` 還會檢查來自\\ :term:`抽象基底類別 (abstract base "
3032-
"class)` 的虛擬繼承。因此對已註冊類別的檢驗會回傳 ``True``,即使沒有直接或間接"
3033-
"繼承自它。要測試「真正繼承」,請掃描該類別的 :term:`MRO`:"
3032+
"class) <abstract base class>` 的虛擬繼承。因此對已註冊類別的檢驗會回傳 "
3033+
"``True``,即使沒有直接或間接繼承自它。要測試「真正繼承」,請掃描該類別"
3034+
"的 :term:`MRO`:"
30343035

30353036
#: ../../faq/programming.rst:1516
30363037
msgid ""

library/itertools.po

+59-52
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: Python 3.13\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2024-12-17 00:14+0000\n"
10+
"POT-Creation-Date: 2025-02-07 15:02+0800\n"
1111
"PO-Revision-Date: 2024-08-16 15:01+0800\n"
1212
"Last-Translator: Adrian Liaw <[email protected]>\n"
1313
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -488,10 +488,10 @@ msgid ""
488488
"www.ramseysolutions.com/real-estate/amortization-schedule>`_, accumulate the "
489489
"interest and apply payments:"
490490
msgstr ""
491-
"*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定為 :func:"
492-
"`max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續的乘積。"
493-
"也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) <https://www."
494-
"ramseysolutions.com/real-estate/amortization-schedule>`_ :"
491+
"*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定"
492+
"為 :func:`max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續"
493+
"的乘積。也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) "
494+
"<https://www.ramseysolutions.com/real-estate/amortization-schedule>`_ :"
495495

496496
#: ../../library/itertools.rst:136
497497
msgid ""
@@ -630,9 +630,9 @@ msgstr "從輸入 *iterable* 中回傳長度為 *r* 的元素的子序列。"
630630
#: ../../library/itertools.rst:227
631631
msgid ""
632632
"The output is a subsequence of :func:`product` keeping only entries that are "
633-
"subsequences of the *iterable*. The length of the output is given by :func:"
634-
"`math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero "
635-
"when ``r > n``."
633+
"subsequences of the *iterable*. The length of the output is given "
634+
"by :func:`math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ "
635+
"n`` or zero when ``r > n``."
636636
msgstr ""
637637
"輸出是 :func:`product` 的子序列,僅保留作為 *iterable* 子序列的條目。輸出的長"
638638
"度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / r! / (n - r)!"
@@ -758,8 +758,8 @@ msgstr ""
758758
#: ../../library/itertools.rst:323
759759
msgid ""
760760
"Make an iterator that returns evenly spaced values beginning with *start*. "
761-
"Can be used with :func:`map` to generate consecutive data points or with :"
762-
"func:`zip` to add sequence numbers. Roughly equivalent to::"
761+
"Can be used with :func:`map` to generate consecutive data points or "
762+
"with :func:`zip` to add sequence numbers. Roughly equivalent to::"
763763
msgstr ""
764764
"建立一個疊代器,回傳從 *start* 開始的等差的值。可以與 :func:`map` 一起使用來"
765765
"產生連續的資料點,或與 :func:`zip` 一起使用來增加序列號。大致等價於: ::"
@@ -939,9 +939,9 @@ msgstr ""
939939
#: ../../library/itertools.rst:420
940940
msgid ""
941941
"The returned group is itself an iterator that shares the underlying iterable "
942-
"with :func:`groupby`. Because the source is shared, when the :func:"
943-
"`groupby` object is advanced, the previous group is no longer visible. So, "
944-
"if that data is needed later, it should be stored as a list::"
942+
"with :func:`groupby`. Because the source is shared, when "
943+
"the :func:`groupby` object is advanced, the previous group is no longer "
944+
"visible. So, if that data is needed later, it should be stored as a list::"
945945
msgstr ""
946946
"回傳的群組本身是一個與 :func:`groupby` 共享底層可疊代物件的疊代器。由於來源是"
947947
"共享的,當 :func:`groupby` 物件前進時,前一個群組將不再可見。因此,如果之後需"
@@ -1146,11 +1146,11 @@ msgstr ""
11461146

11471147
#: ../../library/itertools.rst:536
11481148
msgid ""
1149-
"Return successive *r* length `permutations of elements <https://www."
1150-
"britannica.com/science/permutation>`_ from the *iterable*."
1149+
"Return successive *r* length `permutations of elements <https://"
1150+
"www.britannica.com/science/permutation>`_ from the *iterable*."
11511151
msgstr ""
1152-
"回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 <https://www.britannica."
1153-
"com/science/permutation>`_ 。"
1152+
"回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 <https://"
1153+
"www.britannica.com/science/permutation>`_ 。"
11541154

11551155
#: ../../library/itertools.rst:539
11561156
msgid ""
@@ -1163,13 +1163,13 @@ msgstr ""
11631163
#: ../../library/itertools.rst:543
11641164
msgid ""
11651165
"The output is a subsequence of :func:`product` where entries with repeated "
1166-
"elements have been filtered out. The length of the output is given by :func:"
1167-
"`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero when "
1168-
"``r > n``."
1166+
"elements have been filtered out. The length of the output is given "
1167+
"by :func:`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or "
1168+
"zero when ``r > n``."
11691169
msgstr ""
1170-
"輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度由 :"
1171-
"func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r "
1172-
"> n`` 時為零。"
1170+
"輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度"
1171+
"由 :func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 "
1172+
"``r > n`` 時為零。"
11731173

11741174
#: ../../library/itertools.rst:548
11751175
msgid ""
@@ -1432,14 +1432,15 @@ msgid ""
14321432
"the input iterator and there is no way to access it. This could be an issue "
14331433
"if an application wants to further consume the input iterator after "
14341434
"*takewhile* has been run to exhaustion. To work around this problem, "
1435-
"consider using `more-itertools before_and_after() <https://more-itertools."
1436-
"readthedocs.io/en/stable/api.html#more_itertools.before_and_after>`_ instead."
1435+
"consider using `more-itertools before_and_after() <https://more-"
1436+
"itertools.readthedocs.io/en/stable/"
1437+
"api.html#more_itertools.before_and_after>`_ instead."
14371438
msgstr ""
14381439
"注意,第一個不符合條件判斷的元素將從輸入疊代器中被消耗,且無法再存取它。如果"
14391440
"應用程式希望在 *takewhile* 耗盡後進一步消耗輸入疊代器,這可能會是個問題。為了"
14401441
"解決這個問題,可以考慮使用 `more-itertools 中的 before_and_after() <https://"
1441-
"more-itertools.readthedocs.io/en/stable/api.html#more_itertools."
1442-
"before_and_after>`_ 作為替代。"
1442+
"more-itertools.readthedocs.io/en/stable/"
1443+
"api.html#more_itertools.before_and_after>`_ 作為替代。"
14431444

14441445
#: ../../library/itertools.rst:691
14451446
msgid "Return *n* independent iterators from a single iterable."
@@ -1485,9 +1486,9 @@ msgstr ""
14851486
msgid ""
14861487
"When the input *iterable* is already a tee iterator object, all members of "
14871488
"the return tuple are constructed as if they had been produced by the "
1488-
"upstream :func:`tee` call. This \"flattening step\" allows nested :func:"
1489-
"`tee` calls to share the same underlying data chain and to have a single "
1490-
"update step rather than a chain of calls."
1489+
"upstream :func:`tee` call. This \"flattening step\" allows "
1490+
"nested :func:`tee` calls to share the same underlying data chain and to have "
1491+
"a single update step rather than a chain of calls."
14911492
msgstr ""
14921493

14931494
#: ../../library/itertools.rst:734
@@ -1521,19 +1522,19 @@ msgid ""
15211522
"even if the original *iterable* is threadsafe."
15221523
msgstr ""
15231524
"``tee`` 疊代器不是執行緒安全 (threadsafe) 的。當同時使用由同一個 :func:`tee` "
1524-
"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:"
1525-
"`RuntimeError`。"
1525+
"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引"
1526+
"發 :exc:`RuntimeError`。"
15261527

15271528
#: ../../library/itertools.rst:758
15281529
msgid ""
15291530
"This itertool may require significant auxiliary storage (depending on how "
15301531
"much temporary data needs to be stored). In general, if one iterator uses "
1531-
"most or all of the data before another iterator starts, it is faster to use :"
1532-
"func:`list` instead of :func:`tee`."
1532+
"most or all of the data before another iterator starts, it is faster to "
1533+
"use :func:`list` instead of :func:`tee`."
15331534
msgstr ""
15341535
"此 itertool 可能需要大量的輔助儲存空間(取決於需要儲存多少臨時資料)。通常如"
1535-
"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:"
1536-
"`list` 會比 :func:`tee` 更快。"
1536+
"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使"
1537+
"用 :func:`list` 會比 :func:`tee` 更快。"
15371538

15381539
#: ../../library/itertools.rst:766
15391540
msgid "Make an iterator that aggregates elements from each of the *iterables*."
@@ -1599,9 +1600,9 @@ msgstr ""
15991600

16001601
#: ../../library/itertools.rst:798
16011602
msgid ""
1602-
"If one of the iterables is potentially infinite, then the :func:"
1603-
"`zip_longest` function should be wrapped with something that limits the "
1604-
"number of calls (for example :func:`islice` or :func:`takewhile`)."
1603+
"If one of the iterables is potentially infinite, then "
1604+
"the :func:`zip_longest` function should be wrapped with something that "
1605+
"limits the number of calls (for example :func:`islice` or :func:`takewhile`)."
16051606
msgstr ""
16061607
"如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來包"
16071608
"裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。"
@@ -1624,16 +1625,16 @@ msgid ""
16241625
"``chain.from_iterable`` is related to the concept of flattening. The "
16251626
"recipes also give ideas about ways that the tools can be combined — for "
16261627
"example, how ``starmap()`` and ``repeat()`` can work together. The recipes "
1627-
"also show patterns for using itertools with the :mod:`operator` and :mod:"
1628-
"`collections` modules as well as with the built-in itertools such as "
1629-
"``map()``, ``filter()``, ``reversed()``, and ``enumerate()``."
1628+
"also show patterns for using itertools with the :mod:`operator` "
1629+
"and :mod:`collections` modules as well as with the built-in itertools such "
1630+
"as ``map()``, ``filter()``, ``reversed()``, and ``enumerate()``."
16301631
msgstr ""
16311632
"itertools 應用技巧的主要目的是教學。這些應用技巧展示了對單個工具進行思考的各"
16321633
"種方式 —— 例如,``chain.from_iterable`` 與攤平 (flattening) 的概念相關。這些"
16331634
"應用技巧還提供了組合使用工具的想法 —— 例如,``starmap()`` 和 ``repeat()`` 如"
1634-
"何一起工作。另外還展示了將 itertools 與 :mod:`operator` 和 :mod:"
1635-
"`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter()``、"
1636-
"``reversed()`` 和 ``enumerate()``)一同使用的模式。"
1635+
"何一起工作。另外還展示了將 itertools 與 :mod:`operator` "
1636+
"和 :mod:`collections` 模組一同使用以及與內建 itertools(如 ``map()``、"
1637+
"``filter()``、``reversed()`` 和 ``enumerate()``)一同使用的模式。"
16371638

16381639
#: ../../library/itertools.rst:820
16391640
msgid ""
@@ -1652,8 +1653,8 @@ msgid ""
16521653
"Substantially all of these recipes and many, many others can be installed "
16531654
"from the :pypi:`more-itertools` project found on the Python Package Index::"
16541655
msgstr ""
1655-
"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :"
1656-
"pypi:`more-itertools` 專案中安裝: ::"
1656+
"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index "
1657+
"的 :pypi:`more-itertools` 專案中安裝: ::"
16571658

16581659
#: ../../library/itertools.rst:829
16591660
msgid "python -m pip install more-itertools"
@@ -1674,15 +1675,15 @@ msgstr ""
16741675
"可疊代物件一次性引入記憶體,能保持優異的記憶體性能。以\\ `函式風格 "
16751676
"(functional style) <https://www.cs.kent.ac.uk/people/staff/dat/miranda/"
16761677
"whyfp90.pdf>`_ 將工具連接在一起,能將程式碼的數量維持在較少的情況。透過優先使"
1677-
"用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和\\ :"
1678-
"term:`產生器 <generator>`,則能保持高速度。"
1678+
"用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和"
1679+
"\\ :term:`產生器 <generator>`,則能保持高速度。"
16791680

16801681
#: ../../library/itertools.rst:839
16811682
msgid ""
1682-
"from collections import deque\n"
1683+
"from collections import Counter, deque\n"
16831684
"from contextlib import suppress\n"
16841685
"from functools import reduce\n"
1685-
"from math import sumprod, isqrt\n"
1686+
"from math import comb, prod, sumprod, isqrt\n"
16861687
"from operator import itemgetter, getitem, mul, neg\n"
16871688
"\n"
16881689
"def take(n, iterable):\n"
@@ -1972,7 +1973,13 @@ msgid ""
19721973
" # totient(12) → 4 because len([1, 5, 7, 11]) == 4\n"
19731974
" for prime in set(factor(n)):\n"
19741975
" n -= n // prime\n"
1975-
" return n"
1976+
" return n\n"
1977+
"\n"
1978+
"def multinomial(*counts):\n"
1979+
" \"Number of distinct arrangements of a multiset.\"\n"
1980+
" # Counter('abracadabra').values() -> 5 2 1 1 2\n"
1981+
" # multinomial(5, 2, 1, 1, 2) → 83160\n"
1982+
" return prod(map(comb, accumulate(counts), counts))"
19761983
msgstr ""
19771984

19781985
#~ msgid ""

0 commit comments

Comments
 (0)