Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3b0ddc7

Browse files
github-actions[bot]mattwang44
authored andcommitted
sync with cpython d8981abb
1 parent bfbbc31 commit 3b0ddc7

File tree

3 files changed

+409
-396
lines changed

3 files changed

+409
-396
lines changed

library/dataclasses.po

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ msgid ""
44
msgstr ""
55
"Project-Id-Version: Python 3.12\n"
66
"Report-Msgid-Bugs-To: \n"
7-
"POT-Creation-Date: 2024-05-17 00:03+0000\n"
7+
"POT-Creation-Date: 2024-05-21 00:03+0000\n"
88
"PO-Revision-Date: 2023-02-11 15:02+0800\n"
99
"Last-Translator: \n"
1010
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -951,17 +951,16 @@ msgstr ""
951951
msgid ""
952952
"There is a tiny performance penalty when using ``frozen=True``: :meth:"
953953
"`~object.__init__` cannot use simple assignment to initialize fields, and "
954-
"must use :meth:`!object.__setattr__`. .. Make sure to not remove \"object\" "
955-
"from \"object.__setattr__\" in the above markup"
954+
"must use :meth:`!object.__setattr__`."
956955
msgstr ""
957956
"使用 ``frozen=True`` 時有一個微小的性能損失::meth:`~object.__init__` 不能使"
958957
"用簡單賦值來初始化欄位,必須使用 :meth:`!__setattr__`。"
959958

960-
#: ../../library/dataclasses.rst:622
959+
#: ../../library/dataclasses.rst:623
961960
msgid "Inheritance"
962961
msgstr "繼承"
963962

964-
#: ../../library/dataclasses.rst:624
963+
#: ../../library/dataclasses.rst:625
965964
#, fuzzy
966965
msgid ""
967966
"When the dataclass is being created by the :func:`@dataclass <dataclass>` "
@@ -979,7 +978,7 @@ msgstr ""
979978
"將自己的欄位新增到有序映射中。所有生成的方法都將使用這種組合的、計算的有序欄"
980979
"位映射。因為欄位是按插入順序排列的,所以派生類會覆蓋基底類別。一個例子: ::"
981980

982-
#: ../../library/dataclasses.rst:644
981+
#: ../../library/dataclasses.rst:645
983982
#, fuzzy
984983
msgid ""
985984
"The final list of fields is, in order, :attr:`!x`, :attr:`!y`, :attr:`!z`. "
@@ -989,19 +988,19 @@ msgstr ""
989988
"最終的欄位列表按順序為 :attr:`!x`、:attr:`!y`、:attr:`!z`。:attr:`!x` 的最終"
990989
"型別是 :class:`int`,如類別 :class:`!C` 中指定的那樣。"
991990

992-
#: ../../library/dataclasses.rst:647
991+
#: ../../library/dataclasses.rst:648
993992
#, fuzzy
994993
msgid ""
995994
"The generated :meth:`~object.__init__` method for :class:`!C` will look "
996995
"like::"
997996
msgstr "為 ``C`` 生成的 :meth:`~object.__init__` 方法將如下所示:"
998997

999-
#: ../../library/dataclasses.rst:652
998+
#: ../../library/dataclasses.rst:653
1000999
#, fuzzy
10011000
msgid "Re-ordering of keyword-only parameters in :meth:`!__init__`"
10021001
msgstr ":meth:`__init__` 中僅關鍵字參數的重新排序"
10031002

1004-
#: ../../library/dataclasses.rst:654
1003+
#: ../../library/dataclasses.rst:655
10051004
#, fuzzy
10061005
msgid ""
10071006
"After the parameters needed for :meth:`~object.__init__` are computed, any "
@@ -1013,7 +1012,7 @@ msgstr ""
10131012
"僅關鍵字)參數之後。這是如何在 Python 中實作僅關鍵字參數的要求:它們必須位於"
10141013
"非僅關鍵字參數之後。"
10151014

1016-
#: ../../library/dataclasses.rst:660
1015+
#: ../../library/dataclasses.rst:661
10171016
#, fuzzy
10181017
msgid ""
10191018
"In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are "
@@ -1023,12 +1022,12 @@ msgstr ""
10231022
"在此示例中,:attr:`!Base.y`、:attr:`!Base.w` 和 :attr:`!D.t` 是僅限關鍵字的欄"
10241023
"位,:attr:`!Base.x` 和 :attr:`!D.z` 是常規欄位: ::"
10251024

1026-
#: ../../library/dataclasses.rst:675
1025+
#: ../../library/dataclasses.rst:676
10271026
#, fuzzy
10281027
msgid "The generated :meth:`!__init__` method for :class:`!D` will look like::"
10291028
msgstr "為 :class:`!D` 生成的 :meth:`!__init__` 方法將如下所示:"
10301029

1031-
#: ../../library/dataclasses.rst:679
1030+
#: ../../library/dataclasses.rst:680
10321031
#, fuzzy
10331032
msgid ""
10341033
"Note that the parameters have been re-ordered from how they appear in the "
@@ -1038,18 +1037,18 @@ msgstr ""
10381037
"請注意,參數已根據它們在欄位列表中的顯示方式重新排序:從常規欄位派生的參數後"
10391038
"跟從僅關鍵字欄位派生的參數。"
10401039

1041-
#: ../../library/dataclasses.rst:683
1040+
#: ../../library/dataclasses.rst:684
10421041
#, fuzzy
10431042
msgid ""
10441043
"The relative ordering of keyword-only parameters is maintained in the re-"
10451044
"ordered :meth:`!__init__` parameter list."
10461045
msgstr "僅關鍵字參數的相對順序在重新排序的 :meth:`!__init__` 參數列表中維護。"
10471046

1048-
#: ../../library/dataclasses.rst:688
1047+
#: ../../library/dataclasses.rst:689
10491048
msgid "Default factory functions"
10501049
msgstr "預設工廠函式"
10511050

1052-
#: ../../library/dataclasses.rst:690
1051+
#: ../../library/dataclasses.rst:691
10531052
#, fuzzy
10541053
msgid ""
10551054
"If a :func:`field` specifies a *default_factory*, it is called with zero "
@@ -1059,7 +1058,7 @@ msgstr ""
10591058
"如果 :func:`field` 指定了 *default_factory*,當需要該欄位的預設值時,它會以零"
10601059
"參數呼叫。例如,要建立列表的新實例,請使用:"
10611060

1062-
#: ../../library/dataclasses.rst:696
1061+
#: ../../library/dataclasses.rst:697
10631062
#, fuzzy
10641063
msgid ""
10651064
"If a field is excluded from :meth:`~object.__init__` (using ``init=False``) "
@@ -1072,19 +1071,19 @@ msgstr ""
10721071
"位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成的 :meth:"
10731072
"`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦予初始值。"
10741073

1075-
#: ../../library/dataclasses.rst:703
1074+
#: ../../library/dataclasses.rst:704
10761075
msgid "Mutable default values"
10771076
msgstr "可變預設值"
10781077

1079-
#: ../../library/dataclasses.rst:705
1078+
#: ../../library/dataclasses.rst:706
10801079
#, fuzzy
10811080
msgid ""
10821081
"Python stores default member variable values in class attributes. Consider "
10831082
"this example, not using dataclasses::"
10841083
msgstr ""
10851084
"Python 將預設成員變數值存儲在類別屬性中。考慮這個例子,不使用資料類別::"
10861085

1087-
#: ../../library/dataclasses.rst:720
1086+
#: ../../library/dataclasses.rst:721
10881087
#, fuzzy
10891088
msgid ""
10901089
"Note that the two instances of class :class:`!C` share the same class "
@@ -1093,16 +1092,16 @@ msgstr ""
10931092
"請注意,類別 :class:`!C` 的兩個實例共享同一個類別變數 :attr:`!x`,正如預期的"
10941093
"那樣。"
10951094

1096-
#: ../../library/dataclasses.rst:723
1095+
#: ../../library/dataclasses.rst:724
10971096
#, fuzzy
10981097
msgid "Using dataclasses, *if* this code was valid::"
10991098
msgstr "使用資料類別,*如果*此程式碼有效: ::"
11001099

1101-
#: ../../library/dataclasses.rst:731
1100+
#: ../../library/dataclasses.rst:732
11021101
msgid "it would generate code similar to::"
11031102
msgstr "它會生成類似的程式碼: ::"
11041103

1105-
#: ../../library/dataclasses.rst:742
1104+
#: ../../library/dataclasses.rst:743
11061105
#, fuzzy
11071106
msgid ""
11081107
"This has the same issue as the original example using class :class:`!C`. "
@@ -1122,14 +1121,14 @@ msgstr ""
11221121
"到不可散列的預設參數,它將引發 :exc:`TypeError`。假設是如果一個值是不可散列"
11231122
"的,那麼它就是可變的。這是一個部分解決方案,但它確實可以防止許多常見錯誤。"
11241123

1125-
#: ../../library/dataclasses.rst:753
1124+
#: ../../library/dataclasses.rst:754
11261125
#, fuzzy
11271126
msgid ""
11281127
"Using default factory functions is a way to create new instances of mutable "
11291128
"types as default values for fields::"
11301129
msgstr "使用預設工廠函式是一種建立可變型別的新實例作為欄位預設值的方法:"
11311130

1132-
#: ../../library/dataclasses.rst:762
1131+
#: ../../library/dataclasses.rst:763
11331132
#, fuzzy
11341133
msgid ""
11351134
"Instead of looking for and disallowing objects of type :class:`list`, :class:"
@@ -1139,20 +1138,20 @@ msgstr ""
11391138
"不再查找和禁止型別為 :class:`list`、:class:`dict` 或 :class:`set` 的物件,現"
11401139
"在不允許使用不可散列的對像作為預設值。不可散列性用於近似可變性。"
11411140

1142-
#: ../../library/dataclasses.rst:769
1141+
#: ../../library/dataclasses.rst:770
11431142
#, fuzzy
11441143
msgid "Descriptor-typed fields"
11451144
msgstr "描述器型別的欄位"
11461145

1147-
#: ../../library/dataclasses.rst:771
1146+
#: ../../library/dataclasses.rst:772
11481147
#, fuzzy
11491148
msgid ""
11501149
"Fields that are assigned :ref:`descriptor objects <descriptors>` as their "
11511150
"default value have the following special behaviors:"
11521151
msgstr ""
11531152
"指定為\\ :ref:`描述器物件 <descriptors>`\\ 作為預設值的欄位具有以下特殊行為:"
11541153

1155-
#: ../../library/dataclasses.rst:774
1154+
#: ../../library/dataclasses.rst:775
11561155
#, fuzzy
11571156
msgid ""
11581157
"The value for the field passed to the dataclass's :meth:`~object.__init__` "
@@ -1162,7 +1161,7 @@ msgstr ""
11621161
"傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器的 :meth:"
11631162
"`~object.__set__` 方法,而不是覆蓋描述器物件。"
11641163

1165-
#: ../../library/dataclasses.rst:778
1164+
#: ../../library/dataclasses.rst:779
11661165
#, fuzzy
11671166
msgid ""
11681167
"Similarly, when getting or setting the field, the descriptor's :meth:"
@@ -1172,7 +1171,7 @@ msgstr ""
11721171
"同樣,在獲取或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!"
11731172
"__set__` 方法,而不是回傳或覆蓋描述器物件。"
11741173

1175-
#: ../../library/dataclasses.rst:782
1174+
#: ../../library/dataclasses.rst:783
11761175
#, fuzzy
11771176
msgid ""
11781177
"To determine whether a field contains a default value, :func:`@dataclass "
@@ -1188,7 +1187,7 @@ msgstr ""
11881187
"面,如果描述器在這種情況下引發 :exc:`AttributeError`,則不會為該欄位提供預設"
11891188
"值。"
11901189

1191-
#: ../../library/dataclasses.rst:817
1190+
#: ../../library/dataclasses.rst:818
11921191
#, fuzzy
11931192
msgid ""
11941193
"Note that if a field is annotated with a descriptor type, but is not "

0 commit comments

Comments
 (0)