diff --git a/c-api/number.po b/c-api/number.po index 66d782afb55..caa5cb95621 100644 --- a/c-api/number.po +++ b/c-api/number.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2018-05-23 14:07+0000\n" +"PO-Revision-Date: 2026-11-07 14:25+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -16,6 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.10\n" #: ../../c-api/number.rst:6 msgid "Number Protocol" @@ -26,40 +27,51 @@ msgid "" "Returns ``1`` if the object *o* provides numeric protocols, and false " "otherwise. This function always succeeds." msgstr "" +"若物件 *o* 提供數值協定,則回傳 ``1``,否則回傳假值。此函式總會成功執行。" #: ../../c-api/number.rst:14 msgid "Returns ``1`` if *o* is an index integer." -msgstr "" +msgstr "若 *o* 為索引整數,則回傳 ``1``。" #: ../../c-api/number.rst:20 msgid "" "Returns the result of adding *o1* and *o2*, or ``NULL`` on failure. This is " "the equivalent of the Python expression ``o1 + o2``." msgstr "" +"回傳 *o1* 與 *o2* 相加的結果,失敗時回傳 ``NULL``。這相當於 Python 運算式 " +"``o1 + o2``。" #: ../../c-api/number.rst:26 msgid "" "Returns the result of subtracting *o2* from *o1*, or ``NULL`` on failure. " "This is the equivalent of the Python expression ``o1 - o2``." msgstr "" +"回傳 *o1* 減去 *o2* 的結果,失敗時回傳 ``NULL``。這相當於 Python 運算式 ``o1 " +"- o2``。" #: ../../c-api/number.rst:32 msgid "" "Returns the result of multiplying *o1* and *o2*, or ``NULL`` on failure. " "This is the equivalent of the Python expression ``o1 * o2``." msgstr "" +"回傳 *o1* 與 *o2* 相乘的結果,失敗時回傳 ``NULL``。這相當於 Python 運算式 " +"``o1 * o2``。" #: ../../c-api/number.rst:38 msgid "" "Returns the result of matrix multiplication on *o1* and *o2*, or ``NULL`` on " "failure. This is the equivalent of the Python expression ``o1 @ o2``." msgstr "" +"回傳對 *o1* 與 *o2* 進行矩陣乘法的結果,失敗時回傳 ``NULL``。這相當於 Python 運" +"算式 ``o1 @ o2``。" #: ../../c-api/number.rst:46 msgid "" "Return the floor of *o1* divided by *o2*, or ``NULL`` on failure. This is " "the equivalent of the Python expression ``o1 // o2``." msgstr "" +"回傳 *o1* 除以 *o2* 後向下取整的結果,失敗時回傳 ``NULL``。這相當於 Python 運" +"算式 ``o1 // o2``。" #: ../../c-api/number.rst:52 msgid "" @@ -70,18 +82,26 @@ msgid "" "point value when passed two integers. This is the equivalent of the Python " "expression ``o1 / o2``." msgstr "" +"回傳 *o1* 除以 *o2* 所得數學值的合理近似值,失敗時回傳 ``NULL``。回傳數值之所" +"以是「近似值」,是因為二進位浮點數無法精確表示所有實數。;無法以二進位表示所" +"有實數。即使傳入兩個整數,此函式仍可能回傳浮點數值。這相當於 Python 運算式 " +"``o1 / o2``。" #: ../../c-api/number.rst:61 msgid "" "Returns the remainder of dividing *o1* by *o2*, or ``NULL`` on failure. " "This is the equivalent of the Python expression ``o1 % o2``." msgstr "" +"回傳 *o1* 除以 *o2* 的餘數,失敗時回傳 ``NULL``。這相當於 Python 運算式 ``o1 " +"% o2``。" #: ../../c-api/number.rst:69 msgid "" "See the built-in function :func:`divmod`. Returns ``NULL`` on failure. This " "is the equivalent of the Python expression ``divmod(o1, o2)``." msgstr "" +"請參閱內建函式 :func:`divmod`。失敗時回傳 ``NULL``。這相當於 Python 運算式 " +"``divmod(o1, o2)``。" #: ../../c-api/number.rst:77 msgid "" @@ -90,60 +110,77 @@ msgid "" "optional. If *o3* is to be ignored, pass :c:data:`Py_None` in its place " "(passing ``NULL`` for *o3* would cause an illegal memory access)." msgstr "" +"請參閱內建函式 :func:`pow`。失敗時回傳 ``NULL``。這相當於 Python 運算式 " +"``pow(o1, o2, o3)``,其中 *o3* 為選用引數。若要忽略 *o3*,請在其位置傳" +"入 :c:data:`Py_None`。若將 ``NULL`` 傳給 *o3*,會造成非法記憶體存取。" #: ../../c-api/number.rst:85 msgid "" "Returns the negation of *o* on success, or ``NULL`` on failure. This is the " "equivalent of the Python expression ``-o``." msgstr "" +"成功時回傳 *o* 的相反數,失敗時回傳 ``NULL``。這相當於 Python 運算式 ``-o``。" #: ../../c-api/number.rst:91 msgid "" "Returns *o* on success, or ``NULL`` on failure. This is the equivalent of " "the Python expression ``+o``." -msgstr "" +msgstr "成功時回傳 *o*,失敗時回傳 ``NULL``。這相當於 Python 運算式 ``+o``。" #: ../../c-api/number.rst:99 msgid "" "Returns the absolute value of *o*, or ``NULL`` on failure. This is the " "equivalent of the Python expression ``abs(o)``." msgstr "" +"回傳 *o* 的絕對值,失敗時回傳 ``NULL``。這相當於 Python 運算式 ``abs(o)``。" #: ../../c-api/number.rst:105 msgid "" "Returns the bitwise negation of *o* on success, or ``NULL`` on failure. " "This is the equivalent of the Python expression ``~o``." msgstr "" +"成功時回傳 *o* 逐位元反相的結果,失敗時回傳 ``NULL``。這相當於 Python 運算式 " +"``~o``。" #: ../../c-api/number.rst:111 msgid "" "Returns the result of left shifting *o1* by *o2* on success, or ``NULL`` on " "failure. This is the equivalent of the Python expression ``o1 << o2``." msgstr "" +"成功時回傳將 *o1* 左移 *o2* 位的結果,失敗時回傳 ``NULL``。這相當於 Python 運" +"算式 ``o1 << o2``。" #: ../../c-api/number.rst:117 msgid "" "Returns the result of right shifting *o1* by *o2* on success, or ``NULL`` on " "failure. This is the equivalent of the Python expression ``o1 >> o2``." msgstr "" +"成功時回傳將 *o1* 右移 *o2* 位的結果,失敗時回傳 ``NULL``。這相當於 Python 運" +"算式 ``o1 >> o2``。" #: ../../c-api/number.rst:123 msgid "" "Returns the \"bitwise and\" of *o1* and *o2* on success and ``NULL`` on " "failure. This is the equivalent of the Python expression ``o1 & o2``." msgstr "" +"成功時回傳 *o1* 與 *o2* 進行「bitwise and」運算的結果,失敗時回傳 " +"``NULL``。這相當於 Python 運算式 ``o1 & o2``。" #: ../../c-api/number.rst:129 msgid "" "Returns the \"bitwise exclusive or\" of *o1* by *o2* on success, or ``NULL`` " "on failure. This is the equivalent of the Python expression ``o1 ^ o2``." msgstr "" +"成功時回傳 *o1* 與 *o2* 進行「bitwise exclusive or」運算的結果,失敗時回傳 " +"``NULL``。這相當於 Python 運算式 ``o1 ^ o2``。" #: ../../c-api/number.rst:135 msgid "" "Returns the \"bitwise or\" of *o1* and *o2* on success, or ``NULL`` on " "failure. This is the equivalent of the Python expression ``o1 | o2``." msgstr "" +"成功時回傳 *o1* 與 *o2* 進行「bitwise or」運算的結果,失敗時回傳 ``NULL``。" +"這相當於 Python 運算式 ``o1 | o2``。" #: ../../c-api/number.rst:141 msgid "" @@ -151,6 +188,8 @@ msgid "" "operation is done *in-place* when *o1* supports it. This is the equivalent " "of the Python statement ``o1 += o2``." msgstr "" +"回傳 *o1* 與 *o2* 相加的結果,失敗時回傳 ``NULL``。若 *o1* 支援,則會以 *in-" +"place* 方式執行此運算。這相當於 Python 陳述式 ``o1 += o2``。" #: ../../c-api/number.rst:148 msgid "" @@ -158,6 +197,8 @@ msgid "" "The operation is done *in-place* when *o1* supports it. This is the " "equivalent of the Python statement ``o1 -= o2``." msgstr "" +"回傳 *o1* 減去 *o2* 的結果,失敗時回傳 ``NULL``。若 *o1* 支援,則會以 *in-" +"place* 方式執行此運算。這相當於 Python 陳述式 ``o1 -= o2``。" #: ../../c-api/number.rst:155 msgid "" @@ -165,6 +206,8 @@ msgid "" "The operation is done *in-place* when *o1* supports it. This is the " "equivalent of the Python statement ``o1 *= o2``." msgstr "" +"回傳 *o1* 與 *o2* 相乘的結果,失敗時回傳 ``NULL``。若 *o1* 支援,則會以 *in-" +"place* 方式執行此運算。這相當於 Python 陳述式 ``o1 *= o2``。" #: ../../c-api/number.rst:162 msgid "" @@ -172,6 +215,8 @@ msgid "" "failure. The operation is done *in-place* when *o1* supports it. This is " "the equivalent of the Python statement ``o1 @= o2``." msgstr "" +"回傳對 *o1* 與 *o2* 進行矩陣乘法的結果,失敗時回傳 ``NULL``。若 *o1* 支援,則" +"會以 *in-place* 方式執行此運算。這相當於 Python 陳述式 ``o1 @= o2``。" #: ../../c-api/number.rst:171 msgid "" @@ -179,6 +224,8 @@ msgid "" "failure. The operation is done *in-place* when *o1* supports it. This is " "the equivalent of the Python statement ``o1 //= o2``." msgstr "" +"回傳 *o1* 除以 *o2* 後向下取整的結果,失敗時回傳 ``NULL``。若 *o1* 支援,則會" +"以 *in-place* 方式執行此運算。這相當於 Python 陳述式 ``o1 //= o2``。" #: ../../c-api/number.rst:178 msgid "" @@ -190,6 +237,10 @@ msgid "" "*o1* supports it. This is the equivalent of the Python statement ``o1 /= " "o2``." msgstr "" +"回傳 *o1* 除以 *o2* 所得數學值的合理近似值,失敗時回傳 ``NULL``。回傳值之所以" +"是「近似值」,是因為二進位浮點數只能表示近似值;無法以二進位表示所有實數。即" +"使傳入兩個整數,此函式仍可能回傳浮點數值。若 *o1* 支援,則會以 *in-place* 方" +"式執行此運算。這相當於 Python 陳述式 ``o1 /= o2``。" #: ../../c-api/number.rst:188 msgid "" @@ -197,6 +248,8 @@ msgid "" "operation is done *in-place* when *o1* supports it. This is the equivalent " "of the Python statement ``o1 %= o2``." msgstr "" +"回傳 *o1* 除以 *o2* 的餘數,失敗時回傳 ``NULL``。若 *o1* 支援,則會以 *in-" +"place* 方式執行此運算。這相當於 Python 陳述式 ``o1 %= o2``。" #: ../../c-api/number.rst:197 msgid "" @@ -207,6 +260,11 @@ msgid "" "pass :c:data:`Py_None` in its place (passing ``NULL`` for *o3* would cause " "an illegal memory access)." msgstr "" +"請參閱內建函式 :func:`pow`。失敗時回傳 ``NULL``。若 *o1* 支援,則會以 *in-" +"place* 方式執行此運算。當 o3 為 :c:data:`Py_None` 時,這相當於 Python 陳述式 " +"``o1 **= o2``;否則,相當於 ``pow(o1, o2, o3)`` 的原地運算版本。若要忽略 " +"*o3*,請在其位置傳入 :c:data:`Py_None`。若將 ``NULL`` 傳給 *o3*,會造成非法記" +"憶體存取。" #: ../../c-api/number.rst:206 msgid "" @@ -214,6 +272,8 @@ msgid "" "failure. The operation is done *in-place* when *o1* supports it. This is " "the equivalent of the Python statement ``o1 <<= o2``." msgstr "" +"成功時回傳將 *o1* 左移 *o2* 位的結果,失敗時回傳 ``NULL``。若 *o1* 支援,則會" +"以 *in-place* 方式執行此運算。這相當於 Python 陳述式 ``o1 <<= o2``。" #: ../../c-api/number.rst:213 msgid "" @@ -221,6 +281,8 @@ msgid "" "failure. The operation is done *in-place* when *o1* supports it. This is " "the equivalent of the Python statement ``o1 >>= o2``." msgstr "" +"成功時回傳將 *o1* 右移 *o2* 位的結果,失敗時回傳 ``NULL``。若 *o1* 支援,則會" +"以 *in-place* 方式執行此運算。這相當於 Python 陳述式 ``o1 >>= o2``。" #: ../../c-api/number.rst:220 msgid "" @@ -228,6 +290,9 @@ msgid "" "failure. The operation is done *in-place* when *o1* supports it. This is " "the equivalent of the Python statement ``o1 &= o2``." msgstr "" +"成功時回傳 *o1* 與 *o2* 進行「bitwise and」運算的結果,失敗時回傳 " +"``NULL``。若 *o1* 支援,則會以 *in-place* 方式執行此運算。這相當於 Python 陳" +"述式 ``o1 &= o2``。" #: ../../c-api/number.rst:227 msgid "" @@ -235,6 +300,9 @@ msgid "" "on failure. The operation is done *in-place* when *o1* supports it. This " "is the equivalent of the Python statement ``o1 ^= o2``." msgstr "" +"成功時回傳 *o1* 與 *o2* 進行「bitwise exclusive or」運算的結果,失敗時回傳 " +"``NULL``。若 *o1* 支援,則會以 *in-place* 方式執行此運算。這相當於 Python 陳" +"述式 ``o1 ^= o2``。" #: ../../c-api/number.rst:234 msgid "" @@ -242,39 +310,53 @@ msgid "" "failure. The operation is done *in-place* when *o1* supports it. This is " "the equivalent of the Python statement ``o1 |= o2``." msgstr "" +"成功時回傳 *o1* 與 *o2* 進行「bitwise or」運算的結果,失敗時回傳 ``NULL``。" +"若 *o1* 支援,則會以 *in-place* 方式執行此運算。這相當於 Python 陳述式 ``o1 |" +"= o2``。" #: ../../c-api/number.rst:243 msgid "" "Returns the *o* converted to an integer object on success, or ``NULL`` on " "failure. This is the equivalent of the Python expression ``int(o)``." msgstr "" +"成功時回傳將 *o* 轉換為整數物件的結果,失敗時回傳 ``NULL``。這相當於 Python " +"運算式 ``int(o)``。" #: ../../c-api/number.rst:251 msgid "" "Returns the *o* converted to a float object on success, or ``NULL`` on " "failure. This is the equivalent of the Python expression ``float(o)``." msgstr "" +"成功時回傳將 *o* 轉換為浮點數物件的結果,失敗時回傳 ``NULL``。這相當於 " +"Python 運算式 ``float(o)``。" #: ../../c-api/number.rst:257 msgid "" -"Returns the *o* converted to a Python int on success or ``NULL`` with a :exc:" -"`TypeError` exception raised on failure." +"Returns the *o* converted to a Python int on success or ``NULL`` with " +"a :exc:`TypeError` exception raised on failure." msgstr "" +"成功時回傳將 *o* 轉換為 Python int 的結果;失敗時引發 :exc:`TypeError` 例外並" +"回傳 ``NULL``。" #: ../../c-api/number.rst:260 msgid "" "The result always has exact type :class:`int`. Previously, the result could " "have been an instance of a subclass of ``int``." msgstr "" +"結果的確切型別一律為 :class:`int`。先前,結果可能是 ``int`` 子類別的實例。" #: ../../c-api/number.rst:267 msgid "" "Returns the integer *n* converted to base *base* as a string. The *base* " "argument must be one of 2, 8, 10, or 16. For base 2, 8, or 16, the returned " "string is prefixed with a base marker of ``'0b'``, ``'0o'``, or ``'0x'``, " -"respectively. If *n* is not a Python int, it is converted with :c:func:" -"`PyNumber_Index` first." +"respectively. If *n* is not a Python int, it is converted " +"with :c:func:`PyNumber_Index` first." msgstr "" +"將整數 *n* 轉換為以 *base* 為基底的字串並回傳。*base* 引數必須為 2、8、10 或 " +"16 其中之一。當基底為 2、8 或 16 時,回傳的字串會分別加上 ``'0b'``、``'0o'`` " +"或 ``'0x'`` 作為進位前綴。若 *n* 不是 Python int,則會先使" +"用 :c:func:`PyNumber_Index` 進行轉換。" #: ../../c-api/number.rst:276 msgid "" @@ -282,16 +364,23 @@ msgid "" "interpreted as an integer. If the call fails, an exception is raised and " "``-1`` is returned." msgstr "" +"若 *o* 可解讀為整數,則將其轉換為 :c:type:`Py_ssize_t` 值並回傳。若呼叫失敗," +"則會引發例外並回傳 ``-1``。" #: ../../c-api/number.rst:279 msgid "" -"If *o* can be converted to a Python int but the attempt to convert to a :c:" -"type:`Py_ssize_t` value would raise an :exc:`OverflowError`, then the *exc* " -"argument is the type of exception that will be raised (usually :exc:" -"`IndexError` or :exc:`OverflowError`). If *exc* is ``NULL``, then the " -"exception is cleared and the value is clipped to ``PY_SSIZE_T_MIN`` for a " -"negative integer or ``PY_SSIZE_T_MAX`` for a positive integer." +"If *o* can be converted to a Python int but the attempt to convert to " +"a :c:type:`Py_ssize_t` value would raise an :exc:`OverflowError`, then the " +"*exc* argument is the type of exception that will be raised " +"(usually :exc:`IndexError` or :exc:`OverflowError`). If *exc* is ``NULL``, " +"then the exception is cleared and the value is clipped to ``PY_SSIZE_T_MIN`` " +"for a negative integer or ``PY_SSIZE_T_MAX`` for a positive integer." msgstr "" +"若 *o* 可以轉換為 Python int,但嘗試轉換為 :c:type:`Py_ssize_t` 值時會引" +"發 :exc:`OverflowError`,則 *exc* 引數指定要引發的例外型別(通常" +"為 :exc:`IndexError` 或 :exc:`OverflowError`)。若 *exc* 為 ``NULL``,則會清" +"除該例外,並將負整數的值限制為 ``PY_SSIZE_T_MIN``,正整數的值限制為 " +"``PY_SSIZE_T_MAX``。" #: ../../c-api/number.rst:289 msgid "" @@ -299,6 +388,8 @@ msgid "" "``tp_as_number`` structure filled in), and ``0`` otherwise. This function " "always succeeds." msgstr "" +"若 *o* 為索引整數(即其 ``tp_as_number`` 結構中的 ``nb_index`` 插槽已填入)," +"則回傳 ``1``,否則回傳 ``0``。此函式總是會成功執行。" #: ../../c-api/number.rst:67 ../../c-api/number.rst:75 #: ../../c-api/number.rst:97 ../../c-api/number.rst:195