@@ -8,7 +8,7 @@ msgstr ""
88"Project-Id-Version :Python 3.12\n "
99"Report-Msgid-Bugs-To :\n "
1010"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 "
1212"Last-Translator :Adrian Liaw <adrianliaw2000@gmail.com>\n "
1313"Language-Team :Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
1414"tw)\n "
@@ -97,6 +97,10 @@ msgid ""
9797"class:`set` interface, but keeps weak references to its elements, just like "
9898"a :class:`WeakKeyDictionary` does."
9999msgstr ""
100+ ":class:`WeakKeyDictionary` 和 :class:`WeakValueDictionary` 在其實作中使用弱參"
101+ "照,在弱參照上設定回呼函式,此弱參照在垃圾回收取回鍵或值時通知弱字典。:class:"
102+ "`WeakSet` 實作了 :class:`set` 介面,但保留對其元素的弱參照,就像 :class:"
103+ "`WeakKeyDictionary` 一樣。"
100104
101105#: ../../library/weakref.rst:57
102106msgid ""
@@ -106,6 +110,9 @@ msgid ""
106110"the module automatically ensures that the finalizer remains alive until the "
107111"object is collected."
108112msgstr ""
113+ ":class:`finalize` 提供了一種直接的方法來註冊在物件被垃圾回收時呼叫的清理函"
114+ "式。這比在原始弱參照上設定回呼函式更容易使用,因為模組在物件被收集前會自動確"
115+ "保終結函式 (finalizer) 保持存活。"
109116
110117#: ../../library/weakref.rst:63
111118msgid ""
@@ -114,6 +121,9 @@ msgid ""
114121"your own weak references directly. The low-level machinery is exposed by "
115122"the :mod:`weakref` module for the benefit of advanced uses."
116123msgstr ""
124+ "大多數程式應該發現使用這些弱容器種類之一或 :class:`finalize` 就足夠了—通常不"
125+ "需要直接建立自己的弱參照。低層級的機制由 :mod:`weakref` 模組公開,以利於進階"
126+ "用途。"
117127
118128#: ../../library/weakref.rst:68
119129msgid ""
@@ -123,28 +133,38 @@ msgid ""
123133"object>`, :term:`generators <generator>`, type objects, sockets, arrays, "
124134"deques, regular expression pattern objects, and code objects."
125135msgstr ""
136+ "並非所有物件都可以被弱參照。支援弱參照的物件包括類別實例、用 Python (但不是"
137+ "C)編寫的函式、實例方法、集合、凍結集合 (frozenset)、一些\\ :term:`檔案物件 "
138+ "<file object>`、:term:`產生器 <generator>`、類型物件、插座 (socket)、陣列、雙"
139+ "向佇列、正規表示式模式物件和程式碼物件。"
126140
127141#: ../../library/weakref.rst:74
128142msgid "Added support for thread.lock, threading.Lock, and code objects."
129- msgstr ""
143+ msgstr "新增了對 thread.lock、threading.Lock 和程式碼物件的支援。 "
130144
131145#: ../../library/weakref.rst:77
132146msgid ""
133147"Several built-in types such as :class:`list` and :class:`dict` do not "
134148"directly support weak references but can add support through subclassing::"
135149msgstr ""
150+ "一些內建型別,例如 :class:`list` 和 :class:`dict` 不直接支援弱參照,但可以透"
151+ "過子類別化來支援: ::"
136152
137153#: ../../library/weakref.rst:87
138154msgid ""
139155"Other built-in types such as :class:`tuple` and :class:`int` do not support "
140156"weak references even when subclassed."
141157msgstr ""
158+ "其他內建型別,例如 :class:`tuple` 和 :class:`int` 即使在子類別化時也不支援弱"
159+ "參照。"
142160
143161#: ../../library/weakref.rst:90
144162msgid ""
145163"Extension types can easily be made to support weak references; see :ref:"
146164"`weakref-support`."
147165msgstr ""
166+ "擴充型別 (extension type) 可以輕易地支援弱參照;請參閱 :ref:`weakref-"
167+ "support`。"
148168
149169#: ../../library/weakref.rst:93
150170msgid ""
@@ -153,6 +173,9 @@ msgid ""
153173"of strings in the ``__slots__`` declaration. See :ref:`__slots__ "
154174"documentation <slots>` for details."
155175msgstr ""
176+ "當為給定的型別定義 ``__slots__`` 時,弱參照支援將被停用,除非 "
177+ "``'__weakref__'`` 字串也存在於 ``__slots__`` 宣告的字串序列中。詳情請參閱 :"
178+ "ref:`__slots__ 文件<slots>`。"
156179
157180#: ../../library/weakref.rst:100
158181msgid ""
@@ -165,20 +188,29 @@ msgid ""
165188"passed as the only parameter to the callback; the referent will no longer be "
166189"available."
167190msgstr ""
191+ "傳回對 *object* 的弱參照。如果參照目標仍存活,則可以透過呼叫參照物件來取回原"
192+ "始物件;如果參照目標已不存活,呼叫參照物件將導致 :const:`None` 被回傳。如果 "
193+ "*callback* 被提供而非 :const:`None`,且回傳的弱參照物件仍存活,那麼當物件即將"
194+ "被終結 (finalize) 時,回呼將被呼叫;弱參照物件將作為唯一的參數傳遞給回呼;參"
195+ "照物件將不再可用。"
168196
169197#: ../../library/weakref.rst:108
170198msgid ""
171199"It is allowable for many weak references to be constructed for the same "
172200"object. Callbacks registered for each weak reference will be called from the "
173201"most recently registered callback to the oldest registered callback."
174202msgstr ""
203+ "為同一個物件建構多個弱參照是可行的。為每個弱參照註冊的回呼將按照最新到最舊註"
204+ "冊的回呼順序來被呼叫。"
175205
176206#: ../../library/weakref.rst:112
177207msgid ""
178208"Exceptions raised by the callback will be noted on the standard error "
179209"output, but cannot be propagated; they are handled in exactly the same way "
180210"as exceptions raised from an object's :meth:`~object.__del__` method."
181211msgstr ""
212+ "回呼引發的例外將在標準錯誤輸出中被註明,但無法被傳播;它們的處理方式與物件"
213+ "的 :meth:`~object.__del__` 方法引發的例外完全相同。"
182214
183215#: ../../library/weakref.rst:116
184216msgid ""
@@ -187,6 +219,9 @@ msgid ""
187219"`hash` is called the first time only after the *object* was deleted, the "
188220"call will raise :exc:`TypeError`."
189221msgstr ""
222+ "如果 *object* 是可雜湊的,那麼弱參照就是 :term:`hashable`。即使在 *object* 被"
223+ "刪除後,它們仍將保留其雜湊值。如果僅在 *object* 刪除後 :func:`hash` 才第一次"
224+ "被呼叫,則該呼叫將引發 :exc:`TypeError`。"
190225
191226#: ../../library/weakref.rst:121
192227msgid ""
@@ -196,17 +231,22 @@ msgid ""
196231"referent has been deleted, the references are equal only if the reference "
197232"objects are the same object."
198233msgstr ""
234+ "弱參照支援相等性的測試,但不支援排序。如果參照目標仍存活,則兩個參照與其參照"
235+ "目標具有相同的相等關係(無論 *callback* 如何)。如果任一參照目標已被刪除,則"
236+ "僅當參照物件是同一物件時,參照才相等。"
199237
200238#: ../../library/weakref.rst:126
201239msgid "This is a subclassable type rather than a factory function."
202- msgstr ""
240+ msgstr "這是一個可子類別化的型別,而不是一個工廠函式。 "
203241
204242#: ../../library/weakref.rst:130
205243msgid ""
206244"This read-only attribute returns the callback currently associated to the "
207245"weakref. If there is no callback or if the referent of the weakref is no "
208246"longer alive then this attribute will have value ``None``."
209247msgstr ""
248+ "此唯讀屬性回傳目前與弱參照關聯的回呼。如果沒有回呼或弱參照的參照目標已不存"
249+ "活,那麼該屬性的值為 ``None``。"
210250
211251#: ../../library/weakref.rst:134
212252msgid "Added the :attr:`__callback__` attribute."