@@ -7,7 +7,7 @@ msgstr ""
77"Project-Id-Version :Python 3.12\n "
88"Report-Msgid-Bugs-To :\n "
99"POT-Creation-Date :2024-06-03 00:03+0000\n "
10- "PO-Revision-Date :2024-03-26 11:30 +0800\n "
10+ "PO-Revision-Date :2024-07-11 11:12 +0800\n "
1111"Last-Translator :Li-Hung Wang <therockleona@gmail.com>\n "
1212"Language-Team :Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
1313"tw)\n "
@@ -16,7 +16,7 @@ msgstr ""
1616"Content-Type :text/plain; charset=UTF-8\n "
1717"Content-Transfer-Encoding :8bit\n "
1818"Plural-Forms :nplurals=1; plural=0;\n "
19- "X-Generator :Poedit 3.4\n "
19+ "X-Generator :Poedit 3.4.4 \n "
2020
2121#: ../../library/typing.rst:3
2222msgid ":mod:`typing` --- Support for type hints"
@@ -41,7 +41,7 @@ msgstr "此模組提供 runtime 型別提示支援。"
4141
4242#: ../../library/typing.rst:28
4343msgid "Consider the function below::"
44- msgstr ""
44+ msgstr "動腦筋思考下面的函式: :: "
4545
4646#: ../../library/typing.rst:33
4747msgid ""
@@ -50,13 +50,18 @@ msgid ""
5050"The function is expected to return an instance of :class:`str`, as indicated "
5151"by the ``-> str`` hint."
5252msgstr ""
53+ "函式 ``moon_weight`` 需要一個引數且預期是一個 :class:`float` 的實例,如 "
54+ "``earth_weight: float`` 所指出的\\ *型別提示*。這個函式預期會回傳一個 :class:"
55+ "`str` 的實例,如 ``-> str`` 所指出的提示。"
5356
5457#: ../../library/typing.rst:37
5558msgid ""
5659"While type hints can be simple classes like :class:`float` or :class:`str`, "
5760"they can also be more complex. The :mod:`typing` module provides a "
5861"vocabulary of more advanced type hints."
5962msgstr ""
63+ "儘管型別提示可以是簡單類別,像是 :class:`float` 或 :class:`str`,他們也可以變"
64+ "得更為複雜。模組 :mod:`typing` 提供一組更高階的型別提示詞彙。"
6065
6166#: ../../library/typing.rst:41
6267msgid ""
@@ -113,14 +118,17 @@ msgstr ""
113118
114119#: ../../library/typing.rst:63
115120msgid "Specification for the Python Type System"
116- msgstr ""
121+ msgstr "Python 型別系統的技術規範 "
117122
118123#: ../../library/typing.rst:65
119124msgid ""
120125"The canonical, up-to-date specification of the Python type system can be "
121126"found at `\" Specification for the Python type system\" <https://typing."
122127"readthedocs.io/en/latest/spec/index.html>`_."
123128msgstr ""
129+ "關於 Python 型別系統標準的 (canonical)、最新的技術規範可以在\\ `「Python 型別"
130+ "系統的技術規範」 <https://typing.readthedocs.io/en/latest/spec/index."
131+ "html>`_\\ 找到。"
124132
125133#: ../../library/typing.rst:71
126134msgid "Type aliases"
@@ -885,14 +893,16 @@ msgid ""
885893":data:`!Never` and :data:`!NoReturn` have the same meaning in the type "
886894"system and static type checkers treat both equivalently."
887895msgstr ""
896+ ":data:`!Never` 以及 :data:`!NoReturn` 在型別系統中具有相同的意義且靜態型別檢"
897+ "查器會將兩者視為相等。"
888898
889899#: ../../library/typing.rst:883
890900msgid "Added :data:`NoReturn`."
891- msgstr ""
901+ msgstr "新增 :data:`NoReturn`。 "
892902
893903#: ../../library/typing.rst:887
894904msgid "Added :data:`Never`."
895- msgstr ""
905+ msgstr "新增 :data:`Never`。 "
896906
897907#: ../../library/typing.rst:891
898908msgid "Special type to represent the current enclosed class."
@@ -983,67 +993,73 @@ msgstr ""
983993
984994#: ../../library/typing.rst:991
985995msgid "Special forms"
986- msgstr ""
996+ msgstr "特別型式 "
987997
988998#: ../../library/typing.rst:993
989999msgid ""
9901000"These can be used as types in annotations. They all support subscription "
9911001"using ``[]``, but each has a unique syntax."
9921002msgstr ""
1003+ "這些在註釋中可以當作型別使用。他們全都支援 ``[]`` 的下標使用,但每個都具有獨"
1004+ "特的語法。"
9931005
9941006#: ../../library/typing.rst:998
9951007msgid ""
9961008"Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or "
9971009"Y."
9981010msgstr ""
1011+ "聯集型別;``Union[X, Y]`` 與 ``X | Y`` 是相等的,且都意味著 X 或 Y 兩者其一。"
9991012
10001013#: ../../library/typing.rst:1000
10011014msgid ""
10021015"To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | "
10031016"str``. Using that shorthand is recommended. Details:"
10041017msgstr ""
1018+ "為了定義聯集,例如可以使用 ``Union[int, str]`` 或是使用簡寫 (shorthand) "
1019+ "``int | str``。使用這種簡寫是非常推薦的。詳細請看: ::"
10051020
10061021#: ../../library/typing.rst:1002
10071022msgid "The arguments must be types and there must be at least one."
1008- msgstr ""
1023+ msgstr "引數必須為型別且必須有至少一個。 "
10091024
10101025#: ../../library/typing.rst:1004
10111026msgid "Unions of unions are flattened, e.g.::"
1012- msgstr ""
1027+ msgstr "聯集中的聯集會是扁平化的 (flattened),舉例來說: :: "
10131028
10141029#: ../../library/typing.rst:1008
10151030msgid "Unions of a single argument vanish, e.g.::"
1016- msgstr ""
1031+ msgstr "單一引數的聯集會消失不見,舉例來說: :: "
10171032
10181033#: ../../library/typing.rst:1012
10191034msgid "Redundant arguments are skipped, e.g.::"
1020- msgstr ""
1035+ msgstr "多餘的引數會被略過,舉例來說: :: "
10211036
10221037#: ../../library/typing.rst:1016
10231038msgid "When comparing unions, the argument order is ignored, e.g.::"
1024- msgstr ""
1039+ msgstr "當比較聯集時,引數的順序會被忽略,舉例來說: :: "
10251040
10261041#: ../../library/typing.rst:1020
10271042msgid "You cannot subclass or instantiate a ``Union``."
1028- msgstr ""
1043+ msgstr "你不能建立 ``Union`` 的子類別或是實例。 "
10291044
10301045#: ../../library/typing.rst:1022
10311046msgid "You cannot write ``Union[X][Y]``."
10321047msgstr "你不能寫成 ``Union[X][Y]``。"
10331048
10341049#: ../../library/typing.rst:1024
10351050msgid "Don't remove explicit subclasses from unions at runtime."
1036- msgstr ""
1051+ msgstr "請勿在 runtime 中將顯性子類別從聯集中移除。 "
10371052
10381053#: ../../library/typing.rst:1027
10391054msgid ""
10401055"Unions can now be written as ``X | Y``. See :ref:`union type "
10411056"expressions<types-union>`."
10421057msgstr ""
1058+ "現在可以將聯集寫成 ``X | Y``。請見\\ :ref:`聯集型別運算式 <types-union>`。"
10431059
10441060#: ../../library/typing.rst:1033
10451061msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)."
1046- msgstr ""
1062+ msgstr "``Optional[X]`` 與 ``X | None`` 是相等的(或是 ``Union[X, None]``)。 "
10471063
10481064#: ../../library/typing.rst:1035
10491065msgid ""
@@ -1052,23 +1068,30 @@ msgid ""
10521068"the ``Optional`` qualifier on its type annotation just because it is "
10531069"optional. For example::"
10541070msgstr ""
1071+ "請注意,這與具有預設值的選擇性引數 (optional argument) 不是相同的概念。一個具"
1072+ "有預設值的選擇性引數的型別註釋中不具有 ``Optional`` 限定符 (qualifier),單純"
1073+ "的因為它就是選擇性的。舉例來說: ::"
10551074
10561075#: ../../library/typing.rst:1043
10571076msgid ""
10581077"On the other hand, if an explicit value of ``None`` is allowed, the use of "
10591078"``Optional`` is appropriate, whether the argument is optional or not. For "
10601079"example::"
10611080msgstr ""
1081+ "另一方面,如果一個顯性的值 ``None`` 是被允許的,不論引數是不是選擇性的,"
1082+ "``Optional`` 都適用。舉例來說: ::"
10621083
10631084#: ../../library/typing.rst:1050
10641085msgid ""
10651086"Optional can now be written as ``X | None``. See :ref:`union type "
10661087"expressions<types-union>`."
10671088msgstr ""
1089+ "現在可以將 Optional 寫成 ``X | None``。請見\\ :ref:`聯集型別運算式 <types-"
1090+ "union>`。"
10681091
10691092#: ../../library/typing.rst:1056
10701093msgid "Special form for annotating higher-order functions."
1071- msgstr ""
1094+ msgstr "用於註釋高階函式的特別型式。 "
10721095
10731096#: ../../library/typing.rst:1058
10741097msgid ""
@@ -1080,6 +1103,13 @@ msgid ""
10801103"a :ref:`Callable <annotating-callables>`. The last parameter to "
10811104"``Concatenate`` must be a :class:`ParamSpec` or ellipsis (``...``)."
10821105msgstr ""
1106+ "``Concatenate`` 可以被用在\\ :ref:`可呼叫物件 <annotating-callables>`\\ 與 :"
1107+ "class:`ParamSpec` 的接合 (conjunction) 並註釋一個高階的 Callable 物件可以新"
1108+ "增、移除、轉換另一個 Callable 物件的參數。使用方法是依照這個格式 "
1109+ "``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``。``Concatenate`` "
1110+ "目前只在 :ref:`Callable 物件 <annotating-callables>`\\ 中第一個引數使用時有"
1111+ "效。``Concatenate`` 的最後一個參數必須為一個 :class:`ParamSpec` 或是刪節號 "
1112+ "(``...``)。"
10831113
10841114#: ../../library/typing.rst:1067
10851115msgid ""
@@ -1091,12 +1121,17 @@ msgid ""
10911121"parameter types are dependent on the parameter types of the callable being "
10921122"passed in::"
10931123msgstr ""
1124+ "舉例來說,註釋一個為裝飾過後的函式提供 :class:`threading.Lock` 的裝飾器 "
1125+ "``with_lock``,``Concatenate`` 可以用於指出 ``with_lock`` 預期一個 Callable "
1126+ "物件,該物件可以接受 ``Lock`` 作為第一引數,並回傳一個具有不同型別簽名 "
1127+ "Callable 物件。在這種情況下,:class:`ParamSpec` 指出回傳的 Callable 物件的參"
1128+ "數型別會依賴傳遞的 Callable 物件的參數型別: ::"
10941129
10951130#: ../../library/typing.rst:1103 ../../library/typing.rst:1865
10961131msgid ""
10971132":pep:`612` -- Parameter Specification Variables (the PEP which introduced "
10981133"``ParamSpec`` and ``Concatenate``)"
1099- msgstr ""
1134+ msgstr ":pep:`612` -- 參數技術規範變數 "
11001135
11011136#: ../../library/typing.rst:1105
11021137msgid ":class:`ParamSpec`"
@@ -1108,20 +1143,24 @@ msgstr ":ref:`annotating-callables`"
11081143
11091144#: ../../library/typing.rst:1110
11101145msgid "Special typing form to define\" literal types\" ."
1111- msgstr ""
1146+ msgstr "特殊型別格式,用於定義「文本型別 (literal type)」。 "
11121147
11131148#: ../../library/typing.rst:1112
11141149msgid ""
11151150"``Literal`` can be used to indicate to type checkers that the annotated "
11161151"object has a value equivalent to one of the provided literals."
11171152msgstr ""
1153+ "``Literal`` 可以用於型別檢查器並指出註釋物件具有一個與提供的文本相同的值。"
11181154
11191155#: ../../library/typing.rst:1128
11201156msgid ""
11211157"``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is "
11221158"allowed as type argument to ``Literal[...]``, but type checkers may impose "
11231159"restrictions. See :pep:`586` for more details about literal types."
11241160msgstr ""
1161+ "``Literal[...]`` 不可以進行子類別化。在 runtime 之中,任意的值是允許作為 "
1162+ "``Literal[...]`` 的型別引數,但型別檢查器可能會加強限制。更多有關文本型別的詳"
1163+ "細資訊請看 :pep:`586`。"
11251164
11261165#: ../../library/typing.rst:1134
11271166msgid ""
@@ -1130,21 +1169,27 @@ msgid ""
11301169"now raise a :exc:`TypeError` exception during equality comparisons if one of "
11311170"their parameters are not :term:`hashable`."
11321171msgstr ""
1172+ "``Literal``現在可以刪除重複 (de-deplicate) 的參數。``Literal`` 物件的相等性比"
1173+ "較不再依照相依性排序。``Literal`` 物件現在會在相等性比較期間,若任一個其中的"
1174+ "參數無法 :term:`hashable` 時,則會引發一個 :exc:`TypeError` 例外。"
11331175
11341176#: ../../library/typing.rst:1142
11351177msgid "Special type construct to mark class variables."
1136- msgstr ""
1178+ msgstr "特殊型別建構,用來標記類別變數。 "
11371179
11381180#: ../../library/typing.rst:1144
11391181msgid ""
11401182"As introduced in :pep:`526`, a variable annotation wrapped in ClassVar "
11411183"indicates that a given attribute is intended to be used as a class variable "
11421184"and should not be set on instances of that class. Usage::"
11431185msgstr ""
1186+ "如同在 :pep:`526` 中的介紹,一個變數註解被包裝在 ClassVar 中時,會指出一個給"
1187+ "定的屬性 (attribute) 意圖被當作類別變數使用,且不該被設定成該類別的實例。使用"
1188+ "方法如下: ::"
11441189
11451190#: ../../library/typing.rst:1152
11461191msgid ":data:`ClassVar` accepts only types and cannot be further subscribed."
1147- msgstr ""
1192+ msgstr ":data:`ClassVar` 只接受型別請不得使用下標。 "
11481193
11491194#: ../../library/typing.rst:1154
11501195msgid ""
@@ -1153,26 +1198,33 @@ msgid ""
11531198"runtime behavior, but it can be used by third-party type checkers. For "
11541199"example, a type checker might flag the following code as an error::"
11551200msgstr ""
1201+ ":data:`ClassVar` 並不代表該類別本身,而且不應該和 :func:`isinstance` 或是 :"
1202+ "func:`issubclass` 一起使用。:data:`ClassVar` 不會改變 Python runtime 的行為,"
1203+ "但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方的程"
1204+ "式碼為一個錯誤: ::"
11561205
11571206#: ../../library/typing.rst:1168
11581207msgid "Special typing construct to indicate final names to type checkers."
1159- msgstr ""
1208+ msgstr "特殊型別建構,用來指出最終名稱給型別檢查器。 "
11601209
11611210#: ../../library/typing.rst:1170
11621211msgid ""
11631212"Final names cannot be reassigned in any scope. Final names declared in class "
11641213"scopes cannot be overridden in subclasses."
11651214msgstr ""
1215+ "最終名稱不可以在任何作用域 (scope) 中重新賦值。在類別作用域中宣告的最終名稱,"
1216+ "不得在子類別中進行覆寫 (override)。"
11661217
11671218#: ../../library/typing.rst:1184 ../../library/typing.rst:2785
11681219msgid ""
11691220"There is no runtime checking of these properties. See :pep:`591` for more "
11701221"details."
11711222msgstr ""
1223+ "這些屬性 (property) 不會在 runtime 時進行檢查。更多詳細資訊請看 :pep:`591`。"
11721224
11731225#: ../../library/typing.rst:1191
11741226msgid "Special typing construct to mark a :class:`TypedDict` key as required."
1175- msgstr ""
1227+ msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是必須的。 "
11761228
11771229#: ../../library/typing.rst:1193
11781230msgid ""
@@ -1186,7 +1238,7 @@ msgstr ""
11861238msgid ""
11871239"Special typing construct to mark a :class:`TypedDict` key as potentially "
11881240"missing."
1189- msgstr ""
1241+ msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是可能消失的。 "
11901242
11911243#: ../../library/typing.rst:1203
11921244msgid "See :class:`TypedDict` and :pep:`655` for more details."