Skip to content

Commit 0f25cbf

Browse files
committed
Working on c-api/tuple.po
1 parent 6a2f51a commit 0f25cbf

File tree

1 file changed

+70
-45
lines changed

1 file changed

+70
-45
lines changed

c-api/tuple.po

Lines changed: 70 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
#
44
# Translators:
55
# Leon H., 2017
6+
#Yorkxe <karta25768@gmail.com>, 2025
67
msgid ""
78
msgstr ""
89
"Project-Id-Version: Python 3.14\n"
910
"Report-Msgid-Bugs-To: \n"
1011
"POT-Creation-Date: 2025-09-08 15:25+0800\n"
1112
"PO-Revision-Date: 2017-09-22 18:26+0000\n"
12-
"Last-Translator: Leon H.\n"
13+
"Last-Translator: Yorkxe <karta25768@gmail.com>\n"
1314
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1415
"tw)\n"
1516
"Language: zh_TW\n"
@@ -24,122 +25,133 @@ msgstr "Tuple(元組)物件"
2425

2526
#: ../../c-api/tuple.rst:13
2627
msgid "This subtype of :c:type:`PyObject` represents a Python tuple object."
27-
msgstr ""
28+
msgstr "此 :c:type:`PyObject` 子型別代表 Python 元組物件"
2829

2930
#: ../../c-api/tuple.rst:18
3031
msgid ""
3132
"This instance of :c:type:`PyTypeObject` represents the Python tuple type; it "
3233
"is the same object as :class:`tuple` in the Python layer."
33-
msgstr ""
34+
msgstr "此 :ctype:`PyTypeObject` 實例代表 Python 元組型別,與 Python layer 中的"
35+
" :class:`tuple` 是同一物件"
3436

3537
#: ../../c-api/tuple.rst:24
3638
msgid ""
3739
"Return true if *p* is a tuple object or an instance of a subtype of the "
3840
"tuple type. This function always succeeds."
39-
msgstr ""
41+
msgstr "如果 *p* 為一元組物件或是元組型別的子型別實例時回傳 true。此函式總會執行成功"
4042

4143
#: ../../c-api/tuple.rst:30
4244
msgid ""
4345
"Return true if *p* is a tuple object, but not an instance of a subtype of "
4446
"the tuple type. This function always succeeds."
45-
msgstr ""
47+
msgstr "如果 *p* 為一元組物件但不是元組型別的子型別實例時回傳 true。此函式總會執行成功"
4648

4749
#: ../../c-api/tuple.rst:36
4850
msgid ""
4951
"Return a new tuple object of size *len*, or ``NULL`` with an exception set "
5052
"on failure."
51-
msgstr ""
53+
msgstr "回傳一個長度為 *len* 的新元組物件,當例外發生時回傳 ``NULL``"
5254

5355
#: ../../c-api/tuple.rst:42
5456
msgid ""
5557
"Return a new tuple object of size *n*, or ``NULL`` with an exception set on "
5658
"failure. The tuple values are initialized to the subsequent *n* C arguments "
5759
"pointing to Python objects. ``PyTuple_Pack(2, a, b)`` is equivalent to "
5860
"``Py_BuildValue(\"(OO)\", a, b)``."
59-
msgstr ""
61+
msgstr "回傳一個長度為 *len* 的新元組物件,當例外發生時回傳 ``NULL``。元組值被初始化為"
62+
"指向 Python 物件的後續 *n* 個 C 參數。``PyTuple_Pack(2, a, b)`` 等價於"
63+
"``Py_BuildValue(\"(OO)\", a, b)``。"
6064

6165
#: ../../c-api/tuple.rst:50
6266
msgid ""
6367
"Take a pointer to a tuple object, and return the size of that tuple. On "
6468
"error, return ``-1`` and with an exception set."
65-
msgstr ""
69+
msgstr "拿取一個元組物件的指針,然後回傳此元組的大小。錯誤發生時,回傳 ``-1``。"
6670

6771
#: ../../c-api/tuple.rst:56
6872
msgid "Like :c:func:`PyTuple_Size`, but without error checking."
69-
msgstr ""
73+
msgstr "就像 :c:func:`PyTuple_Size` 但沒有異常檢查。"
7074

7175
#: ../../c-api/tuple.rst:61
7276
msgid ""
7377
"Return the object at position *pos* in the tuple pointed to by *p*. If "
7478
"*pos* is negative or out of bounds, return ``NULL`` and set "
7579
"an :exc:`IndexError` exception."
76-
msgstr ""
80+
msgstr "回傳 *p* 指向的元組中位置 *pos* 處的物件。如果 *pos* 為負數或超出範圍,回傳"
81+
" ``NULL`` 並拋出 :exc:`IndexError` 異常。"
7782

7883
#: ../../c-api/tuple.rst:64
7984
msgid ""
8085
"The returned reference is borrowed from the tuple *p* (that is: it is only "
8186
"valid as long as you hold a reference to *p*). To get a :term:`strong "
8287
"reference`, use :c:func:`Py_NewRef(PyTuple_GetItem(...)) <Py_NewRef>` "
8388
"or :c:func:`PySequence_GetItem`."
84-
msgstr ""
89+
msgstr "傳回的參照借自元組 *p*(也就是說:它僅在您持有 *p* 的參照時有效)。"
90+
"若要取得一個 :term:`strong reference`,請使用 :c:func:`Py_NewRef(PyTuple_GetItem(...)) "
91+
"<Py_NewRef>` 或 :c:func:`PySequence_GetItem`。"
8592

8693
#: ../../c-api/tuple.rst:73
8794
msgid "Like :c:func:`PyTuple_GetItem`, but does no checking of its arguments."
88-
msgstr ""
95+
msgstr "與 :c:func:`PyTuple_GetItem` 相似,但不修改其引數。"
8996

9097
#: ../../c-api/tuple.rst:78
9198
msgid ""
9299
"Return the slice of the tuple pointed to by *p* between *low* and *high*, or "
93100
"``NULL`` with an exception set on failure."
94-
msgstr ""
101+
msgstr "回傳由 *p* 指向的元組中介於 *low* 和 *high* 之間的切片或回傳 ``NULL`` 並拋出異常。"
95102

96103
#: ../../c-api/tuple.rst:81
97104
msgid ""
98105
"This is the equivalent of the Python expression ``p[low:high]``. Indexing "
99106
"from the end of the tuple is not supported."
100-
msgstr ""
107+
msgstr "這與 Python ``p[low:high]`` 表達式等價。但不支援從元組末端開始索引。"
101108

102109
#: ../../c-api/tuple.rst:87
103110
msgid ""
104111
"Insert a reference to object *o* at position *pos* of the tuple pointed to "
105112
"by *p*. Return ``0`` on success. If *pos* is out of bounds, return ``-1`` "
106113
"and set an :exc:`IndexError` exception."
107-
msgstr ""
114+
msgstr "於 *p* 指向的元組 *pos* 位置處插入對物件 *o* 的參照。如果 *pos* 超出邊界, "
115+
"回傳 ``-1``,並拋出 :exc:`IndexError` 異常。"
108116

109117
#: ../../c-api/tuple.rst:93
110118
msgid ""
111119
"This function \"steals\" a reference to *o* and discards a reference to an "
112120
"item already in the tuple at the affected position."
113-
msgstr ""
121+
msgstr "此函數 \"竊取\" 對 *o* 的參照,並丟棄對元組中受影響位置的項目的參照。"
114122

115123
#: ../../c-api/tuple.rst:99
116124
msgid ""
117125
"Like :c:func:`PyTuple_SetItem`, but does no error checking, and should "
118126
"*only* be used to fill in brand new tuples."
119-
msgstr ""
127+
msgstr "與 :c:func:`PyTuple_SetItem` 相似,但不進行錯誤檢查,且應 *只* "
128+
"用於填充全新的元組。"
120129

121130
#: ../../c-api/tuple.rst:102 ../../c-api/tuple.rst:224
122131
#: ../../c-api/tuple.rst:242
123132
msgid ""
124133
"Bounds checking is performed as an assertion if Python is built "
125134
"in :ref:`debug mode <debug-build>` or :option:`with assertions <--with-"
126135
"assertions>`."
127-
msgstr ""
136+
msgstr "若 Python 以 :ref:`debug mode <debug-build>` 或 :option:`with assertions"
137+
" <--with-assertions>` 建構,則會進行邊界的斷言(asserting)檢查。"
128138

129139
#: ../../c-api/tuple.rst:107
130140
msgid ""
131141
"This function \"steals\" a reference to *o*, and, "
132142
"unlike :c:func:`PyTuple_SetItem`, does *not* discard a reference to any item "
133143
"that is being replaced; any reference in the tuple at position *pos* will be "
134144
"leaked."
135-
msgstr ""
145+
msgstr "此函式 \"竊取\" 對 *o* 的參照,且與 :c:func:`PyTuple_SetItem` 不同的是,"
146+
"此函式並不丟棄任何被替代項目的參照;元組中 *pos* 位置的所有參照皆會被洩漏。"
136147

137148
#: ../../c-api/tuple.rst:114
138149
msgid ""
139150
"This macro should *only* be used on tuples that are newly created. Using "
140151
"this macro on a tuple that is already in use (or in other words, has a "
141152
"refcount > 1) could lead to undefined behavior."
142-
msgstr ""
153+
msgstr "此巨集 *僅* 套用於新建立的元組。在已使用的元組(或換句話說,引用計數大於 "
154+
"1 的元組)上使用此巨集可能會導致未定義行為。"
143155

144156
#: ../../c-api/tuple.rst:121
145157
msgid ""
@@ -154,62 +166,71 @@ msgid ""
154166
"is replaced, the original ``*p`` is destroyed. On failure, returns ``-1`` "
155167
"and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` "
156168
"or :exc:`SystemError`."
157-
msgstr ""
169+
msgstr "可用於調整元組的大小。*newsize* 將是元組的新長度。由於元組 *應該* 是不可變的,"
170+
"因此僅當物件只有一個參照時才應使用此方法。如果程式碼的其他部分已經知道該元組,則 "
171+
"*不要* 使用此方法。最終元組總會變大或縮小。可以將其理解為銷毀舊元組並建立一個新元組,"
172+
"只是有著更高的效率。成功時回傳 ``0``。客戶端程式碼絕不應假設 ``*p`` 的結果值與呼叫此函數"
173+
"之前的值相同。如果 ``*p`` 參照的物件被替換,則原始的 ``*p`` 將被銷毀。失敗時,傳回 ``-1``,"
174+
"並將 ``*p`` 設定為 ``NULL``,並拋出 `:exc:`MemoryError` 或 `:exc:`SystemError` 例外。"
158175

159176
#: ../../c-api/tuple.rst:136
160177
msgid "Struct Sequence Objects"
161-
msgstr ""
178+
msgstr "結構序列化物件"
162179

163180
#: ../../c-api/tuple.rst:138
164181
msgid ""
165182
"Struct sequence objects are the C equivalent "
166183
"of :func:`~collections.namedtuple` objects, i.e. a sequence whose items can "
167184
"also be accessed through attributes. To create a struct sequence, you first "
168185
"have to create a specific struct sequence type."
169-
msgstr ""
186+
msgstr "結構序列化物件與 C 語言中的 :func:`~collections.namedtuple` 物件等價,換言之,"
187+
"一個序列的元素也可以透過屬性存取。要建立結構體序列,首先需要建立特定類型的結構體型別。"
170188

171189
#: ../../c-api/tuple.rst:145
172190
msgid ""
173191
"Create a new struct sequence type from the data in *desc*, described below. "
174192
"Instances of the resulting type can be created "
175193
"with :c:func:`PyStructSequence_New`."
176-
msgstr ""
194+
msgstr "從 *desc* 的資料建立一個新的結構序列型別,如下所述。可以使用 "
195+
":c:func:`PyStructSequence_New` 建立結構序列型別實例。"
177196

178197
#: ../../c-api/tuple.rst:148 ../../c-api/tuple.rst:217
179198
msgid "Return ``NULL`` with an exception set on failure."
180-
msgstr "失敗時回傳 ``NULL`` 並設定例外。"
199+
msgstr "失敗時回傳 ``NULL`` 並拋出例外。"
181200

182201
#: ../../c-api/tuple.rst:153
183202
msgid "Initializes a struct sequence type *type* from *desc* in place."
184-
msgstr ""
203+
msgstr "從 *desc* 就地初始化結構序列化型別 *type*。"
185204

186205
#: ../../c-api/tuple.rst:158
187206
msgid ""
188207
"Like :c:func:`PyStructSequence_InitType`, but returns ``0`` on success and "
189208
"``-1`` with an exception set on failure."
190-
msgstr ""
209+
msgstr "與 :c:func:`PyStructSequence_InitType` 相似,但運行成功時回傳 ``0``,"
210+
"運行失敗時回傳 ``-1`` 並拋出例外。"
191211

192212
#: ../../c-api/tuple.rst:166
193213
msgid "Contains the meta information of a struct sequence type to create."
194-
msgstr ""
214+
msgstr "包含要建立的結構序列化型別的源資訊訊。"
195215

196216
#: ../../c-api/tuple.rst:170
197217
msgid ""
198218
"Fully qualified name of the type; null-terminated UTF-8 encoded. The name "
199219
"must contain the module name."
200-
msgstr ""
220+
msgstr "型別的完整限定名稱(Fully qualified name);以 UTF-8 編碼並以空字元結尾。"
221+
"名稱必須包含完整的模組名稱。"
201222

202223
#: ../../c-api/tuple.rst:175
203224
msgid "Pointer to docstring for the type or ``NULL`` to omit."
204-
msgstr ""
225+
msgstr "指向型別文件 (docstring) 的指針或使用 ``NULL`` 表示忽略。"
205226

206227
#: ../../c-api/tuple.rst:179
207228
msgid "Pointer to ``NULL``-terminated array with field names of the new type."
208-
msgstr ""
229+
msgstr "指向以 ``NULL`` 結尾的陣列指針包含新型別的欄位名稱。"
209230

210231
#: ../../c-api/tuple.rst:183
211232
msgid "Number of fields visible to the Python side (if used as tuple)."
212-
msgstr ""
233+
msgstr "Python 端可以看到欄位的數目 (如果使用元組)。"
213234

214235
#: ../../c-api/tuple.rst:188
215236
msgid ""
@@ -218,63 +239,67 @@ msgid ""
218239
"the :c:member:`~PyStructSequence_Desc.fields` array of "
219240
"the :c:type:`PyStructSequence_Desc` determines which field of the struct "
220241
"sequence is described."
221-
msgstr ""
242+
msgstr "描述結構體序列的一個欄位。由於結構體序列以元組建構,所有欄位的型別均為 "
243+
":c:expr:`PyObject*`。 :c:type:`PyStructSequence_Desc` 的 "
244+
":c:member:`~PyStructSequence_Desc.fields` 陣列中的索引決定了結構體序列的哪個欄位。"
222245

223246
#: ../../c-api/tuple.rst:196
224247
msgid ""
225248
"Name for the field or ``NULL`` to end the list of named fields, set "
226249
"to :c:data:`PyStructSequence_UnnamedField` to leave unnamed."
227-
msgstr ""
250+
msgstr "欄位名稱,或 ``NULL`` 表示命名欄位串列結束,設定為 "
251+
":c:data:`PyStructSequence_UnnamedField` 表示該欄位不命名。"
228252

229253
#: ../../c-api/tuple.rst:201
230254
msgid "Field docstring or ``NULL`` to omit."
231-
msgstr ""
255+
msgstr "欄位文件或使用 ``NULL`` 表示忽略。"
232256

233257
#: ../../c-api/tuple.rst:206
234258
msgid "Special value for a field name to leave it unnamed."
235-
msgstr ""
259+
msgstr "特別的值給欄位名稱,表示該欄位不命名。"
236260

237261
#: ../../c-api/tuple.rst:208
238262
msgid "The type was changed from ``char *``."
239-
msgstr ""
263+
msgstr "型別已被 ``char *`` 修改。"
240264

241265
#: ../../c-api/tuple.rst:214
242266
msgid ""
243267
"Creates an instance of *type*, which must have been created "
244268
"with :c:func:`PyStructSequence_NewType`."
245-
msgstr ""
269+
msgstr "建立 *type* 的實例,必須以 :c:func:`PyStructSequence_NewType` 建立。"
246270

247271
#: ../../c-api/tuple.rst:222
248272
msgid ""
249273
"Return the object at position *pos* in the struct sequence pointed to by *p*."
250-
msgstr ""
274+
msgstr "回傳結構體序列中由 *p* 指向 *pos* 處的物件。"
251275

252276
#: ../../c-api/tuple.rst:230
253277
msgid "Alias to :c:func:`PyStructSequence_GetItem`."
254-
msgstr ""
278+
msgstr ":c:func:`PyStructSequence_GetItem` 的別名。"
255279

256280
#: ../../c-api/tuple.rst:232
257281
msgid "Now implemented as an alias to :c:func:`PyStructSequence_GetItem`."
258-
msgstr ""
282+
msgstr "現在以 :c:func:`PyStructSequence_GetItem` 的別名型式實現。"
259283

260284
#: ../../c-api/tuple.rst:238
261285
msgid ""
262286
"Sets the field at index *pos* of the struct sequence *p* to value *o*. "
263287
"Like :c:func:`PyTuple_SET_ITEM`, this should only be used to fill in brand "
264288
"new instances."
265-
msgstr ""
289+
msgstr "將結構體序列 *p* 中索引 *pos* 處的欄位值設為 *o*。與 "
290+
":c:func:`PyTuple_SET_ITEM` 類似,此函數僅套用於填充全新實例。"
266291

267292
#: ../../c-api/tuple.rst:247
268293
msgid "This function \"steals\" a reference to *o*."
269-
msgstr ""
294+
msgstr "此函式 \"竊取\" *o* 的參照。"
270295

271296
#: ../../c-api/tuple.rst:252
272297
msgid "Alias to :c:func:`PyStructSequence_SetItem`."
273-
msgstr ""
298+
msgstr ":c:func:`PyStructSequence_SetItem` 的別名。"
274299

275300
#: ../../c-api/tuple.rst:254
276301
msgid "Now implemented as an alias to :c:func:`PyStructSequence_SetItem`."
277-
msgstr ""
302+
msgstr "現在以 :c:func:`PyStructSequence_SetItem` 的別名實現。"
278303

279304
#: ../../c-api/tuple.rst:8
280305
msgid "object"

0 commit comments

Comments
 (0)