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