-
-
Notifications
You must be signed in to change notification settings - Fork 214
/
Copy pathdatastructures.po
1383 lines (1258 loc) · 53.3 KB
/
datastructures.po
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
# Copyright (C) 2001-2024, Python Software Foundation
# This file is distributed under the same license as the Python package.
#
# Translators:
# Adrian Liaw <adrianliaw2000@gmail.com>, 2016
# Ching-Hao Liu <chinghao.liu@gmail.com>, 2018
# KentHsu <luffy1610@gmail.com>, 2016
# Liang-Bo Wang <me@liang2.tw>, 2015-2016
# hsiao yi <hsiaoyi0504@gmail.com>, 2015
# Steven Hsu <hsuhaochun@gmail.com>, 2021
msgid ""
msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-07 00:14+0000\n"
"PO-Revision-Date: 2024-01-22 21:43+0800\n"
"Last-Translator: Steven Hsu <hsuhaochun@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.4.1\n"
#: ../../tutorial/datastructures.rst:5
msgid "Data Structures"
msgstr "資料結構"
#: ../../tutorial/datastructures.rst:7
msgid ""
"This chapter describes some things you've learned about already in more "
"detail, and adds some new things as well."
msgstr ""
"這個章節將會更深入的介紹一些你已經學過的東西的細節上,並且加入一些你還沒有接"
"觸過的部分。"
#: ../../tutorial/datastructures.rst:13
msgid "More on Lists"
msgstr "進一步了解 List(串列)"
#: ../../tutorial/datastructures.rst:15
msgid ""
"The list data type has some more methods. Here are all of the methods of "
"list objects:"
msgstr ""
"List(串列)這個資料型態,具有更多操作的方法。下面條列了所有關於 list 物件的 "
"method:"
#: ../../tutorial/datastructures.rst:22
msgid "Add an item to the end of the list. Similar to ``a[len(a):] = [x]``."
msgstr "將一個新的項目加到 list 的尾端。與 ``a[len(a):] = [x]`` 類似。"
#: ../../tutorial/datastructures.rst:28
msgid ""
"Extend the list by appending all the items from the iterable. Similar to "
"``a[len(a):] = iterable``."
msgstr ""
"將 iterable(可疊代物件)接到 list 的尾端。與 ``a[len(a):] = iterable`` 類"
"似。"
#: ../../tutorial/datastructures.rst:35
msgid ""
"Insert an item at a given position. The first argument is the index of the "
"element before which to insert, so ``a.insert(0, x)`` inserts at the front "
"of the list, and ``a.insert(len(a), x)`` is equivalent to ``a.append(x)``."
msgstr ""
"將一個項目插入至 list 中給定的位置。第一個引數為插入處前元素的索引值,所以 "
"``a.insert(0, x)`` 會插入在 list 首位,而 ``a.insert(len(a), x)`` 則相當於 "
"``a.append(x)``。"
#: ../../tutorial/datastructures.rst:43
msgid ""
"Remove the first item from the list whose value is equal to *x*. It raises "
"a :exc:`ValueError` if there is no such item."
msgstr ""
"刪除 list 中第一個值等於 *x* 的元素。若 list 中無此元素則會觸發 :exc:"
"`ValueError`。"
#: ../../tutorial/datastructures.rst:50
msgid ""
"Remove the item at the given position in the list, and return it. If no "
"index is specified, ``a.pop()`` removes and returns the last item in the "
"list. It raises an :exc:`IndexError` if the list is empty or the index is "
"outside the list range."
msgstr ""
"移除 list 中給定位置的項目,並回傳它。如果沒有指定位置, ``a.pop()`` 將會移"
"除 list 中最後的項目並回傳它。若 list 是空的或是索引值超出範圍,則會引發 :"
"exc:`IndexError` 例外。"
#: ../../tutorial/datastructures.rst:59
msgid "Remove all items from the list. Similar to ``del a[:]``."
msgstr "刪除 list 中所有項目。與 ``del a[:]`` 類似。"
#: ../../tutorial/datastructures.rst:65
msgid ""
"Return zero-based index in the list of the first item whose value is equal "
"to *x*. Raises a :exc:`ValueError` if there is no such item."
msgstr ""
"回傳 list 中第一個值等於 *x* 的項目之索引值(從零開始的索引)。若 list 中無此"
"項目,則丟出 :exc:`ValueError` 錯誤。"
#: ../../tutorial/datastructures.rst:68
msgid ""
"The optional arguments *start* and *end* are interpreted as in the slice "
"notation and are used to limit the search to a particular subsequence of the "
"list. The returned index is computed relative to the beginning of the full "
"sequence rather than the *start* argument."
msgstr ""
"引數 *start* 和 *end* 的定義跟在 slice 表示法中相同,搜尋的動作被這兩個引數限"
"定在 list 中特定的子序列。但要注意的是,回傳的索引值是從 list 的開頭開始算,"
"而不是從 *start* 開始算。"
#: ../../tutorial/datastructures.rst:77
msgid "Return the number of times *x* appears in the list."
msgstr "回傳 *x* 在 list 中所出現的次數。"
#: ../../tutorial/datastructures.rst:83
msgid ""
"Sort the items of the list in place (the arguments can be used for sort "
"customization, see :func:`sorted` for their explanation)."
msgstr ""
"將 list 中的項目排序。(可使用引數來進行客製化的排序,請參考 :func:`sorted` "
"部分的解釋)"
#: ../../tutorial/datastructures.rst:90
msgid "Reverse the elements of the list in place."
msgstr "將 list 中的項目前後順序反過來。"
#: ../../tutorial/datastructures.rst:96
msgid "Return a shallow copy of the list. Similar to ``a[:]``."
msgstr "回傳一個淺複製 (shallow copy) 的 list。與 ``a[:]`` 類似。"
#: ../../tutorial/datastructures.rst:99
msgid "An example that uses most of the list methods::"
msgstr "以下是一個使用到許多 list 物件方法的例子: ::"
#: ../../tutorial/datastructures.rst:101
msgid ""
">>> fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', "
"'banana']\n"
">>> fruits.count('apple')\n"
"2\n"
">>> fruits.count('tangerine')\n"
"0\n"
">>> fruits.index('banana')\n"
"3\n"
">>> fruits.index('banana', 4) # Find next banana starting at position 4\n"
"6\n"
">>> fruits.reverse()\n"
">>> fruits\n"
"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange']\n"
">>> fruits.append('grape')\n"
">>> fruits\n"
"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape']\n"
">>> fruits.sort()\n"
">>> fruits\n"
"['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear']\n"
">>> fruits.pop()\n"
"'pear'"
msgstr ""
">>> fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', "
"'banana']\n"
">>> fruits.count('apple')\n"
"2\n"
">>> fruits.count('tangerine')\n"
"0\n"
">>> fruits.index('banana')\n"
"3\n"
">>> fruits.index('banana', 4) # 從位置 4 開始找到下一個 banana\n"
"6\n"
">>> fruits.reverse()\n"
">>> fruits\n"
"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange']\n"
">>> fruits.append('grape')\n"
">>> fruits\n"
"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape']\n"
">>> fruits.sort()\n"
">>> fruits\n"
"['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear']\n"
">>> fruits.pop()\n"
"'pear'"
#: ../../tutorial/datastructures.rst:122
msgid ""
"You might have noticed that methods like ``insert``, ``remove`` or ``sort`` "
"that only modify the list have no return value printed -- they return the "
"default ``None``. [#]_ This is a design principle for all mutable data "
"structures in Python."
msgstr ""
"你可能會注意到一些方法,像是 ``insert``、``remove`` 或者是 ``sort``,並沒有印"
"出回傳值,事實上,他們回傳預設值 ``None`` [#]_。這是一個用於 Python 中所有可"
"變資料結構的設計法則。"
#: ../../tutorial/datastructures.rst:127
msgid ""
"Another thing you might notice is that not all data can be sorted or "
"compared. For instance, ``[None, 'hello', 10]`` doesn't sort because "
"integers can't be compared to strings and ``None`` can't be compared to "
"other types. Also, there are some types that don't have a defined ordering "
"relation. For example, ``3+4j < 5+7j`` isn't a valid comparison."
msgstr ""
"另外你可能也會發現,不是所有資料都可以被排序或比較。例如,``[None, 'hello', "
"10]`` 就不可排序,因為整數不能與字串比較,而 ``None`` 不能與其他型別比較。有"
"些型別根本就沒有被定義彼此之間的大小順序,例如,``3+4j < 5+7j`` 就是一個無效"
"的比較。"
#: ../../tutorial/datastructures.rst:138
msgid "Using Lists as Stacks"
msgstr "將 List 作為 Stack(堆疊)使用"
#: ../../tutorial/datastructures.rst:143
msgid ""
"The list methods make it very easy to use a list as a stack, where the last "
"element added is the first element retrieved (\"last-in, first-out\"). To "
"add an item to the top of the stack, use :meth:`!append`. To retrieve an "
"item from the top of the stack, use :meth:`!pop` without an explicit index. "
"For example::"
msgstr ""
"List 的操作方法使得它非常簡單可以用來實作 stack(堆疊)。Stack 為一個遵守最後"
"加入元素最先被取回(後進先出,\"last-in, first-out\")規則的資料結構。你可以"
"使用方法 :meth:`!append` 將一個項目放到堆疊的頂層。而使用方法 :meth:`!pop` 且"
"不給定索引值去取得堆疊最上面的項目。舉例而言: ::"
#: ../../tutorial/datastructures.rst:148
msgid ""
">>> stack = [3, 4, 5]\n"
">>> stack.append(6)\n"
">>> stack.append(7)\n"
">>> stack\n"
"[3, 4, 5, 6, 7]\n"
">>> stack.pop()\n"
"7\n"
">>> stack\n"
"[3, 4, 5, 6]\n"
">>> stack.pop()\n"
"6\n"
">>> stack.pop()\n"
"5\n"
">>> stack\n"
"[3, 4]"
msgstr ""
">>> stack = [3, 4, 5]\n"
">>> stack.append(6)\n"
">>> stack.append(7)\n"
">>> stack\n"
"[3, 4, 5, 6, 7]\n"
">>> stack.pop()\n"
"7\n"
">>> stack\n"
"[3, 4, 5, 6]\n"
">>> stack.pop()\n"
"6\n"
">>> stack.pop()\n"
"5\n"
">>> stack\n"
"[3, 4]"
#: ../../tutorial/datastructures.rst:168
msgid "Using Lists as Queues"
msgstr "將 List 作為 Queue(佇列)使用"
#: ../../tutorial/datastructures.rst:172
msgid ""
"It is also possible to use a list as a queue, where the first element added "
"is the first element retrieved (\"first-in, first-out\"); however, lists are "
"not efficient for this purpose. While appends and pops from the end of list "
"are fast, doing inserts or pops from the beginning of a list is slow "
"(because all of the other elements have to be shifted by one)."
msgstr ""
"我們也可以將 list 當作 queue(佇列)使用,即最先加入元素最先被取回(先進先"
"出,\"first-in, first-out\")的資料結構。然而,list 在這種使用方式下效率較"
"差。使用 ``append`` 和 ``pop`` 來加入和取出尾端的元素較快,而使用 ``insert`` "
"和 ``pop`` 來插入和取出頭端的元素較慢(因為其他元素都需要挪動一格)。"
#: ../../tutorial/datastructures.rst:178
msgid ""
"To implement a queue, use :class:`collections.deque` which was designed to "
"have fast appends and pops from both ends. For example::"
msgstr ""
"如果要實作 queue,請使用 :class:`collections.deque`,其被設計成能快速的從頭尾"
"兩端加入和取出。例如: ::"
#: ../../tutorial/datastructures.rst:181
msgid ""
">>> from collections import deque\n"
">>> queue = deque([\"Eric\", \"John\", \"Michael\"])\n"
">>> queue.append(\"Terry\") # Terry arrives\n"
">>> queue.append(\"Graham\") # Graham arrives\n"
">>> queue.popleft() # The first to arrive now leaves\n"
"'Eric'\n"
">>> queue.popleft() # The second to arrive now leaves\n"
"'John'\n"
">>> queue # Remaining queue in order of arrival\n"
"deque(['Michael', 'Terry', 'Graham'])"
msgstr ""
">>> from collections import deque\n"
">>> queue = deque([\"Eric\", \"John\", \"Michael\"])\n"
">>> queue.append(\"Terry\") # Terry 加進來\n"
">>> queue.append(\"Graham\") # Graham 加進來\n"
">>> queue.popleft() # 第一個加進來的現在離開\n"
"'Eric'\n"
">>> queue.popleft() # 第二個加進來的現在離開\n"
"'John'\n"
">>> queue # queue 裡剩下的會按照加進來的順序排列\n"
"deque(['Michael', 'Terry', 'Graham'])"
#: ../../tutorial/datastructures.rst:196
msgid "List Comprehensions"
msgstr "List Comprehensions(串列綜合運算)"
#: ../../tutorial/datastructures.rst:198
msgid ""
"List comprehensions provide a concise way to create lists. Common "
"applications are to make new lists where each element is the result of some "
"operations applied to each member of another sequence or iterable, or to "
"create a subsequence of those elements that satisfy a certain condition."
msgstr ""
"List comprehension(串列綜合運算)讓你可以用簡潔的方法建立 list。常見的應用是"
"基於一個序列或 iterable(可疊代物件),將每一個元素經過某個運算的結果串接起來"
"成為新的 list,或是建立一個子序列,其每一個元素皆滿足一個特定的條件。"
#: ../../tutorial/datastructures.rst:203
msgid "For example, assume we want to create a list of squares, like::"
msgstr "舉例來說,假設我們要建立一個「平方的 list」: ::"
#: ../../tutorial/datastructures.rst:205
msgid ""
">>> squares = []\n"
">>> for x in range(10):\n"
"... squares.append(x**2)\n"
"...\n"
">>> squares\n"
"[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]"
msgstr ""
">>> squares = []\n"
">>> for x in range(10):\n"
"... squares.append(x**2)\n"
"...\n"
">>> squares\n"
"[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]"
#: ../../tutorial/datastructures.rst:212
msgid ""
"Note that this creates (or overwrites) a variable named ``x`` that still "
"exists after the loop completes. We can calculate the list of squares "
"without any side effects using::"
msgstr ""
"注意這是建立(或覆寫)一個變數叫 ``x``,其在迴圈結束後仍然存在。我們可以這樣"
"產生平方串列而不造成任何 side effects(副作用): ::"
#: ../../tutorial/datastructures.rst:216
msgid "squares = list(map(lambda x: x**2, range(10)))"
msgstr "squares = list(map(lambda x: x**2, range(10)))"
#: ../../tutorial/datastructures.rst:218
msgid "or, equivalently::"
msgstr "或與此相等的: ::"
#: ../../tutorial/datastructures.rst:220
msgid "squares = [x**2 for x in range(10)]"
msgstr "squares = [x**2 for x in range(10)]"
#: ../../tutorial/datastructures.rst:222
msgid "which is more concise and readable."
msgstr "這樣更簡潔和易讀。"
#: ../../tutorial/datastructures.rst:224
msgid ""
"A list comprehension consists of brackets containing an expression followed "
"by a :keyword:`!for` clause, then zero or more :keyword:`!for` or :keyword:`!"
"if` clauses. The result will be a new list resulting from evaluating the "
"expression in the context of the :keyword:`!for` and :keyword:`!if` clauses "
"which follow it. For example, this listcomp combines the elements of two "
"lists if they are not equal::"
msgstr ""
"一個 list comprehension 的組成,是在一對方括號內,放入一個 expression(運算"
"式)、一個 :keyword:`!for` 子句、再接著零個或多個 :keyword:`!for` 或 :"
"keyword:`!if` 子句。結果會是一個新的 list,內容是在後面的 :keyword:`!for` "
"和 :keyword:`!if` 子句情境下,對前面運算式求值的結果。例如,這個 list "
"comprehension 組合了兩個 list 中彼此相異的元素: ::"
#: ../../tutorial/datastructures.rst:231
msgid ""
">>> [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]\n"
"[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]"
msgstr ""
">>> [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]\n"
"[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]"
#: ../../tutorial/datastructures.rst:234
msgid "and it's equivalent to::"
msgstr "而它就等於: ::"
#: ../../tutorial/datastructures.rst:236
msgid ""
">>> combs = []\n"
">>> for x in [1,2,3]:\n"
"... for y in [3,1,4]:\n"
"... if x != y:\n"
"... combs.append((x, y))\n"
"...\n"
">>> combs\n"
"[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]"
msgstr ""
">>> combs = []\n"
">>> for x in [1,2,3]:\n"
"... for y in [3,1,4]:\n"
"... if x != y:\n"
"... combs.append((x, y))\n"
"...\n"
">>> combs\n"
"[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]"
#: ../../tutorial/datastructures.rst:245
msgid ""
"Note how the order of the :keyword:`for` and :keyword:`if` statements is the "
"same in both these snippets."
msgstr "注意 :keyword:`for` 和 :keyword:`if` 在這兩段程式裡的順序是相同的。"
#: ../../tutorial/datastructures.rst:248
msgid ""
"If the expression is a tuple (e.g. the ``(x, y)`` in the previous example), "
"it must be parenthesized. ::"
msgstr ""
"如果 expression 是一個 tuple(例如上面例子中的 ``(x, y)``),它必須加上括"
"號: ::"
#: ../../tutorial/datastructures.rst:251
msgid ""
">>> vec = [-4, -2, 0, 2, 4]\n"
">>> # create a new list with the values doubled\n"
">>> [x*2 for x in vec]\n"
"[-8, -4, 0, 4, 8]\n"
">>> # filter the list to exclude negative numbers\n"
">>> [x for x in vec if x >= 0]\n"
"[0, 2, 4]\n"
">>> # apply a function to all the elements\n"
">>> [abs(x) for x in vec]\n"
"[4, 2, 0, 2, 4]\n"
">>> # call a method on each element\n"
">>> freshfruit = [' banana', ' loganberry ', 'passion fruit ']\n"
">>> [weapon.strip() for weapon in freshfruit]\n"
"['banana', 'loganberry', 'passion fruit']\n"
">>> # create a list of 2-tuples like (number, square)\n"
">>> [(x, x**2) for x in range(6)]\n"
"[(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25)]\n"
">>> # the tuple must be parenthesized, otherwise an error is raised\n"
">>> [x, x**2 for x in range(6)]\n"
" File \"<stdin>\", line 1\n"
" [x, x**2 for x in range(6)]\n"
" ^^^^^^^\n"
"SyntaxError: did you forget parentheses around the comprehension target?\n"
">>> # flatten a list using a listcomp with two 'for'\n"
">>> vec = [[1,2,3], [4,5,6], [7,8,9]]\n"
">>> [num for elem in vec for num in elem]\n"
"[1, 2, 3, 4, 5, 6, 7, 8, 9]"
msgstr ""
#: ../../tutorial/datastructures.rst:279
msgid ""
"List comprehensions can contain complex expressions and nested functions::"
msgstr "List comprehensions 可以含有複雜的 expression 和巢狀的函式: ::"
#: ../../tutorial/datastructures.rst:281
msgid ""
">>> from math import pi\n"
">>> [str(round(pi, i)) for i in range(1, 6)]\n"
"['3.1', '3.14', '3.142', '3.1416', '3.14159']"
msgstr ""
">>> from math import pi\n"
">>> [str(round(pi, i)) for i in range(1, 6)]\n"
"['3.1', '3.14', '3.142', '3.1416', '3.14159']"
#: ../../tutorial/datastructures.rst:286
msgid "Nested List Comprehensions"
msgstr "巢狀的 List Comprehensions"
#: ../../tutorial/datastructures.rst:288
msgid ""
"The initial expression in a list comprehension can be any arbitrary "
"expression, including another list comprehension."
msgstr ""
"在 list comprehesion 中開頭的 expression 可以是任何形式的 expression,包括再"
"寫一個 list comprehension。"
#: ../../tutorial/datastructures.rst:291
msgid ""
"Consider the following example of a 3x4 matrix implemented as a list of 3 "
"lists of length 4::"
msgstr "考慮以下表示 3x4 矩陣的範例,使用 list 包含 3 個長度為 4 的 list :"
#: ../../tutorial/datastructures.rst:294
msgid ""
">>> matrix = [\n"
"... [1, 2, 3, 4],\n"
"... [5, 6, 7, 8],\n"
"... [9, 10, 11, 12],\n"
"... ]"
msgstr ""
">>> matrix = [\n"
"... [1, 2, 3, 4],\n"
"... [5, 6, 7, 8],\n"
"... [9, 10, 11, 12],\n"
"... ]"
#: ../../tutorial/datastructures.rst:300
msgid "The following list comprehension will transpose rows and columns::"
msgstr "以下的 list comprehesion 會將矩陣的行與列作轉置: ::"
#: ../../tutorial/datastructures.rst:302
msgid ""
">>> [[row[i] for row in matrix] for i in range(4)]\n"
"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]"
msgstr ""
">>> [[row[i] for row in matrix] for i in range(4)]\n"
"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]"
#: ../../tutorial/datastructures.rst:305
msgid ""
"As we saw in the previous section, the inner list comprehension is evaluated "
"in the context of the :keyword:`for` that follows it, so this example is "
"equivalent to::"
msgstr ""
"如同我們在上一節看到的,內部的 list comprehension 會依據後面的 :keyword:"
"`for` 環境被求值,所以這個例子就等於: ::"
#: ../../tutorial/datastructures.rst:309
msgid ""
">>> transposed = []\n"
">>> for i in range(4):\n"
"... transposed.append([row[i] for row in matrix])\n"
"...\n"
">>> transposed\n"
"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]"
msgstr ""
">>> transposed = []\n"
">>> for i in range(4):\n"
"... transposed.append([row[i] for row in matrix])\n"
"...\n"
">>> transposed\n"
"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]"
#: ../../tutorial/datastructures.rst:316
msgid "which, in turn, is the same as::"
msgstr "而它也和這一段相同: ::"
#: ../../tutorial/datastructures.rst:318
msgid ""
">>> transposed = []\n"
">>> for i in range(4):\n"
"... # the following 3 lines implement the nested listcomp\n"
"... transposed_row = []\n"
"... for row in matrix:\n"
"... transposed_row.append(row[i])\n"
"... transposed.append(transposed_row)\n"
"...\n"
">>> transposed\n"
"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]"
msgstr ""
">>> transposed = []\n"
">>> for i in range(4):\n"
"... # 下面這三行實作了巢狀的 listcomp\n"
"... transposed_row = []\n"
"... for row in matrix:\n"
"... transposed_row.append(row[i])\n"
"... transposed.append(transposed_row)\n"
"...\n"
">>> transposed\n"
"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]"
#: ../../tutorial/datastructures.rst:329
msgid ""
"In the real world, you should prefer built-in functions to complex flow "
"statements. The :func:`zip` function would do a great job for this use case::"
msgstr ""
"在實際運用上,我們傾向於使用內建函式 (built-in functions) 而不是複雜的流程控"
"制陳述式。在這個例子中,使用 :func:`zip` 函式會非常有效率: ::"
#: ../../tutorial/datastructures.rst:332
msgid ""
">>> list(zip(*matrix))\n"
"[(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]"
msgstr ""
">>> list(zip(*matrix))\n"
"[(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]"
#: ../../tutorial/datastructures.rst:335
msgid ""
"See :ref:`tut-unpacking-arguments` for details on the asterisk in this line."
msgstr "關於星號的更多細節,請參考\\ :ref:`tut-unpacking-arguments`。"
#: ../../tutorial/datastructures.rst:340
msgid "The :keyword:`!del` statement"
msgstr ":keyword:`!del` 陳述式"
#: ../../tutorial/datastructures.rst:342
msgid ""
"There is a way to remove an item from a list given its index instead of its "
"value: the :keyword:`del` statement. This differs from the :meth:`!pop` "
"method which returns a value. The :keyword:`!del` statement can also be "
"used to remove slices from a list or clear the entire list (which we did "
"earlier by assignment of an empty list to the slice). For example::"
msgstr ""
"有一個方法可以藉由索引而不是值來刪除 list 中的項目::keyword:`del` 陳述式。這"
"和 :meth:`!pop` method 傳回一個值不同,:keyword:`!del` 陳述式可以用來刪除 "
"list 中的片段或者清空整個 list(我們之前藉由指派一個空的 list 給想刪除的片段"
"來完成這件事)。例如: ::"
#: ../../tutorial/datastructures.rst:348
msgid ""
">>> a = [-1, 1, 66.25, 333, 333, 1234.5]\n"
">>> del a[0]\n"
">>> a\n"
"[1, 66.25, 333, 333, 1234.5]\n"
">>> del a[2:4]\n"
">>> a\n"
"[1, 66.25, 1234.5]\n"
">>> del a[:]\n"
">>> a\n"
"[]"
msgstr ""
">>> a = [-1, 1, 66.25, 333, 333, 1234.5]\n"
">>> del a[0]\n"
">>> a\n"
"[1, 66.25, 333, 333, 1234.5]\n"
">>> del a[2:4]\n"
">>> a\n"
"[1, 66.25, 1234.5]\n"
">>> del a[:]\n"
">>> a\n"
"[]"
#: ../../tutorial/datastructures.rst:359
msgid ":keyword:`del` can also be used to delete entire variables::"
msgstr ":keyword:`del` 也可以用來刪除整個變數: ::"
#: ../../tutorial/datastructures.rst:361
msgid ">>> del a"
msgstr ">>> del a"
#: ../../tutorial/datastructures.rst:363
msgid ""
"Referencing the name ``a`` hereafter is an error (at least until another "
"value is assigned to it). We'll find other uses for :keyword:`del` later."
msgstr ""
"刪除之後,對 ``a`` 的參照將會造成錯誤(至少在另一個值又被指派到它之前)。我們"
"將在後面看到更多關於 :keyword:`del` 的其他用法。"
#: ../../tutorial/datastructures.rst:370
msgid "Tuples and Sequences"
msgstr "Tuples 和序列 (Sequences)"
#: ../../tutorial/datastructures.rst:372
msgid ""
"We saw that lists and strings have many common properties, such as indexing "
"and slicing operations. They are two examples of *sequence* data types "
"(see :ref:`typesseq`). Since Python is an evolving language, other sequence "
"data types may be added. There is also another standard sequence data type: "
"the *tuple*."
msgstr ""
"我們看到 list 和字串 (string) 有許多共同的特性,像是索引操作 (indexing) 以及"
"切片操作 (slicing) 。他們是\\ *序列*\\ 資料類型中的兩個例子(請參考\\ :ref:"
"`typesseq`\\ )。由於 Python 是個持續發展中的語言,未來可能還會有其他的序列資"
"料類型加入。接著要介紹是下一個標準序列資料類型:*tuple*。"
#: ../../tutorial/datastructures.rst:378
msgid ""
"A tuple consists of a number of values separated by commas, for instance::"
msgstr "一個 tuple 是由若干個值藉由逗號區隔而組成,例如: ::"
#: ../../tutorial/datastructures.rst:380
msgid ""
">>> t = 12345, 54321, 'hello!'\n"
">>> t[0]\n"
"12345\n"
">>> t\n"
"(12345, 54321, 'hello!')\n"
">>> # Tuples may be nested:\n"
">>> u = t, (1, 2, 3, 4, 5)\n"
">>> u\n"
"((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))\n"
">>> # Tuples are immutable:\n"
">>> t[0] = 88888\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 1, in <module>\n"
"TypeError: 'tuple' object does not support item assignment\n"
">>> # but they can contain mutable objects:\n"
">>> v = ([1, 2, 3], [3, 2, 1])\n"
">>> v\n"
"([1, 2, 3], [3, 2, 1])"
msgstr ""
">>> t = 12345, 54321, 'hello!'\n"
">>> t[0]\n"
"12345\n"
">>> t\n"
"(12345, 54321, 'hello!')\n"
">>> # Tuple 可以為巢狀的:\n"
">>> u = t, (1, 2, 3, 4, 5)\n"
">>> u\n"
"((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))\n"
">>> # Tuple 為不可變的:\n"
">>> t[0] = 88888\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 1, in <module>\n"
"TypeError: 'tuple' object does not support item assignment\n"
">>> # but they can contain mutable objects:\n"
">>> v = ([1, 2, 3], [3, 2, 1])\n"
">>> v\n"
"([1, 2, 3], [3, 2, 1])"
#: ../../tutorial/datastructures.rst:400
msgid ""
"As you see, on output tuples are always enclosed in parentheses, so that "
"nested tuples are interpreted correctly; they may be input with or without "
"surrounding parentheses, although often parentheses are necessary anyway (if "
"the tuple is part of a larger expression). It is not possible to assign to "
"the individual items of a tuple, however it is possible to create tuples "
"which contain mutable objects, such as lists."
msgstr ""
"如同我們看到的,被輸出的 tuple 總是以括號包著,如此巢狀的 tuple 才能被正確的"
"直譯 (interpret);他們可以是以被括號包著或不被包著的方式當作輸入,雖然括號的"
"使用常常是有其必要的(譬如此 tuple 是一個較大的運算式的一部分)。指派東西給 "
"tuple 中的個別項目是不行的,但是可以建立含有可變物件(譬如 list)的 tuple。"
#: ../../tutorial/datastructures.rst:407
msgid ""
"Though tuples may seem similar to lists, they are often used in different "
"situations and for different purposes. Tuples are :term:`immutable`, and "
"usually contain a heterogeneous sequence of elements that are accessed via "
"unpacking (see later in this section) or indexing (or even by attribute in "
"the case of :func:`namedtuples <collections.namedtuple>`). Lists are :term:"
"`mutable`, and their elements are usually homogeneous and are accessed by "
"iterating over the list."
msgstr ""
"雖然 tuple 和 list 看起來很類似,但是他們通常用在不同的情況與不同目的。 "
"tuple 是 :term:`immutable`\\ (不可變的),通常儲存異質的元素序列,並可經由拆"
"解 (unpacking)(請參考本節後段)或索引 (indexing) 來存取(或者在使用 :func:"
"`namedtuples <collections.namedtuple>` 的時候藉由屬性 (attribute) 來存取)。"
"List 是 :term:`mutable`\\ (可變的),其元素通常是同質的且可藉由疊代整個 "
"list 來存取。"
#: ../../tutorial/datastructures.rst:415
msgid ""
"A special problem is the construction of tuples containing 0 or 1 items: the "
"syntax has some extra quirks to accommodate these. Empty tuples are "
"constructed by an empty pair of parentheses; a tuple with one item is "
"constructed by following a value with a comma (it is not sufficient to "
"enclose a single value in parentheses). Ugly, but effective. For example::"
msgstr ""
"一個特別的議題是,關於建立一個含有 0 個或 1 個項目的 tuple:語法上會採納一些"
"奇怪的用法。空的 tuple 藉由一對空括號來建立;含有一個項目的 tuple 經由一個值"
"加上一個逗點來建立(用括號把一個單一的值包住是不夠的)。醜,但有效率。例"
"如: ::"
#: ../../tutorial/datastructures.rst:421
msgid ""
">>> empty = ()\n"
">>> singleton = 'hello', # <-- note trailing comma\n"
">>> len(empty)\n"
"0\n"
">>> len(singleton)\n"
"1\n"
">>> singleton\n"
"('hello',)"
msgstr ""
">>> empty = ()\n"
">>> singleton = 'hello', # <-- 注意後面有個逗號\n"
">>> len(empty)\n"
"0\n"
">>> len(singleton)\n"
"1\n"
">>> singleton\n"
"('hello',)"
#: ../../tutorial/datastructures.rst:430
msgid ""
"The statement ``t = 12345, 54321, 'hello!'`` is an example of *tuple "
"packing*: the values ``12345``, ``54321`` and ``'hello!'`` are packed "
"together in a tuple. The reverse operation is also possible::"
msgstr ""
"陳述式 ``t = 12345, 54321, 'hello!'`` 就是一個 *tuple packing* 的例子:"
"``12345``,``54321`` 和 ``'hello!'`` 一起被放進 tuple 裡。反向操作也可以: ::"
#: ../../tutorial/datastructures.rst:434
msgid ">>> x, y, z = t"
msgstr ">>> x, y, z = t"
#: ../../tutorial/datastructures.rst:436
msgid ""
"This is called, appropriately enough, *sequence unpacking* and works for any "
"sequence on the right-hand side. Sequence unpacking requires that there are "
"as many variables on the left side of the equals sign as there are elements "
"in the sequence. Note that multiple assignment is really just a combination "
"of tuple packing and sequence unpacking."
msgstr ""
"這個正是我們所說序列拆解 (*sequence unpacking*),可運用在任何位在等號右邊的序"
"列。序列拆解要求等號左邊的變數數量必須與等號右邊的序列中的元素數量相同。注"
"意,多重指派就只是 tuple packing 和序列拆解的結合而已。"
#: ../../tutorial/datastructures.rst:446
msgid "Sets"
msgstr "集合 (Sets)"
#: ../../tutorial/datastructures.rst:448
msgid ""
"Python also includes a data type for *sets*. A set is an unordered "
"collection with no duplicate elements. Basic uses include membership "
"testing and eliminating duplicate entries. Set objects also support "
"mathematical operations like union, intersection, difference, and symmetric "
"difference."
msgstr ""
"Python 也包含了一種用在 *set*\\ (集合)的資料類型。一個 set 是一組無序且沒有"
"重複的元素。基本的使用方式包括了隸屬資格檢測和消除重複元素。 Set 物件也支援聯"
"集、交集、差集和互斥等數學運算。"
#: ../../tutorial/datastructures.rst:453
msgid ""
"Curly braces or the :func:`set` function can be used to create sets. Note: "
"to create an empty set you have to use ``set()``, not ``{}``; the latter "
"creates an empty dictionary, a data structure that we discuss in the next "
"section."
msgstr ""
"大括號或 :func:`set` 函式都可以用來建立 set。注意:要建立一個空的 set,你必須"
"使用 ``set()`` 而不是 ``{}``;後者會建立一個空的 dictionary,一種我們將在下一"
"節討論的資料結構。"
#: ../../tutorial/datastructures.rst:457
msgid "Here is a brief demonstration::"
msgstr "這裡是一個簡單的演示: ::"
#: ../../tutorial/datastructures.rst:459
msgid ""
">>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}\n"
">>> print(basket) # show that duplicates have been "
"removed\n"
"{'orange', 'banana', 'pear', 'apple'}\n"
">>> 'orange' in basket # fast membership testing\n"
"True\n"
">>> 'crabgrass' in basket\n"
"False\n"
"\n"
">>> # Demonstrate set operations on unique letters from two words\n"
">>>\n"
">>> a = set('abracadabra')\n"
">>> b = set('alacazam')\n"
">>> a # unique letters in a\n"
"{'a', 'r', 'b', 'c', 'd'}\n"
">>> a - b # letters in a but not in b\n"
"{'r', 'd', 'b'}\n"
">>> a | b # letters in a or b or both\n"
"{'a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'}\n"
">>> a & b # letters in both a and b\n"
"{'a', 'c'}\n"
">>> a ^ b # letters in a or b but not both\n"
"{'r', 'd', 'b', 'm', 'z', 'l'}"
msgstr ""
#: ../../tutorial/datastructures.rst:482
msgid ""
"Similarly to :ref:`list comprehensions <tut-listcomps>`, set comprehensions "
"are also supported::"
msgstr ""
"和 :ref:`list comprehensions <tut-listcomps>` 類似,也有 set comprehensions"
"(集合綜合運算): ::"
#: ../../tutorial/datastructures.rst:485
msgid ""
">>> a = {x for x in 'abracadabra' if x not in 'abc'}\n"
">>> a\n"
"{'r', 'd'}"
msgstr ""
">>> a = {x for x in 'abracadabra' if x not in 'abc'}\n"
">>> a\n"
"{'r', 'd'}"
#: ../../tutorial/datastructures.rst:493
msgid "Dictionaries"
msgstr "字典(Dictionary)"
#: ../../tutorial/datastructures.rst:495
msgid ""
"Another useful data type built into Python is the *dictionary* (see :ref:"
"`typesmapping`). Dictionaries are sometimes found in other languages as "
"\"associative memories\" or \"associative arrays\". Unlike sequences, which "
"are indexed by a range of numbers, dictionaries are indexed by *keys*, which "
"can be any immutable type; strings and numbers can always be keys. Tuples "
"can be used as keys if they contain only strings, numbers, or tuples; if a "
"tuple contains any mutable object either directly or indirectly, it cannot "
"be used as a key. You can't use lists as keys, since lists can be modified "
"in place using index assignments, slice assignments, or methods like :meth:`!"
"append` and :meth:`!extend`."
msgstr ""
"下一個常用的 Python 內建資料類型為 *dictionary*\\ (請參考\\ :ref:"
"`typesmapping`\\ )。 Dictionary 有時被稱為「關聯記憶體」(associative "
"memories) 或「關聯陣列」(associative arrays)。不像序列是由一個範圍內的數字當"
"作索引,dictionary 是由\\ *鍵* (key) 來當索引,鍵可以是任何不可變的類型;字串"
"和數字都可以當作鍵。Tuple 也可以當作鍵,如果他們只含有字串、數字或 tuple;若"
"一個 tuple 直接或間接地含有任何可變的物件,它就不能當作鍵。你無法使用 list 當"
"作鍵,因為 list 可以經由索引指派 (index assignment)、切片指派 (slice "
"assignment) 或是像 :meth:`!append` 和 :meth:`!extend` 等 method 被修改。"
#: ../../tutorial/datastructures.rst:506
msgid ""
"It is best to think of a dictionary as a set of *key: value* pairs, with the "
"requirement that the keys are unique (within one dictionary). A pair of "
"braces creates an empty dictionary: ``{}``. Placing a comma-separated list "
"of key:value pairs within the braces adds initial key:value pairs to the "
"dictionary; this is also the way dictionaries are written on output."
msgstr ""
"思考 dictionary 最好的方式是把它想成是一組\\ *鍵值*\\ 對 (*key: value* pair) "
"的 set,其中鍵在同一個 dictionary 裡必須是獨一無二的。使用一對大括號可建立一"
"個空的 dictionary:``{}``。將一串由逗號分隔的鍵值對置於大括號則可初始化字典的"
"鍵值對。這同樣也是字典輸出時的格式。"
#: ../../tutorial/datastructures.rst:512
msgid ""
"The main operations on a dictionary are storing a value with some key and "
"extracting the value given the key. It is also possible to delete a key:"
"value pair with ``del``. If you store using a key that is already in use, "
"the old value associated with that key is forgotten. It is an error to "
"extract a value using a non-existent key."
msgstr ""
"Dictionary 主要的操作為藉由鍵來儲存一個值並且可藉由該鍵來取出該值。也可以使"
"用 ``del`` 來刪除鍵值對。如果我們使用用過的鍵來儲存,該鍵所對應的較舊的值會被"
"覆蓋。使用不存在的鍵來取出值會造成錯誤。"
#: ../../tutorial/datastructures.rst:518
msgid ""
"Performing ``list(d)`` on a dictionary returns a list of all the keys used "
"in the dictionary, in insertion order (if you want it sorted, just use "
"``sorted(d)`` instead). To check whether a single key is in the dictionary, "
"use the :keyword:`in` keyword."
msgstr ""
"對 dictionary 使用 ``list(d)`` 會得到一個包含該字典所有鍵的 list,其排列順序"
"為插入時的順序。(若想要排序,則使用 ``sorted(d)`` 代替即可)。如果想確認一個"
"鍵是否已存在於字典中,可使用關鍵字 :keyword:`in`。"
#: ../../tutorial/datastructures.rst:523
msgid "Here is a small example using a dictionary::"
msgstr "這是個使用一個 dictionary 的簡單範例: ::"
#: ../../tutorial/datastructures.rst:525
msgid ""
">>> tel = {'jack': 4098, 'sape': 4139}\n"
">>> tel['guido'] = 4127\n"
">>> tel\n"
"{'jack': 4098, 'sape': 4139, 'guido': 4127}\n"
">>> tel['jack']\n"
"4098\n"
">>> del tel['sape']\n"
">>> tel['irv'] = 4127\n"
">>> tel\n"
"{'jack': 4098, 'guido': 4127, 'irv': 4127}\n"
">>> list(tel)\n"
"['jack', 'guido', 'irv']\n"
">>> sorted(tel)\n"
"['guido', 'irv', 'jack']\n"
">>> 'guido' in tel\n"
"True\n"
">>> 'jack' not in tel\n"
"False"
msgstr ""
">>> tel = {'jack': 4098, 'sape': 4139}\n"
">>> tel['guido'] = 4127\n"
">>> tel\n"
"{'jack': 4098, 'sape': 4139, 'guido': 4127}\n"
">>> tel['jack']\n"
"4098\n"
">>> del tel['sape']\n"
">>> tel['irv'] = 4127\n"
">>> tel\n"
"{'jack': 4098, 'guido': 4127, 'irv': 4127}\n"
">>> list(tel)\n"
"['jack', 'guido', 'irv']\n"
">>> sorted(tel)\n"
"['guido', 'irv', 'jack']\n"
">>> 'guido' in tel\n"
"True\n"
">>> 'jack' not in tel\n"
"False"
#: ../../tutorial/datastructures.rst:544
msgid ""
"The :func:`dict` constructor builds dictionaries directly from sequences of "
"key-value pairs::"
msgstr "函式 :func:`dict` 可直接透過一串鍵值對序列來建立 dictionary: ::"
#: ../../tutorial/datastructures.rst:547
msgid ""
">>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)])\n"
"{'sape': 4139, 'guido': 4127, 'jack': 4098}"
msgstr ""
">>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)])\n"
"{'sape': 4139, 'guido': 4127, 'jack': 4098}"
#: ../../tutorial/datastructures.rst:550
msgid ""
"In addition, dict comprehensions can be used to create dictionaries from "