@@ -8,7 +8,7 @@ msgstr ""
8
8
"Project-Id-Version : Python 3.12\n "
9
9
"Report-Msgid-Bugs-To : \n "
10
10
"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 "
12
12
"
Last-Translator :
Adrian Liaw <[email protected] >\n "
13
13
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
14
14
"tw)\n "
@@ -543,7 +543,7 @@ msgid ""
543
543
"when ``r > n``."
544
544
msgstr ""
545
545
"輸出是 :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)!"
547
547
"``,當 ``r > n`` 時為零。"
548
548
549
549
#: ../../library/itertools.rst:228
@@ -606,8 +606,8 @@ msgid ""
606
606
"element in *selectors* is true. Stops when either the *data* or *selectors* "
607
607
"iterables have been exhausted. Roughly equivalent to::"
608
608
msgstr ""
609
- "建立一個疊代器,回傳 *data* 中對應 *selectors* 的元素為真的元素。當 *data* "
610
- "或 *selectors* 可疊代物件耗盡時停止。大致等價於: ::"
609
+ "建立一個疊代器,回傳 *data* 中對應 *selectors* 的元素為 true 的元素。當 "
610
+ "*data* 或 *selectors* 可疊代物件耗盡時停止。大致等價於: ::"
611
611
612
612
#: ../../library/itertools.rst:319
613
613
msgid ""
@@ -652,8 +652,8 @@ msgid ""
652
652
"*predicate* is true and afterwards returns every element. Roughly "
653
653
"equivalent to::"
654
654
msgstr ""
655
- "建立一個疊代器,在 *predicate* 為真時丟棄 *iterable* 中的元素,之後回傳每個元 "
656
- "素 。大致等價於:"
655
+ "建立一個疊代器,在 *predicate* 為 true 時丟棄 *iterable* 中的元素,之後回傳每 "
656
+ "個元素 。大致等價於:"
657
657
658
658
#: ../../library/itertools.rst:378
659
659
msgid ""
@@ -719,48 +719,62 @@ msgid ""
719
719
"like sequence slicing but does not support negative values for *start*, "
720
720
"*stop*, or *step*."
721
721
msgstr ""
722
+ "建立一個疊代器,回傳從 iterable 中選取的元素。其作用類似於序列切片 (sequence "
723
+ "slicing),但不支援負數的 *start*、*stop* 或 *step* 的值。"
722
724
723
725
#: ../../library/itertools.rst:466
724
726
msgid ""
725
727
"If *start* is zero or ``None``, iteration starts at zero. Otherwise, "
726
728
"elements from the iterable are skipped until *start* is reached."
727
729
msgstr ""
730
+ "如果 *start* 為零或 ``None``,則從零開始疊代。否則在達到 *start* 之前,會跳"
731
+ "過 iterable 中的元素。"
728
732
729
733
#: ../../library/itertools.rst:469
730
734
msgid ""
731
735
"If *stop* is ``None``, iteration continues until the iterator is exhausted, "
732
736
"if at all. Otherwise, it stops at the specified position."
733
737
msgstr ""
738
+ "如果 *stop* 為 ``None``,則疊代將繼續前進直到疊代器耗盡。如果指定了 *stop*,"
739
+ "則在達到指定位置時停止。"
734
740
735
741
#: ../../library/itertools.rst:472
736
742
msgid ""
737
743
"If *step* is ``None``, the step defaults to one. Elements are returned "
738
744
"consecutively unless *step* is set higher than one which results in items "
739
745
"being skipped."
740
746
msgstr ""
747
+ "如果 *step* 為 ``None``,則步長 (step) 預設為一。元素會連續回傳,除非將 "
748
+ "*step* 設定為大於一,這會導致一些項目被跳過。"
741
749
742
750
#: ../../library/itertools.rst:501
743
751
msgid "Return successive overlapping pairs taken from the input *iterable*."
744
- msgstr ""
752
+ msgstr "回傳從輸入的 *iterable* 中提取的連續重疊對。 "
745
753
746
754
#: ../../library/itertools.rst:503
747
755
msgid ""
748
756
"The number of 2-tuples in the output iterator will be one fewer than the "
749
757
"number of inputs. It will be empty if the input iterable has fewer than two "
750
758
"values."
751
759
msgstr ""
760
+ "輸出疊代器中的 2 元組數量將比輸入少一個。如果輸入的可疊代物件中的值少於兩個,"
761
+ "則輸出將為空值。"
752
762
753
763
#: ../../library/itertools.rst:522
754
764
msgid ""
755
765
"Return successive *r* length `permutations of elements <https://www."
756
766
"britannica.com/science/permutation>`_ from the *iterable*."
757
767
msgstr ""
768
+ "回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 <https://www.britannica."
769
+ "com/science/permutation>`_ 。"
758
770
759
771
#: ../../library/itertools.rst:525
760
772
msgid ""
761
773
"If *r* is not specified or is ``None``, then *r* defaults to the length of "
762
774
"the *iterable* and all possible full-length permutations are generated."
763
775
msgstr ""
776
+ "如果未指定 *r* 或其值為 ``None``,則 *r* 預設為 *iterable* 的長度,並產生所有"
777
+ "可能的完整長度的排列。"
764
778
765
779
#: ../../library/itertools.rst:529
766
780
msgid ""
@@ -769,31 +783,40 @@ msgid ""
769
783
"`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero when "
770
784
"``r > n``."
771
785
msgstr ""
786
+ "輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度由 :"
787
+ "func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r "
788
+ "> n`` 時為零。"
772
789
773
790
#: ../../library/itertools.rst:534
774
791
msgid ""
775
792
"The permutation tuples are emitted in lexicographic order according to the "
776
793
"order of the input *iterable*. If the input *iterable* is sorted, the "
777
794
"output tuples will be produced in sorted order."
778
795
msgstr ""
796
+ "根據輸入值 *iterable* 的順序,排列的元組會按照字典順序輸出。如果輸入的 "
797
+ "*iterable* 已排序,則輸出的元組也將按排序的順序產生。"
779
798
780
799
#: ../../library/itertools.rst:538
781
800
msgid ""
782
801
"Elements are treated as unique based on their position, not on their value. "
783
802
"If the input elements are unique, there will be no repeated values within a "
784
803
"permutation."
785
804
msgstr ""
805
+ "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,則排"
806
+ "列中將不會有重複的值。"
786
807
787
808
#: ../../library/itertools.rst:575
788
809
msgid "Cartesian product of input iterables."
789
- msgstr ""
810
+ msgstr "輸入的 iterables 的笛卡爾乘積。 "
790
811
791
812
#: ../../library/itertools.rst:577
792
813
msgid ""
793
814
"Roughly equivalent to nested for-loops in a generator expression. For "
794
815
"example, ``product(A, B)`` returns the same as ``((x,y) for x in A for y in "
795
816
"B)``."
796
817
msgstr ""
818
+ "大致等價於產生器運算式中的巢狀 for 迴圈。例如,``product(A, B)`` 的回傳結果"
819
+ "與 ``((x,y) for x in A for y in B)`` 相同。"
797
820
798
821
#: ../../library/itertools.rst:580
799
822
msgid ""
@@ -802,58 +825,74 @@ msgid ""
802
825
"if the input's iterables are sorted, the product tuples are emitted in "
803
826
"sorted order."
804
827
msgstr ""
828
+ "巢狀迴圈的循環類似於里程表,最右邊的元素在每次疊代時前進。這種模式會建立字典"
829
+ "順序,因此如果輸入的 iterables 已排序,則輸出的乘積元組也將按排序的順序產生。"
805
830
806
831
#: ../../library/itertools.rst:585
807
832
msgid ""
808
833
"To compute the product of an iterable with itself, specify the number of "
809
834
"repetitions with the optional *repeat* keyword argument. For example, "
810
835
"``product(A, repeat=4)`` means the same as ``product(A, A, A, A)``."
811
836
msgstr ""
837
+ "要計算可疊代物件自身的乘積,可以使用可選的 *repeat* 關鍵字引數來指定重複次"
838
+ "數。例如,``product(A, repeat=4)`` 與 ``product(A, A, A, A)`` 相同。"
812
839
813
840
#: ../../library/itertools.rst:589
814
841
msgid ""
815
842
"This function is roughly equivalent to the following code, except that the "
816
843
"actual implementation does not build up intermediate results in memory::"
817
844
msgstr ""
845
+ "此函式大致等價於以下的程式碼,不同之處在於真正的實作不會在記憶體中建立中間結"
846
+ "果: ::"
818
847
819
848
#: ../../library/itertools.rst:605
820
849
msgid ""
821
850
"Before :func:`product` runs, it completely consumes the input iterables, "
822
851
"keeping pools of values in memory to generate the products. Accordingly, it "
823
852
"is only useful with finite inputs."
824
853
msgstr ""
854
+ "在 :func:`product` 執行之前,它會完全消耗輸入的 iterables,並將值的池 (pools "
855
+ "of values) 保存在記憶體中以產生乘積。因此,它僅對有限的輸入有用。"
825
856
826
857
#: ../../library/itertools.rst:612
827
858
msgid ""
828
859
"Make an iterator that returns *object* over and over again. Runs "
829
860
"indefinitely unless the *times* argument is specified."
830
861
msgstr ""
862
+ "建立一個疊代器,反覆回傳 *object*。除非指定了 *times* 引數,否則會執行無限"
863
+ "次。"
831
864
832
865
#: ../../library/itertools.rst:626
833
866
msgid ""
834
867
"A common use for *repeat* is to supply a stream of constant values to *map* "
835
868
"or *zip*:"
836
- msgstr ""
869
+ msgstr "*repeat* 的常見用途是為 *map* 或 *zip* 提供定值的串流: "
837
870
838
871
#: ../../library/itertools.rst:637
839
872
msgid ""
840
873
"Make an iterator that computes the *function* using arguments obtained from "
841
874
"the *iterable*. Used instead of :func:`map` when argument parameters have "
842
875
"already been \" pre-zipped\" into tuples."
843
876
msgstr ""
877
+ "建立一個疊代器,使用從 *iterable* 獲取的引數計算 *function* 。當引數參數已經"
878
+ "被「預先壓縮 (pre-zipped)」成元組時,使用此方法代替 :func:`map`。"
844
879
845
880
#: ../../library/itertools.rst:641
846
881
msgid ""
847
882
"The difference between :func:`map` and :func:`starmap` parallels the "
848
883
"distinction between ``function(a,b)`` and ``function(*c)``. Roughly "
849
884
"equivalent to::"
850
885
msgstr ""
886
+ ":func:`map` 和 :func:`starmap` 之間的區別類似於 ``function(a,b)`` 和 "
887
+ "``function(*c)`` 之間的區別。大致等價於:"
851
888
852
889
#: ../../library/itertools.rst:653
853
890
msgid ""
854
891
"Make an iterator that returns elements from the *iterable* as long as the "
855
892
"*predicate* is true. Roughly equivalent to::"
856
893
msgstr ""
894
+ "建立一個疊代器,只在 *predicate* 為 true 時回傳 *iterable* 中的元素。大致等價"
895
+ "於:"
857
896
858
897
#: ../../library/itertools.rst:663
859
898
msgid ""
@@ -864,24 +903,34 @@ msgid ""
864
903
"consider using `more-iterools before_and_after() <https://more-itertools."
865
904
"readthedocs.io/en/stable/api.html#more_itertools.before_and_after>`_ instead."
866
905
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>`_ 作為替代。"
867
911
868
912
#: ../../library/itertools.rst:674
869
913
msgid "Return *n* independent iterators from a single iterable."
870
- msgstr ""
914
+ msgstr "從一個 iterable 中回傳 *n* 個獨立的疊代器。 "
871
915
872
916
#: ../../library/itertools.rst:694
873
917
msgid ""
874
918
"Once a :func:`tee` has been created, the original *iterable* should not be "
875
919
"used anywhere else; otherwise, the *iterable* could get advanced without the "
876
920
"tee objects being informed."
877
921
msgstr ""
922
+ "一旦建立了 :func:`tee`,原始的 *iterable* 不應在其他地方使用;否則,"
923
+ "*iterable* 可能會在 tee 物件未被通知的情況下前進。"
878
924
879
925
#: ../../library/itertools.rst:698
880
926
msgid ""
881
927
"``tee`` iterators are not threadsafe. A :exc:`RuntimeError` may be raised "
882
928
"when simultaneously using iterators returned by the same :func:`tee` call, "
883
929
"even if the original *iterable* is threadsafe."
884
930
msgstr ""
931
+ "``tee`` 疊代器不是執行緒安全 (threadsafe) 的。當同時使用由同一個 :func:`tee` "
932
+ "呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:"
933
+ "`RuntimeError`。"
885
934
886
935
#: ../../library/itertools.rst:702
887
936
msgid ""
@@ -890,37 +939,45 @@ msgid ""
890
939
"most or all of the data before another iterator starts, it is faster to use :"
891
940
"func:`list` instead of :func:`tee`."
892
941
msgstr ""
942
+ "此 itertool 可能需要大量的輔助儲存空間(取決於需要儲存多少臨時資料)。通常如"
943
+ "果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:"
944
+ "`list` 會比 :func:`tee` 更快。"
893
945
894
946
#: ../../library/itertools.rst:710
895
947
msgid "Make an iterator that aggregates elements from each of the *iterables*."
896
- msgstr ""
948
+ msgstr "建立一個疊代器,聚合來自每個 *iterables* 中的元素。 "
897
949
898
950
#: ../../library/itertools.rst:713
899
951
msgid ""
900
952
"If the iterables are of uneven length, missing values are filled-in with "
901
953
"*fillvalue*. If not specified, *fillvalue* defaults to ``None``."
902
954
msgstr ""
955
+ "如果 iterables 的長度不一,則使用 *fillvalue* 填充缺少的值。如果未指定,"
956
+ "*fillvalue* 會預設為 ``None``。"
903
957
904
958
#: ../../library/itertools.rst:716
905
959
msgid "Iteration continues until the longest iterable is exhausted."
906
- msgstr ""
960
+ msgstr "疊代將持續直到最長的可疊代物件耗盡為止。 "
907
961
908
962
#: ../../library/itertools.rst:742
909
963
msgid ""
910
964
"If one of the iterables is potentially infinite, then the :func:"
911
965
"`zip_longest` function should be wrapped with something that limits the "
912
966
"number of calls (for example :func:`islice` or :func:`takewhile`)."
913
967
msgstr ""
968
+ "如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來"
969
+ "包裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。"
914
970
915
971
#: ../../library/itertools.rst:750
916
972
msgid "Itertools Recipes"
917
- msgstr ""
973
+ msgstr "Itertools 應用技巧 "
918
974
919
975
#: ../../library/itertools.rst:752
920
976
msgid ""
921
977
"This section shows recipes for creating an extended toolset using the "
922
978
"existing itertools as building blocks."
923
979
msgstr ""
980
+ "此段落展示了使用現有的 itertools 作為構建塊來建立擴展工具集的應用技巧。"
924
981
925
982
#: ../../library/itertools.rst:755
926
983
msgid ""
@@ -933,6 +990,12 @@ msgid ""
933
990
"`collections` modules as well as with the built-in itertools such as "
934
991
"``map()``, ``filter()``, ``reversed()``, and ``enumerate()``."
935
992
msgstr ""
993
+ "itertools 應用技巧的主要目的是教學。這些應用技巧展示了對單個工具進行思考的各"
994
+ "種方式 —— 例如,``chain.from_iterable`` 與攤平 (flattening) 的概念相關。這些"
995
+ "應用技巧還提供了組合使用工具的想法 —— 例如,``starmap()`` 和 ``repeat()`` 如"
996
+ "何一起工作。另外還展示了將 itertools 與 :mod:`operator` 和 :mod:"
997
+ "`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter()``、"
998
+ "``reversed()`` 和 ``enumerate()``)一同使用的模式。"
936
999
937
1000
#: ../../library/itertools.rst:764
938
1001
msgid ""
@@ -941,12 +1004,18 @@ msgid ""
941
1004
"as recipes. Currently, the ``sliding_window()``, ``iter_index()``, and "
942
1005
"``sieve()`` recipes are being tested to see whether they prove their worth."
943
1006
msgstr ""
1007
+ "應用技巧的次要目的是作為 itertools 的孵化器。``accumulate()``, "
1008
+ "``compress()`` 和 ``pairwise()`` itertools 最初都是作為應用技巧出現的。目前,"
1009
+ "``sliding_window()``、``iter_index()`` 和 ``sieve()`` 的應用技巧正在被測試,"
1010
+ "以確定它們是否有價值被收錄到內建的 itertools 中。"
944
1011
945
1012
#: ../../library/itertools.rst:769
946
1013
msgid ""
947
1014
"Substantially all of these recipes and many, many others can be installed "
948
1015
"from the :pypi:`more-itertools` project found on the Python Package Index::"
949
1016
msgstr ""
1017
+ "幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :"
1018
+ "pypi:`more-itertools` 專案中安裝: ::"
950
1019
951
1020
#: ../../library/itertools.rst:775
952
1021
msgid ""
@@ -959,10 +1028,16 @@ msgid ""
959
1028
"of for-loops and :term:`generators <generator>` which incur interpreter "
960
1029
"overhead."
961
1030
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>`,則能保持高速度。"
962
1037
963
1038
#: ../../library/itertools.rst:956
964
1039
msgid "The following recipes have a more mathematical flavor:"
965
- msgstr ""
1040
+ msgstr "以下的應用技巧具有更多的數學風格: "
966
1041
967
1042
#~ msgid "``filterfalse(lambda x: x%2, range(10)) → 0 2 4 6 8``"
968
1043
#~ msgstr "``filterfalse(lambda x: x%2, range(10)) → 0 2 4 6 8``"
0 commit comments