-
-
Notifications
You must be signed in to change notification settings - Fork 224
Expand file tree
/
Copy pathcontrolflow.po
More file actions
1438 lines (1273 loc) · 61.9 KB
/
controlflow.po
File metadata and controls
1438 lines (1273 loc) · 61.9 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:
# Liang-Bo Wang <me@liang2.tw>, 2015
# Liang-Bo Wang <me@liang2.tw>, 2016
# hsiao yi <hsiaoyi0504@gmail.com>, 2015
# Steven Hsu <hsuhaochun@gmail.com>, 2021-2022
msgid ""
msgstr ""
"Project-Id-Version: Python 3.12\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-22 00:03+0000\n"
"PO-Revision-Date: 2022-07-24 14:52+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.1.1\n"
#: ../../tutorial/controlflow.rst:5
msgid "More Control Flow Tools"
msgstr "深入了解流程控制"
#: ../../tutorial/controlflow.rst:7
msgid ""
"As well as the :keyword:`while` statement just introduced, Python uses a few "
"more that we will encounter in this chapter."
msgstr ""
"除了剛才介紹的 :keyword:`while`,這章節還會介紹一些 Python 的陳述式語法。"
#: ../../tutorial/controlflow.rst:14
msgid ":keyword:`!if` Statements"
msgstr ":keyword:`!if` 陳述式"
#: ../../tutorial/controlflow.rst:16
msgid ""
"Perhaps the most well-known statement type is the :keyword:`if` statement. "
"For example::"
msgstr ""
"或許最常見的陳述式種類就是 :keyword:`if` 了。舉例來說:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:33
msgid ""
"There can be zero or more :keyword:`elif` parts, and the :keyword:`else` "
"part is optional. The keyword ':keyword:`!elif`' is short for 'else if', "
"and is useful to avoid excessive indentation. An :keyword:`!if` ... :"
"keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute for the "
"``switch`` or ``case`` statements found in other languages."
msgstr ""
"在陳述式中,可以沒有或有許多個 :keyword:`elif` 敘述,且 :keyword:`else` 敘述"
"並不是必要的。關鍵字 :keyword:`!elif` 是「else if」的縮寫,用來避免過多的縮"
"排。一個 :keyword:`!if` ... :keyword:`!elif` ... :keyword:`!elif` ... 序列可"
"以用來替代其他程式語言中的 ``switch`` 或 ``case`` 陳述式。"
#: ../../tutorial/controlflow.rst:39
msgid ""
"If you're comparing the same value to several constants, or checking for "
"specific types or attributes, you may also find the :keyword:`!match` "
"statement useful. For more details see :ref:`tut-match`."
msgstr ""
"如果你要將同一個值與多個常數進行比較,或者檢查特定的型別或屬性,你可能會發"
"現 :keyword:`!match` 陳述式也很有用。更多的細節,請參閱 :ref:`tut-match`。"
#: ../../tutorial/controlflow.rst:46
msgid ":keyword:`!for` Statements"
msgstr ":keyword:`!for` 陳述式"
#: ../../tutorial/controlflow.rst:51
msgid ""
"The :keyword:`for` statement in Python differs a bit from what you may be "
"used to in C or Pascal. Rather than always iterating over an arithmetic "
"progression of numbers (like in Pascal), or giving the user the ability to "
"define both the iteration step and halting condition (as C), Python's :"
"keyword:`!for` statement iterates over the items of any sequence (a list or "
"a string), in the order that they appear in the sequence. For example (no "
"pun intended):"
msgstr ""
"在 Python 中的 :keyword:`for` 陳述式有點不同於在 C 或 Pascal 中的慣用方式。相"
"較於只能疊代 (iterate) 一個等差數列(如 Pascal),或給予使用者定義疊代步驟與"
"終止條件(如 C),Python 的 :keyword:`!for` 陳述式疊代任何序列(list 或者字"
"串)的元素,順序與它們出現在序列中的順序相同。例如(無意雙關):\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:72
msgid ""
"Code that modifies a collection while iterating over that same collection "
"can be tricky to get right. Instead, it is usually more straight-forward to "
"loop over a copy of the collection or to create a new collection::"
msgstr ""
"在疊代一個集合的同時修改該集合的內容,很難獲取想要的結果。比較直觀的替代方"
"式,是疊代該集合的副本,或建立一個新的集合:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:94
msgid "The :func:`range` Function"
msgstr ":func:`range` 函式"
#: ../../tutorial/controlflow.rst:96
msgid ""
"If you do need to iterate over a sequence of numbers, the built-in function :"
"func:`range` comes in handy. It generates arithmetic progressions::"
msgstr ""
"如果你需要疊代一個數列的話,使用內建 :func:`range` 函式就很方便。它可以生成一"
"等差數列:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:108
msgid ""
"The given end point is never part of the generated sequence; ``range(10)`` "
"generates 10 values, the legal indices for items of a sequence of length "
"10. It is possible to let the range start at another number, or to specify "
"a different increment (even negative; sometimes this is called the 'step')::"
msgstr ""
"給定的結束值永遠不會出現在生成的序列中;\\ ``range(10)`` 生成的 10 個數值,即"
"對應存取一個長度為 10 的序列內每一個項目的索引值。也可以讓 range 從其他數值開"
"始計數,或者給定不同的公差(甚至為負;有時稱之為 step):\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:122
msgid ""
"To iterate over the indices of a sequence, you can combine :func:`range` "
"and :func:`len` as follows::"
msgstr ""
"欲疊代一個序列的索引值,你可以搭配使用 :func:`range` 和 :func:`len` 如下:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:135
msgid ""
"In most such cases, however, it is convenient to use the :func:`enumerate` "
"function, see :ref:`tut-loopidioms`."
msgstr ""
"然而,在多數的情況,使用 :func:`enumerate` 函式將更為方便,詳見\\ :ref:`tut-"
"loopidioms`。"
#: ../../tutorial/controlflow.rst:138
msgid "A strange thing happens if you just print a range::"
msgstr ""
"如果直接印出一個 range 則會出現奇怪的輸出:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:143
msgid ""
"In many ways the object returned by :func:`range` behaves as if it is a "
"list, but in fact it isn't. It is an object which returns the successive "
"items of the desired sequence when you iterate over it, but it doesn't "
"really make the list, thus saving space."
msgstr ""
"在很多情況下,由 :func:`range` 回傳的物件表現得像是一個 list(串列)一樣,但"
"實際上它並不是。它是一個在疊代時能夠回傳所要求的序列中所有項目的物件,但它不"
"會真正建出這個序列的 list,以節省空間。"
#: ../../tutorial/controlflow.rst:148
msgid ""
"We say such an object is :term:`iterable`, that is, suitable as a target for "
"functions and constructs that expect something from which they can obtain "
"successive items until the supply is exhausted. We have seen that the :"
"keyword:`for` statement is such a construct, while an example of a function "
"that takes an iterable is :func:`sum`::"
msgstr ""
"我們稱這樣的物件為 :term:`iterable`\\ (可疊代物件),意即能作為函式及架構中"
"可以一直獲取項目直到取盡的對象。我們已經了解 :keyword:`for` 陳述式就是如此的"
"架構,另一個使用 iterable 的函式範例是 :func:`sum`\\ :\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:157
msgid ""
"Later we will see more functions that return iterables and take iterables as "
"arguments. In chapter :ref:`tut-structures`, we will discuss in more detail "
"about :func:`list`."
msgstr ""
"待會我們可以看到更多回傳 iterable 和使用 iterable 為引數的函式。在\\ :ref:"
"`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。"
#: ../../tutorial/controlflow.rst:164
msgid ""
":keyword:`!break` and :keyword:`!continue` Statements, and :keyword:`!else` "
"Clauses on Loops"
msgstr ""
"迴圈內的 :keyword:`!break` 和 :keyword:`!continue` 陳述式及 :keyword:`!else` "
"子句"
#: ../../tutorial/controlflow.rst:166
msgid ""
"The :keyword:`break` statement breaks out of the innermost enclosing :"
"keyword:`for` or :keyword:`while` loop."
msgstr ""
":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` 或 :keyword:"
"`while` 迴圈。"
#: ../../tutorial/controlflow.rst:169
msgid ""
"A :keyword:`!for` or :keyword:`!while` loop can include an :keyword:`!else` "
"clause."
msgstr ""
":keyword:`!for` 和 :keyword:`!while` 迴圈可帶有一個 :keyword:`!else` 子句"
#: ../../tutorial/controlflow.rst:171
msgid ""
"In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the "
"loop reaches its final iteration."
msgstr ""
"在 :keyword:`for` 迴圈中,:keyword:`!else` 子句會在迴圈到達最終的疊代後執行。"
#: ../../tutorial/controlflow.rst:174
msgid ""
"In a :keyword:`while` loop, it's executed after the loop's condition becomes "
"false."
msgstr "在 :keyword:`while` 迴圈中,它會在迴圈條件變為 false 後執行。"
#: ../../tutorial/controlflow.rst:176
msgid ""
"In either kind of loop, the :keyword:`!else` clause is **not** executed if "
"the loop was terminated by a :keyword:`break`."
msgstr ""
"在任何一種迴圈中,如果迴圈由 :keyword:`break` 終止,則不會執行 :keyword:`!"
"else` 子句。"
#: ../../tutorial/controlflow.rst:179
msgid ""
"This is exemplified in the following :keyword:`!for` loop, which searches "
"for prime numbers::"
msgstr "下面的 :keyword:`!for` 迴圈對此進行了舉例說明,該迴圈用以搜索質數: ::"
#: ../../tutorial/controlflow.rst:200
msgid ""
"(Yes, this is the correct code. Look closely: the ``else`` clause belongs "
"to the :keyword:`for` loop, **not** the :keyword:`if` statement.)"
msgstr ""
"(沒錯,這是正確的程式碼。請看仔細:``else`` 子句屬於 :keyword:`for` 迴圈,**"
"並非** :keyword:`if` 陳述式。)"
#: ../../tutorial/controlflow.rst:203
msgid ""
"When used with a loop, the ``else`` clause has more in common with the "
"``else`` clause of a :keyword:`try` statement than it does with that of :"
"keyword:`if` statements: a :keyword:`try` statement's ``else`` clause runs "
"when no exception occurs, and a loop's ``else`` clause runs when no "
"``break`` occurs. For more on the :keyword:`!try` statement and exceptions, "
"see :ref:`tut-handling`."
msgstr ""
"當 ``else`` 子句用於迴圈時,相較於搭配 :keyword:`if` 陳述式使用,它的行為與 :"
"keyword:`try` 陳述式中的 ``else`` 子句更為相似::keyword:`try` 陳述式的 "
"``else`` 子句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有"
"任何 ``break`` 發生時執行。更多有關 :keyword:`!try` 陳述式和例外的介紹,見"
"\\ :ref:`tut-handling`。"
#: ../../tutorial/controlflow.rst:210
msgid ""
"The :keyword:`continue` statement, also borrowed from C, continues with the "
"next iteration of the loop::"
msgstr ""
":keyword:`continue` 陳述式,亦承襲於 C 語言,讓所屬的迴圈繼續執行下個疊代:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:231
msgid ":keyword:`!pass` Statements"
msgstr ":keyword:`!pass` 陳述式"
#: ../../tutorial/controlflow.rst:233
msgid ""
"The :keyword:`pass` statement does nothing. It can be used when a statement "
"is required syntactically but the program requires no action. For example::"
msgstr ""
":keyword:`pass` 陳述式不執行任何動作。它可用在語法上需要一個陳述式但程式不需"
"要執行任何動作的時候。例如:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:240
msgid "This is commonly used for creating minimal classes::"
msgstr ""
"這經常用於建立簡單的 class(類別):\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:246
msgid ""
"Another place :keyword:`pass` can be used is as a place-holder for a "
"function or conditional body when you are working on new code, allowing you "
"to keep thinking at a more abstract level. The :keyword:`!pass` is silently "
"ignored::"
msgstr ""
":keyword:`pass` 亦可作為一個函式或條件判斷主體的預留位置,在你撰寫新的程式碼"
"時讓你保持在更抽象的思維層次。:keyword:`!pass` 會直接被忽略:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:258
msgid ":keyword:`!match` Statements"
msgstr ":keyword:`!match` 陳述式"
#: ../../tutorial/controlflow.rst:260
msgid ""
"A :keyword:`match` statement takes an expression and compares its value to "
"successive patterns given as one or more case blocks. This is superficially "
"similar to a switch statement in C, Java or JavaScript (and many other "
"languages), but it's more similar to pattern matching in languages like Rust "
"or Haskell. Only the first pattern that matches gets executed and it can "
"also extract components (sequence elements or object attributes) from the "
"value into variables."
msgstr ""
":keyword:`match` 陳述式會拿取一個運算式,並將其值與多個連續的模式 (pattern) "
"進行比較,這些模式是以一個或多個 case 區塊來表示。表面上,這類似 C、Java 或 "
"JavaScript(以及許多其他語言)中的 switch 陳述式,但它與 Rust 或 Haskell 等語"
"言中的模式匹配 (pattern matching) 更為相近。只有第一個匹配成功的模式會被執"
"行,而它也可以將成分(序列元素或物件屬性)從值中提取到變數中。"
#: ../../tutorial/controlflow.rst:268
msgid ""
"The simplest form compares a subject value against one or more literals::"
msgstr ""
"最簡單的形式,是將一個主題值 (subject value) 與一個或多個字面值 (literal) 進"
"行比較:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:281
msgid ""
"Note the last block: the \"variable name\" ``_`` acts as a *wildcard* and "
"never fails to match. If no case matches, none of the branches is executed."
msgstr ""
"請注意最後一段:「變數名稱」\\ ``_`` 是作為\\ *通用字元 (wildcard)*\\ 的角"
"色,且永遠不會匹配失敗。如果沒有 case 匹配成功,則不會執行任何的分支。"
#: ../../tutorial/controlflow.rst:284
msgid ""
"You can combine several literals in a single pattern using ``|`` (\"or\")::"
msgstr ""
"你可以使用 ``|``\\ (「或」)來將多個字面值組合在單一模式中:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:289
msgid ""
"Patterns can look like unpacking assignments, and can be used to bind "
"variables::"
msgstr ""
"模式可以看起來像是拆解賦值 (unpacking assignment),且可以用來連結變數:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:305
msgid ""
"Study that one carefully! The first pattern has two literals, and can be "
"thought of as an extension of the literal pattern shown above. But the next "
"two patterns combine a literal and a variable, and the variable *binds* a "
"value from the subject (``point``). The fourth pattern captures two values, "
"which makes it conceptually similar to the unpacking assignment ``(x, y) = "
"point``."
msgstr ""
"請仔細研究那個例子!第一個模式有兩個字面值,可以想作是之前所述的字面值模式的"
"延伸。但是接下來的兩個模式結合了一個字面值和一個變數,且該變數\\ *繫結 "
"(bind)* 了來自主題 (``point``) 的一個值。第四個模式會擷取兩個值,這使得它在概"
"念上類似於拆解賦值 ``(x, y) = point``。"
#: ../../tutorial/controlflow.rst:312
msgid ""
"If you are using classes to structure your data you can use the class name "
"followed by an argument list resembling a constructor, but with the ability "
"to capture attributes into variables::"
msgstr ""
"如果你要用 class 來結構化你的資料,你可以使用該 class 的名稱加上一個引數列"
"表,類似一個建構式 (constructor),但它能夠將屬性擷取到變數中:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:334
msgid ""
"You can use positional parameters with some builtin classes that provide an "
"ordering for their attributes (e.g. dataclasses). You can also define a "
"specific position for attributes in patterns by setting the "
"``__match_args__`` special attribute in your classes. If it's set to (\"x\", "
"\"y\"), the following patterns are all equivalent (and all bind the ``y`` "
"attribute to the ``var`` variable)::"
msgstr ""
"你可以將位置參數 (positional parameter) 與一些能夠排序其屬性的內建 class(例"
"如 dataclasses)一起使用。你也可以透過在 class 中設定特殊屬性 "
"``__match_args__``,來定義模式中屬性們的特定位置。如果它被設定為 (\"x\", "
"\"y\"),則以下的模式都是等價的(且都會將屬性 ``y`` 連結到變數 ``var``):\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:345
msgid ""
"A recommended way to read patterns is to look at them as an extended form of "
"what you would put on the left of an assignment, to understand which "
"variables would be set to what. Only the standalone names (like ``var`` "
"above) are assigned to by a match statement. Dotted names (like ``foo."
"bar``), attribute names (the ``x=`` and ``y=`` above) or class names "
"(recognized by the \"(...)\" next to them like ``Point`` above) are never "
"assigned to."
msgstr ""
"理解模式的一種推薦方法,是將它們看作是你會放在賦值 (assignment) 左側內容的一"
"種延伸形式,這樣就可以了解哪些變數會被設為何值。只有獨立的名稱(像是上面的 "
"``var``)能被 match 陳述式賦值。點分隔名稱(如 ``foo.bar``)、屬性名稱(上面"
"的 ``x=`` 及 ``y=``)或 class 名稱(由它們後面的 \"(...)\" 被辨識,如上面的 "
"``Point``)則永遠無法被賦值。"
#: ../../tutorial/controlflow.rst:352
msgid ""
"Patterns can be arbitrarily nested. For example, if we have a short list of "
"Points, with ``__match_args__`` added, we could match it like this::"
msgstr ""
"模式可以任意地被巢套 (nested)。例如,如果我們有一個由某些點所組成的簡短 "
"list,我們就可以像這樣加入 ``__match_args__`` 來對它進行匹配:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:373
msgid ""
"We can add an ``if`` clause to a pattern, known as a \"guard\". If the "
"guard is false, ``match`` goes on to try the next case block. Note that "
"value capture happens before the guard is evaluated::"
msgstr ""
"我們可以在模式中加入一個 ``if`` 子句,稱為「防護 (guard)」。如果該防護為假,"
"則 ``match`` 會繼續嘗試下一個 case 區塊。請注意,值的擷取會發生在防護的評估之"
"前:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:383
msgid "Several other key features of this statement:"
msgstr "此種陳述式的其他幾個重要特色:"
#: ../../tutorial/controlflow.rst:385
msgid ""
"Like unpacking assignments, tuple and list patterns have exactly the same "
"meaning and actually match arbitrary sequences. An important exception is "
"that they don't match iterators or strings."
msgstr ""
"與拆解賦值的情況類似,tuple(元組)和 list 模式具有完全相同的意義,而且實際上"
"可以匹配任意的序列。一個重要的例外,是它們不能匹配疊代器 (iterator) 或字串。"
#: ../../tutorial/controlflow.rst:389
msgid ""
"Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, "
"*rest)`` work similar to unpacking assignments. The name after ``*`` may "
"also be ``_``, so ``(x, y, *_)`` matches a sequence of at least two items "
"without binding the remaining items."
msgstr ""
"序列模式 (sequence pattern) 可支援擴充拆解 (extended unpacking):``[x, y, "
"*rest]`` 與 ``(x, y, *rest)`` 的作用類似於拆解賦值。``*`` 後面的名稱也可以是 "
"``_``,所以 ``(x, y, *_)`` 會匹配一個至少兩項的序列,且不會連結那兩項以外的其"
"餘項。"
#: ../../tutorial/controlflow.rst:394
msgid ""
"Mapping patterns: ``{\"bandwidth\": b, \"latency\": l}`` captures the "
"``\"bandwidth\"`` and ``\"latency\"`` values from a dictionary. Unlike "
"sequence patterns, extra keys are ignored. An unpacking like ``**rest`` is "
"also supported. (But ``**_`` would be redundant, so it is not allowed.)"
msgstr ""
"映射模式 (mapping pattern):``{\"bandwidth\": b, \"latency\": l}`` 能從一個 "
"dictionary(字典)中擷取 ``\"bandwidth\"`` 及 ``\"latency\"`` 的值。與序列模"
"式不同,額外的鍵 (key) 會被忽略。一種像是 ``**rest`` 的拆解方式,也是可被支援"
"的。(但 ``**_`` 則是多餘的做法,所以它並不被允許。)"
#: ../../tutorial/controlflow.rst:399
msgid "Subpatterns may be captured using the ``as`` keyword::"
msgstr ""
"使用關鍵字 ``as`` 可以擷取子模式 (subpattern):\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:403
msgid ""
"will capture the second element of the input as ``p2`` (as long as the input "
"is a sequence of two points)"
msgstr ""
"將會擷取輸入的第二個元素作為 ``p2``\\ (只要該輸入是一個由兩個點所組成的序"
"列)。"
#: ../../tutorial/controlflow.rst:406
msgid ""
"Most literals are compared by equality, however the singletons ``True``, "
"``False`` and ``None`` are compared by identity."
msgstr ""
"大部分的字面值是藉由相等性 (equality) 來比較,但是單例物件 (singleton) "
"``True``、``False`` 和 ``None`` 是藉由標識值 (identity) 來比較。"
#: ../../tutorial/controlflow.rst:409
msgid ""
"Patterns may use named constants. These must be dotted names to prevent "
"them from being interpreted as capture variable::"
msgstr ""
"模式可以使用附名常數 (named constant)。這些模式必須是點分隔名稱,以免它們被解"
"釋為擷取變數:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:428
msgid ""
"For a more detailed explanation and additional examples, you can look into :"
"pep:`636` which is written in a tutorial format."
msgstr ""
"關於更詳細的解釋和其他範例,你可以閱讀 :pep:`636`,它是以教學的格式編寫而成。"
#: ../../tutorial/controlflow.rst:434
msgid "Defining Functions"
msgstr "定義函式 (function)"
#: ../../tutorial/controlflow.rst:436
msgid ""
"We can create a function that writes the Fibonacci series to an arbitrary "
"boundary::"
msgstr ""
"我們可以建立一個函式來產生費式數列到任何一個上界:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:456
msgid ""
"The keyword :keyword:`def` introduces a function *definition*. It must be "
"followed by the function name and the parenthesized list of formal "
"parameters. The statements that form the body of the function start at the "
"next line, and must be indented."
msgstr ""
"關鍵字 :keyword:`def` 介紹一個函式的\\ *定義*\\ 。它之後必須連著該函式的名稱"
"和置於括號之中的一串參數。自下一行起,所有縮排的陳述式成為該函式的主體。"
#: ../../tutorial/controlflow.rst:461
msgid ""
"The first statement of the function body can optionally be a string literal; "
"this string literal is the function's documentation string, or :dfn:"
"`docstring`. (More about docstrings can be found in the section :ref:`tut-"
"docstrings`.) There are tools which use docstrings to automatically produce "
"online or printed documentation, or to let the user interactively browse "
"through code; it's good practice to include docstrings in code that you "
"write, so make a habit of it."
msgstr ""
"一個函式的第一個陳述式可以是一個字串文本;該字串文本被視為該函式的說明文件字"
"串,即 :dfn:`docstring`。(關於 docstring 的細節請參見\\ :ref:`tut-"
"docstrings`\\ 段落。)有些工具可以使用 docstring 來自動產生線上或可列印的文"
"件,或讓使用者能以互動的方式在原始碼中瀏覽文件。在原始碼中加入 docstring 是個"
"好慣例,應該養成這樣的習慣。"
#: ../../tutorial/controlflow.rst:468
msgid ""
"The *execution* of a function introduces a new symbol table used for the "
"local variables of the function. More precisely, all variable assignments "
"in a function store the value in the local symbol table; whereas variable "
"references first look in the local symbol table, then in the local symbol "
"tables of enclosing functions, then in the global symbol table, and finally "
"in the table of built-in names. Thus, global variables and variables of "
"enclosing functions cannot be directly assigned a value within a function "
"(unless, for global variables, named in a :keyword:`global` statement, or, "
"for variables of enclosing functions, named in a :keyword:`nonlocal` "
"statement), although they may be referenced."
msgstr ""
"函式\\ *執行*\\ 時會建立一個新的符號表 (symbol table) 來儲存該函式內的區域變"
"數 (local variable)。更精確地說,所有在函式內的變數賦值都會把該值儲存在一個區"
"域符號表。然而,在引用一個變數時,會先從區域符號表開始搜尋,其次為外層函式的"
"區域符號表,其次為全域符號表 (global symbol table),最後為所有內建的名稱。因"
"此,在函式中,全域變數及外層函式變數雖然可以被引用,但無法被直接賦值(除非全"
"域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:"
"`nonlocal` 陳述式中被定義)。"
#: ../../tutorial/controlflow.rst:479
msgid ""
"The actual parameters (arguments) to a function call are introduced in the "
"local symbol table of the called function when it is called; thus, arguments "
"are passed using *call by value* (where the *value* is always an object "
"*reference*, not the value of the object). [#]_ When a function calls "
"another function, or calls itself recursively, a new local symbol table is "
"created for that call."
msgstr ""
"在一個函式被呼叫的時候,實際傳入的參數(引數)會被加入至該函式的區域符號表。"
"因此,引數傳入的方式為\\ *傳值呼叫 (call by value)*\\ (這裡傳遞的\\ *值*\\ "
"永遠是一個物件的\\ *參照 (reference)*\\ ,而不是該物件的值)。\\ [#]_ 當一個"
"函式呼叫別的函式或遞迴呼叫它自己時,在被呼叫的函式中會建立一個新的區域符號"
"表。"
#: ../../tutorial/controlflow.rst:486
msgid ""
"A function definition associates the function name with the function object "
"in the current symbol table. The interpreter recognizes the object pointed "
"to by that name as a user-defined function. Other names can also point to "
"that same function object and can also be used to access the function::"
msgstr ""
"函式定義時,會把該函式名稱加入至當前的符號表。函式名稱的值帶有一個型別,並被"
"直譯器辨識為使用者自定函式 (user-defined function)。該值可以被指定給別的變數"
"名,使該變數名也可以被當作函式使用。這是常見的重新命名方式:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:497
msgid ""
"Coming from other languages, you might object that ``fib`` is not a function "
"but a procedure since it doesn't return a value. In fact, even functions "
"without a :keyword:`return` statement do return a value, albeit a rather "
"boring one. This value is called ``None`` (it's a built-in name). Writing "
"the value ``None`` is normally suppressed by the interpreter if it would be "
"the only value written. You can see it if you really want to using :func:"
"`print`::"
msgstr ""
"如果你是來自別的語言,你可能不同意 ``fib`` 是個函式,而是個程序 (procedure),"
"因為它並沒有回傳值。實際上,即使一個函式缺少一個 :keyword:`return` 陳述式,它"
"亦有一個固定的回傳值。這個值稱為 ``None``\\ (它是一個內建名稱)。在直譯器中"
"單獨使用 ``None`` 時,通常不會被顯示。你可以使用 :func:`print` 來看到它:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:508
msgid ""
"It is simple to write a function that returns a list of the numbers of the "
"Fibonacci series, instead of printing it::"
msgstr ""
"如果要寫一個函式回傳費式數列的 list 而不是直接印出它,這也很容易:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:524
msgid "This example, as usual, demonstrates some new Python features:"
msgstr "這個例子一樣示範了一些新的 Python 特性:"
#: ../../tutorial/controlflow.rst:526
msgid ""
"The :keyword:`return` statement returns with a value from a function. :"
"keyword:`!return` without an expression argument returns ``None``. Falling "
"off the end of a function also returns ``None``."
msgstr ""
":keyword:`return` 陳述式會讓一個函式回傳一個值。單獨使用 :keyword:`!return` "
"不外加一個運算式作為引數時會回傳 ``None``。一個函式執行到結束也會回傳 "
"``None``。"
#: ../../tutorial/controlflow.rst:530
msgid ""
"The statement ``result.append(a)`` calls a *method* of the list object "
"``result``. A method is a function that 'belongs' to an object and is named "
"``obj.methodname``, where ``obj`` is some object (this may be an "
"expression), and ``methodname`` is the name of a method that is defined by "
"the object's type. Different types define different methods. Methods of "
"different types may have the same name without causing ambiguity. (It is "
"possible to define your own object types and methods, using *classes*, see :"
"ref:`tut-classes`) The method :meth:`~list.append` shown in the example is "
"defined for list objects; it adds a new element at the end of the list. In "
"this example it is equivalent to ``result = result + [a]``, but more "
"efficient."
msgstr ""
"``result.append(a)`` 陳述式呼叫了一個 list 物件 ``result`` 的 *method(方法)"
"*。method 為「屬於」一個物件的函式,命名規則為 ``obj.methodname``,其中 "
"``obj`` 為某個物件(亦可為一運算式),而 ``methodname`` 為該 method 的名稱,"
"並由該物件的型別所定義。不同的型別定義不同的 method。不同型別的 method 可以擁"
"有一樣的名稱而不會讓 Python 混淆。(你可以使用 *class*\\ (類別)定義自己的物"
"件型別和 method,見 :ref:`tut-classes`\\ )範例中的 :meth:`~list.append` "
"method 定義在 list 物件中;它會在該 list 的末端加入一個新的元素。這個例子等同"
"於 ``result = result + [a]``,但更有效率。"
#: ../../tutorial/controlflow.rst:545
msgid "More on Defining Functions"
msgstr "深入了解函式定義"
#: ../../tutorial/controlflow.rst:547
msgid ""
"It is also possible to define functions with a variable number of arguments. "
"There are three forms, which can be combined."
msgstr ""
"定義函式時使用的引數 (argument) 數量是可變的。總共有三種可以組合使用的形式。"
#: ../../tutorial/controlflow.rst:554
msgid "Default Argument Values"
msgstr "預設引數值"
#: ../../tutorial/controlflow.rst:556
msgid ""
"The most useful form is to specify a default value for one or more "
"arguments. This creates a function that can be called with fewer arguments "
"than it is defined to allow. For example::"
msgstr ""
"為一個或多個引數指定預設值是很有用的方式。函式建立後,可以用比定義時更少的引"
"數呼叫該函式。例如:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:572
msgid "This function can be called in several ways:"
msgstr "該函式可以用以下幾種方式被呼叫:"
#: ../../tutorial/controlflow.rst:574
msgid ""
"giving only the mandatory argument: ``ask_ok('Do you really want to quit?')``"
msgstr "只給必要引數:``ask_ok('Do you really want to quit?')``"
#: ../../tutorial/controlflow.rst:576
msgid ""
"giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', "
"2)``"
msgstr "給予一個選擇性引數:``ask_ok('OK to overwrite the file?', 2)``"
#: ../../tutorial/controlflow.rst:578
msgid ""
"or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come "
"on, only yes or no!')``"
msgstr ""
"給予所有引數:``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or "
"no!')``"
#: ../../tutorial/controlflow.rst:581
msgid ""
"This example also introduces the :keyword:`in` keyword. This tests whether "
"or not a sequence contains a certain value."
msgstr "此例也使用了關鍵字 :keyword:`in`,用於測試序列中是否包含某個特定值。"
#: ../../tutorial/controlflow.rst:584
msgid ""
"The default values are evaluated at the point of function definition in the "
"*defining* scope, so that ::"
msgstr ""
"預設值是在函式定義當下,於\\ *定義時*\\ 的作用域中求值,所以:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:595
msgid "will print ``5``."
msgstr "將會輸出 ``5``。"
#: ../../tutorial/controlflow.rst:597
msgid ""
"**Important warning:** The default value is evaluated only once. This makes "
"a difference when the default is a mutable object such as a list, "
"dictionary, or instances of most classes. For example, the following "
"function accumulates the arguments passed to it on subsequent calls::"
msgstr ""
"\\ **重要警告**\\ :預設值只求值一次。當預設值為可變物件,例如 list、"
"dictionary(字典)或許多類別實例時,會產生不同的結果。例如,以下函式於後續呼"
"叫時會累積曾經傳遞的引數:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:610
msgid "This will print ::"
msgstr ""
"將會輸出:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:616
msgid ""
"If you don't want the default to be shared between subsequent calls, you can "
"write the function like this instead::"
msgstr "如果不想在後續呼叫之間共用預設值,應以如下方式編寫函式:"
#: ../../tutorial/controlflow.rst:629
msgid "Keyword Arguments"
msgstr "關鍵字引數"
#: ../../tutorial/controlflow.rst:631
msgid ""
"Functions can also be called using :term:`keyword arguments <keyword "
"argument>` of the form ``kwarg=value``. For instance, the following "
"function::"
msgstr ""
"函式也可以使用\\ :term:`關鍵字引數 <keyword argument>`,以 ``kwarg=value`` 的"
"形式呼叫。舉例來說,以下函式:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:640
msgid ""
"accepts one required argument (``voltage``) and three optional arguments "
"(``state``, ``action``, and ``type``). This function can be called in any "
"of the following ways::"
msgstr ""
"接受一個必要引數 (``voltage``) 和三個選擇性引數 (``state``,``action``,和 "
"``type``)。該函式可用下列任一方式呼叫:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:651
msgid "but all the following calls would be invalid::"
msgstr ""
"但以下呼叫方式都無效:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:658
msgid ""
"In a function call, keyword arguments must follow positional arguments. All "
"the keyword arguments passed must match one of the arguments accepted by the "
"function (e.g. ``actor`` is not a valid argument for the ``parrot`` "
"function), and their order is not important. This also includes non-"
"optional arguments (e.g. ``parrot(voltage=1000)`` is valid too). No argument "
"may receive a value more than once. Here's an example that fails due to this "
"restriction::"
msgstr ""
"函式呼叫時,關鍵字引數 (keyword argument) 必須在位置引數 (positional "
"argument) 後面。所有傳遞的關鍵字引數都必須匹配一個可被函式接受的引數(\\ "
"``actor`` 不是 ``parrot`` 函式的有效引數),而關鍵字引數的順序並不重要。此規"
"則也包括必要引數,(\\ ``parrot(voltage=1000)`` 也有效)。一個引數不可多次被"
"賦值,下面就是一個因此限制而無效的例子:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:674
msgid ""
"When a final formal parameter of the form ``**name`` is present, it receives "
"a dictionary (see :ref:`typesmapping`) containing all keyword arguments "
"except for those corresponding to a formal parameter. This may be combined "
"with a formal parameter of the form ``*name`` (described in the next "
"subsection) which receives a :ref:`tuple <tut-tuples>` containing the "
"positional arguments beyond the formal parameter list. (``*name`` must "
"occur before ``**name``.) For example, if we define a function like this::"
msgstr ""
"當最後一個參數為 ``**name`` 形式時,它接收一個 dictionary(字典,詳見 :ref:"
"`typesmapping`\\ ),該字典包含所有可對應形式參數以外的關鍵字引數。"
"``**name`` 可以與 ``*name`` 參數(下一小節介紹)組合使用,``*name`` 接收一"
"個 :ref:`tuple <tut-tuples>`,該 tuple 包含一般參數以外的位置引數(\\ "
"``*name`` 必須出現在 ``**name`` 前面)。例如,若我們定義這樣的函式:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:691
msgid "It could be called like this::"
msgstr ""
"它可以被如此呼叫:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:699
msgid "and of course it would print:"
msgstr ""
"輸出結果如下:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:712
msgid ""
"Note that the order in which the keyword arguments are printed is guaranteed "
"to match the order in which they were provided in the function call."
msgstr "注意,關鍵字引數的輸出順序與呼叫函式時被提供的順序必定一致。"
#: ../../tutorial/controlflow.rst:716
msgid "Special parameters"
msgstr "特殊參數"
#: ../../tutorial/controlflow.rst:718
msgid ""
"By default, arguments may be passed to a Python function either by position "
"or explicitly by keyword. For readability and performance, it makes sense to "
"restrict the way arguments can be passed so that a developer need only look "
"at the function definition to determine if items are passed by position, by "
"position or keyword, or by keyword."
msgstr ""
"在預設情況,引數能以位置或明確地以關鍵字傳遞给 Python 函式。為了程式的可讀性"
"及效能,限制引數的傳遞方式是合理的,如此,開發者只需查看函式定義,即可確定各"
"項目是按位置,按位置或關鍵字,還是按關鍵字傳遞。"
#: ../../tutorial/controlflow.rst:724
msgid "A function definition may look like:"
msgstr "函式定義可能如以下樣式:"
#: ../../tutorial/controlflow.rst:735
msgid ""
"where ``/`` and ``*`` are optional. If used, these symbols indicate the kind "
"of parameter by how the arguments may be passed to the function: positional-"
"only, positional-or-keyword, and keyword-only. Keyword parameters are also "
"referred to as named parameters."
msgstr ""
"``/`` 和 ``*`` 是選擇性的。這些符號若被使用,是表明引數被傳遞給函式的參數種"
"類:僅限位置、位置或關鍵字、僅限關鍵字。關鍵字參數也稱為附名參數 (named "
"parameters)。"
#: ../../tutorial/controlflow.rst:742
msgid "Positional-or-Keyword Arguments"
msgstr "位置或關鍵字引數 (Positional-or-Keyword Arguments)"
#: ../../tutorial/controlflow.rst:744
msgid ""
"If ``/`` and ``*`` are not present in the function definition, arguments may "
"be passed to a function by position or by keyword."
msgstr ""
"若函式定義中未使用 ``/`` 和 ``*`` 時,引數可以按位置或關鍵字傳遞給函式。"
#: ../../tutorial/controlflow.rst:749
msgid "Positional-Only Parameters"
msgstr "僅限位置參數 (Positional-Only Parameters)"
#: ../../tutorial/controlflow.rst:751
msgid ""
"Looking at this in a bit more detail, it is possible to mark certain "
"parameters as *positional-only*. If *positional-only*, the parameters' order "
"matters, and the parameters cannot be passed by keyword. Positional-only "
"parameters are placed before a ``/`` (forward-slash). The ``/`` is used to "
"logically separate the positional-only parameters from the rest of the "
"parameters. If there is no ``/`` in the function definition, there are no "
"positional-only parameters."
msgstr ""
"此處再詳述一些細節,特定參數可以標記為\\ *僅限位置*\\ 。若參數為\\ *僅限位置"
"*\\ 時,它們的順序很重要,且這些參數不能用關鍵字傳遞。僅限位置參數必須放在 "
"``/``\\ (斜線)之前。\\ ``/`` 用於在邏輯上分開僅限位置參數與其餘參數。如果函"
"式定義中沒有 ``/``\\ ,則表示沒有任何僅限位置參數。"
#: ../../tutorial/controlflow.rst:759
msgid ""
"Parameters following the ``/`` may be *positional-or-keyword* or *keyword-"
"only*."
msgstr "``/`` 後面的參數可以是\\ *位置或關鍵字*\\ 或\\ *僅限關鍵字*\\ 參數。"
#: ../../tutorial/controlflow.rst:763
msgid "Keyword-Only Arguments"
msgstr "僅限關鍵字引數 (Keyword-Only Arguments)"
#: ../../tutorial/controlflow.rst:765
msgid ""
"To mark parameters as *keyword-only*, indicating the parameters must be "
"passed by keyword argument, place an ``*`` in the arguments list just before "
"the first *keyword-only* parameter."
msgstr ""
"要把參數標記為\\ *僅限關鍵字*\\ ,表明參數必須以關鍵字引數傳遞,必須在引數列"
"表中第一個\\ *僅限關鍵字*\\ 參數前放上 ``*``。"
#: ../../tutorial/controlflow.rst:771
msgid "Function Examples"
msgstr "函式範例"
#: ../../tutorial/controlflow.rst:773
msgid ""
"Consider the following example function definitions paying close attention "
"to the markers ``/`` and ``*``::"
msgstr ""
"請看以下的函式定義範例,注意 ``/`` 和 ``*`` 記號:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:789
msgid ""
"The first function definition, ``standard_arg``, the most familiar form, "
"places no restrictions on the calling convention and arguments may be passed "
"by position or keyword::"
msgstr ""
"第一個函式定義 ``standard_arg`` 是我們最熟悉的形式,對呼叫方式沒有任何限制,"
"可以按位置或關鍵字傳遞引數:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:799
msgid ""
"The second function ``pos_only_arg`` is restricted to only use positional "
"parameters as there is a ``/`` in the function definition::"
msgstr ""
"第二個函式 ``pos_only_arg`` 的函式定義中有 ``/``,因此僅限使用位置參數:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:810
msgid ""
"The third function ``kwd_only_args`` only allows keyword arguments as "
"indicated by a ``*`` in the function definition::"
msgstr ""
"第三個函式 ``kwd_only_args`` 的函式定義透過 ``*`` 表明僅限關鍵字引數:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:821
msgid ""
"And the last uses all three calling conventions in the same function "
"definition::"
msgstr ""
"最後一個函式在同一個函式定義中,使用了全部三種呼叫方式:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:841
msgid ""
"Finally, consider this function definition which has a potential collision "
"between the positional argument ``name`` and ``**kwds`` which has ``name`` "
"as a key::"
msgstr ""
"最後,請看這個函式定義,如果 ``**kwds`` 內有 ``name`` 這個鍵,可能與位置引數 "
"``name`` 產生潛在衝突:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:846
msgid ""
"There is no possible call that will make it return ``True`` as the keyword "
"``'name'`` will always bind to the first parameter. For example::"
msgstr ""
"呼叫該函式不可能回傳 ``True``,因為關鍵字 ``'name'`` 永遠是連結在第一個參數。"
"例如:\n"
"\n"
"::"
#: ../../tutorial/controlflow.rst:855