@@ -8,7 +8,7 @@ msgstr ""
8
8
"Project-Id-Version :Python 3.12\n "
9
9
"Report-Msgid-Bugs-To :\n "
10
10
"POT-Creation-Date :2023-10-11 17:13+0000\n "
11
- "PO-Revision-Date :2024-03-22 22:11 +0800\n "
11
+ "PO-Revision-Date :2024-03-25 21:54 +0800\n "
12
12
"Last-Translator :Adrian Liaw <adrianliaw2000@gmail.com>\n "
13
13
"Language-Team :Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
14
14
"tw)\n "
@@ -97,6 +97,10 @@ msgid ""
97
97
"class:`set` interface, but keeps weak references to its elements, just like "
98
98
"a :class:`WeakKeyDictionary` does."
99
99
msgstr ""
100
+ ":class:`WeakKeyDictionary` 和 :class:`WeakValueDictionary` 在其實作中使用弱參"
101
+ "照,在弱參照上設定回呼函式,此弱參照在垃圾回收取回鍵或值時通知弱字典。:class:"
102
+ "`WeakSet` 實作了 :class:`set` 介面,但保留對其元素的弱參照,就像 :class:"
103
+ "`WeakKeyDictionary` 一樣。"
100
104
101
105
#: ../../library/weakref.rst:57
102
106
msgid ""
@@ -106,6 +110,9 @@ msgid ""
106
110
"the module automatically ensures that the finalizer remains alive until the "
107
111
"object is collected."
108
112
msgstr ""
113
+ ":class:`finalize` 提供了一種直接的方法來註冊在物件被垃圾回收時呼叫的清理函"
114
+ "式。這比在原始弱參照上設定回呼函式更容易使用,因為模組在物件被收集前會自動確"
115
+ "保終結函式 (finalizer) 保持存活。"
109
116
110
117
#: ../../library/weakref.rst:63
111
118
msgid ""
@@ -114,6 +121,9 @@ msgid ""
114
121
"your own weak references directly. The low-level machinery is exposed by "
115
122
"the :mod:`weakref` module for the benefit of advanced uses."
116
123
msgstr ""
124
+ "大多數程式應該發現使用這些弱容器種類之一或 :class:`finalize` 就足夠了—通常不"
125
+ "需要直接建立自己的弱參照。低層級的機制由 :mod:`weakref` 模組公開,以利於進階"
126
+ "用途。"
117
127
118
128
#: ../../library/weakref.rst:68
119
129
msgid ""
@@ -123,28 +133,38 @@ msgid ""
123
133
"object>`, :term:`generators <generator>`, type objects, sockets, arrays, "
124
134
"deques, regular expression pattern objects, and code objects."
125
135
msgstr ""
136
+ "並非所有物件都可以被弱參照。支援弱參照的物件包括類別實例、用 Python (但不是"
137
+ "C)編寫的函式、實例方法、集合、凍結集合 (frozenset)、一些\\ :term:`檔案物件 "
138
+ "<file object>`、:term:`產生器 <generator>`、類型物件、插座 (socket)、陣列、雙"
139
+ "向佇列、正規表示式模式物件和程式碼物件。"
126
140
127
141
#: ../../library/weakref.rst:74
128
142
msgid "Added support for thread.lock, threading.Lock, and code objects."
129
- msgstr ""
143
+ msgstr "新增了對 thread.lock、threading.Lock 和程式碼物件的支援。 "
130
144
131
145
#: ../../library/weakref.rst:77
132
146
msgid ""
133
147
"Several built-in types such as :class:`list` and :class:`dict` do not "
134
148
"directly support weak references but can add support through subclassing::"
135
149
msgstr ""
150
+ "一些內建型別,例如 :class:`list` 和 :class:`dict` 不直接支援弱參照,但可以透"
151
+ "過子類別化來支援: ::"
136
152
137
153
#: ../../library/weakref.rst:87
138
154
msgid ""
139
155
"Other built-in types such as :class:`tuple` and :class:`int` do not support "
140
156
"weak references even when subclassed."
141
157
msgstr ""
158
+ "其他內建型別,例如 :class:`tuple` 和 :class:`int` 即使在子類別化時也不支援弱"
159
+ "參照。"
142
160
143
161
#: ../../library/weakref.rst:90
144
162
msgid ""
145
163
"Extension types can easily be made to support weak references; see :ref:"
146
164
"`weakref-support`."
147
165
msgstr ""
166
+ "擴充型別 (extension type) 可以輕易地支援弱參照;請參閱 :ref:`weakref-"
167
+ "support`。"
148
168
149
169
#: ../../library/weakref.rst:93
150
170
msgid ""
@@ -153,6 +173,9 @@ msgid ""
153
173
"of strings in the ``__slots__`` declaration. See :ref:`__slots__ "
154
174
"documentation <slots>` for details."
155
175
msgstr ""
176
+ "當為給定的型別定義 ``__slots__`` 時,弱參照支援將被停用,除非 "
177
+ "``'__weakref__'`` 字串也存在於 ``__slots__`` 宣告的字串序列中。詳情請參閱 :"
178
+ "ref:`__slots__ 文件<slots>`。"
156
179
157
180
#: ../../library/weakref.rst:100
158
181
msgid ""
@@ -165,20 +188,29 @@ msgid ""
165
188
"passed as the only parameter to the callback; the referent will no longer be "
166
189
"available."
167
190
msgstr ""
191
+ "傳回對 *object* 的弱參照。如果參照目標仍存活,則可以透過呼叫參照物件來取回原"
192
+ "始物件;如果參照目標已不存活,呼叫參照物件將導致 :const:`None` 被回傳。如果 "
193
+ "*callback* 被提供而非 :const:`None`,且回傳的弱參照物件仍存活,那麼當物件即將"
194
+ "被終結 (finalize) 時,回呼將被呼叫;弱參照物件將作為唯一的參數傳遞給回呼;參"
195
+ "照物件將不再可用。"
168
196
169
197
#: ../../library/weakref.rst:108
170
198
msgid ""
171
199
"It is allowable for many weak references to be constructed for the same "
172
200
"object. Callbacks registered for each weak reference will be called from the "
173
201
"most recently registered callback to the oldest registered callback."
174
202
msgstr ""
203
+ "為同一個物件建構多個弱參照是可行的。為每個弱參照註冊的回呼將按照最新到最舊註"
204
+ "冊的回呼順序來被呼叫。"
175
205
176
206
#: ../../library/weakref.rst:112
177
207
msgid ""
178
208
"Exceptions raised by the callback will be noted on the standard error "
179
209
"output, but cannot be propagated; they are handled in exactly the same way "
180
210
"as exceptions raised from an object's :meth:`~object.__del__` method."
181
211
msgstr ""
212
+ "回呼引發的例外將在標準錯誤輸出中被註明,但無法被傳播;它們的處理方式與物件"
213
+ "的 :meth:`~object.__del__` 方法引發的例外完全相同。"
182
214
183
215
#: ../../library/weakref.rst:116
184
216
msgid ""
@@ -187,6 +219,9 @@ msgid ""
187
219
"`hash` is called the first time only after the *object* was deleted, the "
188
220
"call will raise :exc:`TypeError`."
189
221
msgstr ""
222
+ "如果 *object* 是可雜湊的,那麼弱參照就是 :term:`hashable`。即使在 *object* 被"
223
+ "刪除後,它們仍將保留其雜湊值。如果僅在 *object* 刪除後 :func:`hash` 才第一次"
224
+ "被呼叫,則該呼叫將引發 :exc:`TypeError`。"
190
225
191
226
#: ../../library/weakref.rst:121
192
227
msgid ""
@@ -196,17 +231,22 @@ msgid ""
196
231
"referent has been deleted, the references are equal only if the reference "
197
232
"objects are the same object."
198
233
msgstr ""
234
+ "弱參照支援相等性的測試,但不支援排序。如果參照目標仍存活,則兩個參照與其參照"
235
+ "目標具有相同的相等關係(無論 *callback* 如何)。如果任一參照目標已被刪除,則"
236
+ "僅當參照物件是同一物件時,參照才相等。"
199
237
200
238
#: ../../library/weakref.rst:126
201
239
msgid "This is a subclassable type rather than a factory function."
202
- msgstr ""
240
+ msgstr "這是一個可子類別化的型別,而不是一個工廠函式。 "
203
241
204
242
#: ../../library/weakref.rst:130
205
243
msgid ""
206
244
"This read-only attribute returns the callback currently associated to the "
207
245
"weakref. If there is no callback or if the referent of the weakref is no "
208
246
"longer alive then this attribute will have value ``None``."
209
247
msgstr ""
248
+ "此唯讀屬性回傳目前與弱參照關聯的回呼。如果沒有回呼或弱參照的參照目標已不存"
249
+ "活,那麼該屬性的值為 ``None``。"
210
250
211
251
#: ../../library/weakref.rst:134
212
252
msgid "Added the :attr:`__callback__` attribute."