@@ -8,7 +8,7 @@ msgstr ""
8
8
"Project-Id-Version : Python 3.12\n "
9
9
"Report-Msgid-Bugs-To : \n "
10
10
"POT-Creation-Date : 2023-10-11 17:13+0000\n "
11
- "PO-Revision-Date : 2023-10-31 23:08 +0800\n "
11
+ "PO-Revision-Date : 2023-11-01 14:02 +0800\n "
12
12
"Last-Translator : RockLeon <therockleona@gmail.com>\n "
13
13
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
14
14
"tw)\n "
@@ -17,7 +17,7 @@ msgstr ""
17
17
"Content-Type : text/plain; charset=UTF-8\n "
18
18
"Content-Transfer-Encoding : 8bit\n "
19
19
"Plural-Forms : nplurals=1; plural=0;\n "
20
- "X-Generator : Poedit 3.4.1 \n "
20
+ "X-Generator : Poedit 3.4\n "
21
21
22
22
#: ../../library/typing.rst:3
23
23
msgid ":mod:`typing` --- Support for type hints"
@@ -425,9 +425,9 @@ msgid ""
425
425
"checker treat ``Alias`` as being *exactly equivalent* to ``Original`` in all "
426
426
"cases. This is useful when you want to simplify complex type signatures."
427
427
msgstr ""
428
- "請記得使用型別別名是宣告兩種型別是互相\\ *相等*\\ 的。使用 ``type Alias = "
428
+ "請記得使用型別別名是宣告兩種型別是互相\\ *相等*\\ 的。使用 ``type Alias = "
429
429
"Original`` 則會讓靜態型別檢查器在任何情況之下將 ``Alias`` 視為與 "
430
- "``Original`` \\ *完全相等*\\ 。這當你想把複雜的型別簽名進行簡化時,非常好用。"
430
+ "``Original`` \\ *完全相等*\\ 。這當你想把複雜的型別簽名進行簡化時,非常好用。"
431
431
432
432
#: ../../library/typing.rst:243
433
433
msgid ""
@@ -450,16 +450,18 @@ msgid ""
450
450
"some additional runtime cost when calling ``NewType`` over a regular "
451
451
"function."
452
452
msgstr ""
453
+ "現在的 ``NewType`` 比起一個函式更像一個類別。因此,比起一般的函式,呼叫 "
454
+ "``NewType`` 需要額外的執行環境成本。"
453
455
454
456
#: ../../library/typing.rst:257
455
457
msgid ""
456
458
"The performance of calling ``NewType`` has been restored to its level in "
457
459
"Python 3.9."
458
- msgstr ""
460
+ msgstr "呼叫 ``NewType`` 的效能已經恢復與 Python 3.9 相同的水準。 "
459
461
460
462
#: ../../library/typing.rst:264
461
463
msgid "Annotating callable objects"
462
- msgstr ""
464
+ msgstr "標記 callable 物件 "
463
465
464
466
#: ../../library/typing.rst:266
465
467
msgid ""
@@ -468,6 +470,9 @@ msgid ""
468
470
"``Callable[[int], str]`` signifies a function that takes a single parameter "
469
471
"of type :class:`int` and returns a :class:`str`."
470
472
msgstr ""
473
+ "函式,或者是 :term:`callable` 物件,可以使用 :class:`collections.abc."
474
+ "Callable` 或 :data:`typing.Callable` 進行標記。 ``Callable[[int], str]`` 象徵"
475
+ "為一個函式,可以接受一個型別為 :class:`int` 的引數,並回傳一個 :class:`str`。"
471
476
472
477
#: ../../library/typing.rst:271 ../../library/typing.rst:2888
473
478
#: ../../library/typing.rst:3030
@@ -481,12 +486,17 @@ msgid ""
481
486
"types, a :class:`ParamSpec`, :data:`Concatenate`, or an ellipsis. The return "
482
487
"type must be a single type."
483
488
msgstr ""
489
+ "使用訂閱語法 (subscription syntax) 時,必須使用到兩個值,分別為引述串列以及回"
490
+ "傳類別。引數串列必須為一個型別串列::class:`ParamSpec`、:data:`Concatenate` "
491
+ "或是一個刪節號 (ellipsis)。回傳類別必為一個單一類別。"
484
492
485
493
#: ../../library/typing.rst:294
486
494
msgid ""
487
495
"If a literal ellipsis ``...`` is given as the argument list, it indicates "
488
496
"that a callable with any arbitrary parameter list would be acceptable:"
489
497
msgstr ""
498
+ "若刪節號文字 ``...`` 被當作引數串列給定,其指出一個具任何、隨意參數列表的 "
499
+ "callable 會被接受: ::"
490
500
491
501
#: ../../library/typing.rst:306
492
502
msgid ""
@@ -496,6 +506,10 @@ msgid ""
496
506
"be expressed by defining a :class:`Protocol` class with a :meth:`~object."
497
507
"__call__` method:"
498
508
msgstr ""
509
+ "``Callable`` 不如有可變數量引數的函式、:func:`overloaded functions "
510
+ "<overload>`、或是限定關鍵字參數的函式,可以表示複雜簽名。然而,這些簽名可以透"
511
+ "過定義一個具有 :meth:`~object.__call__` 方法的 :class:`Protocol` 類別進行表"
512
+ "示:"
499
513
500
514
#: ../../library/typing.rst:333
501
515
msgid ""
@@ -507,53 +521,70 @@ msgid ""
507
521
"``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], "
508
522
"ReturnType]`` respectively."
509
523
msgstr ""
524
+ "Callable 物件可以取用其他 callable 當作引數使用,可以透過 :class:`ParamSpec` "
525
+ "指出他們的參數型別是個別獨立的。另外,如果這個 callable 從其他 callable 新增"
526
+ "或刪除引數時,將會使用到 :data:`Concatenate` 運算子。他們可以分別採用 "
527
+ "``Callable[ParamSpecVariable, ReturnType]`` 以及 "
528
+ "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], "
529
+ "ReturnType]`` 的形式。"
510
530
511
531
#: ../../library/typing.rst:341 ../../library/typing.rst:3559
512
532
msgid ""
513
533
"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :"
514
534
"pep:`612` for more details."
515
535
msgstr ""
536
+ "``Callable`` 現已支援 :class:`ParamSpec` 以及 :data:`Concatenate`。請參閱 :"
537
+ "pep:`612` 閱讀詳細內容。"
516
538
517
539
#: ../../library/typing.rst:346
518
540
msgid ""
519
541
"The documentation for :class:`ParamSpec` and :class:`Concatenate` provides "
520
542
"examples of usage in ``Callable``."
521
543
msgstr ""
544
+ ":class:`ParamSpec` 以及 :class:`Concatenate` 的文件中,提供範例如何在 "
545
+ "``Callable`` 中使用。"
522
546
523
547
#: ../../library/typing.rst:352
524
548
msgid "Generics"
525
- msgstr ""
549
+ msgstr "泛型 "
526
550
527
551
#: ../../library/typing.rst:354
528
552
msgid ""
529
553
"Since type information about objects kept in containers cannot be statically "
530
554
"inferred in a generic way, many container classes in the standard library "
531
555
"support subscription to denote the expected types of container elements."
532
556
msgstr ""
557
+ "自從關於物件的型別資訊留存在容器之內,且無法使用泛型的方式進行靜態推論 "
558
+ "(statically inferred),許多標準函式庫的容器類別支援訂閱及表示容器內元素預期的"
559
+ "型別。"
533
560
534
561
#: ../../library/typing.rst:371
535
562
msgid ""
536
563
"Generic functions and classes can be parameterized by using :ref:`type "
537
564
"parameter syntax <type-params>`::"
538
565
msgstr ""
566
+ "泛型函式及類別可以使用 :ref:`type parameter syntax <type-params>` 進行參數化 "
567
+ "(parameterize) : ::"
539
568
540
569
#: ../../library/typing.rst:379
541
570
msgid "Or by using the :class:`TypeVar` factory directly::"
542
- msgstr ""
571
+ msgstr "或是直接使用 :class:`TypeVar` 工具 (factory): :: "
543
572
544
573
#: ../../library/typing.rst:389
545
574
msgid "Syntactic support for generics is new in Python 3.12."
546
- msgstr ""
575
+ msgstr "在 Python 3.12 中,泛型的語法支援是全新功能。 "
547
576
548
577
#: ../../library/typing.rst:395
549
578
msgid "Annotating tuples"
550
- msgstr ""
579
+ msgstr "標記元組 (tuple) "
551
580
552
581
#: ../../library/typing.rst:397
553
582
msgid ""
554
583
"For most containers in Python, the typing system assumes that all elements "
555
584
"in the container will be of the same type. For example::"
556
585
msgstr ""
586
+ "在 Python 大多數的容器當中,加註型別系統認為容器內的所有元素會是相同型別。舉"
587
+ "例來說: ::"
557
588
558
589
#: ../../library/typing.rst:412
559
590
msgid ""
@@ -562,6 +593,10 @@ msgid ""
562
593
"Mapping` only accepts two type arguments: the first indicates the type of "
563
594
"the keys, and the second indicates the type of the values."
564
595
msgstr ""
596
+ ":class:`list` 只接受一個型別引數,所以型別檢查器可能在上述 ``y`` 賦值 "
597
+ "(assignment)觸發錯誤。類似的範例,:class:`~collections.abc.Mapping` 只接受兩"
598
+ "個型別引數:第一個引數指出 keys (鍵) 的型別;第二個引數指出 values (值)的"
599
+ "型別。"
565
600
566
601
#: ../../library/typing.rst:418
567
602
msgid ""
@@ -570,6 +605,10 @@ msgid ""
570
605
"For this reason, tuples are special-cased in Python's typing system. :class:"
571
606
"`tuple` accepts *any number* of type arguments::"
572
607
msgstr ""
608
+ "然而,與其他多數的 Python 容器不同,在慣用的 (idiomatic) Python 程式碼中,元"
609
+ "組可以擁有不完全相同型別的元素是相當常見的。為此,元祖在 Python 的加註型別系"
610
+ "統中是個特例 (special-cased)。:class:`tuple` 接受\\ *任何數量*\\ 的型別引"
611
+ "數: ::"
573
612
574
613
#: ../../library/typing.rst:434
575
614
msgid ""
@@ -578,6 +617,9 @@ msgid ""
578
617
"use ``tuple[()]``. Using plain ``tuple`` as an annotation is equivalent to "
579
618
"using ``tuple[Any, ...]``::"
580
619
msgstr ""
620
+ "為了標示一個元組可以為\\ *任意*\\ 長度,且所有元素皆是相同型別 ``T``,請使用 "
621
+ "``tuple[T, ...]`` 進行標示。為了標示一個空元組,請使用 ``tuple[()]``。單純使"
622
+ "用 ``tuple`` 作為標記,會與使用 ``tuple[Any, ...]`` 是相等的: ::"
581
623
582
624
#: ../../library/typing.rst:457
583
625
msgid "The type of class objects"
0 commit comments