-
-
Notifications
You must be signed in to change notification settings - Fork 224
Expand file tree
/
Copy pathcollections.po
More file actions
1675 lines (1464 loc) · 73.8 KB
/
collections.po
File metadata and controls
1675 lines (1464 loc) · 73.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2022, Python Software Foundation
# This file is distributed under the same license as the Python package.
#
# Translators:
# 周 忠毅 <rilakcrc35@gmail.com>, 2016
# Adrian Liaw <adrianliaw2000@gmail.com>, 2018
# Matt Wang <mattwang44@gmail.com>, 2022
msgid ""
msgstr ""
"Project-Id-Version: Python 3.12\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-17 17:39+0800\n"
"PO-Revision-Date: 2023-02-18 14:48+0800\n"
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.2.2\n"
#: ../../library/collections.rst:2
msgid ":mod:`collections` --- Container datatypes"
msgstr ":mod:`collections` --- 容器資料型態"
#: ../../library/collections.rst:10
msgid "**Source code:** :source:`Lib/collections/__init__.py`"
msgstr "**原始碼:**\\ :source:`Lib/collections/__init__.py`"
#: ../../library/collections.rst:20
msgid ""
"This module implements specialized container datatypes providing "
"alternatives to Python's general purpose built-in containers, :class:"
"`dict`, :class:`list`, :class:`set`, and :class:`tuple`."
msgstr ""
"這個模組實作了一些特別的容器資料型態,用來替代 Python 一般內建的容器,例如 :"
"class:`dict`\\ (字典)、\\ :class:`list`\\ (串列)、\\ :class:`set`\\ (集"
"合)和 :class:`tuple`\\ (元組)。"
#: ../../library/collections.rst:25
msgid ":func:`namedtuple`"
msgstr ":func:`namedtuple`"
#: ../../library/collections.rst:25
msgid "factory function for creating tuple subclasses with named fields"
msgstr "用來建立具名欄位的 tuple 子類別的工廠函式"
#: ../../library/collections.rst:26
msgid ":class:`deque`"
msgstr ":class:`deque`"
#: ../../library/collections.rst:26
msgid "list-like container with fast appends and pops on either end"
msgstr ""
"一個類似 list 的容器,可以快速的在頭尾加入 (append) 元素與移除 (pop) 元素"
#: ../../library/collections.rst:27
msgid ":class:`ChainMap`"
msgstr ":class:`ChainMap`"
#: ../../library/collections.rst:27
msgid "dict-like class for creating a single view of multiple mappings"
msgstr "一個類似 dict 的類別,用來為多個對映 (mapping) 建立單一的視圖 (view)"
#: ../../library/collections.rst:28
msgid ":class:`Counter`"
msgstr ":class:`Counter`"
#: ../../library/collections.rst:28
msgid "dict subclass for counting :term:`hashable` objects"
msgstr "dict 的子類別,用來計算\\ :term:`可雜湊 <hashable>`\\ 物件的數量"
#: ../../library/collections.rst:29
msgid ":class:`OrderedDict`"
msgstr ":class:`OrderedDict`"
#: ../../library/collections.rst:29
msgid "dict subclass that remembers the order entries were added"
msgstr "dict 的子類別,會記錄物件被加入的順序"
#: ../../library/collections.rst:30
msgid ":class:`defaultdict`"
msgstr ":class:`defaultdict`"
#: ../../library/collections.rst:30
msgid "dict subclass that calls a factory function to supply missing values"
msgstr "dict 的子類別,當值不存在 dict 中時會呼叫一個提供預設值的工廠函式"
#: ../../library/collections.rst:31
msgid ":class:`UserDict`"
msgstr ":class:`UserDict`"
#: ../../library/collections.rst:31
msgid "wrapper around dictionary objects for easier dict subclassing"
msgstr "dict 物件的包裝器 (wrapper),簡化了 dict 的子類別化過程"
#: ../../library/collections.rst:32
msgid ":class:`UserList`"
msgstr ":class:`UserList`"
#: ../../library/collections.rst:32
msgid "wrapper around list objects for easier list subclassing"
msgstr "list 物件的包裝器,簡化了 list 的子類別化過程"
#: ../../library/collections.rst:33
msgid ":class:`UserString`"
msgstr ":class:`UserString`"
#: ../../library/collections.rst:33
msgid "wrapper around string objects for easier string subclassing"
msgstr "字串物件的包裝器,簡化了字串的子類別化過程"
#: ../../library/collections.rst:38
msgid ":class:`ChainMap` objects"
msgstr ":class:`ChainMap` 物件"
#: ../../library/collections.rst:42
msgid ""
"A :class:`ChainMap` class is provided for quickly linking a number of "
"mappings so they can be treated as a single unit. It is often much faster "
"than creating a new dictionary and running multiple :meth:`~dict.update` "
"calls."
msgstr ""
":class:`ChainMap`\\ (對映鏈結)類別的目的是快速將數個對映連結在一起,讓它們"
"可以被當作一個單元來處理。它通常會比建立一個新的字典並多次呼叫 :meth:`~dict."
"update` 來得更快。"
#: ../../library/collections.rst:46
msgid ""
"The class can be used to simulate nested scopes and is useful in templating."
msgstr ""
"這個類別可用於模擬巢狀作用域 (nested scopes),且在模板化 (templating) 時能派"
"上用場。"
#: ../../library/collections.rst:50
msgid ""
"A :class:`ChainMap` groups multiple dicts or other mappings together to "
"create a single, updateable view. If no *maps* are specified, a single "
"empty dictionary is provided so that a new chain always has at least one "
"mapping."
msgstr ""
"一個 :class:`ChainMap` 將多個 dict 或其他對映組合在一起,建立一個獨立、可更新"
"的視圖。如果沒有指定 *maps*,預設會提供一個空字典讓每個新鏈結都至少有一個對"
"映。"
#: ../../library/collections.rst:54
msgid ""
"The underlying mappings are stored in a list. That list is public and can "
"be accessed or updated using the *maps* attribute. There is no other state."
msgstr ""
"底層的對映儲存於一個 list 中,這個 list 是公開的且可透過 *maps* 屬性存取或更"
"新,沒有其他狀態 (state)。"
#: ../../library/collections.rst:57
msgid ""
"Lookups search the underlying mappings successively until a key is found. "
"In contrast, writes, updates, and deletions only operate on the first "
"mapping."
msgstr ""
"檢索 (lookup) 陸續查詢底層對映,直到鍵被找到,然而讀取、更新和刪除就只會對第"
"一個對映操作。"
#: ../../library/collections.rst:60
msgid ""
"A :class:`ChainMap` incorporates the underlying mappings by reference. So, "
"if one of the underlying mappings gets updated, those changes will be "
"reflected in :class:`ChainMap`."
msgstr ""
":class:`ChainMap` 透過參照將底層對映合併,所以當一個底層對映被更新,這些改變"
"也會反映到 :class:`ChainMap`。"
#: ../../library/collections.rst:64
msgid ""
"All of the usual dictionary methods are supported. In addition, there is a "
"*maps* attribute, a method for creating new subcontexts, and a property for "
"accessing all but the first mapping:"
msgstr ""
"所有常見的字典方法都有支援。此外,還有一個 *maps* 屬性 (attribute)、一個建立"
"子上下文 (subcontext) 的方法、和一個能夠存取除了第一個以外其他所有對映的特性 "
"(property):"
#: ../../library/collections.rst:70
msgid ""
"A user updateable list of mappings. The list is ordered from first-searched "
"to last-searched. It is the only stored state and can be modified to change "
"which mappings are searched. The list should always contain at least one "
"mapping."
msgstr ""
"一個可被更新的對映列表,這個列表是按照被搜索的順序來排列,在 ChainMap 中它是"
"唯一被儲存的狀態,可被修改來變換搜索順序。回傳的列表都至少包含一個對映。"
#: ../../library/collections.rst:77
msgid ""
"Returns a new :class:`ChainMap` containing a new map followed by all of the "
"maps in the current instance. If ``m`` is specified, it becomes the new map "
"at the front of the list of mappings; if not specified, an empty dict is "
"used, so that a call to ``d.new_child()`` is equivalent to: ``ChainMap({}, "
"*d.maps)``. If any keyword arguments are specified, they update passed map "
"or new empty dict. This method is used for creating subcontexts that can be "
"updated without altering values in any of the parent mappings."
msgstr ""
"回傳包含一個新對映的 :class:`ChainMap`, 新對映後面接著當前實例的所有現存對"
"映。如果有給定 ``m``,``m`` 會成為那個最前面的新對映;若沒有指定,則會加上一"
"個空 dict,如此一來呼叫 ``d.new_child()`` 就等同於 ``ChainMap({}, *d."
"maps)``。這個方法用於建立子上下文,而保持父對映的不變。"
#: ../../library/collections.rst:86
msgid "The optional ``m`` parameter was added."
msgstr "加入可選參數 ``m``\\ 。"
#: ../../library/collections.rst:89
msgid "Keyword arguments support was added."
msgstr "增加了對關鍵字引數的支援。"
#: ../../library/collections.rst:94
msgid ""
"Property returning a new :class:`ChainMap` containing all of the maps in the "
"current instance except the first one. This is useful for skipping the "
"first map in the search. Use cases are similar to those for the :keyword:"
"`nonlocal` keyword used in :term:`nested scopes <nested scope>`. The use "
"cases also parallel those for the built-in :func:`super` function. A "
"reference to ``d.parents`` is equivalent to: ``ChainMap(*d.maps[1:])``."
msgstr ""
"回傳一個包含除了第一個以外所有其他對映的新 :class:`ChainMap` 的特性,可用於需"
"要跳過第一個對映的搜索。使用情境類似於在\\ :term:`巢狀作用域 <nested "
"scope>`\\ 當中使用 :keyword:`nonlocal` 關鍵字,也可與內建函式 :func:`super` "
"做類比。引用 ``d.parents`` 等同於 ``ChainMap(*d.maps[1:])``。"
#: ../../library/collections.rst:102
msgid ""
"Note, the iteration order of a :class:`ChainMap()` is determined by scanning "
"the mappings last to first::"
msgstr ""
"注意,一個 :class:`ChainMap()` 的疊代順序是透過由後往前掃描對映而定:\n"
"\n"
"::"
#: ../../library/collections.rst:110
msgid ""
"This gives the same ordering as a series of :meth:`dict.update` calls "
"starting with the last mapping::"
msgstr ""
"這和呼叫 :meth:`dict.update` 結果的順序一樣是從最後一個對映開始:\n"
"\n"
"::"
#: ../../library/collections.rst:118
msgid "Added support for ``|`` and ``|=`` operators, specified in :pep:`584`."
msgstr "支援 ``|`` 和 ``|=`` 運算子,詳見 :pep:`584`。"
#: ../../library/collections.rst:123
msgid ""
"The `MultiContext class <https://github.com/enthought/codetools/blob/4.0.0/"
"codetools/contexts/multi_context.py>`_ in the Enthought `CodeTools package "
"<https://github.com/enthought/codetools>`_ has options to support writing to "
"any mapping in the chain."
msgstr ""
"Enthought `CodeTools package <https://github.com/enthought/codetools>`_ 中的 "
"`MultiContext class <https://github.com/enthought/codetools/blob/4.0.0/"
"codetools/contexts/multi_context.py>`_ 支援在鏈中選定任意對映寫入。"
#: ../../library/collections.rst:129
msgid ""
"Django's `Context class <https://github.com/django/django/blob/main/django/"
"template/context.py>`_ for templating is a read-only chain of mappings. It "
"also features pushing and popping of contexts similar to the :meth:"
"`~collections.ChainMap.new_child` method and the :attr:`~collections."
"ChainMap.parents` property."
msgstr ""
"Django 中用於模板的 `Context class <https://github.com/django/django/blob/"
"main/django/template/context.py>`_ 是唯讀的對映鏈,也具有加入 (push) 和移除 "
"(pop) 上下文的功能,與 :meth:`~collections.ChainMap.new_child` 方法和 :attr:"
"`~collections.ChainMap.parents` 特性類似。"
#: ../../library/collections.rst:136
msgid ""
"The `Nested Contexts recipe <https://code.activestate.com/recipes/577434/>`_ "
"has options to control whether writes and other mutations apply only to the "
"first mapping or to any mapping in the chain."
msgstr ""
"`Nested Contexts recipe <https://code.activestate.com/recipes/577434/>`_ 提供"
"了控制是否只對鏈中第一個或其他對映做寫入或其他操作的選項。"
#: ../../library/collections.rst:141
msgid ""
"A `greatly simplified read-only version of Chainmap <https://code."
"activestate.com/recipes/305268/>`_."
msgstr ""
"一個\\ `極度簡化、維讀版本的 Chainmap <https://code.activestate.com/"
"recipes/305268/>`_。"
#: ../../library/collections.rst:146
msgid ":class:`ChainMap` Examples and Recipes"
msgstr ":class:`ChainMap` 範例和用法"
#: ../../library/collections.rst:148
msgid "This section shows various approaches to working with chained maps."
msgstr "此章節提供了多種操作 ChainMap 的案例。"
#: ../../library/collections.rst:151
msgid "Example of simulating Python's internal lookup chain::"
msgstr ""
"模擬 Python 內部檢索鏈結的例子:\n"
"\n"
"::"
#: ../../library/collections.rst:156
msgid ""
"Example of letting user specified command-line arguments take precedence "
"over environment variables which in turn take precedence over default "
"values::"
msgstr ""
"讓使用者指定的命令列引數優先於環境變數、再優先於預設值的範例:\n"
"\n"
"::"
#: ../../library/collections.rst:173
msgid ""
"Example patterns for using the :class:`ChainMap` class to simulate nested "
"contexts::"
msgstr ""
"用 :class:`ChainMap` 類別模擬巢狀上下文的範例模式:\n"
"\n"
"::"
#: ../../library/collections.rst:192
msgid ""
"The :class:`ChainMap` class only makes updates (writes and deletions) to the "
"first mapping in the chain while lookups will search the full chain. "
"However, if deep writes and deletions are desired, it is easy to make a "
"subclass that updates keys found deeper in the chain::"
msgstr ""
":class:`ChainMap` 類別只對鏈結中第一個對映來做寫入或刪除,但檢索則會掃過整個"
"鏈結。但如果需要對更深層的鍵寫入或刪除,透過定義一個子類別來實作也不困難:\n"
"\n"
"::"
#: ../../library/collections.rst:223
msgid ":class:`Counter` objects"
msgstr ":class:`Counter` 物件"
#: ../../library/collections.rst:225
msgid ""
"A counter tool is provided to support convenient and rapid tallies. For "
"example::"
msgstr ""
"提供一個支援方便且快速計數的計數器工具,例如:\n"
"\n"
"::"
#: ../../library/collections.rst:245
msgid ""
"A :class:`Counter` is a :class:`dict` subclass for counting :term:`hashable` "
"objects. It is a collection where elements are stored as dictionary keys and "
"their counts are stored as dictionary values. Counts are allowed to be any "
"integer value including zero or negative counts. The :class:`Counter` class "
"is similar to bags or multisets in other languages."
msgstr ""
":class:`Counter` 是 :class:`dict` 的子類別,用來計算\\ :term:`可雜湊 "
"<hashable>`\\ 物件的數量。它是將物件與其計數作為字典的鍵值對儲存的集合容器。"
"計數可以是包含 0 與負數的任何整數值。:class:`Counter` 類別類似其他程式語言中"
"的 bags 或 multisets。"
#: ../../library/collections.rst:251
msgid ""
"Elements are counted from an *iterable* or initialized from another "
"*mapping* (or counter):"
msgstr ""
"被計數的元素來自一個 *iterable* 或是被其他的 *mapping*\\ (或 Counter)初始"
"化:"
#: ../../library/collections.rst:259
msgid ""
"Counter objects have a dictionary interface except that they return a zero "
"count for missing items instead of raising a :exc:`KeyError`:"
msgstr ""
"Counter 物件擁有一個字典的使用介面,除了遇到 Counter 中沒有的值時會回傳計數 "
"0 取代 :exc:`KeyError` 這點不同:"
#: ../../library/collections.rst:266
msgid ""
"Setting a count to zero does not remove an element from a counter. Use "
"``del`` to remove it entirely:"
msgstr ""
"將一個值的計數設為 0 並不會真的從 Counter 中刪除這個元素,要使用 ``del`` 來將"
"其刪除:"
#: ../../library/collections.rst:274
msgid ""
"As a :class:`dict` subclass, :class:`Counter` inherited the capability to "
"remember insertion order. Math operations on *Counter* objects also "
"preserve order. Results are ordered according to when an element is first "
"encountered in the left operand and then by the order encountered in the "
"right operand."
msgstr ""
"作為 :class:`dict` 的子類別,\\ :class:`Counter` 繼承了記憶插入順序的功能。"
"對 *Counter* 做數學運算後同樣保留順序性,其結果是依照各個元素在運算元左邊出現"
"的時間先後、再按照運算元右邊出現的時間先後來排列。"
#: ../../library/collections.rst:280
msgid ""
"Counter objects support additional methods beyond those available for all "
"dictionaries:"
msgstr "除了字典原本就有的方法外,Counter 物件額外支援數個新方法:"
#: ../../library/collections.rst:285
msgid ""
"Return an iterator over elements repeating each as many times as its count. "
"Elements are returned in the order first encountered. If an element's count "
"is less than one, :meth:`elements` will ignore it."
msgstr ""
"回傳每個元素都重複出現計算次數的 iterator(疊代器)物件,其中元素的回傳順序是"
"依照各元素首次出現的時間先後。如果元素的出現次數小於 1,\\ :meth:`elements` "
"方法會忽略這些元素。"
#: ../../library/collections.rst:295
msgid ""
"Return a list of the *n* most common elements and their counts from the most "
"common to the least. If *n* is omitted or ``None``, :meth:`most_common` "
"returns *all* elements in the counter. Elements with equal counts are "
"ordered in the order first encountered:"
msgstr ""
"回傳一個 list,包含出現最多次的 *n* 個元素及其出現次數,並按照出現次數排序。"
"如果 *n* 被省略或者為 ``None``\\ ,\\ :meth:`most_common` 會回傳\\ *所有* "
"counter 中的元素。出現次數相同的元素會按照首次出現的時間先後來排列:"
#: ../../library/collections.rst:305
msgid ""
"Elements are subtracted from an *iterable* or from another *mapping* (or "
"counter). Like :meth:`dict.update` but subtracts counts instead of "
"replacing them. Both inputs and outputs may be zero or negative."
msgstr ""
"減去自一個 *iterable* 或另一個\\ *對映*\\ (或 Counter)中的計數元素,行為類"
"似 :meth:`dict.update` 但是是為了減去計數而非取代其值。輸入和輸出都可以是 0 "
"或是負數。"
#: ../../library/collections.rst:319
msgid "Compute the sum of the counts."
msgstr "計算總計數值。"
#: ../../library/collections.rst:327
msgid ""
"The usual dictionary methods are available for :class:`Counter` objects "
"except for two which work differently for counters."
msgstr ""
"通常來說字典方法也可以用於 :class:`Counter` 物件,除了以下兩個作用方式與計數"
"器不同。"
#: ../../library/collections.rst:332
msgid "This class method is not implemented for :class:`Counter` objects."
msgstr "此類別方法沒有被實作於 :class:`Counter` 物件中。"
#: ../../library/collections.rst:336
msgid ""
"Elements are counted from an *iterable* or added-in from another *mapping* "
"(or counter). Like :meth:`dict.update` but adds counts instead of replacing "
"them. Also, the *iterable* is expected to be a sequence of elements, not a "
"sequence of ``(key, value)`` pairs."
msgstr ""
"加上自一個 *iterable* 計算出的計數或加上另一個 *mapping*\\ (或 Counter)中的"
"計數,行為類似 :meth:`dict.update` 但是是為了加上計數而非取代其值。另外,\\ "
"*iterable* 需要是一串將被計算個數元素的序列,而非元素為 ``(key, value)`` 形式"
"的序列。"
#: ../../library/collections.rst:341
msgid ""
"Counters support rich comparison operators for equality, subset, and "
"superset relationships: ``==``, ``!=``, ``<``, ``<=``, ``>``, ``>=``. All of "
"those tests treat missing elements as having zero counts so that "
"``Counter(a=1) == Counter(a=1, b=0)`` returns true."
msgstr ""
"Counter 支援相等性、子集和超集關係的 rich comparison 運算子:``==``、``!=``、"
"``<``、``<=``、``>``、``>=``。這些檢測會將不存在的元素之計數值當作零,因此 "
"``Counter(a=1) == Counter(a=1, b=0)`` 將回傳真值。"
#: ../../library/collections.rst:346
msgid "Rich comparison operations were added."
msgstr "增加了 rich comparison 運算。"
#: ../../library/collections.rst:349
msgid ""
"In equality tests, missing elements are treated as having zero counts. "
"Formerly, ``Counter(a=3)`` and ``Counter(a=3, b=0)`` were considered "
"distinct."
msgstr ""
"在相等性運算中,不存在的元素之計數值會被當作零。在此之前,``Counter(a=3)`` "
"和 ``Counter(a=3, b=0)`` 被視為不同。"
#: ../../library/collections.rst:354
msgid "Common patterns for working with :class:`Counter` objects::"
msgstr ""
"使用 :class:`Counter` 物件的常見使用模式:\n"
"\n"
"::"
#: ../../library/collections.rst:366
msgid ""
"Several mathematical operations are provided for combining :class:`Counter` "
"objects to produce multisets (counters that have counts greater than zero). "
"Addition and subtraction combine counters by adding or subtracting the "
"counts of corresponding elements. Intersection and union return the minimum "
"and maximum of corresponding counts. Equality and inclusion compare "
"corresponding counts. Each operation can accept inputs with signed counts, "
"but the output will exclude results with counts of zero or less."
msgstr ""
"為結合多個 :class:`Counter` 物件以產生 multiset(多重集合,擁有大於 0 計數元"
"素的計數器),有提供了幾種數學操作。加法和減法是根據各個對應元素分別將 "
"Counter 加上和減去計數,交集和聯集分別回傳各個元素最小和最大計數,相等性與包"
"含性運算則會比較對應的計數。每一個操作都可以接受輸入帶有正負號的計數,但輸出"
"的 Counter 則會將擁有小於或等於 0 計數的元素剔除。"
#: ../../library/collections.rst:391
msgid ""
"Unary addition and subtraction are shortcuts for adding an empty counter or "
"subtracting from an empty counter."
msgstr "加減法的一元運算子分別是加上空的 Counter 和從空 Counter 減去的簡寫。"
#: ../../library/collections.rst:400
msgid ""
"Added support for unary plus, unary minus, and in-place multiset operations."
msgstr "開始支援加減一元運算子和 multiset 的原地 (in-place) 操作。"
#: ../../library/collections.rst:405
msgid ""
"Counters were primarily designed to work with positive integers to represent "
"running counts; however, care was taken to not unnecessarily preclude use "
"cases needing other types or negative values. To help with those use cases, "
"this section documents the minimum range and type restrictions."
msgstr ""
"Counter 主要是被設計來操作正整數以當作使用中的計數,但為了某些會用到計數之值"
"為負數或為其他型別的案例中,Counter 也小心地被設計成不會預先排除這些特殊元"
"素。為了輔助使用於上述案例,這一小節記錄了最小範圍和型別限制。"
#: ../../library/collections.rst:410
msgid ""
"The :class:`Counter` class itself is a dictionary subclass with no "
"restrictions on its keys and values. The values are intended to be numbers "
"representing counts, but you *could* store anything in the value field."
msgstr ""
":class:`Counter` 類別本身是字典的子類別,且不限制其鍵與值。值被用來表示計數,"
"但實際上你\\ *可以*\\ 儲存任何值。"
#: ../../library/collections.rst:414
msgid ""
"The :meth:`~Counter.most_common` method requires only that the values be "
"orderable."
msgstr "使用 :meth:`~Counter.most_common` 方法的唯一條件是其值要是可被排序的。"
#: ../../library/collections.rst:416
msgid ""
"For in-place operations such as ``c[key] += 1``, the value type need only "
"support addition and subtraction. So fractions, floats, and decimals would "
"work and negative values are supported. The same is also true for :meth:"
"`~Counter.update` and :meth:`~Counter.subtract` which allow negative and "
"zero values for both inputs and outputs."
msgstr ""
"像是 ``c[key] += 1`` 的原地操作中,其值之型別只必須支援加減,所以分數、浮點"
"數、十進位數與其負值都可以使用。同理,\\ :meth:`~Counter.update` 和 :meth:"
"`~Counter.subtract` 也都允許 0 或負值為輸入或輸出。"
#: ../../library/collections.rst:422
msgid ""
"The multiset methods are designed only for use cases with positive values. "
"The inputs may be negative or zero, but only outputs with positive values "
"are created. There are no type restrictions, but the value type needs to "
"support addition, subtraction, and comparison."
msgstr ""
"Multiset 相關方法只為了處理正值而設計,其輸入允許是 0 或負值但只有正值會被輸"
"出。並無型別限制,但其值的型別須支援加、減及比較運算。"
#: ../../library/collections.rst:427
msgid ""
"The :meth:`~Counter.elements` method requires integer counts. It ignores "
"zero and negative counts."
msgstr ":meth:`~Counter.elements` 方法需要其計數為正值,如為 0 或負值則忽略。"
#: ../../library/collections.rst:432
msgid ""
"`Bag class <https://www.gnu.org/software/smalltalk/manual-base/html_node/Bag."
"html>`_ in Smalltalk."
msgstr ""
"Smalltalk 中的 `Bag class <https://www.gnu.org/software/smalltalk/manual-"
"base/html_node/Bag.html>`_\\ 。"
#: ../../library/collections.rst:435
msgid ""
"Wikipedia entry for `Multisets <https://en.wikipedia.org/wiki/Multiset>`_."
msgstr ""
"維基百科上的\\ `多重集合 <https://en.wikipedia.org/wiki/Multiset>`_\\ 條目。"
#: ../../library/collections.rst:437
msgid ""
"`C++ multisets <http://www.java2s.com/Tutorial/Cpp/0380__set-multiset/"
"Catalog0380__set-multiset.htm>`_ tutorial with examples."
msgstr ""
"`C++ multisets <http://www.java2s.com/Tutorial/Cpp/0380__set-multiset/"
"Catalog0380__set-multiset.htm>`_ 教學與範例。"
#: ../../library/collections.rst:440
msgid ""
"For mathematical operations on multisets and their use cases, see *Knuth, "
"Donald. The Art of Computer Programming Volume II, Section 4.6.3, Exercise "
"19*."
msgstr ""
"Multiset 的數學運算及其使用時機,參考 *Knuth, Donald. The Art of Computer "
"Programming Volume II, Section 4.6.3, Exercise 19*\\ 。"
#: ../../library/collections.rst:444
msgid ""
"To enumerate all distinct multisets of a given size over a given set of "
"elements, see :func:`itertools.combinations_with_replacement`::"
msgstr ""
"若要根據給定的元素集合來列舉出所有不重複且擁有指定元素數量的 multiset,請見 :"
"func:`itertools.combinations_with_replacement`\\ :\n"
"\n"
"::"
#: ../../library/collections.rst:451
msgid ":class:`deque` objects"
msgstr ":class:`deque` 物件"
#: ../../library/collections.rst:455
msgid ""
"Returns a new deque object initialized left-to-right (using :meth:`append`) "
"with data from *iterable*. If *iterable* is not specified, the new deque is "
"empty."
msgstr ""
"回傳一個新的 deque(雙端佇列)物件,將 *iterable* 中的資料由左至右(使用 :"
"meth:`append`\\ )加入來做初始化。如果 *iterable* 並未給定,回傳的則是一個空"
"的 deque。"
#: ../../library/collections.rst:458
msgid ""
"Deques are a generalization of stacks and queues (the name is pronounced "
"\"deck\" and is short for \"double-ended queue\"). Deques support thread-"
"safe, memory efficient appends and pops from either side of the deque with "
"approximately the same O(1) performance in either direction."
msgstr ""
"Deque(發音為 \"deck\",為 \"double-ended queue\" 的簡稱)為 stack 和 queue "
"的一般化。deque 支援執行緒安全 (thread-safe),且能夠有效率地節省記憶體在頭和"
"尾加入和移除元素,兩個方向的表現都大致為 O(1) 複雜度。"
#: ../../library/collections.rst:463
msgid ""
"Though :class:`list` objects support similar operations, they are optimized "
"for fast fixed-length operations and incur O(n) memory movement costs for "
"``pop(0)`` and ``insert(0, v)`` operations which change both the size and "
"position of the underlying data representation."
msgstr ""
"雖然 :class:`list` 物件也支援類似操作,但 list 優化了長度固定時的操作,而會改"
"變底層資料的長度及位置的 ``pop(0)`` 和 ``insert(0, v)`` 操作,記憶體移動則為 "
"O(n) 複雜度。"
#: ../../library/collections.rst:469
msgid ""
"If *maxlen* is not specified or is ``None``, deques may grow to an arbitrary "
"length. Otherwise, the deque is bounded to the specified maximum length. "
"Once a bounded length deque is full, when new items are added, a "
"corresponding number of items are discarded from the opposite end. Bounded "
"length deques provide functionality similar to the ``tail`` filter in Unix. "
"They are also useful for tracking transactions and other pools of data where "
"only the most recent activity is of interest."
msgstr ""
"如果 *maxlen* 沒有給定或者為 ``None``,deque 可以增長到任意長度;但若有給定的"
"話,deque 的最大長度就會被限制。一個被限制長度的 deque 一但滿了,若在一端加入"
"數個新元素,則同時會在另一端移除相同數量的元素。限定長度的 deque 提供了和 "
"Unix ``tail`` filter 類似的功能,可用於追蹤使用者在意的那些最新執行事項或數據"
"源。"
#: ../../library/collections.rst:478
msgid "Deque objects support the following methods:"
msgstr "Deque 物件支援以下方法:"
#: ../../library/collections.rst:482
msgid "Add *x* to the right side of the deque."
msgstr "將 *x* 自 deque 的右側加入。"
#: ../../library/collections.rst:487
msgid "Add *x* to the left side of the deque."
msgstr "將 *x* 自 deque 的左側加入。"
#: ../../library/collections.rst:492
msgid "Remove all elements from the deque leaving it with length 0."
msgstr "將所有元素從 deque 中移除,使其長度為 0。"
#: ../../library/collections.rst:497
msgid "Create a shallow copy of the deque."
msgstr "建立一個 deque 的淺複製 (shallow copy)。"
#: ../../library/collections.rst:504
msgid "Count the number of deque elements equal to *x*."
msgstr "計算 deque 內元素為 *x* 的個數。"
#: ../../library/collections.rst:511
msgid ""
"Extend the right side of the deque by appending elements from the iterable "
"argument."
msgstr "將 iterable 引數加入 deque 的右側。"
#: ../../library/collections.rst:517
msgid ""
"Extend the left side of the deque by appending elements from *iterable*. "
"Note, the series of left appends results in reversing the order of elements "
"in the iterable argument."
msgstr ""
"將 iterable 引數加入 deque 的左側。要注意的是,加入後的元素順序和 iterable 參"
"數是相反的。"
#: ../../library/collections.rst:524
msgid ""
"Return the position of *x* in the deque (at or after index *start* and "
"before index *stop*). Returns the first match or raises :exc:`ValueError` "
"if not found."
msgstr ""
"回傳 deque 中 *x* 的位置(或在索引 *start* 之後、索引 *stop* 之前的位置)。回"
"傳第一個匹配的位置,如果沒找到就引發 :exc:`ValueError`\\ 。"
#: ../../library/collections.rst:533
msgid "Insert *x* into the deque at position *i*."
msgstr "在 deque 位置 *i* 中插入 *x*\\ 。"
#: ../../library/collections.rst:535
msgid ""
"If the insertion would cause a bounded deque to grow beyond *maxlen*, an :"
"exc:`IndexError` is raised."
msgstr ""
"如果此插入操作導致 deque 超過其長度上限 *maxlen* 的話,會引發 :exc:"
"`IndexError` 例外。"
#: ../../library/collections.rst:543
msgid ""
"Remove and return an element from the right side of the deque. If no "
"elements are present, raises an :exc:`IndexError`."
msgstr ""
"移除並回傳 deque 的最右側元素,若本來就沒有任何元素,則會引發 :exc:"
"`IndexError`\\ 。"
#: ../../library/collections.rst:549
msgid ""
"Remove and return an element from the left side of the deque. If no elements "
"are present, raises an :exc:`IndexError`."
msgstr ""
"移除並回傳 deque 的最左側元素,若本來就沒有任何元素,則會引發 :exc:"
"`IndexError`\\ 。"
#: ../../library/collections.rst:555
msgid ""
"Remove the first occurrence of *value*. If not found, raises a :exc:"
"`ValueError`."
msgstr ""
"移除第一個出現的 *value*\\ ,如果沒找到的話就引發一個 :exc:`ValueError`\\ 。"
#: ../../library/collections.rst:561
msgid "Reverse the elements of the deque in-place and then return ``None``."
msgstr "將 deque 中的元素原地 (in-place) 倒序排列並回傳 ``None``\\ 。"
#: ../../library/collections.rst:568
msgid ""
"Rotate the deque *n* steps to the right. If *n* is negative, rotate to the "
"left."
msgstr "將 deque 向右輪轉 *n* 步。若 *n* 為負值則向左輪轉。"
#: ../../library/collections.rst:571
msgid ""
"When the deque is not empty, rotating one step to the right is equivalent to "
"``d.appendleft(d.pop())``, and rotating one step to the left is equivalent "
"to ``d.append(d.popleft())``."
msgstr ""
"當 deque 不是空的,向右輪轉一步和 ``d.appendleft(d.pop())`` 有相同意義,而向"
"左輪轉亦等價於 ``d.append(d.popleft())``\\ 。"
#: ../../library/collections.rst:576
msgid "Deque objects also provide one read-only attribute:"
msgstr "Deque 物件也提供了一個唯讀屬性:"
#: ../../library/collections.rst:580
msgid "Maximum size of a deque or ``None`` if unbounded."
msgstr "Deque 的最大長度,如果不限制長度的話則為 ``None``\\ 。"
#: ../../library/collections.rst:585
msgid ""
"In addition to the above, deques support iteration, pickling, ``len(d)``, "
"``reversed(d)``, ``copy.copy(d)``, ``copy.deepcopy(d)``, membership testing "
"with the :keyword:`in` operator, and subscript references such as ``d[0]`` "
"to access the first element. Indexed access is O(1) at both ends but slows "
"to O(n) in the middle. For fast random access, use lists instead."
msgstr ""
"除了以上使用方式,deque 亦支援了疊代、pickle、``len(d)``、``reversed(d)``、"
"``copy.copy(d)``、``copy.deepcopy(d)``、用 :keyword:`in` 運算子來作成員檢測以"
"及像是 ``d[0]`` 的標號引用來取得第一個元素。在兩端做索引存取的複雜度為 O(1) "
"但越靠近中間則減慢至 O(n)。若想要隨機而快速的存取,使用 list 會較為合適。"
#: ../../library/collections.rst:591
msgid ""
"Starting in version 3.5, deques support ``__add__()``, ``__mul__()``, and "
"``__imul__()``."
msgstr ""
"自從 3.5 版本起,deque 開始支援 ``__add__()``、``__mul__()`` 和 "
"``__imul__()``。"
#: ../../library/collections.rst:594
msgid "Example:"
msgstr "範例:"
#: ../../library/collections.rst:651
msgid ":class:`deque` Recipes"
msgstr ":class:`deque` 用法"
#: ../../library/collections.rst:653
msgid "This section shows various approaches to working with deques."
msgstr "這一章節提供了多種操作 deque 的案例。"
#: ../../library/collections.rst:655
msgid ""
"Bounded length deques provide functionality similar to the ``tail`` filter "
"in Unix::"
msgstr ""
"被限制長度的 deque 功能類似 Unix 中的 ``tail`` filter:\n"
"\n"
"::"
#: ../../library/collections.rst:663
msgid ""
"Another approach to using deques is to maintain a sequence of recently added "
"elements by appending to the right and popping to the left::"
msgstr ""
"另一用法是透過從右邊加入、從左邊移除來維護最近加入元素的 list:\n"
"\n"
"::"
#: ../../library/collections.rst:678
msgid ""
"A `round-robin scheduler <https://en.wikipedia.org/wiki/Round-"
"robin_scheduling>`_ can be implemented with input iterators stored in a :"
"class:`deque`. Values are yielded from the active iterator in position "
"zero. If that iterator is exhausted, it can be removed with :meth:`~deque."
"popleft`; otherwise, it can be cycled back to the end with the :meth:`~deque."
"rotate` method::"
msgstr ""
"一個\\ `輪詢調度器 <https://en.wikipedia.org/wiki/Round-"
"robin_scheduling>`_\\ 可以透過在 :class:`deque` 中放入 iterator 來實現,值自"
"當前 iterator 的位置 0 取出,如果 iterator 已經消耗完畢就用 :meth:`~deque."
"popleft` 將其從佇列中移除,否則利用 :meth:`~deque.rotate` 來將其移至佇列尾"
"端:\n"
"\n"
"::"
#: ../../library/collections.rst:697
msgid ""
"The :meth:`~deque.rotate` method provides a way to implement :class:`deque` "
"slicing and deletion. For example, a pure Python implementation of ``del "
"d[n]`` relies on the ``rotate()`` method to position elements to be popped::"
msgstr ""
":meth:`~deque.rotate` 提供了可以用來實作 :class:`deque` 切片和刪除的方法。舉"
"例來說,用純 Python 實作 ``del d[n]`` 需要用 ``rotate()`` 來定位要被移除的元"
"素:\n"
"\n"
"::"
#: ../../library/collections.rst:706
msgid ""
"To implement :class:`deque` slicing, use a similar approach applying :meth:"
"`~deque.rotate` to bring a target element to the left side of the deque. "
"Remove old entries with :meth:`~deque.popleft`, add new entries with :meth:"
"`~deque.extend`, and then reverse the rotation. With minor variations on "
"that approach, it is easy to implement Forth style stack manipulations such "
"as ``dup``, ``drop``, ``swap``, ``over``, ``pick``, ``rot``, and ``roll``."
msgstr ""
"要實現 :class:`deque` 切片,可使用近似以下方法:使用 :meth:`~deque.rotate` 來"
"將目標元素移動到 deque 最左側,用 :meth:`~deque.popleft` 移除舊元素並用 :"
"meth:`~deque.extend` 加入新元素,最後再反向 rotate。在這個方法上做小小的更動"
"就能簡單地實現 Forth 風格的 stack 操作,例如 ``dup``、``drop``、``swap``、"
"``over``、``pick``、``rot`` 和 ``roll``。"
#: ../../library/collections.rst:716
msgid ":class:`defaultdict` objects"
msgstr ":class:`defaultdict` 物件"
#: ../../library/collections.rst:720
msgid ""
"Return a new dictionary-like object. :class:`defaultdict` is a subclass of "
"the built-in :class:`dict` class. It overrides one method and adds one "
"writable instance variable. The remaining functionality is the same as for "
"the :class:`dict` class and is not documented here."
msgstr ""
"回傳一個新的類似字典的物件。\\ :class:`defaultdict` 是內建類別 :class:`dict` "
"的子類別。它覆蓋掉了一個方法並添加了一個可寫入的實例變數。其餘功能與 :class:"
"`dict` 相同,此文件不再複述。"
#: ../../library/collections.rst:725
msgid ""
"The first argument provides the initial value for the :attr:"
"`default_factory` attribute; it defaults to ``None``. All remaining "
"arguments are treated the same as if they were passed to the :class:`dict` "
"constructor, including keyword arguments."
msgstr ""
"第一個引數為 :attr:`default_factory` 屬性提供了初始值,他被預設為 ``None``,"
"所有其他的引數(包括關鍵字引數)都會被傳遞給 :class:`dict` 的建構函式 "
"(constructor)。"
#: ../../library/collections.rst:731
msgid ""
":class:`defaultdict` objects support the following method in addition to the "
"standard :class:`dict` operations:"
msgstr ":class:`defaultdict` 物件支援以下 :class:`dict` 所沒有的方法:"
#: ../../library/collections.rst:736
msgid ""
"If the :attr:`default_factory` attribute is ``None``, this raises a :exc:"
"`KeyError` exception with the *key* as argument."
msgstr ""
"如果 :attr:`default_factory` 屬性為 ``None``,呼叫此方法會引發一個附帶引數 "
"*key* 的 :exc:`KeyError` 例外。"
#: ../../library/collections.rst:739
msgid ""
"If :attr:`default_factory` is not ``None``, it is called without arguments "
"to provide a default value for the given *key*, this value is inserted in "
"the dictionary for the *key*, and returned."
msgstr ""
"如果 :attr:`default_factory` 不為 ``None``,它會不帶引數地被呼叫來為給定的 "
"*key* 提供一個預設值,這個值和 *key* 被作為鍵值對來插入到字典中,並且被此方法"
"所回傳。"
#: ../../library/collections.rst:743
msgid ""
"If calling :attr:`default_factory` raises an exception this exception is "
"propagated unchanged."
msgstr ""
"如果呼叫 :attr:`default_factory` 時發生例外,則該例外將會保持不變地向外傳遞。"
#: ../../library/collections.rst:746
msgid ""
"This method is called by the :meth:`__getitem__` method of the :class:`dict` "
"class when the requested key is not found; whatever it returns or raises is "
"then returned or raised by :meth:`__getitem__`."
msgstr ""
"在無法找到所要求的鍵時,此方法會被 :class:`dict` 類別的 :meth:`__getitem__` "
"方法呼叫。無論此方法回傳了值還是引發了例外,都會被 :meth:`__getitem__` 所傳"
"遞。"
#: ../../library/collections.rst:750
msgid ""
"Note that :meth:`__missing__` is *not* called for any operations besides :"
"meth:`__getitem__`. This means that :meth:`get` will, like normal "
"dictionaries, return ``None`` as a default rather than using :attr:"
"`default_factory`."
msgstr ""
"注意,\\ :meth:`__missing__` *不會*\\ 被 :meth:`__getitem__` 以外的其他方法呼"
"叫,這意味著 :meth:`get` 會像一般的 dict 那樣回傳 ``None`` 做為預設值,而非使"
"用 :attr:`default_factory`。"
#: ../../library/collections.rst:756
msgid ":class:`defaultdict` objects support the following instance variable:"
msgstr ":class:`defaultdict` 物件支援以下實例變數:"
#: ../../library/collections.rst:761
msgid ""
"This attribute is used by the :meth:`__missing__` method; it is initialized "
"from the first argument to the constructor, if present, or to ``None``, if "
"absent."
msgstr ""
"此屬性為 :meth:`__missing__` 方法所使用。如果有引數被傳入建構函式,則此屬性會"
"被初始化成第一個引數,如未提供引數則被初始化為 ``None``。"
#: ../../library/collections.rst:765 ../../library/collections.rst:1182
msgid ""
"Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`."
msgstr "新增合併 (``|``) 和更新 (``|=``) 運算子,請見 :pep:`584`。"
#: ../../library/collections.rst:771
msgid ":class:`defaultdict` Examples"
msgstr ":class:`defaultdict` 範例"
#: ../../library/collections.rst:773
msgid ""
"Using :class:`list` as the :attr:`~defaultdict.default_factory`, it is easy "
"to group a sequence of key-value pairs into a dictionary of lists:"
msgstr ""
"使用 :class:`list` 作為 :attr:`~defaultdict.default_factory` 可以很輕鬆地將鍵"
"值對序列轉換為包含 list 之字典:"
#: ../../library/collections.rst:784
msgid ""
"When each key is encountered for the first time, it is not already in the "
"mapping; so an entry is automatically created using the :attr:`~defaultdict."
"default_factory` function which returns an empty :class:`list`. The :meth:"
"`list.append` operation then attaches the value to the new list. When keys "
"are encountered again, the look-up proceeds normally (returning the list for "
"that key) and the :meth:`list.append` operation adds another value to the "
"list. This technique is simpler and faster than an equivalent technique "
"using :meth:`dict.setdefault`:"
msgstr ""
"當每個鍵第一次被存取時,它還沒有存在於對映中,所以會自動呼叫 :attr:"
"`~defaultdict.default_factory` 方法來回傳一個空的 :class:`list` 以建立一個條"
"目,\\ :meth:`list.append` 操作後續會再新增值到這個新的列表裡。當再次存取該鍵"
"時,就如普通字典般操作(回傳該鍵所對應到的 list),\\ :meth:`list.append` 也"