Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c884c82

Browse filesBrowse files
committed
Finish Translate Sections
1 parent 8077637 commit c884c82
Copy full SHA for c884c82

File tree

1 file changed

+42
-4
lines changed
Filter options

1 file changed

+42
-4
lines changed

‎library/typing.po

Copy file name to clipboardExpand all lines: library/typing.po
+42-4Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version: Python 3.12\n"
99
"Report-Msgid-Bugs-To: \n"
1010
"POT-Creation-Date: 2023-11-09 00:04+0000\n"
11-
"PO-Revision-Date: 2023-12-15 10:37+0800\n"
11+
"PO-Revision-Date: 2023-12-15 14:19+0800\n"
1212
"Last-Translator: RockLeon <therockleona@gmail.com>\n"
1313
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1414
"tw)\n"
@@ -723,10 +723,12 @@ msgid ""
723723
"for each position. In the following example, ``MyIterable`` is not generic "
724724
"but implicitly inherits from ``Iterable[Any]``:"
725725
msgstr ""
726+
"若使用泛型類別卻沒有特指型別參數,則會將每個位子視為 :data:`Any`。在下列的範"
727+
"例中 ``MyIterable`` 不是泛型,但隱性繼承了 ``Iterable[Any]``: ::"
726728

727729
#: ../../library/typing.rst:608
728730
msgid "User-defined generic type aliases are also supported. Examples::"
729-
msgstr ""
731+
msgstr "使用者定義的泛型型別別名也有支援。例如: ::"
730732

731733
#: ../../library/typing.rst:623
732734
msgid ""
@@ -736,14 +738,16 @@ msgstr "為了向後相容性,泛型型別別名可以透過簡單的賦值來
736738

737739
#: ../../library/typing.rst:632
738740
msgid ":class:`Generic` no longer has a custom metaclass."
739-
msgstr ""
741+
msgstr ":class:`Generic` 不再是一個自訂的 metaclass。"
740742

741743
#: ../../library/typing.rst:635
742744
msgid ""
743745
"Syntactic support for generics and type aliases is new in version 3.12. "
744746
"Previously, generic classes had to explicitly inherit from :class:`Generic` "
745747
"or contain a type variable in one of their bases."
746748
msgstr ""
749+
"在版本 3.12 新增了泛型及型別別名的語法支援。在之前的版本中,泛型類別必須顯性"
750+
"繼承 :class:`Generic` 或是包含一個型別變數在基底類別 (base) 當中。"
747751

748752
#: ../../library/typing.rst:640
749753
msgid ""
@@ -754,12 +758,18 @@ msgid ""
754758
"The one exception to this is that a list of types can be used to substitute "
755759
"a :class:`ParamSpec`::"
756760
msgstr ""
761+
"使用者定義的參數運算式 (parameter expression) 泛型一樣有支援,透過 ``[**P]`` "
762+
"格式的參數規格變數來進行表示。對於上述作為參數規格變數的型別變數,將持續被型"
763+
"別模組視為一個特定的型別變數。對此,其中一個例外是一個型別列表可以替代 :"
764+
"class:`ParamSpec`: ::"
757765

758766
#: ../../library/typing.rst:651
759767
msgid ""
760768
"Classes generic over a :class:`ParamSpec` can also be created using explicit "
761769
"inheritance from :class:`Generic`. In this case, ``**`` is not used::"
762770
msgstr ""
771+
"具有 :class:`ParamSpec` 的泛型類別可以透過顯示繼承 :class:`Generic` 進行建"
772+
"立。在這種情況下,不需要使用 ``**``: ::"
763773

764774
#: ../../library/typing.rst:661
765775
msgid ""
@@ -769,19 +779,27 @@ msgid ""
769779
"Type2, ...]`` for aesthetic reasons. Internally, the latter is converted to "
770780
"the former, so the following are equivalent::"
771781
msgstr ""
782+
"另外一個 :class:`TypeVar` 以及 :class:`ParamSpec` 之間的差異是,基於美觀因"
783+
"素,只有一個參數規格變數的泛型可以接受如 ``X[[Type1, Type2, ...]]`` 以及 "
784+
"``X[Type1, Type2, ...]`` 的參數列表。在內部中,後者會被轉換為前者,所以在下方"
785+
"的範例中為相等的: ::"
772786

773787
#: ../../library/typing.rst:674
774788
msgid ""
775789
"Note that generics with :class:`ParamSpec` may not have correct "
776790
"``__parameters__`` after substitution in some cases because they are "
777791
"intended primarily for static type checking."
778792
msgstr ""
793+
"請記得,具有 :class:`ParamSpec` 的泛型在某些情況下替換之後可能不會有正確的 "
794+
"``__parameters__``,因為參數規格主要還是用於靜態型別檢查。"
779795

780796
#: ../../library/typing.rst:678
781797
msgid ""
782798
":class:`Generic` can now be parameterized over parameter expressions. See :"
783799
"class:`ParamSpec` and :pep:`612` for more details."
784800
msgstr ""
801+
":class:`Generic` 現在可以透過參數運算式來進行參數化。詳細內容請見 :class:"
802+
"`ParamSpec` 以及 :pep:`612`。"
785803

786804
#: ../../library/typing.rst:682
787805
msgid ""
@@ -790,6 +808,9 @@ msgid ""
790808
"parameterizing generics is cached, and most types in the typing module are :"
791809
"term:`hashable` and comparable for equality."
792810
msgstr ""
811+
"一個使用者定義的泛型類別可以將 ABC 作為他們的基底類別,且不會有 metaclass 衝"
812+
"突。泛型的 metaclass 則不支援。參數化泛型的輸出將被存為快取,而在型別模組中多"
813+
"數的型別皆為 :term:`hashable` 且可以比較相等性。"
793814

794815
#: ../../library/typing.rst:689
795816
msgid "The :data:`Any` type"
@@ -801,12 +822,16 @@ msgid ""
801822
"every type as being compatible with :data:`Any` and :data:`Any` as being "
802823
"compatible with every type."
803824
msgstr ""
825+
":data:`Any` 是一種特別的型別。一個靜態型別檢查器會將每個型別視為可相容於 :"
826+
"data:`Any` 且 :data:`Any` 也可以相容於每個型別。"
804827

805828
#: ../../library/typing.rst:695
806829
msgid ""
807830
"This means that it is possible to perform any operation or method call on a "
808831
"value of type :data:`Any` and assign it to any variable::"
809832
msgstr ""
833+
"這意味著如果在一個為 :data:`Any` 的值上執行任何操作或呼叫方法是可行的,且可以"
834+
"賦值給任意變數: ::"
810835

811836
#: ../../library/typing.rst:713
812837
msgid ""
@@ -816,18 +841,23 @@ msgid ""
816841
"declared to be of type :class:`str` and receives an :class:`int` value at "
817842
"runtime!"
818843
msgstr ""
844+
"請注意,當賦予型別為 :data:`Any` 的值更精確的型別時,將不會執行任何型別檢查。"
845+
"舉例來說,靜態型別檢查器不會在 runtime 中,將 ``a`` 賦值給 ``s`` 的情況下回報"
846+
"錯誤,儘管 ``s`` 是被宣告為型別 :class:`str` 卻接收到 :class:`int` 的值!"
819847

820848
#: ../../library/typing.rst:719
821849
msgid ""
822850
"Furthermore, all functions without a return type or parameter types will "
823851
"implicitly default to using :data:`Any`::"
824-
msgstr ""
852+
msgstr "另外,所有缺少回傳型別或參數型別的函式將會隱性預設為 :data:`Any`: ::"
825853

826854
#: ../../library/typing.rst:732
827855
msgid ""
828856
"This behavior allows :data:`Any` to be used as an *escape hatch* when you "
829857
"need to mix dynamically and statically typed code."
830858
msgstr ""
859+
"當你需要混和動態及靜態的型別程式碼,這個行為允許 :data:`Any` 被當作一個\\ *緊"
860+
"急出口 (escape hatch)*\\使用。"
831861

832862
#: ../../library/typing.rst:735
833863
msgid ""
@@ -836,6 +866,9 @@ msgid ""
836866
"unlike :data:`Any`, the reverse is not true: :class:`object` is *not* a "
837867
"subtype of every other type."
838868
msgstr ""
869+
":data:`Any` 的行為對比 :class:`object` 的行為。與 :data:`Any` 相似,所有的型"
870+
"別會作為 :class:`object` 的子型別。然而,不像 :data:`Any`,反之不亦然::"
871+
"class:`object` 並\\ *不是*\\一個其他型別的子型別。"
839872

840873
#: ../../library/typing.rst:740
841874
msgid ""
@@ -844,12 +877,17 @@ msgid ""
844877
"it as a return value) of a more specialized type is a type error. For "
845878
"example::"
846879
msgstr ""
880+
"這意味著當一個值的型別為 :class:`object` 時,型別檢查器會拒絕幾乎所有的操作,"
881+
"並將賦予這個值到一個特定型別變數(或是當作回傳值使用)視為一個型別錯誤。舉例"
882+
"來說: ::"
847883

848884
#: ../../library/typing.rst:762
849885
msgid ""
850886
"Use :class:`object` to indicate that a value could be any type in a typesafe "
851887
"manner. Use :data:`Any` to indicate that a value is dynamically typed."
852888
msgstr ""
889+
"使用 :class:`object` ,將指出在型別安全 (typesafe) 的習慣之下一個值可以為任意"
890+
"型別。使用 :data:`Any`,將指出這個值是個動態型別。"
853891

854892
#: ../../library/typing.rst:767
855893
msgid "Nominal vs structural subtyping"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.