Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc857be3

Browse files
authored
Merge branch '3.12' into cron/sync/3.12
2 parents1f5e744 +485c468 commitc857be3

File tree

4 files changed

+476
-187
lines changed

4 files changed

+476
-187
lines changed

‎library/itertools.po

Lines changed: 89 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version:Python 3.12\n"
99
"Report-Msgid-Bugs-To:\n"
1010
"POT-Creation-Date:2024-07-20 00:03+0000\n"
11-
"PO-Revision-Date:2024-07-09 13:34+0800\n"
11+
"PO-Revision-Date:2024-08-16 15:01+0800\n"
1212
"Last-Translator:Adrian Liaw <adrianliaw2000@gmail.com>\n"
1313
"Language-Team:Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1414
"tw)\n"
@@ -543,7 +543,7 @@ msgid ""
543543
"when ``r > n``."
544544
msgstr""
545545
"輸出是 :func:`product` 的子序列,僅保留作為 *iterable* 子序列的條目。輸出的長"
546-
"度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,計算 ``n! / r! / (n - r)!"
546+
"度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / r! / (n - r)!"
547547
"``,當 ``r > n`` 時為零。"
548548

549549
#:../../library/itertools.rst:228
@@ -606,8 +606,8 @@ msgid ""
606606
"element in *selectors* is true. Stops when either the *data* or *selectors* "
607607
"iterables have been exhausted. Roughly equivalent to::"
608608
msgstr""
609-
"建立一個疊代器,回傳 *data* 中對應 *selectors*的元素為真的元素。當 *data* "
610-
"或 *selectors* 可疊代物件耗盡時停止。大致等價於: ::"
609+
"建立一個疊代器,回傳 *data* 中對應 *selectors*的元素為 true 的元素。當 "
610+
"*data*或 *selectors* 可疊代物件耗盡時停止。大致等價於: ::"
611611

612612
#:../../library/itertools.rst:319
613613
msgid""
@@ -652,8 +652,8 @@ msgid ""
652652
"*predicate* is true and afterwards returns every element. Roughly "
653653
"equivalent to::"
654654
msgstr""
655-
"建立一個疊代器,在 *predicate*為真時丟棄*iterable* 中的元素,之後回傳每個元"
656-
"。大致等價於:"
655+
"建立一個疊代器,在 *predicate*為 true 時丟棄*iterable* 中的元素,之後回傳每"
656+
"個元素。大致等價於:"
657657

658658
#:../../library/itertools.rst:378
659659
msgid""
@@ -719,48 +719,62 @@ msgid ""
719719
"like sequence slicing but does not support negative values for *start*, "
720720
"*stop*, or *step*."
721721
msgstr""
722+
"建立一個疊代器,回傳從 iterable 中選取的元素。其作用類似於序列切片 (sequence "
723+
"slicing),但不支援負數的 *start*、*stop* 或 *step* 的值。"
722724

723725
#:../../library/itertools.rst:466
724726
msgid""
725727
"If *start* is zero or ``None``, iteration starts at zero. Otherwise, "
726728
"elements from the iterable are skipped until *start* is reached."
727729
msgstr""
730+
"如果 *start* 為零或 ``None``,則從零開始疊代。否則在達到 *start* 之前,會跳"
731+
"過 iterable 中的元素。"
728732

729733
#:../../library/itertools.rst:469
730734
msgid""
731735
"If *stop* is ``None``, iteration continues until the iterator is exhausted, "
732736
"if at all. Otherwise, it stops at the specified position."
733737
msgstr""
738+
"如果 *stop* 為 ``None``,則疊代將繼續前進直到疊代器耗盡。如果指定了 *stop*,"
739+
"則在達到指定位置時停止。"
734740

735741
#:../../library/itertools.rst:472
736742
msgid""
737743
"If *step* is ``None``, the step defaults to one. Elements are returned "
738744
"consecutively unless *step* is set higher than one which results in items "
739745
"being skipped."
740746
msgstr""
747+
"如果 *step* 為 ``None``,則步長 (step) 預設為一。元素會連續回傳,除非將 "
748+
"*step* 設定為大於一,這會導致一些項目被跳過。"
741749

742750
#:../../library/itertools.rst:501
743751
msgid"Return successive overlapping pairs taken from the input *iterable*."
744-
msgstr""
752+
msgstr"回傳從輸入的 *iterable* 中提取的連續重疊對。"
745753

746754
#:../../library/itertools.rst:503
747755
msgid""
748756
"The number of 2-tuples in the output iterator will be one fewer than the "
749757
"number of inputs. It will be empty if the input iterable has fewer than two "
750758
"values."
751759
msgstr""
760+
"輸出疊代器中的 2 元組數量將比輸入少一個。如果輸入的可疊代物件中的值少於兩個,"
761+
"則輸出將為空值。"
752762

753763
#:../../library/itertools.rst:522
754764
msgid""
755765
"Return successive *r* length `permutations of elements <https://www."
756766
"britannica.com/science/permutation>`_ from the *iterable*."
757767
msgstr""
768+
"回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 <https://www.britannica."
769+
"com/science/permutation>`_ 。"
758770

759771
#:../../library/itertools.rst:525
760772
msgid""
761773
"If *r* is not specified or is ``None``, then *r* defaults to the length of "
762774
"the *iterable* and all possible full-length permutations are generated."
763775
msgstr""
776+
"如果未指定 *r* 或其值為 ``None``,則 *r* 預設為 *iterable* 的長度,並產生所有"
777+
"可能的完整長度的排列。"
764778

765779
#:../../library/itertools.rst:529
766780
msgid""
@@ -769,31 +783,40 @@ msgid ""
769783
"`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero when "
770784
"``r > n``."
771785
msgstr""
786+
"輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度由 :"
787+
"func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r "
788+
"> n`` 時為零。"
772789

773790
#:../../library/itertools.rst:534
774791
msgid""
775792
"The permutation tuples are emitted in lexicographic order according to the "
776793
"order of the input *iterable*. If the input *iterable* is sorted, the "
777794
"output tuples will be produced in sorted order."
778795
msgstr""
796+
"根據輸入值 *iterable* 的順序,排列的元組會按照字典順序輸出。如果輸入的 "
797+
"*iterable* 已排序,則輸出的元組也將按排序的順序產生。"
779798

780799
#:../../library/itertools.rst:538
781800
msgid""
782801
"Elements are treated as unique based on their position, not on their value. "
783802
"If the input elements are unique, there will be no repeated values within a "
784803
"permutation."
785804
msgstr""
805+
"元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,則排"
806+
"列中將不會有重複的值。"
786807

787808
#:../../library/itertools.rst:575
788809
msgid"Cartesian product of input iterables."
789-
msgstr""
810+
msgstr"輸入的 iterables 的笛卡爾乘積。"
790811

791812
#:../../library/itertools.rst:577
792813
msgid""
793814
"Roughly equivalent to nested for-loops in a generator expression. For "
794815
"example, ``product(A, B)`` returns the same as ``((x,y) for x in A for y in "
795816
"B)``."
796817
msgstr""
818+
"大致等價於產生器運算式中的巢狀 for 迴圈。例如,``product(A, B)`` 的回傳結果"
819+
"與 ``((x,y) for x in A for y in B)`` 相同。"
797820

798821
#:../../library/itertools.rst:580
799822
msgid""
@@ -802,58 +825,74 @@ msgid ""
802825
"if the input's iterables are sorted, the product tuples are emitted in "
803826
"sorted order."
804827
msgstr""
828+
"巢狀迴圈的循環類似於里程表,最右邊的元素在每次疊代時前進。這種模式會建立字典"
829+
"順序,因此如果輸入的 iterables 已排序,則輸出的乘積元組也將按排序的順序產生。"
805830

806831
#:../../library/itertools.rst:585
807832
msgid""
808833
"To compute the product of an iterable with itself, specify the number of "
809834
"repetitions with the optional *repeat* keyword argument. For example, "
810835
"``product(A, repeat=4)`` means the same as ``product(A, A, A, A)``."
811836
msgstr""
837+
"要計算可疊代物件自身的乘積,可以使用可選的 *repeat* 關鍵字引數來指定重複次"
838+
"數。例如,``product(A, repeat=4)`` 與 ``product(A, A, A, A)`` 相同。"
812839

813840
#:../../library/itertools.rst:589
814841
msgid""
815842
"This function is roughly equivalent to the following code, except that the "
816843
"actual implementation does not build up intermediate results in memory::"
817844
msgstr""
845+
"此函式大致等價於以下的程式碼,不同之處在於真正的實作不會在記憶體中建立中間結"
846+
"果: ::"
818847

819848
#:../../library/itertools.rst:605
820849
msgid""
821850
"Before :func:`product` runs, it completely consumes the input iterables, "
822851
"keeping pools of values in memory to generate the products. Accordingly, it "
823852
"is only useful with finite inputs."
824853
msgstr""
854+
"在 :func:`product` 執行之前,它會完全消耗輸入的 iterables,並將值的池 (pools "
855+
"of values) 保存在記憶體中以產生乘積。因此,它僅對有限的輸入有用。"
825856

826857
#:../../library/itertools.rst:612
827858
msgid""
828859
"Make an iterator that returns *object* over and over again. Runs "
829860
"indefinitely unless the *times* argument is specified."
830861
msgstr""
862+
"建立一個疊代器,反覆回傳 *object*。除非指定了 *times* 引數,否則會執行無限"
863+
"次。"
831864

832865
#:../../library/itertools.rst:626
833866
msgid""
834867
"A common use for *repeat* is to supply a stream of constant values to *map* "
835868
"or *zip*:"
836-
msgstr""
869+
msgstr"*repeat* 的常見用途是為 *map* 或 *zip* 提供定值的串流:"
837870

838871
#:../../library/itertools.rst:637
839872
msgid""
840873
"Make an iterator that computes the *function* using arguments obtained from "
841874
"the *iterable*. Used instead of :func:`map` when argument parameters have "
842875
"already been\"pre-zipped\" into tuples."
843876
msgstr""
877+
"建立一個疊代器,使用從 *iterable* 獲取的引數計算 *function* 。當引數參數已經"
878+
"被「預先壓縮 (pre-zipped)」成元組時,使用此方法代替 :func:`map`。"
844879

845880
#:../../library/itertools.rst:641
846881
msgid""
847882
"The difference between :func:`map` and :func:`starmap` parallels the "
848883
"distinction between ``function(a,b)`` and ``function(*c)``. Roughly "
849884
"equivalent to::"
850885
msgstr""
886+
":func:`map` 和 :func:`starmap` 之間的區別類似於 ``function(a,b)`` 和 "
887+
"``function(*c)`` 之間的區別。大致等價於:"
851888

852889
#:../../library/itertools.rst:653
853890
msgid""
854891
"Make an iterator that returns elements from the *iterable* as long as the "
855892
"*predicate* is true. Roughly equivalent to::"
856893
msgstr""
894+
"建立一個疊代器,只在 *predicate* 為 true 時回傳 *iterable* 中的元素。大致等價"
895+
"於:"
857896

858897
#:../../library/itertools.rst:663
859898
msgid""
@@ -864,24 +903,34 @@ msgid ""
864903
"consider using `more-iterools before_and_after() <https://more-itertools."
865904
"readthedocs.io/en/stable/api.html#more_itertools.before_and_after>`_ instead."
866905
msgstr""
906+
"注意,第一個不符合條件判斷的元素將從輸入疊代器中被消耗,且無法再存取它。如果"
907+
"應用程式希望在 *takewhile* 耗盡後進一步消耗輸入疊代器,這可能會是個問題。為了"
908+
"解決這個問題,可以考慮使用 `more-itertools 中的 before_and_after() <https://"
909+
"more-itertools.readthedocs.io/en/stable/api.html#more_itertools."
910+
"before_and_after>`_ 作為替代。"
867911

868912
#:../../library/itertools.rst:674
869913
msgid"Return *n* independent iterators from a single iterable."
870-
msgstr""
914+
msgstr"從一個 iterable 中回傳 *n* 個獨立的疊代器。"
871915

872916
#:../../library/itertools.rst:694
873917
msgid""
874918
"Once a :func:`tee` has been created, the original *iterable* should not be "
875919
"used anywhere else; otherwise, the *iterable* could get advanced without the "
876920
"tee objects being informed."
877921
msgstr""
922+
"一旦建立了 :func:`tee`,原始的 *iterable* 不應在其他地方使用;否則,"
923+
"*iterable* 可能會在 tee 物件未被通知的情況下前進。"
878924

879925
#:../../library/itertools.rst:698
880926
msgid""
881927
"``tee`` iterators are not threadsafe. A :exc:`RuntimeError` may be raised "
882928
"when simultaneously using iterators returned by the same :func:`tee` call, "
883929
"even if the original *iterable* is threadsafe."
884930
msgstr""
931+
"``tee`` 疊代器不是執行緒安全 (threadsafe) 的。當同時使用由同一個 :func:`tee` "
932+
"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:"
933+
"`RuntimeError`。"
885934

886935
#:../../library/itertools.rst:702
887936
msgid""
@@ -890,37 +939,45 @@ msgid ""
890939
"most or all of the data before another iterator starts, it is faster to use :"
891940
"func:`list` instead of :func:`tee`."
892941
msgstr""
942+
"此 itertool 可能需要大量的輔助儲存空間(取決於需要儲存多少臨時資料)。通常如"
943+
"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:"
944+
"`list` 會比 :func:`tee` 更快。"
893945

894946
#:../../library/itertools.rst:710
895947
msgid"Make an iterator that aggregates elements from each of the *iterables*."
896-
msgstr""
948+
msgstr"建立一個疊代器,聚合來自每個 *iterables* 中的元素。"
897949

898950
#:../../library/itertools.rst:713
899951
msgid""
900952
"If the iterables are of uneven length, missing values are filled-in with "
901953
"*fillvalue*. If not specified, *fillvalue* defaults to ``None``."
902954
msgstr""
955+
"如果 iterables 的長度不一,則使用 *fillvalue* 填充缺少的值。如果未指定,"
956+
"*fillvalue* 會預設為 ``None``。"
903957

904958
#:../../library/itertools.rst:716
905959
msgid"Iteration continues until the longest iterable is exhausted."
906-
msgstr""
960+
msgstr"疊代將持續直到最長的可疊代物件耗盡為止。"
907961

908962
#:../../library/itertools.rst:742
909963
msgid""
910964
"If one of the iterables is potentially infinite, then the :func:"
911965
"`zip_longest` function should be wrapped with something that limits the "
912966
"number of calls (for example :func:`islice` or :func:`takewhile`)."
913967
msgstr""
968+
"如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來"
969+
"包裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。"
914970

915971
#:../../library/itertools.rst:750
916972
msgid"Itertools Recipes"
917-
msgstr""
973+
msgstr"Itertools 應用技巧"
918974

919975
#:../../library/itertools.rst:752
920976
msgid""
921977
"This section shows recipes for creating an extended toolset using the "
922978
"existing itertools as building blocks."
923979
msgstr""
980+
"此段落展示了使用現有的 itertools 作為構建塊來建立擴展工具集的應用技巧。"
924981

925982
#:../../library/itertools.rst:755
926983
msgid""
@@ -933,6 +990,12 @@ msgid ""
933990
"`collections` modules as well as with the built-in itertools such as "
934991
"``map()``, ``filter()``, ``reversed()``, and ``enumerate()``."
935992
msgstr""
993+
"itertools 應用技巧的主要目的是教學。這些應用技巧展示了對單個工具進行思考的各"
994+
"種方式 —— 例如,``chain.from_iterable`` 與攤平 (flattening) 的概念相關。這些"
995+
"應用技巧還提供了組合使用工具的想法 —— 例如,``starmap()`` 和 ``repeat()`` 如"
996+
"何一起工作。另外還展示了將 itertools 與 :mod:`operator` 和 :mod:"
997+
"`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter()``、"
998+
"``reversed()`` 和 ``enumerate()``)一同使用的模式。"
936999

9371000
#:../../library/itertools.rst:764
9381001
msgid""
@@ -941,12 +1004,18 @@ msgid ""
9411004
"as recipes. Currently, the ``sliding_window()``, ``iter_index()``, and "
9421005
"``sieve()`` recipes are being tested to see whether they prove their worth."
9431006
msgstr""
1007+
"應用技巧的次要目的是作為 itertools 的孵化器。``accumulate()``, "
1008+
"``compress()`` 和 ``pairwise()`` itertools 最初都是作為應用技巧出現的。目前,"
1009+
"``sliding_window()``、``iter_index()`` 和 ``sieve()`` 的應用技巧正在被測試,"
1010+
"以確定它們是否有價值被收錄到內建的 itertools 中。"
9441011

9451012
#:../../library/itertools.rst:769
9461013
msgid""
9471014
"Substantially all of these recipes and many, many others can be installed "
9481015
"from the :pypi:`more-itertools` project found on the Python Package Index::"
9491016
msgstr""
1017+
"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :"
1018+
"pypi:`more-itertools` 專案中安裝: ::"
9501019

9511020
#:../../library/itertools.rst:775
9521021
msgid""
@@ -959,10 +1028,16 @@ msgid ""
9591028
"of for-loops and :term:`generators <generator>` which incur interpreter "
9601029
"overhead."
9611030
msgstr""
1031+
"許多應用技巧提供了與底層工具集相同的高性能。透過一次處理一個元素而不是將整個"
1032+
"可疊代物件一次性引入記憶體,能保持優異的記憶體性能。以\\ `函式風格 "
1033+
"(functional style) <https://www.cs.kent.ac.uk/people/staff/dat/miranda/"
1034+
"whyfp90.pdf>`_ 將工具連接在一起,能將程式碼的數量維持在較少的情況。透過優先使"
1035+
"用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和\\ :"
1036+
"term:`產生器 <generator>`,則能保持高速度。"
9621037

9631038
#:../../library/itertools.rst:956
9641039
msgid"The following recipes have a more mathematical flavor:"
965-
msgstr""
1040+
msgstr"以下的應用技巧具有更多的數學風格:"
9661041

9671042
#~ msgid "``filterfalse(lambda x: x%2, range(10)) → 0 2 4 6 8``"
9681043
#~ msgstr "``filterfalse(lambda x: x%2, range(10)) → 0 2 4 6 8``"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp