Skip to content

Commit 97784a8

Browse files
github-actions[bot]mattwang44
authored andcommitted
sync with cpython a3db4e8f
1 parent 411aeb6 commit 97784a8

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

library/dataclasses.po

Lines changed: 30 additions & 29 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-09 00:03+0000\n"
7+
"POT-Creation-Date: 2024-05-17 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,16 +951,17 @@ 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:`!__setattr__`."
954+
"must use :meth:`!object.__setattr__`. .. Make sure to not remove \"object\" "
955+
"from \"object.__setattr__\" in the above markup"
955956
msgstr ""
956957
"使用 ``frozen=True`` 時有一個微小的性能損失::meth:`~object.__init__` 不能使"
957958
"用簡單賦值來初始化欄位,必須使用 :meth:`!__setattr__`。"
958959

959-
#: ../../library/dataclasses.rst:621
960+
#: ../../library/dataclasses.rst:622
960961
msgid "Inheritance"
961962
msgstr "繼承"
962963

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

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

991-
#: ../../library/dataclasses.rst:646
992+
#: ../../library/dataclasses.rst:647
992993
#, fuzzy
993994
msgid ""
994995
"The generated :meth:`~object.__init__` method for :class:`!C` will look "
995996
"like::"
996997
msgstr "為 ``C`` 生成的 :meth:`~object.__init__` 方法將如下所示:"
997998

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

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

1015-
#: ../../library/dataclasses.rst:659
1016+
#: ../../library/dataclasses.rst:660
10161017
#, fuzzy
10171018
msgid ""
10181019
"In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are "
@@ -1022,12 +1023,12 @@ msgstr ""
10221023
"在此示例中,:attr:`!Base.y`、:attr:`!Base.w` 和 :attr:`!D.t` 是僅限關鍵字的欄"
10231024
"位,:attr:`!Base.x` 和 :attr:`!D.z` 是常規欄位: ::"
10241025

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

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

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

1047-
#: ../../library/dataclasses.rst:687
1048+
#: ../../library/dataclasses.rst:688
10481049
msgid "Default factory functions"
10491050
msgstr "預設工廠函式"
10501051

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

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

1074-
#: ../../library/dataclasses.rst:702
1075+
#: ../../library/dataclasses.rst:703
10751076
msgid "Mutable default values"
10761077
msgstr "可變預設值"
10771078

1078-
#: ../../library/dataclasses.rst:704
1079+
#: ../../library/dataclasses.rst:705
10791080
#, fuzzy
10801081
msgid ""
10811082
"Python stores default member variable values in class attributes. Consider "
10821083
"this example, not using dataclasses::"
10831084
msgstr ""
10841085
"Python 將預設成員變數值存儲在類別屬性中。考慮這個例子,不使用資料類別::"
10851086

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

1095-
#: ../../library/dataclasses.rst:722
1096+
#: ../../library/dataclasses.rst:723
10961097
#, fuzzy
10971098
msgid "Using dataclasses, *if* this code was valid::"
10981099
msgstr "使用資料類別,*如果*此程式碼有效: ::"
10991100

1100-
#: ../../library/dataclasses.rst:730
1101+
#: ../../library/dataclasses.rst:731
11011102
msgid "it would generate code similar to::"
11021103
msgstr "它會生成類似的程式碼: ::"
11031104

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

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

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

1141-
#: ../../library/dataclasses.rst:768
1142+
#: ../../library/dataclasses.rst:769
11421143
#, fuzzy
11431144
msgid "Descriptor-typed fields"
11441145
msgstr "描述器型別的欄位"
11451146

1146-
#: ../../library/dataclasses.rst:770
1147+
#: ../../library/dataclasses.rst:771
11471148
#, fuzzy
11481149
msgid ""
11491150
"Fields that are assigned :ref:`descriptor objects <descriptors>` as their "
11501151
"default value have the following special behaviors:"
11511152
msgstr ""
11521153
"指定為\\ :ref:`描述器物件 <descriptors>`\\ 作為預設值的欄位具有以下特殊行為:"
11531154

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

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

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

1190-
#: ../../library/dataclasses.rst:816
1191+
#: ../../library/dataclasses.rst:817
11911192
#, fuzzy
11921193
msgid ""
11931194
"Note that if a field is annotated with a descriptor type, but is not "

0 commit comments

Comments
 (0)