4
4
msgstr ""
5
5
"Project-Id-Version : Python 3.12\n "
6
6
"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 "
8
8
"PO-Revision-Date : 2023-02-11 15:02+0800\n "
9
9
"Last-Translator : \n "
10
10
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -951,16 +951,17 @@ msgstr ""
951
951
msgid ""
952
952
"There is a tiny performance penalty when using ``frozen=True``: :meth:"
953
953
"`~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"
955
956
msgstr ""
956
957
"使用 ``frozen=True`` 時有一個微小的性能損失::meth:`~object.__init__` 不能使"
957
958
"用簡單賦值來初始化欄位,必須使用 :meth:`!__setattr__`。"
958
959
959
- #: ../../library/dataclasses.rst:621
960
+ #: ../../library/dataclasses.rst:622
960
961
msgid "Inheritance"
961
962
msgstr "繼承"
962
963
963
- #: ../../library/dataclasses.rst:623
964
+ #: ../../library/dataclasses.rst:624
964
965
#, fuzzy
965
966
msgid ""
966
967
"When the dataclass is being created by the :func:`@dataclass <dataclass>` "
@@ -978,7 +979,7 @@ msgstr ""
978
979
"將自己的欄位新增到有序映射中。所有生成的方法都將使用這種組合的、計算的有序欄"
979
980
"位映射。因為欄位是按插入順序排列的,所以派生類會覆蓋基底類別。一個例子: ::"
980
981
981
- #: ../../library/dataclasses.rst:643
982
+ #: ../../library/dataclasses.rst:644
982
983
#, fuzzy
983
984
msgid ""
984
985
"The final list of fields is, in order, :attr:`!x`, :attr:`!y`, :attr:`!z`. "
@@ -988,19 +989,19 @@ msgstr ""
988
989
"最終的欄位列表按順序為 :attr:`!x`、:attr:`!y`、:attr:`!z`。:attr:`!x` 的最終"
989
990
"型別是 :class:`int`,如類別 :class:`!C` 中指定的那樣。"
990
991
991
- #: ../../library/dataclasses.rst:646
992
+ #: ../../library/dataclasses.rst:647
992
993
#, fuzzy
993
994
msgid ""
994
995
"The generated :meth:`~object.__init__` method for :class:`!C` will look "
995
996
"like::"
996
997
msgstr "為 ``C`` 生成的 :meth:`~object.__init__` 方法將如下所示:"
997
998
998
- #: ../../library/dataclasses.rst:651
999
+ #: ../../library/dataclasses.rst:652
999
1000
#, fuzzy
1000
1001
msgid "Re-ordering of keyword-only parameters in :meth:`!__init__`"
1001
1002
msgstr ":meth:`__init__` 中僅關鍵字參數的重新排序"
1002
1003
1003
- #: ../../library/dataclasses.rst:653
1004
+ #: ../../library/dataclasses.rst:654
1004
1005
#, fuzzy
1005
1006
msgid ""
1006
1007
"After the parameters needed for :meth:`~object.__init__` are computed, any "
@@ -1012,7 +1013,7 @@ msgstr ""
1012
1013
"僅關鍵字)參數之後。這是如何在 Python 中實作僅關鍵字參數的要求:它們必須位於"
1013
1014
"非僅關鍵字參數之後。"
1014
1015
1015
- #: ../../library/dataclasses.rst:659
1016
+ #: ../../library/dataclasses.rst:660
1016
1017
#, fuzzy
1017
1018
msgid ""
1018
1019
"In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are "
@@ -1022,12 +1023,12 @@ msgstr ""
1022
1023
"在此示例中,:attr:`!Base.y`、:attr:`!Base.w` 和 :attr:`!D.t` 是僅限關鍵字的欄"
1023
1024
"位,:attr:`!Base.x` 和 :attr:`!D.z` 是常規欄位: ::"
1024
1025
1025
- #: ../../library/dataclasses.rst:674
1026
+ #: ../../library/dataclasses.rst:675
1026
1027
#, fuzzy
1027
1028
msgid "The generated :meth:`!__init__` method for :class:`!D` will look like::"
1028
1029
msgstr "為 :class:`!D` 生成的 :meth:`!__init__` 方法將如下所示:"
1029
1030
1030
- #: ../../library/dataclasses.rst:678
1031
+ #: ../../library/dataclasses.rst:679
1031
1032
#, fuzzy
1032
1033
msgid ""
1033
1034
"Note that the parameters have been re-ordered from how they appear in the "
@@ -1037,18 +1038,18 @@ msgstr ""
1037
1038
"請注意,參數已根據它們在欄位列表中的顯示方式重新排序:從常規欄位派生的參數後"
1038
1039
"跟從僅關鍵字欄位派生的參數。"
1039
1040
1040
- #: ../../library/dataclasses.rst:682
1041
+ #: ../../library/dataclasses.rst:683
1041
1042
#, fuzzy
1042
1043
msgid ""
1043
1044
"The relative ordering of keyword-only parameters is maintained in the re-"
1044
1045
"ordered :meth:`!__init__` parameter list."
1045
1046
msgstr "僅關鍵字參數的相對順序在重新排序的 :meth:`!__init__` 參數列表中維護。"
1046
1047
1047
- #: ../../library/dataclasses.rst:687
1048
+ #: ../../library/dataclasses.rst:688
1048
1049
msgid "Default factory functions"
1049
1050
msgstr "預設工廠函式"
1050
1051
1051
- #: ../../library/dataclasses.rst:689
1052
+ #: ../../library/dataclasses.rst:690
1052
1053
#, fuzzy
1053
1054
msgid ""
1054
1055
"If a :func:`field` specifies a *default_factory*, it is called with zero "
@@ -1058,7 +1059,7 @@ msgstr ""
1058
1059
"如果 :func:`field` 指定了 *default_factory*,當需要該欄位的預設值時,它會以零"
1059
1060
"參數呼叫。例如,要建立列表的新實例,請使用:"
1060
1061
1061
- #: ../../library/dataclasses.rst:695
1062
+ #: ../../library/dataclasses.rst:696
1062
1063
#, fuzzy
1063
1064
msgid ""
1064
1065
"If a field is excluded from :meth:`~object.__init__` (using ``init=False``) "
@@ -1071,19 +1072,19 @@ msgstr ""
1071
1072
"位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成的 :meth:"
1072
1073
"`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦予初始值。"
1073
1074
1074
- #: ../../library/dataclasses.rst:702
1075
+ #: ../../library/dataclasses.rst:703
1075
1076
msgid "Mutable default values"
1076
1077
msgstr "可變預設值"
1077
1078
1078
- #: ../../library/dataclasses.rst:704
1079
+ #: ../../library/dataclasses.rst:705
1079
1080
#, fuzzy
1080
1081
msgid ""
1081
1082
"Python stores default member variable values in class attributes. Consider "
1082
1083
"this example, not using dataclasses::"
1083
1084
msgstr ""
1084
1085
"Python 將預設成員變數值存儲在類別屬性中。考慮這個例子,不使用資料類別::"
1085
1086
1086
- #: ../../library/dataclasses.rst:719
1087
+ #: ../../library/dataclasses.rst:720
1087
1088
#, fuzzy
1088
1089
msgid ""
1089
1090
"Note that the two instances of class :class:`!C` share the same class "
@@ -1092,16 +1093,16 @@ msgstr ""
1092
1093
"請注意,類別 :class:`!C` 的兩個實例共享同一個類別變數 :attr:`!x`,正如預期的"
1093
1094
"那樣。"
1094
1095
1095
- #: ../../library/dataclasses.rst:722
1096
+ #: ../../library/dataclasses.rst:723
1096
1097
#, fuzzy
1097
1098
msgid "Using dataclasses, *if* this code was valid::"
1098
1099
msgstr "使用資料類別,*如果*此程式碼有效: ::"
1099
1100
1100
- #: ../../library/dataclasses.rst:730
1101
+ #: ../../library/dataclasses.rst:731
1101
1102
msgid "it would generate code similar to::"
1102
1103
msgstr "它會生成類似的程式碼: ::"
1103
1104
1104
- #: ../../library/dataclasses.rst:741
1105
+ #: ../../library/dataclasses.rst:742
1105
1106
#, fuzzy
1106
1107
msgid ""
1107
1108
"This has the same issue as the original example using class :class:`!C`. "
@@ -1121,14 +1122,14 @@ msgstr ""
1121
1122
"到不可散列的預設參數,它將引發 :exc:`TypeError`。假設是如果一個值是不可散列"
1122
1123
"的,那麼它就是可變的。這是一個部分解決方案,但它確實可以防止許多常見錯誤。"
1123
1124
1124
- #: ../../library/dataclasses.rst:752
1125
+ #: ../../library/dataclasses.rst:753
1125
1126
#, fuzzy
1126
1127
msgid ""
1127
1128
"Using default factory functions is a way to create new instances of mutable "
1128
1129
"types as default values for fields::"
1129
1130
msgstr "使用預設工廠函式是一種建立可變型別的新實例作為欄位預設值的方法:"
1130
1131
1131
- #: ../../library/dataclasses.rst:761
1132
+ #: ../../library/dataclasses.rst:762
1132
1133
#, fuzzy
1133
1134
msgid ""
1134
1135
"Instead of looking for and disallowing objects of type :class:`list`, :class:"
@@ -1138,20 +1139,20 @@ msgstr ""
1138
1139
"不再查找和禁止型別為 :class:`list`、:class:`dict` 或 :class:`set` 的物件,現"
1139
1140
"在不允許使用不可散列的對像作為預設值。不可散列性用於近似可變性。"
1140
1141
1141
- #: ../../library/dataclasses.rst:768
1142
+ #: ../../library/dataclasses.rst:769
1142
1143
#, fuzzy
1143
1144
msgid "Descriptor-typed fields"
1144
1145
msgstr "描述器型別的欄位"
1145
1146
1146
- #: ../../library/dataclasses.rst:770
1147
+ #: ../../library/dataclasses.rst:771
1147
1148
#, fuzzy
1148
1149
msgid ""
1149
1150
"Fields that are assigned :ref:`descriptor objects <descriptors>` as their "
1150
1151
"default value have the following special behaviors:"
1151
1152
msgstr ""
1152
1153
"指定為\\ :ref:`描述器物件 <descriptors>`\\ 作為預設值的欄位具有以下特殊行為:"
1153
1154
1154
- #: ../../library/dataclasses.rst:773
1155
+ #: ../../library/dataclasses.rst:774
1155
1156
#, fuzzy
1156
1157
msgid ""
1157
1158
"The value for the field passed to the dataclass's :meth:`~object.__init__` "
@@ -1161,7 +1162,7 @@ msgstr ""
1161
1162
"傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器的 :meth:"
1162
1163
"`~object.__set__` 方法,而不是覆蓋描述器物件。"
1163
1164
1164
- #: ../../library/dataclasses.rst:777
1165
+ #: ../../library/dataclasses.rst:778
1165
1166
#, fuzzy
1166
1167
msgid ""
1167
1168
"Similarly, when getting or setting the field, the descriptor's :meth:"
@@ -1171,7 +1172,7 @@ msgstr ""
1171
1172
"同樣,在獲取或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!"
1172
1173
"__set__` 方法,而不是回傳或覆蓋描述器物件。"
1173
1174
1174
- #: ../../library/dataclasses.rst:781
1175
+ #: ../../library/dataclasses.rst:782
1175
1176
#, fuzzy
1176
1177
msgid ""
1177
1178
"To determine whether a field contains a default value, :func:`@dataclass "
@@ -1187,7 +1188,7 @@ msgstr ""
1187
1188
"面,如果描述器在這種情況下引發 :exc:`AttributeError`,則不會為該欄位提供預設"
1188
1189
"值。"
1189
1190
1190
- #: ../../library/dataclasses.rst:816
1191
+ #: ../../library/dataclasses.rst:817
1191
1192
#, fuzzy
1192
1193
msgid ""
1193
1194
"Note that if a field is annotated with a descriptor type, but is not "
0 commit comments