Skip to content

Commit c369929

Browse files
Yorkxemattwang44
andauthored
Working on c-api/tuple.po (#1164)
Co-authored-by: W. H. Wang <[email protected]>
1 parent 7beef77 commit c369929

File tree

1 file changed

+77
-24
lines changed

1 file changed

+77
-24
lines changed

c-api/tuple.po

Lines changed: 77 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
#
44
# Translators:
55
# Leon H., 2017
6+
# Yorkxe <[email protected]>, 2025
67
msgid ""
78
msgstr ""
89
"Project-Id-Version: Python 3.14\n"
910
"Report-Msgid-Bugs-To: \n"
1011
"POT-Creation-Date: 2025-11-05 00:16+0000\n"
11-
"PO-Revision-Date: 2017-09-22 18:26+0000\n"
12-
"Last-Translator: Leon H.\n"
12+
"PO-Revision-Date: 2025-11-13 21:53+0000\n"
13+
"Last-Translator: Yorkxe <[email protected]>\n"
1314
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1415
"tw)\n"
1516
"Language: zh_TW\n"
@@ -24,31 +25,36 @@ 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."
3334
msgstr ""
35+
"此 :c:type:`PyTypeObject` 實例代表 Python 元組型別,與 Python 層中的 :class:"
36+
"`tuple` 是同一物件"
3437

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

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

4753
#: ../../c-api/tuple.rst:36
4854
msgid ""
4955
"Return a new tuple object of size *len*, or ``NULL`` with an exception set "
5056
"on failure."
51-
msgstr ""
57+
msgstr "回傳一個長度為 *len* 的新元組物件,失敗會時回傳 ``NULL`` 並設定例外。"
5258

5359
#: ../../c-api/tuple.rst:42
5460
msgid ""
@@ -57,23 +63,30 @@ msgid ""
5763
"pointing to Python objects. ``PyTuple_Pack(2, a, b)`` is equivalent to "
5864
"``Py_BuildValue(\"(OO)\", a, b)``."
5965
msgstr ""
66+
"回傳一個長度為 *n* 的新元組物件,失敗時會回傳 ``NULL`` 並設定例外。元組值被初"
67+
"始化為指向 Python 物件的接續 *n* 個 C 引數。``PyTuple_Pack(2, a, b)`` 等價於 "
68+
"``Py_BuildValue(\"(OO)\", a, b)``。"
6069

6170
#: ../../c-api/tuple.rst:50
6271
msgid ""
6372
"Take a pointer to a tuple object, and return the size of that tuple. On "
6473
"error, return ``-1`` with an exception set."
6574
msgstr ""
75+
"拿取一個元組物件的指標,然後回傳此元組的大小。錯誤發生時,回傳 ``-1`` 並設定"
76+
"例外。"
6677

6778
#: ../../c-api/tuple.rst:56
6879
msgid "Like :c:func:`PyTuple_Size`, but without error checking."
69-
msgstr ""
80+
msgstr "就像 :c:func:`PyTuple_Size` 但沒有錯誤檢查。"
7081

7182
#: ../../c-api/tuple.rst:61
7283
msgid ""
7384
"Return the object at position *pos* in the tuple pointed to by *p*. If "
7485
"*pos* is negative or out of bounds, return ``NULL`` and set an :exc:"
7586
"`IndexError` exception."
7687
msgstr ""
88+
"回傳 *p* 指向的元組中位置 *pos* 處的物件。如果 *pos* 為負數或超出範圍,回傳 "
89+
"``NULL`` 並設定 :exc:`IndexError` 例外。"
7790

7891
#: ../../c-api/tuple.rst:64
7992
msgid ""
@@ -82,62 +95,78 @@ msgid ""
8295
"reference`, use :c:func:`Py_NewRef(PyTuple_GetItem(...)) <Py_NewRef>` or :c:"
8396
"func:`PySequence_GetItem`."
8497
msgstr ""
98+
"回傳的參照借自元組 *p*\\ (也就是說:它僅在你持有 *p* 的參照時有效)。若要取"
99+
"得一個 :term:`strong reference`,請使用 :c:func:"
100+
"`Py_NewRef(PyTuple_GetItem(...)) <Py_NewRef>` 或 :c:func:"
101+
"`PySequence_GetItem`。"
85102

86103
#: ../../c-api/tuple.rst:73
87104
msgid "Like :c:func:`PyTuple_GetItem`, but does no checking of its arguments."
88-
msgstr ""
105+
msgstr "與 :c:func:`PyTuple_GetItem` 相似,但不檢查其引數。"
89106

90107
#: ../../c-api/tuple.rst:78
91108
msgid ""
92109
"Return the slice of the tuple pointed to by *p* between *low* and *high*, or "
93110
"``NULL`` with an exception set on failure."
94111
msgstr ""
112+
"回傳由 *p* 指向的元組中介於 *low* 和 *high* 之間的切片或在錯誤時回傳 "
113+
"``NULL`` 並設定例外。"
95114

96115
#: ../../c-api/tuple.rst:81
97116
msgid ""
98117
"This is the equivalent of the Python expression ``p[low:high]``. Indexing "
99118
"from the end of the tuple is not supported."
100-
msgstr ""
119+
msgstr "這與 Python ``p[low:high]`` 運算式等價。但不支援從元組末端開始索引。"
101120

102121
#: ../../c-api/tuple.rst:87
103122
msgid ""
104123
"Insert a reference to object *o* at position *pos* of the tuple pointed to "
105124
"by *p*. Return ``0`` on success. If *pos* is out of bounds, return ``-1`` "
106125
"and set an :exc:`IndexError` exception."
107126
msgstr ""
127+
"於 *p* 指向的元組 *pos* 位置處插入對物件 *o* 的參照。成功時回傳 ``0``,如果 "
128+
"*pos* 超出邊界則回傳 ``-1``,並設定 :exc:`IndexError` 例外。"
108129

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

115136
#: ../../c-api/tuple.rst:99
116137
msgid ""
117138
"Like :c:func:`PyTuple_SetItem`, but does no error checking, and should "
118139
"*only* be used to fill in brand new tuples."
119140
msgstr ""
141+
"與 :c:func:`PyTuple_SetItem` 相似,但不進行錯誤檢查,且應 *只* 用於填充全新的"
142+
"元組。"
120143

121144
#: ../../c-api/tuple.rst:102 ../../c-api/tuple.rst:224
122145
#: ../../c-api/tuple.rst:242
123146
msgid ""
124147
"Bounds checking is performed as an assertion if Python is built in :ref:"
125148
"`debug mode <debug-build>` or :option:`with assertions <--with-assertions>`."
126149
msgstr ""
150+
"若 Python 以 :ref:`debug mode <debug-build>` 或 :option:`with assertions <--"
151+
"with-assertions>` 建置,則會進行作為斷言(asserting)的邊界檢查。"
127152

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

135162
#: ../../c-api/tuple.rst:114
136163
msgid ""
137164
"This macro should *only* be used on tuples that are newly created. Using "
138165
"this macro on a tuple that is already in use (or in other words, has a "
139166
"refcount > 1) could lead to undefined behavior."
140167
msgstr ""
168+
"此巨集應 *僅* 用於新建立的元組。在正被使用中的元組(或換句話說,參照計數大於 "
169+
"1 的元組)上使用此巨集可能會導致未定義行為。"
141170

142171
#: ../../c-api/tuple.rst:121
143172
msgid ""
@@ -153,10 +182,17 @@ msgid ""
153182
"and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` or :exc:"
154183
"`SystemError`."
155184
msgstr ""
185+
"可用於調整元組的大小。*newsize* 將是元組的新長度。由於元組 *應該* 是不可變"
186+
"的,因此僅當物件只有一個參照時才應使用此方法。如果程式碼的其他部分已經知道該"
187+
"元組,則 *不要* 使用此方法。最終元組總會變大或縮小。可以將其理解為銷毀舊元組"
188+
"並建立一個新元組,只是有著更高的效率。成功時回傳 ``0``。用戶端程式碼絕不應假"
189+
"設 ``*p`` 的結果值與呼叫此函式之前的值相同。如果 ``*p`` 參照的物件被替換,則"
190+
"原始的 ``*p`` 將被銷毀。失敗時,回傳 ``-1``,並將 ``*p`` 設定為 ``NULL``,並"
191+
"引發 :exc:`MemoryError` 或 :exc:`SystemError` 例外。"
156192

157193
#: ../../c-api/tuple.rst:136
158194
msgid "Struct Sequence Objects"
159-
msgstr ""
195+
msgstr "結構序列物件"
160196

161197
#: ../../c-api/tuple.rst:138
162198
msgid ""
@@ -165,49 +201,58 @@ msgid ""
165201
"through attributes. To create a struct sequence, you first have to create a "
166202
"specific struct sequence type."
167203
msgstr ""
204+
"結構序列物件是 :func:`~collections.namedtuple` 物件在 C 語言中的等價,換言"
205+
"之,一個序列的元素也可以透過屬性存取。要建立結構序列,首先需要建立特定的結構"
206+
"序列型別。"
168207

169208
#: ../../c-api/tuple.rst:145
170209
msgid ""
171210
"Create a new struct sequence type from the data in *desc*, described below. "
172211
"Instances of the resulting type can be created with :c:func:"
173212
"`PyStructSequence_New`."
174213
msgstr ""
214+
"從 *desc* 中的資料建立一個新的結構序列型別,如下所述。可以使用 :c:func:"
215+
"`PyStructSequence_New` 以建立產生結構序列型別的實例。"
175216

176217
#: ../../c-api/tuple.rst:148 ../../c-api/tuple.rst:217
177218
msgid "Return ``NULL`` with an exception set on failure."
178219
msgstr "失敗時回傳 ``NULL`` 並設定例外。"
179220

180221
#: ../../c-api/tuple.rst:153
181222
msgid "Initializes a struct sequence type *type* from *desc* in place."
182-
msgstr ""
223+
msgstr "從 *desc* 原地(in place)初始化結構序列型別 *type*。"
183224

184225
#: ../../c-api/tuple.rst:158
185226
msgid ""
186227
"Like :c:func:`PyStructSequence_InitType`, but returns ``0`` on success and "
187228
"``-1`` with an exception set on failure."
188229
msgstr ""
230+
"與 :c:func:`PyStructSequence_InitType` 相似,但運行成功時回傳 ``0``,運行失敗"
231+
"時回傳 ``-1`` 並設定例外。"
189232

190233
#: ../../c-api/tuple.rst:166
191234
msgid "Contains the meta information of a struct sequence type to create."
192-
msgstr ""
235+
msgstr "包含要建立的結構序列化型別的中介資訊(meta information)。"
193236

194237
#: ../../c-api/tuple.rst:170
195238
msgid ""
196239
"Fully qualified name of the type; null-terminated UTF-8 encoded. The name "
197240
"must contain the module name."
198241
msgstr ""
242+
"型別的完整限定名稱(Fully qualified name);以 UTF-8 編碼並以空字元結尾。名稱"
243+
"必須包含完整的模組名稱。"
199244

200245
#: ../../c-api/tuple.rst:175
201246
msgid "Pointer to docstring for the type or ``NULL`` to omit."
202-
msgstr ""
247+
msgstr "指向型別說明文件(docstring)的指標或使用 ``NULL`` 表示忽略。"
203248

204249
#: ../../c-api/tuple.rst:179
205250
msgid "Pointer to ``NULL``-terminated array with field names of the new type."
206-
msgstr ""
251+
msgstr "指向一個以 ``NULL`` 結尾的陣列指標,其包含新型別的欄位名稱。"
207252

208253
#: ../../c-api/tuple.rst:183
209254
msgid "Number of fields visible to the Python side (if used as tuple)."
210-
msgstr ""
255+
msgstr "Python 端可以看到欄位的數目(如果作為元組使用)。"
211256

212257
#: ../../c-api/tuple.rst:188
213258
msgid ""
@@ -217,62 +262,70 @@ msgid ""
217262
"`PyStructSequence_Desc` determines which field of the struct sequence is "
218263
"described."
219264
msgstr ""
265+
"描述結構序列的一個欄位。由於結構序列以元組作為原型,所有欄位的型別均為 :c:"
266+
"expr:`PyObject*`。:c:type:`PyStructSequence_Desc` 在 :c:member:"
267+
"`~PyStructSequence_Desc.fields` 陣列中的索引決定了描述的是結構序列的哪個欄"
268+
"位。"
220269

221270
#: ../../c-api/tuple.rst:196
222271
msgid ""
223272
"Name for the field or ``NULL`` to end the list of named fields, set to :c:"
224273
"data:`PyStructSequence_UnnamedField` to leave unnamed."
225274
msgstr ""
275+
"欄位名稱,或 ``NULL`` 表示命名欄位串列結束,設定為 :c:data:"
276+
"`PyStructSequence_UnnamedField` 表示該欄位不命名。"
226277

227278
#: ../../c-api/tuple.rst:201
228279
msgid "Field docstring or ``NULL`` to omit."
229-
msgstr ""
280+
msgstr "欄位說明字串或為 ``NULL`` 表示忽略。"
230281

231282
#: ../../c-api/tuple.rst:206
232283
msgid "Special value for a field name to leave it unnamed."
233-
msgstr ""
284+
msgstr "給定欄位名稱一個特別值,表示該欄位不命名。"
234285

235286
#: ../../c-api/tuple.rst:208
236287
msgid "The type was changed from ``char *``."
237-
msgstr ""
288+
msgstr "型別原本是 ``char *``,現已被修改。"
238289

239290
#: ../../c-api/tuple.rst:214
240291
msgid ""
241292
"Creates an instance of *type*, which must have been created with :c:func:"
242293
"`PyStructSequence_NewType`."
243-
msgstr ""
294+
msgstr "建立 *type* 的實例,必須以 :c:func:`PyStructSequence_NewType` 建立。"
244295

245296
#: ../../c-api/tuple.rst:222
246297
msgid ""
247298
"Return the object at position *pos* in the struct sequence pointed to by *p*."
248-
msgstr ""
299+
msgstr "回傳結構序列中由 *p* 指向 *pos* 處的物件。"
249300

250301
#: ../../c-api/tuple.rst:230
251302
msgid "Alias to :c:func:`PyStructSequence_GetItem`."
252-
msgstr ""
303+
msgstr ":c:func:`PyStructSequence_GetItem` 的別名。"
253304

254305
#: ../../c-api/tuple.rst:232
255306
msgid "Now implemented as an alias to :c:func:`PyStructSequence_GetItem`."
256-
msgstr ""
307+
msgstr "現在是被實作為 :c:func:`PyStructSequence_GetItem` 的一個別名。"
257308

258309
#: ../../c-api/tuple.rst:238
259310
msgid ""
260311
"Sets the field at index *pos* of the struct sequence *p* to value *o*. "
261312
"Like :c:func:`PyTuple_SET_ITEM`, this should only be used to fill in brand "
262313
"new instances."
263314
msgstr ""
315+
"將結構序列 *p* 中索引 *pos* 處的欄位值設為 *o*。與 :c:func:"
316+
"`PyTuple_SET_ITEM` 類似,此函式僅套用於填充全新實例。"
264317

265318
#: ../../c-api/tuple.rst:247
266319
msgid "This function \"steals\" a reference to *o*."
267-
msgstr ""
320+
msgstr "此函式 \"竊取\" *o* 的參照。"
268321

269322
#: ../../c-api/tuple.rst:252
270323
msgid "Alias to :c:func:`PyStructSequence_SetItem`."
271-
msgstr ""
324+
msgstr ":c:func:`PyStructSequence_SetItem` 的別名。"
272325

273326
#: ../../c-api/tuple.rst:254
274327
msgid "Now implemented as an alias to :c:func:`PyStructSequence_SetItem`."
275-
msgstr ""
328+
msgstr "現在是被實作為 :c:func:`PyStructSequence_SetItem` 的一個別名。"
276329

277330
#: ../../c-api/tuple.rst:8
278331
msgid "object"

0 commit comments

Comments
 (0)