@@ -11,7 +11,7 @@ msgid ""
11
11
msgstr ""
12
12
"Project-Id-Version : Python 3.11\n "
13
13
"Report-Msgid-Bugs-To : \n "
14
- "POT-Creation-Date : 2023-07-12 00:20 +0000\n "
14
+ "POT-Creation-Date : 2023-07-18 00:46 +0000\n "
15
15
"PO-Revision-Date : 2022-07-24 14:52+0800\n "
16
16
"Last-Translator : Steven Hsu <hsuhaochun@gmail.com>\n "
17
17
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -395,16 +395,17 @@ msgstr ""
395
395
"``Point``)則永遠無法被賦值。"
396
396
397
397
#: ../../tutorial/controlflow.rst:345
398
+ #, fuzzy
398
399
msgid ""
399
400
"Patterns can be arbitrarily nested. For example, if we have a short list of "
400
- "points , we could match it like this::"
401
+ "Points, with ``__match_args__`` added , we could match it like this::"
401
402
msgstr ""
402
403
"模式可以任意地被巢套 (nested)。例如,如果我們有一個由某些點所組成的簡短 "
403
404
"list,我們就可以像這樣來對它進行匹配:\n"
404
405
"\n"
405
406
"::"
406
407
407
- #: ../../tutorial/controlflow.rst:360
408
+ #: ../../tutorial/controlflow.rst:366
408
409
msgid ""
409
410
"We can add an ``if`` clause to a pattern, known as a \" guard\" . If the "
410
411
"guard is false, ``match`` goes on to try the next case block. Note that "
@@ -416,11 +417,11 @@ msgstr ""
416
417
"\n"
417
418
"::"
418
419
419
- #: ../../tutorial/controlflow.rst:370
420
+ #: ../../tutorial/controlflow.rst:376
420
421
msgid "Several other key features of this statement:"
421
422
msgstr "此種陳述式的其他幾個重要特色:"
422
423
423
- #: ../../tutorial/controlflow.rst:372
424
+ #: ../../tutorial/controlflow.rst:378
424
425
msgid ""
425
426
"Like unpacking assignments, tuple and list patterns have exactly the same "
426
427
"meaning and actually match arbitrary sequences. An important exception is "
@@ -429,7 +430,7 @@ msgstr ""
429
430
"與拆解賦值的情況類似,tuple(元組)和 list 模式具有完全相同的意義,而且實際上"
430
431
"可以匹配任意的序列。一個重要的例外,是它們不能匹配疊代器 (iterator) 或字串。"
431
432
432
- #: ../../tutorial/controlflow.rst:376
433
+ #: ../../tutorial/controlflow.rst:382
433
434
msgid ""
434
435
"Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, "
435
436
"*rest)`` work similar to unpacking assignments. The name after ``*`` may "
@@ -441,7 +442,7 @@ msgstr ""
441
442
"是 ``_``,所以 ``(x, y, *_)`` 會匹配一個至少兩項的序列,且不會連結那兩項以外"
442
443
"的其餘項。"
443
444
444
- #: ../../tutorial/controlflow.rst:381
445
+ #: ../../tutorial/controlflow.rst:387
445
446
msgid ""
446
447
"Mapping patterns: ``{\" bandwidth\" : b, \" latency\" : l}`` captures the "
447
448
"``\" bandwidth\" `` and ``\" latency\" `` values from a dictionary. Unlike "
@@ -453,30 +454,30 @@ msgstr ""
453
454
"模式不同,額外的鍵 (key) 會被忽略。一種像是 ``**rest`` 的拆解方式,也是可被支"
454
455
"援的。(但 ``**_`` 則是多餘的做法,所以它並不被允許。)"
455
456
456
- #: ../../tutorial/controlflow.rst:386
457
+ #: ../../tutorial/controlflow.rst:392
457
458
msgid "Subpatterns may be captured using the ``as`` keyword::"
458
459
msgstr ""
459
460
"使用關鍵字 ``as`` 可以擷取子模式 (subpattern):\n"
460
461
"\n"
461
462
"::"
462
463
463
- #: ../../tutorial/controlflow.rst:390
464
+ #: ../../tutorial/controlflow.rst:396
464
465
msgid ""
465
466
"will capture the second element of the input as ``p2`` (as long as the input "
466
467
"is a sequence of two points)"
467
468
msgstr ""
468
469
"將會擷取輸入的第二個元素作為 ``p2``\\ (只要該輸入是一個由兩個點所組成的序"
469
470
"列)。"
470
471
471
- #: ../../tutorial/controlflow.rst:393
472
+ #: ../../tutorial/controlflow.rst:399
472
473
msgid ""
473
474
"Most literals are compared by equality, however the singletons ``True``, "
474
475
"``False`` and ``None`` are compared by identity."
475
476
msgstr ""
476
477
"大部分的字面值是藉由相等性 (equality) 來比較,但是單例物件 (singleton) "
477
478
"``True``\\ 、\\ ``False`` 和 ``None`` 是藉由標識值 (identity) 來比較。"
478
479
479
- #: ../../tutorial/controlflow.rst:396
480
+ #: ../../tutorial/controlflow.rst:402
480
481
msgid ""
481
482
"Patterns may use named constants. These must be dotted names to prevent "
482
483
"them from being interpreted as capture variable::"
@@ -486,18 +487,18 @@ msgstr ""
486
487
"\n"
487
488
"::"
488
489
489
- #: ../../tutorial/controlflow.rst:415
490
+ #: ../../tutorial/controlflow.rst:421
490
491
msgid ""
491
492
"For a more detailed explanation and additional examples, you can look into :"
492
493
"pep:`636` which is written in a tutorial format."
493
494
msgstr ""
494
495
"關於更詳細的解釋和其他範例,你可以閱讀 :pep:`636`,它是以教學的格式編寫而成。"
495
496
496
- #: ../../tutorial/controlflow.rst:421
497
+ #: ../../tutorial/controlflow.rst:427
497
498
msgid "Defining Functions"
498
499
msgstr "定義函式 (function)"
499
500
500
- #: ../../tutorial/controlflow.rst:423
501
+ #: ../../tutorial/controlflow.rst:429
501
502
msgid ""
502
503
"We can create a function that writes the Fibonacci series to an arbitrary "
503
504
"boundary::"
@@ -506,7 +507,7 @@ msgstr ""
506
507
"\n"
507
508
"::"
508
509
509
- #: ../../tutorial/controlflow.rst:443
510
+ #: ../../tutorial/controlflow.rst:449
510
511
msgid ""
511
512
"The keyword :keyword:`def` introduces a function *definition*. It must be "
512
513
"followed by the function name and the parenthesized list of formal "
@@ -516,7 +517,7 @@ msgstr ""
516
517
"關鍵字 :keyword:`def` 介紹一個函式的\\ *定義*\\ 。它之後必須連著該函式的名稱"
517
518
"和置於括號之中的一串參數。自下一行起,所有縮排的陳述式成為該函式的主體。"
518
519
519
- #: ../../tutorial/controlflow.rst:448
520
+ #: ../../tutorial/controlflow.rst:454
520
521
msgid ""
521
522
"The first statement of the function body can optionally be a string literal; "
522
523
"this string literal is the function's documentation string, or :dfn:"
@@ -532,7 +533,7 @@ msgstr ""
532
533
"件,或讓使用者能以互動的方式在原始碼中瀏覽文件。在原始碼中加入 docstring 是個"
533
534
"好慣例,應該養成這樣的習慣。"
534
535
535
- #: ../../tutorial/controlflow.rst:455
536
+ #: ../../tutorial/controlflow.rst:461
536
537
msgid ""
537
538
"The *execution* of a function introduces a new symbol table used for the "
538
539
"local variables of the function. More precisely, all variable assignments "
@@ -553,7 +554,7 @@ msgstr ""
553
554
"域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:"
554
555
"`nonlocal` 陳述式中被定義)。"
555
556
556
- #: ../../tutorial/controlflow.rst:466
557
+ #: ../../tutorial/controlflow.rst:472
557
558
msgid ""
558
559
"The actual parameters (arguments) to a function call are introduced in the "
559
560
"local symbol table of the called function when it is called; thus, arguments "
@@ -568,7 +569,7 @@ msgstr ""
568
569
"函式呼叫別的函式或遞迴呼叫它自己時,在被呼叫的函式中會建立一個新的區域符號"
569
570
"表。"
570
571
571
- #: ../../tutorial/controlflow.rst:473
572
+ #: ../../tutorial/controlflow.rst:479
572
573
msgid ""
573
574
"A function definition associates the function name with the function object "
574
575
"in the current symbol table. The interpreter recognizes the object pointed "
@@ -581,7 +582,7 @@ msgstr ""
581
582
"\n"
582
583
"::"
583
584
584
- #: ../../tutorial/controlflow.rst:484
585
+ #: ../../tutorial/controlflow.rst:490
585
586
msgid ""
586
587
"Coming from other languages, you might object that ``fib`` is not a function "
587
588
"but a procedure since it doesn't return a value. In fact, even functions "
@@ -598,7 +599,7 @@ msgstr ""
598
599
"\n"
599
600
"::"
600
601
601
- #: ../../tutorial/controlflow.rst:495
602
+ #: ../../tutorial/controlflow.rst:501
602
603
msgid ""
603
604
"It is simple to write a function that returns a list of the numbers of the "
604
605
"Fibonacci series, instead of printing it::"
@@ -607,11 +608,11 @@ msgstr ""
607
608
"\n"
608
609
"::"
609
610
610
- #: ../../tutorial/controlflow.rst:511
611
+ #: ../../tutorial/controlflow.rst:517
611
612
msgid "This example, as usual, demonstrates some new Python features:"
612
613
msgstr "這個例子一樣示範了一些新的 Python 特性:"
613
614
614
- #: ../../tutorial/controlflow.rst:513
615
+ #: ../../tutorial/controlflow.rst:519
615
616
msgid ""
616
617
"The :keyword:`return` statement returns with a value from a function. :"
617
618
"keyword:`!return` without an expression argument returns ``None``. Falling "
@@ -621,7 +622,7 @@ msgstr ""
621
622
"不外加一個運算式作為引數時會回傳 ``None``\\ 。一個函式執行到結束也會回傳 "
622
623
"``None``\\ 。"
623
624
624
- #: ../../tutorial/controlflow.rst:517
625
+ #: ../../tutorial/controlflow.rst:523
625
626
msgid ""
626
627
"The statement ``result.append(a)`` calls a *method* of the list object "
627
628
"``result``. A method is a function that 'belongs' to an object and is named "
@@ -643,22 +644,22 @@ msgstr ""
643
644
"method 定義在 list 物件中;它會在該 list 的末端加入一個新的元素。這個例子等同"
644
645
"於 ``result = result + [a]``\\ ,但更有效率。"
645
646
646
- #: ../../tutorial/controlflow.rst:532
647
+ #: ../../tutorial/controlflow.rst:538
647
648
msgid "More on Defining Functions"
648
649
msgstr "深入了解函式定義"
649
650
650
- #: ../../tutorial/controlflow.rst:534
651
+ #: ../../tutorial/controlflow.rst:540
651
652
msgid ""
652
653
"It is also possible to define functions with a variable number of arguments. "
653
654
"There are three forms, which can be combined."
654
655
msgstr ""
655
656
"定義函式時使用的引數 (argument) 數量是可變的。總共有三種可以組合使用的形式。"
656
657
657
- #: ../../tutorial/controlflow.rst:541
658
+ #: ../../tutorial/controlflow.rst:547
658
659
msgid "Default Argument Values"
659
660
msgstr "預設引數值"
660
661
661
- #: ../../tutorial/controlflow.rst:543
662
+ #: ../../tutorial/controlflow.rst:549
662
663
msgid ""
663
664
"The most useful form is to specify a default value for one or more "
664
665
"arguments. This creates a function that can be called with fewer arguments "
@@ -669,37 +670,37 @@ msgstr ""
669
670
"\n"
670
671
"::"
671
672
672
- #: ../../tutorial/controlflow.rst:559
673
+ #: ../../tutorial/controlflow.rst:565
673
674
msgid "This function can be called in several ways:"
674
675
msgstr "該函式可以用以下幾種方式被呼叫:"
675
676
676
- #: ../../tutorial/controlflow.rst:561
677
+ #: ../../tutorial/controlflow.rst:567
677
678
msgid ""
678
679
"giving only the mandatory argument: ``ask_ok('Do you really want to quit?')``"
679
680
msgstr "只給必要引數:\\ ``ask_ok('Do you really want to quit?')``"
680
681
681
- #: ../../tutorial/controlflow.rst:563
682
+ #: ../../tutorial/controlflow.rst:569
682
683
msgid ""
683
684
"giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', "
684
685
"2)``"
685
686
msgstr "給予一個選擇性引數:\\ ``ask_ok('OK to overwrite the file?', 2)``"
686
687
687
- #: ../../tutorial/controlflow.rst:565
688
+ #: ../../tutorial/controlflow.rst:571
688
689
msgid ""
689
690
"or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come "
690
691
"on, only yes or no!')``"
691
692
msgstr ""
692
693
"給予所有引數:\\ ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes "
693
694
"or no!')``"
694
695
695
- #: ../../tutorial/controlflow.rst:568
696
+ #: ../../tutorial/controlflow.rst:574
696
697
msgid ""
697
698
"This example also introduces the :keyword:`in` keyword. This tests whether "
698
699
"or not a sequence contains a certain value."
699
700
msgstr ""
700
701
"此例也使用了關鍵字 :keyword:`in`\\ ,用於測試序列中是否包含某個特定值。"
701
702
702
- #: ../../tutorial/controlflow.rst:571
703
+ #: ../../tutorial/controlflow.rst:577
703
704
msgid ""
704
705
"The default values are evaluated at the point of function definition in the "
705
706
"*defining* scope, so that ::"
@@ -708,11 +709,11 @@ msgstr ""
708
709
"\n"
709
710
"::"
710
711
711
- #: ../../tutorial/controlflow.rst:582
712
+ #: ../../tutorial/controlflow.rst:588
712
713
msgid "will print ``5``."
713
714
msgstr "將會輸出 ``5``\\ 。"
714
715
715
- #: ../../tutorial/controlflow.rst:584
716
+ #: ../../tutorial/controlflow.rst:590
716
717
msgid ""
717
718
"**Important warning:** The default value is evaluated only once. This makes "
718
719
"a difference when the default is a mutable object such as a list, "
@@ -725,24 +726,24 @@ msgstr ""
725
726
"\n"
726
727
"::"
727
728
728
- #: ../../tutorial/controlflow.rst:597
729
+ #: ../../tutorial/controlflow.rst:603
729
730
msgid "This will print ::"
730
731
msgstr ""
731
732
"將會輸出:\n"
732
733
"\n"
733
734
"::"
734
735
735
- #: ../../tutorial/controlflow.rst:603
736
+ #: ../../tutorial/controlflow.rst:609
736
737
msgid ""
737
738
"If you don't want the default to be shared between subsequent calls, you can "
738
739
"write the function like this instead::"
739
740
msgstr "如果不想在後續呼叫之間共用預設值,應以如下方式編寫函式:"
740
741
741
- #: ../../tutorial/controlflow.rst:616
742
+ #: ../../tutorial/controlflow.rst:622
742
743
msgid "Keyword Arguments"
743
744
msgstr "關鍵字引數"
744
745
745
- #: ../../tutorial/controlflow.rst:618
746
+ #: ../../tutorial/controlflow.rst:624
746
747
msgid ""
747
748
"Functions can also be called using :term:`keyword arguments <keyword "
748
749
"argument>` of the form ``kwarg=value``. For instance, the following "
@@ -753,7 +754,7 @@ msgstr ""
753
754
"\n"
754
755
"::"
755
756
756
- #: ../../tutorial/controlflow.rst:627
757
+ #: ../../tutorial/controlflow.rst:633
757
758
msgid ""
758
759
"accepts one required argument (``voltage``) and three optional arguments "
759
760
"(``state``, ``action``, and ``type``). This function can be called in any "
@@ -764,14 +765,14 @@ msgstr ""
764
765
"\n"
765
766
"::"
766
767
767
- #: ../../tutorial/controlflow.rst:638
768
+ #: ../../tutorial/controlflow.rst:644
768
769
msgid "but all the following calls would be invalid::"
769
770
msgstr ""
770
771
"但以下呼叫方式都無效:\n"
771
772
"\n"
772
773
"::"
773
774
774
- #: ../../tutorial/controlflow.rst:645
775
+ #: ../../tutorial/controlflow.rst:651
775
776
msgid ""
776
777
"In a function call, keyword arguments must follow positional arguments. All "
777
778
"the keyword arguments passed must match one of the arguments accepted by the "
@@ -789,7 +790,7 @@ msgstr ""
789
790
"\n"
790
791
"::"
791
792
792
- #: ../../tutorial/controlflow.rst:661
793
+ #: ../../tutorial/controlflow.rst:667
793
794
msgid ""
794
795
"When a final formal parameter of the form ``**name`` is present, it receives "
795
796
"a dictionary (see :ref:`typesmapping`) containing all keyword arguments "
@@ -807,31 +808,31 @@ msgstr ""
807
808
"\n"
808
809
"::"
809
810
810
- #: ../../tutorial/controlflow.rst:678
811
+ #: ../../tutorial/controlflow.rst:684
811
812
msgid "It could be called like this::"
812
813
msgstr ""
813
814
"它可以被如此呼叫:\n"
814
815
"\n"
815
816
"::"
816
817
817
- #: ../../tutorial/controlflow.rst:686
818
+ #: ../../tutorial/controlflow.rst:692
818
819
msgid "and of course it would print:"
819
820
msgstr ""
820
821
"輸出結果如下:\n"
821
822
"\n"
822
823
"::"
823
824
824
- #: ../../tutorial/controlflow.rst:699
825
+ #: ../../tutorial/controlflow.rst:705
825
826
msgid ""
826
827
"Note that the order in which the keyword arguments are printed is guaranteed "
827
828
"to match the order in which they were provided in the function call."
828
829
msgstr "注意,關鍵字引數的輸出順序與呼叫函式時被提供的順序必定一致。"
829
830
830
- #: ../../tutorial/controlflow.rst:703
831
+ #: ../../tutorial/controlflow.rst:709
831
832
msgid "Special parameters"
832
833
msgstr "特殊參數"
833
834
834
- #: ../../tutorial/controlflow.rst:705
835
+ #: ../../tutorial/controlflow.rst:711
835
836
msgid ""
836
837
"By default, arguments may be passed to a Python function either by position "
837
838
"or explicitly by keyword. For readability and performance, it makes sense to "
@@ -843,11 +844,11 @@ msgstr ""
843
844
"及效能,限制引數的傳遞方式是合理的,如此,開發者只需查看函式定義,即可確定各"
844
845
"項目是按位置,按位置或關鍵字,還是按關鍵字傳遞。"
845
846
846
- #: ../../tutorial/controlflow.rst:711
847
+ #: ../../tutorial/controlflow.rst:717
847
848
msgid "A function definition may look like:"
848
849
msgstr "函式定義可能如以下樣式:"
849
850
850
- #: ../../tutorial/controlflow.rst:722
851
+ #: ../../tutorial/controlflow.rst:728
851
852
msgid ""
852
853
"where ``/`` and ``*`` are optional. If used, these symbols indicate the kind "
853
854
"of parameter by how the arguments may be passed to the function: positional-"
@@ -858,22 +859,22 @@ msgstr ""
858
859
"類:僅限位置、位置或關鍵字、僅限關鍵字。關鍵字參數也稱為附名參數 (named "
859
860
"parameters)。"
860
861
861
- #: ../../tutorial/controlflow.rst:729
862
+ #: ../../tutorial/controlflow.rst:735
862
863
msgid "Positional-or-Keyword Arguments"
863
864
msgstr "位置或關鍵字引數 (Positional-or-Keyword Arguments)"
864
865
865
- #: ../../tutorial/controlflow.rst:731
866
+ #: ../../tutorial/controlflow.rst:737
866
867
msgid ""
867
868
"If ``/`` and ``*`` are not present in the function definition, arguments may "
868
869
"be passed to a function by position or by keyword."
869
870
msgstr ""
870
871
"若函式定義中未使用 ``/`` 和 ``*`` 時,引數可以按位置或關鍵字傳遞給函式。"
871
872
872
- #: ../../tutorial/controlflow.rst:736
873
+ #: ../../tutorial/controlflow.rst:742
873
874
msgid "Positional-Only Parameters"
874
875
msgstr "僅限位置參數 (Positional-Only Parameters)"
875
876
876
- #: ../../tutorial/controlflow.rst:738
877
+ #: ../../tutorial/controlflow.rst:744
877
878
msgid ""
878
879
"Looking at this in a bit more detail, it is possible to mark certain "
879
880
"parameters as *positional-only*. If *positional-only*, the parameters' order "
@@ -888,17 +889,17 @@ msgstr ""
888
889
"``/``\\ (斜線)之前。\\ ``/`` 用於在邏輯上分開僅限位置參數與其餘參數。如果函"
889
890
"式定義中沒有 ``/``\\ ,則表示沒有任何僅限位置參數。"
890
891
891
- #: ../../tutorial/controlflow.rst:746
892
+ #: ../../tutorial/controlflow.rst:752
892
893
msgid ""
893
894
"Parameters following the ``/`` may be *positional-or-keyword* or *keyword-"
894
895
"only*."
895
896
msgstr "``/`` 後面的參數可以是\\ *位置或關鍵字*\\ 或\\ *僅限關鍵字*\\ 參數。"
896
897
897
- #: ../../tutorial/controlflow.rst:750
898
+ #: ../../tutorial/controlflow.rst:756
898
899
msgid "Keyword-Only Arguments"
899
900
msgstr "僅限關鍵字引數 (Keyword-Only Arguments)"
900
901
901
- #: ../../tutorial/controlflow.rst:752
902
+ #: ../../tutorial/controlflow.rst:758
902
903
msgid ""
903
904
"To mark parameters as *keyword-only*, indicating the parameters must be "
904
905
"passed by keyword argument, place an ``*`` in the arguments list just before "
@@ -907,11 +908,11 @@ msgstr ""
907
908
"要把參數標記為\\ *僅限關鍵字*\\ ,表明參數必須以關鍵字引數傳遞,必須在引數列"
908
909
"表中第一個\\ *僅限關鍵字*\\ 參數前放上 ``*``\\ 。"
909
910
910
- #: ../../tutorial/controlflow.rst:758
911
+ #: ../../tutorial/controlflow.rst:764
911
912
msgid "Function Examples"
912
913
msgstr "函式範例"
913
914
914
- #: ../../tutorial/controlflow.rst:760
915
+ #: ../../tutorial/controlflow.rst:766
915
916
msgid ""
916
917
"Consider the following example function definitions paying close attention "
917
918
"to the markers ``/`` and ``*``::"
@@ -920,7 +921,7 @@ msgstr ""
920
921
"\n"
921
922
"::"
922
923
923
- #: ../../tutorial/controlflow.rst:776
924
+ #: ../../tutorial/controlflow.rst:782
924
925
msgid ""
925
926
"The first function definition, ``standard_arg``, the most familiar form, "
926
927
"places no restrictions on the calling convention and arguments may be passed "
@@ -931,7 +932,7 @@ msgstr ""
931
932
"\n"
932
933
"::"
933
934
934
- #: ../../tutorial/controlflow.rst:786
935
+ #: ../../tutorial/controlflow.rst:792
935
936
msgid ""
936
937
"The second function ``pos_only_arg`` is restricted to only use positional "
937
938
"parameters as there is a ``/`` in the function definition::"
@@ -940,7 +941,7 @@ msgstr ""
940
941
"\n"
941
942
"::"
942
943
943
- #: ../../tutorial/controlflow.rst:797
944
+ #: ../../tutorial/controlflow.rst:803
944
945
msgid ""
945
946
"The third function ``kwd_only_args`` only allows keyword arguments as "
946
947
"indicated by a ``*`` in the function definition::"
@@ -949,7 +950,7 @@ msgstr ""
949
950
"\n"
950
951
"::"
951
952
952
- #: ../../tutorial/controlflow.rst:808
953
+ #: ../../tutorial/controlflow.rst:814
953
954
msgid ""
954
955
"And the last uses all three calling conventions in the same function "
955
956
"definition::"
@@ -958,7 +959,7 @@ msgstr ""
958
959
"\n"
959
960
"::"
960
961
961
- #: ../../tutorial/controlflow.rst:828
962
+ #: ../../tutorial/controlflow.rst:834
962
963
msgid ""
963
964
"Finally, consider this function definition which has a potential collision "
964
965
"between the positional argument ``name`` and ``**kwds`` which has ``name`` "
@@ -969,7 +970,7 @@ msgstr ""
969
970
"\n"
970
971
"::"
971
972
972
- #: ../../tutorial/controlflow.rst:833
973
+ #: ../../tutorial/controlflow.rst:839
973
974
msgid ""
974
975
"There is no possible call that will make it return ``True`` as the keyword "
975
976
"``'name'`` will always bind to the first parameter. For example::"
@@ -979,7 +980,7 @@ msgstr ""
979
980
"\n"
980
981
"::"
981
982
982
- #: ../../tutorial/controlflow.rst:842
983
+ #: ../../tutorial/controlflow.rst:848
983
984
msgid ""
984
985
"But using ``/`` (positional only arguments), it is possible since it allows "
985
986
"``name`` as a positional argument and ``'name'`` as a key in the keyword "
@@ -990,17 +991,17 @@ msgstr ""
990
991
"\n"
991
992
"::"
992
993
993
- #: ../../tutorial/controlflow.rst:850
994
+ #: ../../tutorial/controlflow.rst:856
994
995
msgid ""
995
996
"In other words, the names of positional-only parameters can be used in "
996
997
"``**kwds`` without ambiguity."
997
998
msgstr "換句話說,僅限位置參數的名稱可以在 ``**kwds`` 中使用,而不產生歧義。"
998
999
999
- #: ../../tutorial/controlflow.rst:855
1000
+ #: ../../tutorial/controlflow.rst:861
1000
1001
msgid "Recap"
1001
1002
msgstr "回顧"
1002
1003
1003
- #: ../../tutorial/controlflow.rst:857
1004
+ #: ../../tutorial/controlflow.rst:863
1004
1005
msgid ""
1005
1006
"The use case will determine which parameters to use in the function "
1006
1007
"definition::"
@@ -1009,11 +1010,11 @@ msgstr ""
1009
1010
"\n"
1010
1011
"::"
1011
1012
1012
- #: ../../tutorial/controlflow.rst:861
1013
+ #: ../../tutorial/controlflow.rst:867
1013
1014
msgid "As guidance:"
1014
1015
msgstr "說明:"
1015
1016
1016
- #: ../../tutorial/controlflow.rst:863
1017
+ #: ../../tutorial/controlflow.rst:869
1017
1018
msgid ""
1018
1019
"Use positional-only if you want the name of the parameters to not be "
1019
1020
"available to the user. This is useful when parameter names have no real "
@@ -1025,7 +1026,7 @@ msgstr ""
1025
1026
"想控制引數在函式呼叫的排列順序,或同時使用位置參數和任意關鍵字時,這種方式很"
1026
1027
"有用。"
1027
1028
1028
- #: ../../tutorial/controlflow.rst:868
1029
+ #: ../../tutorial/controlflow.rst:874
1029
1030
msgid ""
1030
1031
"Use keyword-only when names have meaning and the function definition is more "
1031
1032
"understandable by being explicit with names or you want to prevent users "
@@ -1034,19 +1035,19 @@ msgstr ""
1034
1035
"當參數名稱有意義,且明確的名稱可讓函式定義更易理解,或是你不希望使用者依賴引"
1035
1036
"數被傳遞時的位置時,請使用僅限關鍵字。"
1036
1037
1037
- #: ../../tutorial/controlflow.rst:871
1038
+ #: ../../tutorial/controlflow.rst:877
1038
1039
msgid ""
1039
1040
"For an API, use positional-only to prevent breaking API changes if the "
1040
1041
"parameter's name is modified in the future."
1041
1042
msgstr ""
1042
1043
"對於應用程式介面 (API),使用僅限位置,以防止未來參數名稱被修改時造成 API 的中"
1043
1044
"斷性變更。"
1044
1045
1045
- #: ../../tutorial/controlflow.rst:877
1046
+ #: ../../tutorial/controlflow.rst:883
1046
1047
msgid "Arbitrary Argument Lists"
1047
1048
msgstr "任意引數列表 (Arbitrary Argument Lists)"
1048
1049
1049
- #: ../../tutorial/controlflow.rst:882
1050
+ #: ../../tutorial/controlflow.rst:888
1050
1051
msgid ""
1051
1052
"Finally, the least frequently used option is to specify that a function can "
1052
1053
"be called with an arbitrary number of arguments. These arguments will be "
@@ -1059,7 +1060,7 @@ msgstr ""
1059
1060
"\n"
1060
1061
"::"
1061
1062
1062
- #: ../../tutorial/controlflow.rst:891
1063
+ #: ../../tutorial/controlflow.rst:897
1063
1064
msgid ""
1064
1065
"Normally, these *variadic* arguments will be last in the list of formal "
1065
1066
"parameters, because they scoop up all remaining input arguments that are "
@@ -1073,11 +1074,11 @@ msgstr ""
1073
1074
"\n"
1074
1075
"::"
1075
1076
1076
- #: ../../tutorial/controlflow.rst:908
1077
+ #: ../../tutorial/controlflow.rst:914
1077
1078
msgid "Unpacking Argument Lists"
1078
1079
msgstr "拆解引數列表(Unpacking Argument Lists)"
1079
1080
1080
- #: ../../tutorial/controlflow.rst:910
1081
+ #: ../../tutorial/controlflow.rst:916
1081
1082
msgid ""
1082
1083
"The reverse situation occurs when the arguments are already in a list or "
1083
1084
"tuple but need to be unpacked for a function call requiring separate "
@@ -1093,7 +1094,7 @@ msgstr ""
1093
1094
"\n"
1094
1095
"::"
1095
1096
1096
- #: ../../tutorial/controlflow.rst:926
1097
+ #: ../../tutorial/controlflow.rst:932
1097
1098
msgid ""
1098
1099
"In the same fashion, dictionaries can deliver keyword arguments with the "
1099
1100
"``**``\\ -operator::"
@@ -1102,11 +1103,11 @@ msgstr ""
1102
1103
"\n"
1103
1104
"::"
1104
1105
1105
- #: ../../tutorial/controlflow.rst:942
1106
+ #: ../../tutorial/controlflow.rst:948
1106
1107
msgid "Lambda Expressions"
1107
1108
msgstr "Lambda 運算式"
1108
1109
1109
- #: ../../tutorial/controlflow.rst:944
1110
+ #: ../../tutorial/controlflow.rst:950
1110
1111
msgid ""
1111
1112
"Small anonymous functions can be created with the :keyword:`lambda` keyword. "
1112
1113
"This function returns the sum of its two arguments: ``lambda a, b: a+b``. "
@@ -1123,7 +1124,7 @@ msgstr ""
1123
1124
"\n"
1124
1125
"::"
1125
1126
1126
- #: ../../tutorial/controlflow.rst:961
1127
+ #: ../../tutorial/controlflow.rst:967
1127
1128
msgid ""
1128
1129
"The above example uses a lambda expression to return a function. Another "
1129
1130
"use is to pass a small function as an argument::"
@@ -1133,17 +1134,17 @@ msgstr ""
1133
1134
"\n"
1134
1135
"::"
1135
1136
1136
- #: ../../tutorial/controlflow.rst:973
1137
+ #: ../../tutorial/controlflow.rst:979
1137
1138
msgid "Documentation Strings"
1138
1139
msgstr "說明文件字串 (Documentation Strings)"
1139
1140
1140
- #: ../../tutorial/controlflow.rst:980
1141
+ #: ../../tutorial/controlflow.rst:986
1141
1142
msgid ""
1142
1143
"Here are some conventions about the content and formatting of documentation "
1143
1144
"strings."
1144
1145
msgstr "以下是關於說明文件字串內容和格式的慣例。"
1145
1146
1146
- #: ../../tutorial/controlflow.rst:983
1147
+ #: ../../tutorial/controlflow.rst:989
1147
1148
msgid ""
1148
1149
"The first line should always be a short, concise summary of the object's "
1149
1150
"purpose. For brevity, it should not explicitly state the object's name or "
@@ -1155,7 +1156,7 @@ msgstr ""
1155
1156
"的名稱或型別,因為有其他方法可以達到相同目的(除非該名稱剛好是一個描述函式運"
1156
1157
"算的動詞)。這一行應以大寫字母開頭,以句號結尾。"
1157
1158
1158
- #: ../../tutorial/controlflow.rst:989
1159
+ #: ../../tutorial/controlflow.rst:995
1159
1160
msgid ""
1160
1161
"If there are more lines in the documentation string, the second line should "
1161
1162
"be blank, visually separating the summary from the rest of the description. "
@@ -1165,7 +1166,7 @@ msgstr ""
1165
1166
"文件字串為多行時,第二行應為空白行,在視覺上將摘要與其餘描述分開。後面幾行可"
1166
1167
"包含一或多個段落,描述此物件的呼叫慣例、副作用等。"
1167
1168
1168
- #: ../../tutorial/controlflow.rst:994
1169
+ #: ../../tutorial/controlflow.rst:1000
1169
1170
msgid ""
1170
1171
"The Python parser does not strip indentation from multi-line string literals "
1171
1172
"in Python, so tools that process documentation have to strip indentation if "
@@ -1187,18 +1188,18 @@ msgstr ""
1187
1188
"出現了,這些行的全部前導空白字元都應被去除。展開 tab 鍵後(通常為八個空格),"
1188
1189
"應測試空白字元量是否等價。"
1189
1190
1190
- #: ../../tutorial/controlflow.rst:1006
1191
+ #: ../../tutorial/controlflow.rst:1012
1191
1192
msgid "Here is an example of a multi-line docstring::"
1192
1193
msgstr ""
1193
1194
"下面是多行說明字串的一個範例:\n"
1194
1195
"\n"
1195
1196
"::"
1196
1197
1197
- #: ../../tutorial/controlflow.rst:1024
1198
+ #: ../../tutorial/controlflow.rst:1030
1198
1199
msgid "Function Annotations"
1199
1200
msgstr "函式註釋 (Function Annotations)"
1200
1201
1201
- #: ../../tutorial/controlflow.rst:1032
1202
+ #: ../../tutorial/controlflow.rst:1038
1202
1203
msgid ""
1203
1204
":ref:`Function annotations <function>` are completely optional metadata "
1204
1205
"information about the types used by user-defined functions (see :pep:`3107` "
@@ -1207,7 +1208,7 @@ msgstr ""
1207
1208
":ref:`函式註釋 <function>`\\ 是選擇性的元資料(metadata)資訊,描述使用者定義"
1208
1209
"函式所使用的型別(更多資訊詳見 :pep:`3107` 和 :pep:`484`\\ )。"
1209
1210
1210
- #: ../../tutorial/controlflow.rst:1036
1211
+ #: ../../tutorial/controlflow.rst:1042
1211
1212
msgid ""
1212
1213
":term:`Annotations <function annotation>` are stored in the :attr:"
1213
1214
"`__annotations__` attribute of the function as a dictionary and have no "
@@ -1227,11 +1228,11 @@ msgstr ""
1227
1228
"\n"
1228
1229
"::"
1229
1230
1230
- #: ../../tutorial/controlflow.rst:1058
1231
+ #: ../../tutorial/controlflow.rst:1064
1231
1232
msgid "Intermezzo: Coding Style"
1232
1233
msgstr "間奏曲:程式碼風格 (Coding Style)"
1233
1234
1234
- #: ../../tutorial/controlflow.rst:1063
1235
+ #: ../../tutorial/controlflow.rst:1069
1235
1236
msgid ""
1236
1237
"Now that you are about to write longer, more complex pieces of Python, it is "
1237
1238
"a good time to talk about *coding style*. Most languages can be written (or "
@@ -1244,7 +1245,7 @@ msgstr ""
1244
1245
"式比其他的更具可讀性。能讓其他人輕鬆閱讀你的程式碼永遠是一個好主意,而使用優"
1245
1246
"良的編碼樣式對此有極大的幫助。"
1246
1247
1247
- #: ../../tutorial/controlflow.rst:1069
1248
+ #: ../../tutorial/controlflow.rst:1075
1248
1249
msgid ""
1249
1250
"For Python, :pep:`8` has emerged as the style guide that most projects "
1250
1251
"adhere to; it promotes a very readable and eye-pleasing coding style. Every "
@@ -1254,11 +1255,11 @@ msgstr ""
1254
1255
"對於 Python,大多數的專案都遵循 :pep:`8` 的樣式指南;它推行的編碼樣式相當可讀"
1255
1256
"且賞心悅目。每個 Python 開發者都應該花點時間研讀;這裡是該指南的核心重點:"
1256
1257
1257
- #: ../../tutorial/controlflow.rst:1074
1258
+ #: ../../tutorial/controlflow.rst:1080
1258
1259
msgid "Use 4-space indentation, and no tabs."
1259
1260
msgstr "用 4 個空格縮排,不要用 tab 鍵。"
1260
1261
1261
- #: ../../tutorial/controlflow.rst:1076
1262
+ #: ../../tutorial/controlflow.rst:1082
1262
1263
msgid ""
1263
1264
"4 spaces are a good compromise between small indentation (allows greater "
1264
1265
"nesting depth) and large indentation (easier to read). Tabs introduce "
@@ -1267,41 +1268,41 @@ msgstr ""
1267
1268
"4 個空格是小縮排(容許更大的巢套深度)和大縮排(較易閱讀)之間的折衷方案。"
1268
1269
"Tab 鍵會造成混亂,最好別用。"
1269
1270
1270
- #: ../../tutorial/controlflow.rst:1080
1271
+ #: ../../tutorial/controlflow.rst:1086
1271
1272
msgid "Wrap lines so that they don't exceed 79 characters."
1272
1273
msgstr "換行,使一行不超過 79 個字元。"
1273
1274
1274
- #: ../../tutorial/controlflow.rst:1082
1275
+ #: ../../tutorial/controlflow.rst:1088
1275
1276
msgid ""
1276
1277
"This helps users with small displays and makes it possible to have several "
1277
1278
"code files side-by-side on larger displays."
1278
1279
msgstr ""
1279
1280
"換行能讓使用小顯示器的使用者方便閱讀,也可以在較大顯示器上並排陳列多個程式碼"
1280
1281
"檔案。"
1281
1282
1282
- #: ../../tutorial/controlflow.rst:1085
1283
+ #: ../../tutorial/controlflow.rst:1091
1283
1284
msgid ""
1284
1285
"Use blank lines to separate functions and classes, and larger blocks of code "
1285
1286
"inside functions."
1286
1287
msgstr "用空行分隔函式和 class(類別),及函式內較大塊的程式碼。"
1287
1288
1288
- #: ../../tutorial/controlflow.rst:1088
1289
+ #: ../../tutorial/controlflow.rst:1094
1289
1290
msgid "When possible, put comments on a line of their own."
1290
1291
msgstr "如果可以,把註解放在單獨一行。"
1291
1292
1292
- #: ../../tutorial/controlflow.rst:1090
1293
+ #: ../../tutorial/controlflow.rst:1096
1293
1294
msgid "Use docstrings."
1294
1295
msgstr "使用說明字串。"
1295
1296
1296
- #: ../../tutorial/controlflow.rst:1092
1297
+ #: ../../tutorial/controlflow.rst:1098
1297
1298
msgid ""
1298
1299
"Use spaces around operators and after commas, but not directly inside "
1299
1300
"bracketing constructs: ``a = f(1, 2) + g(3, 4)``."
1300
1301
msgstr ""
1301
1302
"運算子前後、逗號後要加空格,但不要直接放在括號內側:\\ ``a = f(1, 2) + g(3, "
1302
1303
"4)``\\ 。"
1303
1304
1304
- #: ../../tutorial/controlflow.rst:1095
1305
+ #: ../../tutorial/controlflow.rst:1101
1305
1306
msgid ""
1306
1307
"Name your classes and functions consistently; the convention is to use "
1307
1308
"``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for "
@@ -1313,7 +1314,7 @@ msgstr ""
1313
1314
"底線)。永遠用 ``self`` 作為 method 第一個引數的名稱(關於 class 和 method,"
1314
1315
"詳見 :ref:`tut-firstclasses`\\ )。"
1315
1316
1316
- #: ../../tutorial/controlflow.rst:1100
1317
+ #: ../../tutorial/controlflow.rst:1106
1317
1318
msgid ""
1318
1319
"Don't use fancy encodings if your code is meant to be used in international "
1319
1320
"environments. Python's default, UTF-8, or even plain ASCII work best in any "
@@ -1322,7 +1323,7 @@ msgstr ""
1322
1323
"若程式碼是為了用於國際環境時,不要用花俏的編碼。Python 預設的 UTF-8 或甚至普"
1323
1324
"通的 ASCII,就可以勝任各種情況。"
1324
1325
1325
- #: ../../tutorial/controlflow.rst:1104
1326
+ #: ../../tutorial/controlflow.rst:1110
1326
1327
msgid ""
1327
1328
"Likewise, don't use non-ASCII characters in identifiers if there is only the "
1328
1329
"slightest chance people speaking a different language will read or maintain "
@@ -1331,11 +1332,11 @@ msgstr ""
1331
1332
"同樣地,若不同語言使用者閱讀或維護程式碼的可能性微乎其微,就不要在命名時使用"
1332
1333
"非 ASCII 字元。"
1333
1334
1334
- #: ../../tutorial/controlflow.rst:1110
1335
+ #: ../../tutorial/controlflow.rst:1116
1335
1336
msgid "Footnotes"
1336
1337
msgstr "註解"
1337
1338
1338
- #: ../../tutorial/controlflow.rst:1111
1339
+ #: ../../tutorial/controlflow.rst:1117
1339
1340
msgid ""
1340
1341
"Actually, *call by object reference* would be a better description, since if "
1341
1342
"a mutable object is passed, the caller will see any changes the callee makes "
@@ -1353,54 +1354,54 @@ msgstr "statement(陳述式)"
1353
1354
msgid "for"
1354
1355
msgstr "for"
1355
1356
1356
- #: ../../tutorial/controlflow.rst:438 ../../tutorial/controlflow.rst:975
1357
+ #: ../../tutorial/controlflow.rst:444 ../../tutorial/controlflow.rst:981
1357
1358
msgid "documentation strings"
1358
1359
msgstr "ddocumentation strings(說明字串)"
1359
1360
1360
- #: ../../tutorial/controlflow.rst:438 ../../tutorial/controlflow.rst:975
1361
+ #: ../../tutorial/controlflow.rst:444 ../../tutorial/controlflow.rst:981
1361
1362
msgid "docstrings"
1362
1363
msgstr "docstrings(說明字串)"
1363
1364
1364
- #: ../../tutorial/controlflow.rst:438 ../../tutorial/controlflow.rst:975
1365
+ #: ../../tutorial/controlflow.rst:444 ../../tutorial/controlflow.rst:981
1365
1366
msgid "strings, documentation"
1366
1367
msgstr "strings(字串), documentation(說明文件)"
1367
1368
1368
- #: ../../tutorial/controlflow.rst:879
1369
+ #: ../../tutorial/controlflow.rst:885
1369
1370
msgid "* (asterisk)"
1370
1371
msgstr "* (星號)"
1371
1372
1372
- #: ../../tutorial/controlflow.rst:879 ../../tutorial/controlflow.rst:923
1373
+ #: ../../tutorial/controlflow.rst:885 ../../tutorial/controlflow.rst:929
1373
1374
msgid "in function calls"
1374
1375
msgstr "於函式呼叫中"
1375
1376
1376
- #: ../../tutorial/controlflow.rst:923
1377
+ #: ../../tutorial/controlflow.rst:929
1377
1378
msgid "**"
1378
1379
msgstr "**"
1379
1380
1380
- #: ../../tutorial/controlflow.rst:1027
1381
+ #: ../../tutorial/controlflow.rst:1033
1381
1382
msgid "function"
1382
1383
msgstr "function(函式)"
1383
1384
1384
- #: ../../tutorial/controlflow.rst:1027
1385
+ #: ../../tutorial/controlflow.rst:1033
1385
1386
msgid "annotations"
1386
1387
msgstr "annotations(註釋)"
1387
1388
1388
- #: ../../tutorial/controlflow.rst:1027
1389
+ #: ../../tutorial/controlflow.rst:1033
1389
1390
msgid "->"
1390
1391
msgstr "->"
1391
1392
1392
- #: ../../tutorial/controlflow.rst:1027
1393
+ #: ../../tutorial/controlflow.rst:1033
1393
1394
msgid "function annotations"
1394
1395
msgstr "function annotations(函式註釋)"
1395
1396
1396
- #: ../../tutorial/controlflow.rst:1027
1397
+ #: ../../tutorial/controlflow.rst:1033
1397
1398
msgid ": (colon)"
1398
1399
msgstr ": (冒號)"
1399
1400
1400
- #: ../../tutorial/controlflow.rst:1061
1401
+ #: ../../tutorial/controlflow.rst:1067
1401
1402
msgid "coding"
1402
1403
msgstr "coding(程式編寫)"
1403
1404
1404
- #: ../../tutorial/controlflow.rst:1061
1405
+ #: ../../tutorial/controlflow.rst:1067
1405
1406
msgid "style"
1406
1407
msgstr "style(風格)"
0 commit comments