Skip to content

Commit 080d0aa

Browse files
committed
docs(library/pickle.po): editing, up to line 1288
1 parent 148a754 commit 080d0aa

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

library/pickle.po

+30-1
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,9 @@ msgid ""
11841184
"unified interface for retrieving the data necessary for pickling and copying "
11851185
"objects. [#]_"
11861186
msgstr ""
1187+
"如稍後所演示,pickle 並不直接使用上述方法。這些方法實際上是實作了 :meth:"
1188+
"`~object.__reduce__` 特殊方法的拷貝協定(copy protocol)。拷貝協定提供了統一"
1189+
"的介面,以檢索進行封裝及複製物件時所需的資料。 [#]_"
11871190

11881191
#: ../../library/pickle.rst:672
11891192
msgid ""
@@ -1194,13 +1197,20 @@ msgid ""
11941197
"We will show, however, cases where using :meth:`!__reduce__` is the only "
11951198
"option or leads to more efficient pickling or both."
11961199
msgstr ""
1200+
"直接在類別中實作 :meth:`~object.__reduce__` 雖然功能強大但卻容易導致出錯。因"
1201+
"此,設計類別者應盡可能使用高階介面(例如,:meth:`~object."
1202+
"__getnewargs_ex__`、:meth:`~object.__getstate__` 和 :meth:`~object."
1203+
"__setstate__`)。不過,我們也將展示一些特例狀況,在這些狀況中,使用 :meth:`!"
1204+
"__reduce__` 可能是唯一的選擇、是更有效率的封裝方法或二者兼備。"
11971205

11981206
#: ../../library/pickle.rst:681
11991207
msgid ""
12001208
"The interface is currently defined as follows. The :meth:`__reduce__` "
12011209
"method takes no argument and shall return either a string or preferably a "
12021210
"tuple (the returned object is often referred to as the \"reduce value\")."
12031211
msgstr ""
1212+
"目前的介面定義如下。 :meth:`__reduce__` 方法不接受引數,且應回傳一個字串或一"
1213+
"個元組(元組一般而言是較佳的選擇;所回傳的物件通常稱為「縮減值」)。"
12041214

12051215
#: ../../library/pickle.rst:685
12061216
msgid ""
@@ -1209,25 +1219,32 @@ msgid ""
12091219
"module; the pickle module searches the module namespace to determine the "
12101220
"object's module. This behaviour is typically useful for singletons."
12111221
msgstr ""
1222+
"如果回傳的是字串,該字串應被解讀為一個全域變數的名稱。它應是該物件相對其所在"
1223+
"模組的本地名稱;pickle 模組會在模組命名空間中尋找,以確定該物件所在的模組。這"
1224+
"種行為通常對於單例物件特別有用。"
12121225

12131226
#: ../../library/pickle.rst:690
12141227
msgid ""
12151228
"When a tuple is returned, it must be between two and six items long. "
12161229
"Optional items can either be omitted, or ``None`` can be provided as their "
12171230
"value. The semantics of each item are in order:"
12181231
msgstr ""
1232+
"當返回一個元組時,其長度必須介於兩至六項元素之間。可選項可以被省略,或者其值"
1233+
"可以被設為 ``None``。各項物件的語意依序為:"
12191234

12201235
#: ../../library/pickle.rst:696
12211236
msgid ""
12221237
"A callable object that will be called to create the initial version of the "
12231238
"object."
1224-
msgstr ""
1239+
msgstr "一個將會被呼叫來創建初始版本物件的可呼叫物件。"
12251240

12261241
#: ../../library/pickle.rst:699
12271242
msgid ""
12281243
"A tuple of arguments for the callable object. An empty tuple must be given "
12291244
"if the callable does not accept any argument."
12301245
msgstr ""
1246+
"一個用於傳遞引數給前述物件的元組。如果前述物件不接受引數輸入,則你仍應在這裡"
1247+
"給定一個空元組。"
12311248

12321249
#: ../../library/pickle.rst:702
12331250
msgid ""
@@ -1236,6 +1253,9 @@ msgid ""
12361253
"method then, the value must be a dictionary and it will be added to the "
12371254
"object's :attr:`~object.__dict__` attribute."
12381255
msgstr ""
1256+
"可選項。物件狀態。如前所述,會被傳遞給該物件的 :meth:`__setstate__` 方法。如"
1257+
"果該物件沒有實作此方法,則本值必須是一個字典,且其將會被新增到物件的 :attr:"
1258+
"`~object.__dict__` 屬性中。"
12391259

12401260
#: ../../library/pickle.rst:707
12411261
msgid ""
@@ -1248,6 +1268,12 @@ msgid ""
12481268
"which pickle protocol version is used as well as the number of items to "
12491269
"append, so both must be supported.)"
12501270
msgstr ""
1271+
"可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 ``obj."
1272+
"append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被附加到"
1273+
"物件中。主要用於串列(list)子類別,但只要其他類別具有相應的 :ref:`append 和 "
1274+
"extend 方法 <typesseq-common>`就也可以使用。 (如何選擇使用 :meth:`!append` "
1275+
"或 :meth:`!extend` 方法將取決於所選用的 pickle 協定版本以及要附加的項目數量,"
1276+
"因此必須同時支援這兩種方法。)"
12511277

12521278
#: ../../library/pickle.rst:717
12531279
msgid ""
@@ -1256,6 +1282,9 @@ msgid ""
12561282
"value``. This is primarily used for dictionary subclasses, but may be used "
12571283
"by other classes as long as they implement :meth:`__setitem__`."
12581284
msgstr ""
1285+
"可選項。一個產生連續鍵值對的疊代器(不是序列)。這些項目將以 ``obj[key] = "
1286+
"value`` 方式被儲存到物件中。主要用於字典(dictionary)子類別,但只要有實現"
1287+
"了 :meth:`__setitem__` 的其他類別也可以使用。"
12591288

12601289
#: ../../library/pickle.rst:722
12611290
msgid ""

0 commit comments

Comments
 (0)