From 9fb42350507998908a4db4d199bb22a305fc5b29 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 6 Jun 2026 15:52:44 +0000 Subject: [PATCH 1/4] sync with cpython 575916d5 --- c-api/long.po | 14 +++++++------- library/importlib.resources.po | 24 ++++++++++++------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/c-api/long.po b/c-api/long.po index 9e87f06193..468517062a 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-04-23 00:30+0000\n" +"POT-Creation-Date: 2026-06-06 15:51+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -92,16 +92,16 @@ msgid "" "``NULL`` on failure." msgstr "" -#: ../../c-api/long.rst:77 +#: ../../c-api/long.rst:76 msgid "" -"Return a new :c:type:`PyLongObject` object from a signed C :c:expr:`int32_t` " -"or :c:expr:`int64_t`, or ``NULL`` with an exception set on failure." +"Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long " +"long`, or ``NULL`` on failure." msgstr "" -#: ../../c-api/long.rst:86 +#: ../../c-api/long.rst:83 msgid "" -"Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long " -"long`, or ``NULL`` on failure." +"Return a new :c:type:`PyLongObject` object from a signed C :c:expr:`int32_t` " +"or :c:expr:`int64_t`, or ``NULL`` with an exception set on failure." msgstr "" #: ../../c-api/long.rst:93 diff --git a/library/importlib.resources.po b/library/importlib.resources.po index 010415fbe7..aea4ecf7d7 100644 --- a/library/importlib.resources.po +++ b/library/importlib.resources.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-05-01 00:34+0000\n" +"POT-Creation-Date: 2026-06-06 15:51+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -202,8 +202,8 @@ msgstr "" #: ../../library/importlib.resources.rst:140 #: ../../library/importlib.resources.rst:183 #: ../../library/importlib.resources.rst:231 -#: ../../library/importlib.resources.rst:248 -#: ../../library/importlib.resources.rst:266 +#: ../../library/importlib.resources.rst:247 +#: ../../library/importlib.resources.rst:265 msgid "" "See :ref:`the introduction ` for details on " "*anchor* and *path_names*." @@ -220,8 +220,8 @@ msgstr "" #: ../../library/importlib.resources.rst:186 #: ../../library/importlib.resources.rst:207 #: ../../library/importlib.resources.rst:234 -#: ../../library/importlib.resources.rst:251 -#: ../../library/importlib.resources.rst:269 +#: ../../library/importlib.resources.rst:250 +#: ../../library/importlib.resources.rst:268 msgid "This function is roughly equivalent to::" msgstr "這個函式大致等同於: ::" @@ -231,7 +231,8 @@ msgstr "files(anchor).joinpath(*path_names).open('rb')" #: ../../library/importlib.resources.rst:150 #: ../../library/importlib.resources.rst:190 -#: ../../library/importlib.resources.rst:255 +#: ../../library/importlib.resources.rst:238 +#: ../../library/importlib.resources.rst:254 msgid "Multiple *path_names* are accepted." msgstr "多個 *path_names* 是被接受的。" @@ -269,7 +270,6 @@ msgstr "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" #: ../../library/importlib.resources.rst:174 #: ../../library/importlib.resources.rst:211 -#: ../../library/importlib.resources.rst:238 msgid "" "Multiple *path_names* are accepted. *encoding* and *errors* must be given as " "keyword arguments." @@ -324,17 +324,17 @@ msgstr "" msgid "as_file(files(anchor).joinpath(*path_names))" msgstr "as_file(files(anchor).joinpath(*path_names))" -#: ../../library/importlib.resources.rst:245 +#: ../../library/importlib.resources.rst:244 msgid "" "Return ``True`` if the named resource exists, otherwise ``False``. This " "function does not consider directories to be resources." msgstr "" -#: ../../library/importlib.resources.rst:253 +#: ../../library/importlib.resources.rst:252 msgid "files(anchor).joinpath(*path_names).is_file()" msgstr "files(anchor).joinpath(*path_names).is_file()" -#: ../../library/importlib.resources.rst:261 +#: ../../library/importlib.resources.rst:260 msgid "" "Return an iterable over the named items within the package or path. The " "iterable returns names of resources (e.g. files) and non-resources (e.g. " @@ -342,7 +342,7 @@ msgid "" "subdirectories." msgstr "" -#: ../../library/importlib.resources.rst:271 +#: ../../library/importlib.resources.rst:270 msgid "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" @@ -350,7 +350,7 @@ msgstr "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" -#: ../../library/importlib.resources.rst:274 +#: ../../library/importlib.resources.rst:273 msgid "" "Prefer ``iterdir()`` as above, which offers more control over the results " "and richer functionality." From 252b1dc6058e08e0993018a7193fbb59e46f329f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Jun 2026 00:44:43 +0000 Subject: [PATCH 2/4] sync with cpython 157a5df8 --- howto/functional.po | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/howto/functional.po b/howto/functional.po index 8e186ab544..a003e83e2a 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-30 00:16+0000\n" +"POT-Creation-Date: 2026-06-08 00:43+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1635,6 +1635,7 @@ msgid "" msgstr "" #: ../../howto/functional.rst:1039 +#, fuzzy msgid "" ">>> import operator, functools\n" ">>> functools.reduce(operator.concat, ['A', 'BB', 'C'])\n" @@ -1642,7 +1643,7 @@ msgid "" ">>> functools.reduce(operator.concat, [])\n" "Traceback (most recent call last):\n" " ...\n" -"TypeError: reduce() of empty sequence with no initial value\n" +"TypeError: reduce() of empty iterable with no initial value\n" ">>> functools.reduce(operator.mul, [1, 2, 3], 1)\n" "6\n" ">>> functools.reduce(operator.mul, [], 1)\n" From 9520995c46a04660e1e99160892c586106e8acd5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 9 Jun 2026 00:39:11 +0000 Subject: [PATCH 3/4] sync with cpython a8003f6d --- c-api/typeobj.po | 17 +- library/bisect.po | 5 +- library/collections.abc.po | 24 +- library/operator.po | 315 +++--- library/stdtypes.po | 2079 ++++++++++++++++++------------------ 5 files changed, 1259 insertions(+), 1181 deletions(-) diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 55ab6ac1ca..3cb8536133 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-03-19 00:23+0000\n" +"POT-Creation-Date: 2026-06-09 00:37+0000\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -4286,8 +4286,8 @@ msgstr "" #: ../../c-api/typeobj.rst:3047 msgid "" -"Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" -"expr:`view->obj` to ``NULL`` and return ``-1``." +"Check if the request can be met. If not, raise :exc:`BufferError`, set " +"``view->obj`` to ``NULL`` and return ``-1``." msgstr "" #: ../../c-api/typeobj.rst:3050 @@ -4299,8 +4299,7 @@ msgid "Increment an internal counter for the number of exports." msgstr "" #: ../../c-api/typeobj.rst:3054 -msgid "" -"Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." +msgid "Set ``view->obj`` to *exporter* and increment ``view->obj``." msgstr "" #: ../../c-api/typeobj.rst:3056 @@ -4350,14 +4349,14 @@ msgstr "" #: ../../c-api/typeobj.rst:3079 msgid "" -"Re-export: Each member of the tree acts as the exporting object and sets :c:" -"expr:`view->obj` to a new reference to itself." +"Re-export: Each member of the tree acts as the exporting object and sets " +"``view->obj`` to a new reference to itself." msgstr "" #: ../../c-api/typeobj.rst:3082 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " -"Here, :c:expr:`view->obj` will be a new reference to the root object." +"Here, ``view->obj`` will be a new reference to the root object." msgstr "" #: ../../c-api/typeobj.rst:3086 @@ -4434,7 +4433,7 @@ msgstr "" #: ../../c-api/typeobj.rst:3137 msgid "" -"This function MUST NOT decrement :c:expr:`view->obj`, since that is done " +"This function MUST NOT decrement ``view->obj``, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" diff --git a/library/bisect.po b/library/bisect.po index ad8b60c227..016e736d80 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-03-01 00:20+0000\n" +"POT-Creation-Date: 2026-06-09 00:37+0000\n" "PO-Revision-Date: 2023-08-01 12:53+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -314,8 +314,9 @@ msgstr "" "績找到相對應的字母等級:90 以上是 'A'、80 到 89 為 'B',依此類推: ::" #: ../../library/bisect.rst:206 +#, fuzzy msgid "" -">>> def grade(score)\n" +">>> def grade(score):\n" "... i = bisect([60, 70, 80, 90], score)\n" "... return \"FDCBA\"[i]\n" "...\n" diff --git a/library/collections.abc.po b/library/collections.abc.po index b999edb5cc..f5d30db6dd 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-08 00:15+0000\n" +"POT-Creation-Date: 2026-06-09 00:37+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -309,8 +309,8 @@ msgid "" "Inherited :class:`Sequence` methods and ``append``, ``clear``, ``reverse``, " "``extend``, ``pop``, ``remove``, and ``__iadd__``" msgstr "" -"繼承 :class:`Sequence` 方法和 ``append``、``clear``、``reverse``、``extend``、" -"``pop``、``remove`` 和 ``__iadd__``" +"繼承 :class:`Sequence` 方法和 ``append``、``clear``、``reverse``、" +"``extend``、``pop``、``remove`` 和 ``__iadd__``" #: ../../library/collections.abc.rst:143 msgid ":class:`ByteString`" @@ -554,15 +554,14 @@ msgid "" "ABC for classes that provide the :meth:`~iterator.__iter__` and :meth:" "`~iterator.__next__` methods. See also the definition of :term:`iterator`." msgstr "" -"有提供 :meth:`~iterator.__iter__` 和 :meth:`~iterator.__next__` 方法之類別的 ABC。" -"另請參閱 :term:`iterator` 的定義。" +"有提供 :meth:`~iterator.__iter__` 和 :meth:`~iterator.__next__` 方法之類別的 " +"ABC。另請參閱 :term:`iterator` 的定義。" #: ../../library/collections.abc.rst:247 msgid "" "ABC for iterable classes that also provide the :meth:`~object.__reversed__` " "method." -msgstr "" -"亦有提供 :meth:`~object.__reversed__` 方法之可疊代類別的 ABC。" +msgstr "亦有提供 :meth:`~object.__reversed__` 方法之可疊代類別的 ABC。" #: ../../library/collections.abc.rst:254 msgid "" @@ -635,10 +634,11 @@ msgid "" "also never understood as subtypes of :class:`!ByteString` (either at runtime " "or by static type checkers)." msgstr "" -":class:`!ByteString` 最初被設計為一個抽象類別,以作為 :class:`bytes` 和 :class:`bytearray` " -"的超型別 (supertype)。然而由於 ABC 從未擁有任何方法,知道一個物件是 :class:`!ByteString` 的" -"實例從未真正告訴你任何關於該物件的有用資訊。其他常見的緩衝區型別如 :class:`memoryview` " -"也從未被理解為 :class:`!ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" +":class:`!ByteString` 最初被設計為一個抽象類別,以作為 :class:`bytes` 和 :" +"class:`bytearray` 的超型別 (supertype)。然而由於 ABC 從未擁有任何方法,知道一" +"個物件是 :class:`!ByteString` 的實例從未真正告訴你任何關於該物件的有用資訊。" +"其他常見的緩衝區型別如 :class:`memoryview` 也從未被理解為 :class:`!" +"ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" #: ../../library/collections.abc.rst:309 msgid "See :pep:`PEP 688 <688#current-options>` for more details." @@ -819,7 +819,7 @@ msgid "" "The :class:`Set` mixin provides a :meth:`!_hash` method to compute a hash " "value for the set; however, :meth:`~object.__hash__` is not defined because " "not all sets are :term:`hashable` or immutable. To add set hashability " -"using mixins, inherit from both :meth:`Set` and :meth:`Hashable`, then " +"using mixins, inherit from both :class:`Set` and :class:`Hashable`, then " "define ``__hash__ = Set._hash``." msgstr "" diff --git a/library/operator.po b/library/operator.po index fb3db11060..f22fd5eb69 100644 --- a/library/operator.po +++ b/library/operator.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-07 00:19+0000\n" +"POT-Creation-Date: 2026-06-09 00:37+0000\n" "PO-Revision-Date: 2023-02-18 14:49+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -127,8 +127,9 @@ msgid "Return ``a + b``, for *a* and *b* numbers." msgstr "對於數字 *a* 和 *b*,回傳 ``a + b``。" #: ../../library/operator.rst:115 -msgid "Return the bitwise and of *a* and *b*." -msgstr "回傳 *x* 和 *y* 位元運算與 (and) 的結果。" +#, fuzzy +msgid "Return ``a & b``." +msgstr "回傳 ``a % b``。" #: ../../library/operator.rst:121 msgid "Return ``a // b``." @@ -146,22 +147,23 @@ msgstr "" "結果總是 :class:`int` 型別。在過去的版本中,結果可能為 ``int`` 子類別的實例。" #: ../../library/operator.rst:139 -msgid "" -"Return the bitwise inverse of the number *obj*. This is equivalent to " -"``~obj``." -msgstr "回傳數字 *obj* 按位元取反 (inverse) 的結果。這等價於 ``~obj``。" +#, fuzzy +msgid "Return ``~obj``." +msgstr "回傳 ``a % b``。" #: ../../library/operator.rst:145 -msgid "Return *a* shifted left by *b*." -msgstr "回傳 *a* 左移 *b* 位的結果。" +#, fuzzy +msgid "Return ``a << b``." +msgstr "回傳 ``a % b``。" #: ../../library/operator.rst:151 msgid "Return ``a % b``." msgstr "回傳 ``a % b``。" #: ../../library/operator.rst:157 -msgid "Return ``a * b``, for *a* and *b* numbers." -msgstr "對於數字 *a* 和 *b*,回傳 ``a * b``。" +#, fuzzy +msgid "Return ``a * b``." +msgstr "回傳 ``a % b``。" #: ../../library/operator.rst:163 msgid "Return ``a @ b``." @@ -172,20 +174,24 @@ msgid "Return *obj* negated (``-obj``)." msgstr "回傳 *obj* 取負值的結果 (\\ ``-obj``\\ )。" #: ../../library/operator.rst:177 -msgid "Return the bitwise or of *a* and *b*." -msgstr "回傳 *a* 和 *b* 按位元或 (or) 的結果。" +#, fuzzy +msgid "Return ``a | b``." +msgstr "回傳 ``a % b``。" #: ../../library/operator.rst:183 -msgid "Return *obj* positive (``+obj``)." -msgstr "回傳 *obj* 取正的結果 (\\ ``+obj``\\ )。" +#, fuzzy +msgid "Return ``+obj``." +msgstr "回傳 ``a % b``。" #: ../../library/operator.rst:189 -msgid "Return ``a ** b``, for *a* and *b* numbers." -msgstr "對於數字 *a* 和 *b*,回傳 ``a ** b``。" +#, fuzzy +msgid "Return ``a ** b``." +msgstr "回傳 ``a % b``。" #: ../../library/operator.rst:195 -msgid "Return *a* shifted right by *b*." -msgstr "回傳 *a* 右移 *b* 位的結果。" +#, fuzzy +msgid "Return ``a >> b``." +msgstr "回傳 ``a % b``。" #: ../../library/operator.rst:201 msgid "Return ``a - b``." @@ -198,8 +204,9 @@ msgid "" msgstr "回傳 ``a / b``,例如 2/3 將等於 .66 而不是 0。這也被稱為「真」除法。" #: ../../library/operator.rst:214 -msgid "Return the bitwise exclusive or of *a* and *b*." -msgstr "回傳 *a* 和 *b* 按位元異或 (exclusive or) 的結果。" +#, fuzzy +msgid "Return ``a ^ b``." +msgstr "回傳 ``a % b``。" #: ../../library/operator.rst:217 msgid "" @@ -259,8 +266,8 @@ msgid "" "arguments for :func:`map`, :func:`sorted`, :meth:`itertools.groupby`, or " "other functions that expect a function argument." msgstr "" -":mod:`!operator` module 還定義了一些用於常規屬性和條目查詢的工具。這些工具適合" -"用來編寫快速欄位提取器以作為 :func:`map`、:func:`sorted`、:meth:`itertools." +":mod:`!operator` module 還定義了一些用於常規屬性和條目查詢的工具。這些工具適" +"合用來編寫快速欄位提取器以作為 :func:`map`、:func:`sorted`、:meth:`itertools." "groupby` 或其他需要函式引數的函式之引數。" #: ../../library/operator.rst:287 @@ -508,8 +515,9 @@ msgid "``floordiv(a, b)``" msgstr "``floordiv(a, b)``" #: ../../library/operator.rst:408 -msgid "Bitwise And" -msgstr "按位元與 (And)" +#, fuzzy +msgid "Bitwise And, or Intersection" +msgstr "按位元取反 (Inversion)" #: ../../library/operator.rst:408 msgid "``a & b``" @@ -519,361 +527,364 @@ msgstr "``a & b``" msgid "``and_(a, b)``" msgstr "``and_(a, b)``" -#: ../../library/operator.rst:410 -msgid "Bitwise Exclusive Or" +#: ../../library/operator.rst:411 +#, fuzzy +msgid "Bitwise Exclusive Or, or Symmetric Difference" msgstr "按位元互斥或 (Exclusive Or)" -#: ../../library/operator.rst:410 +#: ../../library/operator.rst:411 msgid "``a ^ b``" msgstr "``a ^ b``" -#: ../../library/operator.rst:410 +#: ../../library/operator.rst:411 msgid "``xor(a, b)``" msgstr "``xor(a, b)``" -#: ../../library/operator.rst:412 -msgid "Bitwise Inversion" +#: ../../library/operator.rst:415 +#, fuzzy +msgid "Bitwise Inversion, or Complement" msgstr "按位元取反 (Inversion)" -#: ../../library/operator.rst:412 +#: ../../library/operator.rst:415 msgid "``~ a``" msgstr "``~ a``" -#: ../../library/operator.rst:412 +#: ../../library/operator.rst:415 msgid "``invert(a)``" msgstr "``invert(a)``" -#: ../../library/operator.rst:414 -msgid "Bitwise Or" +#: ../../library/operator.rst:418 +#, fuzzy +msgid "Bitwise Or, or Union" msgstr "按位元或 (Or)" -#: ../../library/operator.rst:414 +#: ../../library/operator.rst:418 msgid "``a | b``" msgstr "``a | b``" -#: ../../library/operator.rst:414 +#: ../../library/operator.rst:418 msgid "``or_(a, b)``" msgstr "``or_(a, b)``" -#: ../../library/operator.rst:416 +#: ../../library/operator.rst:421 msgid "Exponentiation" msgstr "取冪" -#: ../../library/operator.rst:416 +#: ../../library/operator.rst:421 msgid "``a ** b``" msgstr "``a ** b``" -#: ../../library/operator.rst:416 +#: ../../library/operator.rst:421 msgid "``pow(a, b)``" msgstr "``pow(a, b)``" -#: ../../library/operator.rst:418 ../../library/operator.rst:420 -#: ../../library/operator.rst:422 ../../library/operator.rst:424 +#: ../../library/operator.rst:423 ../../library/operator.rst:425 +#: ../../library/operator.rst:427 ../../library/operator.rst:429 msgid "Identity" msgstr "識別性" -#: ../../library/operator.rst:418 +#: ../../library/operator.rst:423 msgid "``a is b``" msgstr "``a is b``" -#: ../../library/operator.rst:418 +#: ../../library/operator.rst:423 msgid "``is_(a, b)``" msgstr "``is_(a, b)``" -#: ../../library/operator.rst:420 +#: ../../library/operator.rst:425 msgid "``a is not b``" msgstr "``a is not b``" -#: ../../library/operator.rst:420 +#: ../../library/operator.rst:425 msgid "``is_not(a, b)``" msgstr "``is_not(a, b)``" -#: ../../library/operator.rst:422 +#: ../../library/operator.rst:427 msgid "``a is None``" msgstr "``a is None``" -#: ../../library/operator.rst:422 +#: ../../library/operator.rst:427 msgid "``is_none(a)``" msgstr "``is_none(a)``" -#: ../../library/operator.rst:424 +#: ../../library/operator.rst:429 msgid "``a is not None``" msgstr "``a is not None``" -#: ../../library/operator.rst:424 +#: ../../library/operator.rst:429 msgid "``is_not_none(a)``" msgstr "``is_not_none(a)``" -#: ../../library/operator.rst:426 +#: ../../library/operator.rst:431 msgid "Indexed Assignment" msgstr "索引賦值" -#: ../../library/operator.rst:426 +#: ../../library/operator.rst:431 msgid "``obj[k] = v``" msgstr "``obj[k] = v``" -#: ../../library/operator.rst:426 +#: ../../library/operator.rst:431 msgid "``setitem(obj, k, v)``" msgstr "``setitem(obj, k, v)``" -#: ../../library/operator.rst:428 +#: ../../library/operator.rst:433 msgid "Indexed Deletion" msgstr "索引刪除" -#: ../../library/operator.rst:428 +#: ../../library/operator.rst:433 msgid "``del obj[k]``" msgstr "``del obj[k]``" -#: ../../library/operator.rst:428 +#: ../../library/operator.rst:433 msgid "``delitem(obj, k)``" msgstr "``delitem(obj, k)``" -#: ../../library/operator.rst:430 +#: ../../library/operator.rst:435 msgid "Indexing" msgstr "索引取值" -#: ../../library/operator.rst:430 +#: ../../library/operator.rst:435 msgid "``obj[k]``" msgstr "``obj[k]``" -#: ../../library/operator.rst:430 +#: ../../library/operator.rst:435 msgid "``getitem(obj, k)``" msgstr "``getitem(obj, k)``" -#: ../../library/operator.rst:432 +#: ../../library/operator.rst:437 msgid "Left Shift" msgstr "左移" -#: ../../library/operator.rst:432 +#: ../../library/operator.rst:437 msgid "``a << b``" msgstr "``a << b``" -#: ../../library/operator.rst:432 +#: ../../library/operator.rst:437 msgid "``lshift(a, b)``" msgstr "``lshift(a, b)``" -#: ../../library/operator.rst:434 +#: ../../library/operator.rst:439 msgid "Modulo" msgstr "模除 (Modulo)" -#: ../../library/operator.rst:434 +#: ../../library/operator.rst:439 msgid "``a % b``" msgstr "``a % b``" -#: ../../library/operator.rst:434 +#: ../../library/operator.rst:439 msgid "``mod(a, b)``" msgstr "``mod(a, b)``" -#: ../../library/operator.rst:436 +#: ../../library/operator.rst:441 msgid "Multiplication" msgstr "乘法" -#: ../../library/operator.rst:436 +#: ../../library/operator.rst:441 msgid "``a * b``" msgstr "``a * b``" -#: ../../library/operator.rst:436 +#: ../../library/operator.rst:441 msgid "``mul(a, b)``" msgstr "``mul(a, b)``" -#: ../../library/operator.rst:438 +#: ../../library/operator.rst:443 msgid "Matrix Multiplication" msgstr "矩陣乘法" -#: ../../library/operator.rst:438 +#: ../../library/operator.rst:443 msgid "``a @ b``" msgstr "``a @ b``" -#: ../../library/operator.rst:438 +#: ../../library/operator.rst:443 msgid "``matmul(a, b)``" msgstr "``matmul(a, b)``" -#: ../../library/operator.rst:440 +#: ../../library/operator.rst:445 msgid "Negation (Arithmetic)" msgstr "反相(算術)" -#: ../../library/operator.rst:440 +#: ../../library/operator.rst:445 msgid "``- a``" msgstr "``- a``" -#: ../../library/operator.rst:440 +#: ../../library/operator.rst:445 msgid "``neg(a)``" msgstr "``neg(a)``" -#: ../../library/operator.rst:442 +#: ../../library/operator.rst:447 msgid "Negation (Logical)" msgstr "反相(邏輯)" -#: ../../library/operator.rst:442 +#: ../../library/operator.rst:447 msgid "``not a``" msgstr "``not a``" -#: ../../library/operator.rst:442 +#: ../../library/operator.rst:447 msgid "``not_(a)``" msgstr "``not_(a)``" -#: ../../library/operator.rst:444 +#: ../../library/operator.rst:449 msgid "Positive" msgstr "正數" -#: ../../library/operator.rst:444 +#: ../../library/operator.rst:449 msgid "``+ a``" msgstr "``+ a``" -#: ../../library/operator.rst:444 +#: ../../library/operator.rst:449 msgid "``pos(a)``" msgstr "``pos(a)``" -#: ../../library/operator.rst:446 +#: ../../library/operator.rst:451 msgid "Right Shift" msgstr "右移" -#: ../../library/operator.rst:446 +#: ../../library/operator.rst:451 msgid "``a >> b``" msgstr "``a >> b``" -#: ../../library/operator.rst:446 +#: ../../library/operator.rst:451 msgid "``rshift(a, b)``" msgstr "``rshift(a, b)``" -#: ../../library/operator.rst:448 +#: ../../library/operator.rst:453 msgid "Slice Assignment" msgstr "切片賦值" -#: ../../library/operator.rst:448 +#: ../../library/operator.rst:453 msgid "``seq[i:j] = values``" msgstr "``seq[i:j] = values``" -#: ../../library/operator.rst:448 +#: ../../library/operator.rst:453 msgid "``setitem(seq, slice(i, j), values)``" msgstr "``setitem(seq, slice(i, j), values)``" -#: ../../library/operator.rst:450 +#: ../../library/operator.rst:455 msgid "Slice Deletion" msgstr "切片刪除" -#: ../../library/operator.rst:450 +#: ../../library/operator.rst:455 msgid "``del seq[i:j]``" msgstr "``del seq[i:j]``" -#: ../../library/operator.rst:450 +#: ../../library/operator.rst:455 msgid "``delitem(seq, slice(i, j))``" msgstr "``delitem(seq, slice(i, j))``" -#: ../../library/operator.rst:452 +#: ../../library/operator.rst:457 msgid "Slicing" msgstr "切片取值" -#: ../../library/operator.rst:452 +#: ../../library/operator.rst:457 msgid "``seq[i:j]``" msgstr "``seq[i:j]``" -#: ../../library/operator.rst:452 +#: ../../library/operator.rst:457 msgid "``getitem(seq, slice(i, j))``" msgstr "``getitem(seq, slice(i, j))``" -#: ../../library/operator.rst:454 +#: ../../library/operator.rst:459 msgid "String Formatting" msgstr "字串格式化" -#: ../../library/operator.rst:454 +#: ../../library/operator.rst:459 msgid "``s % obj``" msgstr "``s % obj``" -#: ../../library/operator.rst:454 +#: ../../library/operator.rst:459 msgid "``mod(s, obj)``" msgstr "``mod(s, obj)``" -#: ../../library/operator.rst:456 +#: ../../library/operator.rst:461 msgid "Subtraction" msgstr "減法" -#: ../../library/operator.rst:456 +#: ../../library/operator.rst:461 msgid "``a - b``" msgstr "``a - b``" -#: ../../library/operator.rst:456 +#: ../../library/operator.rst:461 msgid "``sub(a, b)``" msgstr "``sub(a, b)``" -#: ../../library/operator.rst:458 +#: ../../library/operator.rst:463 msgid "Truth Test" msgstr "真值檢測" -#: ../../library/operator.rst:458 +#: ../../library/operator.rst:463 msgid "``obj``" msgstr "``obj``" -#: ../../library/operator.rst:458 +#: ../../library/operator.rst:463 msgid "``truth(obj)``" msgstr "``truth(obj)``" -#: ../../library/operator.rst:460 ../../library/operator.rst:462 -#: ../../library/operator.rst:468 ../../library/operator.rst:470 +#: ../../library/operator.rst:465 ../../library/operator.rst:467 +#: ../../library/operator.rst:473 ../../library/operator.rst:475 msgid "Ordering" msgstr "比較大小" -#: ../../library/operator.rst:460 +#: ../../library/operator.rst:465 msgid "``a < b``" msgstr "``a < b``" -#: ../../library/operator.rst:460 +#: ../../library/operator.rst:465 msgid "``lt(a, b)``" msgstr "``lt(a, b)``" -#: ../../library/operator.rst:462 +#: ../../library/operator.rst:467 msgid "``a <= b``" msgstr "``a <= b``" -#: ../../library/operator.rst:462 +#: ../../library/operator.rst:467 msgid "``le(a, b)``" msgstr "``le(a, b)``" -#: ../../library/operator.rst:464 +#: ../../library/operator.rst:469 msgid "Equality" msgstr "相等性" -#: ../../library/operator.rst:464 +#: ../../library/operator.rst:469 msgid "``a == b``" msgstr "``a == b``" -#: ../../library/operator.rst:464 +#: ../../library/operator.rst:469 msgid "``eq(a, b)``" msgstr "``eq(a, b)``" -#: ../../library/operator.rst:466 +#: ../../library/operator.rst:471 msgid "Difference" msgstr "不等性" -#: ../../library/operator.rst:466 +#: ../../library/operator.rst:471 msgid "``a != b``" msgstr "``a != b``" -#: ../../library/operator.rst:466 +#: ../../library/operator.rst:471 msgid "``ne(a, b)``" msgstr "``ne(a, b)``" -#: ../../library/operator.rst:468 +#: ../../library/operator.rst:473 msgid "``a >= b``" msgstr "``a >= b``" -#: ../../library/operator.rst:468 +#: ../../library/operator.rst:473 msgid "``ge(a, b)``" msgstr "``ge(a, b)``" -#: ../../library/operator.rst:470 +#: ../../library/operator.rst:475 msgid "``a > b``" msgstr "``a > b``" -#: ../../library/operator.rst:470 +#: ../../library/operator.rst:475 msgid "``gt(a, b)``" msgstr "``gt(a, b)``" -#: ../../library/operator.rst:474 +#: ../../library/operator.rst:479 msgid "In-place Operators" msgstr "原地 (in-place) 運算子" -#: ../../library/operator.rst:476 +#: ../../library/operator.rst:481 msgid "" "Many operations have an \"in-place\" version. Listed below are functions " "providing a more primitive access to in-place operators than the usual " @@ -887,7 +898,7 @@ msgstr "" "iadd(x, y)``。換一種方式來講就是 ``z = operator.iadd(x, y)`` 等價於複合陳述" "式 ``z = x; z += y``。" -#: ../../library/operator.rst:483 +#: ../../library/operator.rst:488 msgid "" "In those examples, note that when an in-place method is called, the " "computation and assignment are performed in two separate steps. The in-" @@ -897,7 +908,7 @@ msgstr "" "在這些例子中,請注意當呼叫一個原地方法時,運算和賦值是分成兩個步驟來執行的。" "下面列出的原地函式只執行第一步,即呼叫原地方法,第二步賦值則不加處理。" -#: ../../library/operator.rst:488 +#: ../../library/operator.rst:493 msgid "" "For immutable targets such as strings, numbers, and tuples, the updated " "value is computed, but not assigned back to the input variable:" @@ -905,7 +916,7 @@ msgstr "" "對於不可變 (immutable) 的目標例如字串、數字和 tupple,更新的值會被計算,但不" "會被再被賦值給輸入變數:" -#: ../../library/operator.rst:497 +#: ../../library/operator.rst:502 msgid "" "For mutable targets such as lists and dictionaries, the in-place method will " "perform the update, so no subsequent assignment is necessary:" @@ -913,59 +924,91 @@ msgstr "" "對於可變 (mutable) 的目標例如 list 和 dictionary,原地方法將執行更新,因此不" "需要後續賦值操作:" -#: ../../library/operator.rst:509 +#: ../../library/operator.rst:514 msgid "``a = iadd(a, b)`` is equivalent to ``a += b``." msgstr "``a = iadd(a, b)`` 等價於 ``a += b``。" -#: ../../library/operator.rst:515 +#: ../../library/operator.rst:520 msgid "``a = iand(a, b)`` is equivalent to ``a &= b``." msgstr "``a = iand(a, b)`` 等價於 ``a &= b``。" -#: ../../library/operator.rst:521 +#: ../../library/operator.rst:526 msgid "" "``a = iconcat(a, b)`` is equivalent to ``a += b`` for *a* and *b* sequences." msgstr "``a = iconcat(a, b)`` 等價於 ``a += b``,其中 *a* 和 *b* 為序列。" -#: ../../library/operator.rst:527 +#: ../../library/operator.rst:532 msgid "``a = ifloordiv(a, b)`` is equivalent to ``a //= b``." msgstr "``a = ifloordiv(a, b)`` 等價於 ``a //= b``。" -#: ../../library/operator.rst:533 +#: ../../library/operator.rst:538 msgid "``a = ilshift(a, b)`` is equivalent to ``a <<= b``." msgstr "``a = ilshift(a, b)`` 等價於 ``a <<= b``。" -#: ../../library/operator.rst:539 +#: ../../library/operator.rst:544 msgid "``a = imod(a, b)`` is equivalent to ``a %= b``." msgstr "``a = imod(a, b)`` 等價於 ``a %= b``。" -#: ../../library/operator.rst:545 +#: ../../library/operator.rst:550 msgid "``a = imul(a, b)`` is equivalent to ``a *= b``." msgstr "``a = imul(a, b)`` 等價於 ``a *= b``。" -#: ../../library/operator.rst:551 +#: ../../library/operator.rst:556 msgid "``a = imatmul(a, b)`` is equivalent to ``a @= b``." msgstr "``a = imatmul(a, b)`` 等價於 ``a @= b``。" -#: ../../library/operator.rst:559 +#: ../../library/operator.rst:564 msgid "``a = ior(a, b)`` is equivalent to ``a |= b``." msgstr "``a = ior(a, b)`` 等價於 ``a |= b``。" -#: ../../library/operator.rst:565 +#: ../../library/operator.rst:570 msgid "``a = ipow(a, b)`` is equivalent to ``a **= b``." msgstr "``a = ipow(a, b)`` 等價於 ``a **= b``。" -#: ../../library/operator.rst:571 +#: ../../library/operator.rst:576 msgid "``a = irshift(a, b)`` is equivalent to ``a >>= b``." msgstr "``a = irshift(a, b)`` 等價於 ``a >>= b``。" -#: ../../library/operator.rst:577 +#: ../../library/operator.rst:582 msgid "``a = isub(a, b)`` is equivalent to ``a -= b``." msgstr "``a = isub(a, b)`` 等價於 ``a -= b``。" -#: ../../library/operator.rst:583 +#: ../../library/operator.rst:588 msgid "``a = itruediv(a, b)`` is equivalent to ``a /= b``." msgstr "``a = itruediv(a, b)`` 等價於 ``a /= b``。" -#: ../../library/operator.rst:589 +#: ../../library/operator.rst:594 msgid "``a = ixor(a, b)`` is equivalent to ``a ^= b``." msgstr "``a = ixor(a, b)`` 等價於 ``a ^= b``。" + +#~ msgid "Return the bitwise and of *a* and *b*." +#~ msgstr "回傳 *x* 和 *y* 位元運算與 (and) 的結果。" + +#~ msgid "" +#~ "Return the bitwise inverse of the number *obj*. This is equivalent to " +#~ "``~obj``." +#~ msgstr "回傳數字 *obj* 按位元取反 (inverse) 的結果。這等價於 ``~obj``。" + +#~ msgid "Return *a* shifted left by *b*." +#~ msgstr "回傳 *a* 左移 *b* 位的結果。" + +#~ msgid "Return ``a * b``, for *a* and *b* numbers." +#~ msgstr "對於數字 *a* 和 *b*,回傳 ``a * b``。" + +#~ msgid "Return the bitwise or of *a* and *b*." +#~ msgstr "回傳 *a* 和 *b* 按位元或 (or) 的結果。" + +#~ msgid "Return *obj* positive (``+obj``)." +#~ msgstr "回傳 *obj* 取正的結果 (\\ ``+obj``\\ )。" + +#~ msgid "Return ``a ** b``, for *a* and *b* numbers." +#~ msgstr "對於數字 *a* 和 *b*,回傳 ``a ** b``。" + +#~ msgid "Return *a* shifted right by *b*." +#~ msgstr "回傳 *a* 右移 *b* 位的結果。" + +#~ msgid "Return the bitwise exclusive or of *a* and *b*." +#~ msgstr "回傳 *a* 和 *b* 按位元異或 (exclusive or) 的結果。" + +#~ msgid "Bitwise And" +#~ msgstr "按位元與 (And)" diff --git a/library/stdtypes.po b/library/stdtypes.po index d3e442205e..09165d599a 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-06-05 00:42+0000\n" +"POT-Creation-Date: 2026-06-09 00:37+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -139,8 +139,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:292 #: ../../library/stdtypes.rst:432 ../../library/stdtypes.rst:1015 -#: ../../library/stdtypes.rst:1237 ../../library/stdtypes.rst:3175 -#: ../../library/stdtypes.rst:4444 +#: ../../library/stdtypes.rst:1237 ../../library/stdtypes.rst:3190 +#: ../../library/stdtypes.rst:4459 msgid "Notes" msgstr "註解" @@ -154,7 +154,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:90 ../../library/stdtypes.rst:1017 #: ../../library/stdtypes.rst:1020 ../../library/stdtypes.rst:1252 -#: ../../library/stdtypes.rst:3181 ../../library/stdtypes.rst:4450 +#: ../../library/stdtypes.rst:3196 ../../library/stdtypes.rst:4465 msgid "\\(1)" msgstr "\\(1)" @@ -168,8 +168,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:93 ../../library/stdtypes.rst:305 #: ../../library/stdtypes.rst:325 ../../library/stdtypes.rst:1263 -#: ../../library/stdtypes.rst:3185 ../../library/stdtypes.rst:3187 -#: ../../library/stdtypes.rst:4454 ../../library/stdtypes.rst:4456 +#: ../../library/stdtypes.rst:3200 ../../library/stdtypes.rst:3202 +#: ../../library/stdtypes.rst:4469 ../../library/stdtypes.rst:4471 msgid "\\(2)" msgstr "\\(2)" @@ -181,18 +181,18 @@ msgstr "``not x``" msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" -#: ../../library/stdtypes.rst:96 ../../library/stdtypes.rst:3189 -#: ../../library/stdtypes.rst:3191 ../../library/stdtypes.rst:3193 -#: ../../library/stdtypes.rst:3195 ../../library/stdtypes.rst:4458 -#: ../../library/stdtypes.rst:4460 ../../library/stdtypes.rst:4462 -#: ../../library/stdtypes.rst:4464 +#: ../../library/stdtypes.rst:96 ../../library/stdtypes.rst:3204 +#: ../../library/stdtypes.rst:3206 ../../library/stdtypes.rst:3208 +#: ../../library/stdtypes.rst:3210 ../../library/stdtypes.rst:4473 +#: ../../library/stdtypes.rst:4475 ../../library/stdtypes.rst:4477 +#: ../../library/stdtypes.rst:4479 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:105 ../../library/stdtypes.rst:336 #: ../../library/stdtypes.rst:450 ../../library/stdtypes.rst:1059 -#: ../../library/stdtypes.rst:1267 ../../library/stdtypes.rst:3225 -#: ../../library/stdtypes.rst:4494 +#: ../../library/stdtypes.rst:1267 ../../library/stdtypes.rst:3240 +#: ../../library/stdtypes.rst:4509 msgid "Notes:" msgstr "註解:" @@ -239,9 +239,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:146 ../../library/stdtypes.rst:3152 -#: ../../library/stdtypes.rst:3175 ../../library/stdtypes.rst:4421 -#: ../../library/stdtypes.rst:4444 +#: ../../library/stdtypes.rst:146 ../../library/stdtypes.rst:3167 +#: ../../library/stdtypes.rst:3190 ../../library/stdtypes.rst:4436 +#: ../../library/stdtypes.rst:4459 msgid "Meaning" msgstr "含義" @@ -591,8 +591,8 @@ msgid "" "zero." msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" -#: ../../library/stdtypes.rst:318 ../../library/stdtypes.rst:3183 -#: ../../library/stdtypes.rst:4481 +#: ../../library/stdtypes.rst:318 ../../library/stdtypes.rst:3198 +#: ../../library/stdtypes.rst:4496 msgid "\\(6)" msgstr "\\(6)" @@ -629,9 +629,9 @@ msgid "*x* to the power *y*" msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:327 ../../library/stdtypes.rst:329 -#: ../../library/stdtypes.rst:3208 ../../library/stdtypes.rst:3211 -#: ../../library/stdtypes.rst:3214 ../../library/stdtypes.rst:4477 -#: ../../library/stdtypes.rst:4484 +#: ../../library/stdtypes.rst:3223 ../../library/stdtypes.rst:3226 +#: ../../library/stdtypes.rst:3229 ../../library/stdtypes.rst:4492 +#: ../../library/stdtypes.rst:4499 msgid "\\(5)" msgstr "\\(5)" @@ -789,9 +789,9 @@ msgid "bitwise :dfn:`or` of *x* and *y*" msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:437 -#: ../../library/stdtypes.rst:440 ../../library/stdtypes.rst:3197 -#: ../../library/stdtypes.rst:3201 ../../library/stdtypes.rst:4466 -#: ../../library/stdtypes.rst:4470 +#: ../../library/stdtypes.rst:440 ../../library/stdtypes.rst:3212 +#: ../../library/stdtypes.rst:3216 ../../library/stdtypes.rst:4481 +#: ../../library/stdtypes.rst:4485 msgid "\\(4)" msgstr "\\(4)" @@ -1142,8 +1142,7 @@ msgstr "" #: ../../library/stdtypes.rst:646 msgid "" "Class method to return a floating-point number constructed from a number *x*." -msgstr "" -"Class method 會基於數字 *x* 建構並回傳一個浮點數。" +msgstr "Class method 會基於數字 *x* 建構並回傳一個浮點數。" #: ../../library/stdtypes.rst:648 msgid "" @@ -1152,8 +1151,8 @@ msgid "" "returned. If the argument is outside the range of a Python float, an :exc:" "`OverflowError` will be raised." msgstr "" -"如果參數是整數或浮點數,將回傳具有相同值的浮點數(在 Python 浮點數精度範圍內)。" -"如果參數超出 Python 浮點數的範圍,將引發 :exc:`OverflowError`。" +"如果參數是整數或浮點數,將回傳具有相同值的浮點數(在 Python 浮點數精度範圍" +"內)。如果參數超出 Python 浮點數的範圍,將引發 :exc:`OverflowError`。" #: ../../library/stdtypes.rst:653 msgid "" @@ -1161,8 +1160,9 @@ msgid "" "__float__()``. If :meth:`~object.__float__` is not defined then it falls " "back to :meth:`~object.__index__`." msgstr "" -"對於任意 Python 物件 ``x``,``float.from_number(x)`` 會委派給 ``x.__float__()``。" -"若 :meth:`~object.__float__` 未定義,則會退回 :meth:`~object.__index__`。" +"對於任意 Python 物件 ``x``,``float.from_number(x)`` 會委派給 ``x." +"__float__()``。若 :meth:`~object.__float__` 未定義,則會退回 :meth:`~object." +"__index__`。" #: ../../library/stdtypes.rst:663 msgid "" @@ -1318,9 +1318,10 @@ msgid "" "falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " "defined then it falls back to :meth:`~object.__index__`." msgstr "" -"對於任意 Python 物件 ``x``,``complex.from_number(x)`` 會委派給 ``x.__complex__()``。" -"若 :meth:`~object.__complex__` 未定義,則會退回 :meth:`~object.__float__`。" -"若 :meth:`!__float__` 未定義,則會退回 :meth:`~object.__index__`。" +"對於任意 Python 物件 ``x``,``complex.from_number(x)`` 會委派給 ``x." +"__complex__()``。若 :meth:`~object.__complex__` 未定義,則會退回 :meth:" +"`~object.__float__`。若 :meth:`!__float__` 未定義,則會退回 :meth:`~object." +"__index__`。" #: ../../library/stdtypes.rst:761 msgid "Hashing of numeric types" @@ -3212,7 +3213,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1923 ../../library/stdtypes.rst:3620 +#: ../../library/stdtypes.rst:1923 ../../library/stdtypes.rst:3635 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -3248,11 +3249,11 @@ msgstr "" ">>> encoded_str_to_bytes\n" "b'Python'" -#: ../../library/stdtypes.rst:1946 ../../library/stdtypes.rst:3639 +#: ../../library/stdtypes.rst:1946 ../../library/stdtypes.rst:3654 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1949 ../../library/stdtypes.rst:3642 +#: ../../library/stdtypes.rst:1949 ../../library/stdtypes.rst:3657 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." @@ -3555,27 +3556,65 @@ msgid "" "least one character, ``False`` otherwise. Digits include decimal characters " "and digits that need special handling, such as the compatibility superscript " "digits. This covers digits which cannot be used to form numbers in base 10, " -"like the Kharosthi numbers. Formally, a digit is a character that has the " +"like the `Kharosthi numbers `__. Formally, a digit is a character that has the " "property value Numeric_Type=Digit or Numeric_Type=Decimal." msgstr "" +#: ../../library/stdtypes.rst:2181 ../../library/stdtypes.rst:2262 +#: ../../library/stdtypes.rst:2279 ../../library/stdtypes.rst:2306 +#: ../../library/stdtypes.rst:2361 ../../library/stdtypes.rst:2434 +#: ../../library/stdtypes.rst:2545 ../../library/stdtypes.rst:2566 +#: ../../library/stdtypes.rst:2630 ../../library/stdtypes.rst:2650 +#: ../../library/stdtypes.rst:2664 ../../library/stdtypes.rst:2751 +#: ../../library/stdtypes.rst:2775 ../../library/stdtypes.rst:2789 +#: ../../library/stdtypes.rst:2896 +msgid "For example:" +msgstr "舉例來說:" + #: ../../library/stdtypes.rst:2183 +#, fuzzy +msgid "" +">>> '0123456789'.isdigit()\n" +"True\n" +">>> '٠١٢٣٤٥٦٧٨٩'.isdigit() # Arabic-Indic digits zero to nine\n" +"True\n" +">>> '⅕'.isdigit() # Vulgar fraction one fifth\n" +"False\n" +">>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric()\n" +"(False, True, True)" +msgstr "" +">>> '0123456789'.isnumeric()\n" +"True\n" +">>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # 阿拉伯-印度數字零到九\n" +"True\n" +">>> '⅕'.isnumeric() # 普通分數五分之一\n" +"True\n" +">>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric()\n" +"(False, True, True)" + +#: ../../library/stdtypes.rst:2194 +#, fuzzy +msgid "See also :meth:`isdecimal` and :meth:`isnumeric`." +msgstr "另請參閱 :meth:`index` 和 :meth:`find`。" + +#: ../../library/stdtypes.rst:2199 msgid "" "Return ``True`` if the string is a valid identifier according to the " "language definition, section :ref:`identifiers`." msgstr "" -#: ../../library/stdtypes.rst:2186 +#: ../../library/stdtypes.rst:2202 msgid "" ":func:`keyword.iskeyword` can be used to test whether string ``s`` is a " "reserved identifier, such as :keyword:`def` and :keyword:`class`." msgstr "" -#: ../../library/stdtypes.rst:2189 +#: ../../library/stdtypes.rst:2205 msgid "Example: ::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:2192 +#: ../../library/stdtypes.rst:2208 msgid "" ">>> from keyword import iskeyword\n" "\n" @@ -3591,13 +3630,13 @@ msgstr "" ">>> 'def'.isidentifier(), iskeyword('def')\n" "(True, True)" -#: ../../library/stdtypes.rst:2202 +#: ../../library/stdtypes.rst:2218 msgid "" "Return ``True`` if all cased characters [4]_ in the string are lowercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:2208 +#: ../../library/stdtypes.rst:2224 msgid "" "Return ``True`` if all characters in the string are numeric characters, and " "there is at least one character, ``False`` otherwise. Numeric characters " @@ -3607,11 +3646,12 @@ msgid "" "Numeric_Type=Decimal or Numeric_Type=Numeric. For example:" msgstr "" -#: ../../library/stdtypes.rst:2216 +#: ../../library/stdtypes.rst:2232 +#, fuzzy msgid "" ">>> '0123456789'.isnumeric()\n" "True\n" -">>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-indic digit zero to nine\n" +">>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-Indic digits zero to nine\n" "True\n" ">>> '⅕'.isnumeric() # Vulgar fraction one fifth\n" "True\n" @@ -3627,20 +3667,18 @@ msgstr "" ">>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric()\n" "(False, True, True)" -#: ../../library/stdtypes.rst:2227 -msgid "" -"See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters are a " -"superset of decimal numbers." -msgstr "" -"也請參閱 :meth:`isdecimal` 和 :meth:`isdigit`。數字字元是十進位數字的超集。" +#: ../../library/stdtypes.rst:2243 +#, fuzzy +msgid "See also :meth:`isdecimal` and :meth:`isdigit`." +msgstr "另請參閱 :meth:`index` 和 :meth:`find`。" -#: ../../library/stdtypes.rst:2233 +#: ../../library/stdtypes.rst:2248 msgid "" "Return ``True`` if all characters in the string are printable, ``False`` if " "it contains at least one non-printable character." msgstr "" -#: ../../library/stdtypes.rst:2236 +#: ../../library/stdtypes.rst:2251 msgid "" "Here \"printable\" means the character is suitable for :func:`repr` to use " "in its output; \"non-printable\" means that :func:`repr` on built-in types " @@ -3648,7 +3686,7 @@ msgid "" "written to :data:`sys.stdout` or :data:`sys.stderr`." msgstr "" -#: ../../library/stdtypes.rst:2241 +#: ../../library/stdtypes.rst:2256 msgid "" "The printable characters are those which in the Unicode character database " "(see :mod:`unicodedata`) have a general category in group Letter, Mark, " @@ -3657,17 +3695,7 @@ msgid "" "C), except the ASCII space." msgstr "" -#: ../../library/stdtypes.rst:2247 ../../library/stdtypes.rst:2264 -#: ../../library/stdtypes.rst:2291 ../../library/stdtypes.rst:2346 -#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:2530 -#: ../../library/stdtypes.rst:2551 ../../library/stdtypes.rst:2615 -#: ../../library/stdtypes.rst:2635 ../../library/stdtypes.rst:2649 -#: ../../library/stdtypes.rst:2736 ../../library/stdtypes.rst:2760 -#: ../../library/stdtypes.rst:2774 ../../library/stdtypes.rst:2881 -msgid "For example:" -msgstr "舉例來說:" - -#: ../../library/stdtypes.rst:2249 +#: ../../library/stdtypes.rst:2264 msgid "" ">>> ''.isprintable(), ' '.isprintable()\n" "(True, True)\n" @@ -3679,17 +3707,17 @@ msgstr "" ">>> '\\t'.isprintable(), '\\n'.isprintable()\n" "(False, False)" -#: ../../library/stdtypes.rst:2256 +#: ../../library/stdtypes.rst:2271 msgid "See also :meth:`isspace`." msgstr "另請參閱 :meth:`isspace`。" -#: ../../library/stdtypes.rst:2261 +#: ../../library/stdtypes.rst:2276 msgid "" "Return ``True`` if there are only whitespace characters in the string and " "there is at least one character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:2266 +#: ../../library/stdtypes.rst:2281 msgid "" ">>> ''.isspace()\n" "False\n" @@ -3701,18 +3729,18 @@ msgid "" "True" msgstr "" -#: ../../library/stdtypes.rst:2277 +#: ../../library/stdtypes.rst:2292 msgid "" "A character is *whitespace* if in the Unicode character database (see :mod:" "`unicodedata`), either its general category is ``Zs`` (\"Separator, " "space\"), or its bidirectional class is one of ``WS``, ``B``, or ``S``." msgstr "" -#: ../../library/stdtypes.rst:2282 +#: ../../library/stdtypes.rst:2297 msgid "See also :meth:`isprintable`." msgstr "另請參閱 :meth:`isprintable`。" -#: ../../library/stdtypes.rst:2287 +#: ../../library/stdtypes.rst:2302 msgid "" "Return ``True`` if the string is a titlecased string and there is at least " "one character, for example uppercase characters may only follow uncased " @@ -3720,7 +3748,7 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:2293 +#: ../../library/stdtypes.rst:2308 msgid "" ">>> 'Spam, Spam, Spam'.istitle()\n" "True\n" @@ -3736,17 +3764,17 @@ msgstr "" ">>> 'SPAM, SPAM, SPAM'.istitle()\n" "False" -#: ../../library/stdtypes.rst:2302 +#: ../../library/stdtypes.rst:2317 msgid "See also :meth:`title`." msgstr "另請參閱 :meth:`title`。" -#: ../../library/stdtypes.rst:2307 +#: ../../library/stdtypes.rst:2322 msgid "" "Return ``True`` if all cased characters [4]_ in the string are uppercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:2325 +#: ../../library/stdtypes.rst:2340 msgid "" "Return a string which is the concatenation of the strings in *iterable*. A :" "exc:`TypeError` will be raised if there are any non-string values in " @@ -3754,7 +3782,7 @@ msgid "" "elements is the string providing this method. For example:" msgstr "" -#: ../../library/stdtypes.rst:2330 +#: ../../library/stdtypes.rst:2345 msgid "" ">>> ', '.join(['spam', 'spam', 'spam'])\n" "'spam, spam, spam'\n" @@ -3766,18 +3794,18 @@ msgstr "" ">>> '-'.join('Python')\n" "'P-y-t-h-o-n'" -#: ../../library/stdtypes.rst:2337 +#: ../../library/stdtypes.rst:2352 msgid "See also :meth:`split`." msgstr "另請參閱 :meth:`split`。" -#: ../../library/stdtypes.rst:2342 +#: ../../library/stdtypes.rst:2357 msgid "" "Return the string left justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2348 +#: ../../library/stdtypes.rst:2363 msgid "" ">>> 'Python'.ljust(10)\n" "'Python '\n" @@ -3793,17 +3821,17 @@ msgstr "" ">>> 'Monty Python'.ljust(10, '.')\n" "'Monty Python'" -#: ../../library/stdtypes.rst:2357 ../../library/stdtypes.rst:2890 +#: ../../library/stdtypes.rst:2372 ../../library/stdtypes.rst:2905 msgid "See also :meth:`rjust`." msgstr "另請參閱 :meth:`rjust`。" -#: ../../library/stdtypes.rst:2362 +#: ../../library/stdtypes.rst:2377 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase. For example:" msgstr "" -#: ../../library/stdtypes.rst:2365 +#: ../../library/stdtypes.rst:2380 msgid "" ">>> 'Lower Method Example'.lower()\n" "'lower method example'" @@ -3811,14 +3839,14 @@ msgstr "" ">>> 'Lower Method Example'.lower()\n" "'lower method example'" -#: ../../library/stdtypes.rst:2370 +#: ../../library/stdtypes.rst:2385 msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2377 +#: ../../library/stdtypes.rst:2392 msgid "" "Return a copy of the string with leading characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3827,7 +3855,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2382 +#: ../../library/stdtypes.rst:2397 msgid "" ">>> ' spacious '.lstrip()\n" "'spacious '\n" @@ -3839,13 +3867,13 @@ msgstr "" ">>> 'www.example.com'.lstrip('cmowz.')\n" "'example.com'" -#: ../../library/stdtypes.rst:2387 +#: ../../library/stdtypes.rst:2402 msgid "" "See :meth:`str.removeprefix` for a method that will remove a single prefix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2390 +#: ../../library/stdtypes.rst:2405 msgid "" ">>> 'Arthur: three!'.lstrip('Arthur: ')\n" "'ee!'\n" @@ -3857,13 +3885,13 @@ msgstr "" ">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" "'three!'" -#: ../../library/stdtypes.rst:2399 +#: ../../library/stdtypes.rst:2414 msgid "" "This static method returns a translation table usable for :meth:`str." "translate`." msgstr "" -#: ../../library/stdtypes.rst:2401 +#: ../../library/stdtypes.rst:2416 msgid "" "If there is only one argument, it must be a dictionary mapping Unicode " "ordinals (integers) or characters (strings of length 1) to Unicode ordinals, " @@ -3871,7 +3899,7 @@ msgid "" "converted to ordinals." msgstr "" -#: ../../library/stdtypes.rst:2406 +#: ../../library/stdtypes.rst:2421 msgid "" "If there are two arguments, they must be strings of equal length, and in the " "resulting dictionary, each character in *from* will be mapped to the " @@ -3879,7 +3907,7 @@ msgid "" "must be a string, whose characters will be mapped to ``None`` in the result." msgstr "" -#: ../../library/stdtypes.rst:2414 +#: ../../library/stdtypes.rst:2429 msgid "" "Split the string at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3887,7 +3915,7 @@ msgid "" "containing the string itself, followed by two empty strings." msgstr "" -#: ../../library/stdtypes.rst:2421 +#: ../../library/stdtypes.rst:2436 msgid "" ">>> 'Monty Python'.partition(' ')\n" "('Monty', ' ', 'Python')\n" @@ -3903,17 +3931,17 @@ msgstr "" ">>> 'Monty Python'.partition('-')\n" "('Monty Python', '', '')" -#: ../../library/stdtypes.rst:2430 +#: ../../library/stdtypes.rst:2445 msgid "See also :meth:`rpartition`." msgstr "另請參閱 :meth:`rpartition`。" -#: ../../library/stdtypes.rst:2435 +#: ../../library/stdtypes.rst:2450 msgid "" "If the string starts with the *prefix* string, return " "``string[len(prefix):]``. Otherwise, return a copy of the original string:" msgstr "" -#: ../../library/stdtypes.rst:2439 +#: ../../library/stdtypes.rst:2454 msgid "" ">>> 'TestHook'.removeprefix('Test')\n" "'Hook'\n" @@ -3925,18 +3953,18 @@ msgstr "" ">>> 'BaseTestCase'.removeprefix('Test')\n" "'BaseTestCase'" -#: ../../library/stdtypes.rst:2448 +#: ../../library/stdtypes.rst:2463 msgid "See also :meth:`removesuffix` and :meth:`startswith`." msgstr "另請參閱 :meth:`removesuffix` 和 :meth:`startswith`。" -#: ../../library/stdtypes.rst:2453 +#: ../../library/stdtypes.rst:2468 msgid "" "If the string ends with the *suffix* string and that *suffix* is not empty, " "return ``string[:-len(suffix)]``. Otherwise, return a copy of the original " "string:" msgstr "" -#: ../../library/stdtypes.rst:2457 +#: ../../library/stdtypes.rst:2472 msgid "" ">>> 'MiscTests'.removesuffix('Tests')\n" "'Misc'\n" @@ -3948,11 +3976,11 @@ msgstr "" ">>> 'TmpDirMixin'.removesuffix('Tests')\n" "'TmpDirMixin'" -#: ../../library/stdtypes.rst:2466 +#: ../../library/stdtypes.rst:2481 msgid "See also :meth:`removeprefix` and :meth:`endswith`." msgstr "另請參閱 :meth:`removeprefix` 和 :meth:`endswith`。" -#: ../../library/stdtypes.rst:2471 +#: ../../library/stdtypes.rst:2486 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " "by *new*. If *count* is given, only the first *count* occurrences are " @@ -3960,7 +3988,7 @@ msgid "" "replaced. For example:" msgstr "" -#: ../../library/stdtypes.rst:2476 +#: ../../library/stdtypes.rst:2491 msgid "" ">>> 'spam, spam, spam'.replace('spam', 'eggs')\n" "'eggs, eggs, eggs'\n" @@ -3972,11 +4000,11 @@ msgstr "" ">>> 'spam, spam, spam'.replace('spam', 'eggs', 1)\n" "'eggs, spam, spam'" -#: ../../library/stdtypes.rst:2483 +#: ../../library/stdtypes.rst:2498 msgid "*count* is now supported as a keyword argument." msgstr "*count* 現在作為關鍵字引數被支援。" -#: ../../library/stdtypes.rst:2489 +#: ../../library/stdtypes.rst:2504 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " @@ -3984,7 +4012,7 @@ msgid "" "For example:" msgstr "" -#: ../../library/stdtypes.rst:2494 +#: ../../library/stdtypes.rst:2509 msgid "" ">>> 'spam, spam, spam'.rfind('sp')\n" "12\n" @@ -3996,17 +4024,17 @@ msgstr "" ">>> 'spam, spam, spam'.rfind('sp', 0, 10)\n" "6" -#: ../../library/stdtypes.rst:2501 +#: ../../library/stdtypes.rst:2516 msgid "See also :meth:`find` and :meth:`rindex`." msgstr "另請參閱 :meth:`find` 和 :meth:`rindex`。" -#: ../../library/stdtypes.rst:2506 +#: ../../library/stdtypes.rst:2521 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found. For example:" msgstr "" -#: ../../library/stdtypes.rst:2510 +#: ../../library/stdtypes.rst:2525 msgid "" ">>> 'spam, spam, spam'.rindex('spam')\n" "12\n" @@ -4026,18 +4054,18 @@ msgstr "" " ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^\n" "ValueError: substring not found" -#: ../../library/stdtypes.rst:2521 +#: ../../library/stdtypes.rst:2536 msgid "See also :meth:`index` and :meth:`find`." msgstr "另請參閱 :meth:`index` 和 :meth:`find`。" -#: ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2541 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2532 +#: ../../library/stdtypes.rst:2547 msgid "" ">>> 'Python'.rjust(10)\n" "' Python'\n" @@ -4053,11 +4081,11 @@ msgstr "" ">>> 'Monty Python'.rjust(10, '.')\n" "'Monty Python'" -#: ../../library/stdtypes.rst:2541 +#: ../../library/stdtypes.rst:2556 msgid "See also :meth:`ljust` and :meth:`zfill`." msgstr "另請參閱 :meth:`ljust` 和 :meth:`zfill`。" -#: ../../library/stdtypes.rst:2546 +#: ../../library/stdtypes.rst:2561 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -4065,7 +4093,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2553 +#: ../../library/stdtypes.rst:2568 msgid "" ">>> 'Monty Python'.rpartition(' ')\n" "('Monty', ' ', 'Python')\n" @@ -4081,11 +4109,11 @@ msgstr "" ">>> 'Monty Python'.rpartition('-')\n" "('', '', 'Monty Python')" -#: ../../library/stdtypes.rst:2562 +#: ../../library/stdtypes.rst:2577 msgid "See also :meth:`partition`." msgstr "另請參閱 :meth:`partition`。" -#: ../../library/stdtypes.rst:2567 +#: ../../library/stdtypes.rst:2582 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -4094,7 +4122,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2576 +#: ../../library/stdtypes.rst:2591 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -4103,7 +4131,7 @@ msgid "" "are stripped. For example:" msgstr "" -#: ../../library/stdtypes.rst:2582 +#: ../../library/stdtypes.rst:2597 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -4115,13 +4143,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2589 +#: ../../library/stdtypes.rst:2604 msgid "" "See :meth:`removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2592 +#: ../../library/stdtypes.rst:2607 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -4133,11 +4161,11 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2597 +#: ../../library/stdtypes.rst:2612 msgid "See also :meth:`strip`." msgstr "另請參閱 :meth:`strip`。" -#: ../../library/stdtypes.rst:2602 +#: ../../library/stdtypes.rst:2617 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -4146,7 +4174,7 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2608 +#: ../../library/stdtypes.rst:2623 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " @@ -4156,7 +4184,7 @@ msgid "" "``['']``." msgstr "" -#: ../../library/stdtypes.rst:2617 +#: ../../library/stdtypes.rst:2632 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -4176,7 +4204,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2628 +#: ../../library/stdtypes.rst:2643 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive whitespace are regarded as a single separator, " @@ -4186,7 +4214,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2637 +#: ../../library/stdtypes.rst:2652 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -4202,13 +4230,13 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2646 +#: ../../library/stdtypes.rst:2661 msgid "" "If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only " "leading runs of consecutive whitespace are considered." msgstr "" -#: ../../library/stdtypes.rst:2651 +#: ../../library/stdtypes.rst:2666 msgid "" ">>> \"\".split(None, 0)\n" "[]\n" @@ -4224,136 +4252,136 @@ msgstr "" ">>> \" foo \".split(maxsplit=0)\n" "['foo ']" -#: ../../library/stdtypes.rst:2660 +#: ../../library/stdtypes.rst:2675 msgid "See also :meth:`join` and :meth:`rsplit`." msgstr "另請參閱 :meth:`join` 和 :meth:`rsplit`。" -#: ../../library/stdtypes.rst:2668 +#: ../../library/stdtypes.rst:2683 msgid "" "Return a list of the lines in the string, breaking at line boundaries. Line " "breaks are not included in the resulting list unless *keepends* is given and " "true." msgstr "" -#: ../../library/stdtypes.rst:2672 +#: ../../library/stdtypes.rst:2687 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2676 +#: ../../library/stdtypes.rst:2691 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2676 +#: ../../library/stdtypes.rst:2691 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2678 +#: ../../library/stdtypes.rst:2693 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2678 +#: ../../library/stdtypes.rst:2693 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2680 +#: ../../library/stdtypes.rst:2695 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2680 +#: ../../library/stdtypes.rst:2695 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2682 +#: ../../library/stdtypes.rst:2697 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2682 +#: ../../library/stdtypes.rst:2697 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2684 +#: ../../library/stdtypes.rst:2699 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2684 +#: ../../library/stdtypes.rst:2699 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2686 +#: ../../library/stdtypes.rst:2701 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2686 +#: ../../library/stdtypes.rst:2701 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2688 +#: ../../library/stdtypes.rst:2703 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2688 +#: ../../library/stdtypes.rst:2703 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2690 +#: ../../library/stdtypes.rst:2705 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2690 +#: ../../library/stdtypes.rst:2705 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2692 +#: ../../library/stdtypes.rst:2707 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2692 +#: ../../library/stdtypes.rst:2707 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2694 +#: ../../library/stdtypes.rst:2709 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2694 +#: ../../library/stdtypes.rst:2709 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2696 +#: ../../library/stdtypes.rst:2711 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2696 +#: ../../library/stdtypes.rst:2711 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2698 +#: ../../library/stdtypes.rst:2713 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2698 +#: ../../library/stdtypes.rst:2713 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2703 +#: ../../library/stdtypes.rst:2718 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2705 ../../library/stdtypes.rst:2811 -#: ../../library/stdtypes.rst:2980 ../../library/stdtypes.rst:3955 -#: ../../library/stdtypes.rst:3973 ../../library/stdtypes.rst:4063 -#: ../../library/stdtypes.rst:4079 ../../library/stdtypes.rst:4104 -#: ../../library/stdtypes.rst:4118 ../../library/stdtypes.rst:4146 -#: ../../library/stdtypes.rst:4160 ../../library/stdtypes.rst:4178 -#: ../../library/stdtypes.rst:4205 ../../library/stdtypes.rst:4228 -#: ../../library/stdtypes.rst:4255 ../../library/stdtypes.rst:4297 -#: ../../library/stdtypes.rst:4321 +#: ../../library/stdtypes.rst:2720 ../../library/stdtypes.rst:2826 +#: ../../library/stdtypes.rst:2995 ../../library/stdtypes.rst:3970 +#: ../../library/stdtypes.rst:3988 ../../library/stdtypes.rst:4078 +#: ../../library/stdtypes.rst:4094 ../../library/stdtypes.rst:4119 +#: ../../library/stdtypes.rst:4133 ../../library/stdtypes.rst:4161 +#: ../../library/stdtypes.rst:4175 ../../library/stdtypes.rst:4193 +#: ../../library/stdtypes.rst:4220 ../../library/stdtypes.rst:4243 +#: ../../library/stdtypes.rst:4270 ../../library/stdtypes.rst:4312 +#: ../../library/stdtypes.rst:4336 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2707 +#: ../../library/stdtypes.rst:2722 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -4365,14 +4393,14 @@ msgstr "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: ../../library/stdtypes.rst:2712 +#: ../../library/stdtypes.rst:2727 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:2716 +#: ../../library/stdtypes.rst:2731 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -4384,11 +4412,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2721 +#: ../../library/stdtypes.rst:2736 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2723 +#: ../../library/stdtypes.rst:2738 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -4400,7 +4428,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:2746 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -4408,7 +4436,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2738 +#: ../../library/stdtypes.rst:2753 msgid "" ">>> 'Python'.startswith('Py')\n" "True\n" @@ -4424,11 +4452,11 @@ msgstr "" ">>> 'Python is amazing'.startswith('is', 7)\n" "True" -#: ../../library/stdtypes.rst:2747 +#: ../../library/stdtypes.rst:2762 msgid "See also :meth:`endswith` and :meth:`removeprefix`." msgstr "另請參閱 :meth:`endswith` 和 :meth:`removeprefix`。" -#: ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2767 msgid "" "Return a copy of the string with the leading and trailing characters " "removed. The *chars* argument is a string specifying the set of characters " @@ -4437,11 +4465,11 @@ msgid "" "all combinations of its values are stripped." msgstr "" -#: ../../library/stdtypes.rst:2758 +#: ../../library/stdtypes.rst:2773 msgid "Whitespace characters are defined by :meth:`str.isspace`." msgstr "" -#: ../../library/stdtypes.rst:2762 +#: ../../library/stdtypes.rst:2777 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -4453,7 +4481,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2769 +#: ../../library/stdtypes.rst:2784 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -4461,7 +4489,7 @@ msgid "" "A similar action takes place on the trailing end." msgstr "" -#: ../../library/stdtypes.rst:2776 +#: ../../library/stdtypes.rst:2791 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -4471,17 +4499,17 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2782 +#: ../../library/stdtypes.rst:2797 msgid "See also :meth:`rstrip`." msgstr "另請參閱 :meth:`rstrip`。" -#: ../../library/stdtypes.rst:2787 +#: ../../library/stdtypes.rst:2802 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " "and vice versa. For example:" msgstr "" -#: ../../library/stdtypes.rst:2790 +#: ../../library/stdtypes.rst:2805 msgid "" ">>> 'Hello World'.swapcase()\n" "'hELLO wORLD'" @@ -4489,13 +4517,13 @@ msgstr "" ">>> 'Hello World'.swapcase()\n" "'hELLO wORLD'" -#: ../../library/stdtypes.rst:2795 +#: ../../library/stdtypes.rst:2810 msgid "" "Note that it is not necessarily true that ``s.swapcase().swapcase() == s``. " "For example:" msgstr "" -#: ../../library/stdtypes.rst:2798 +#: ../../library/stdtypes.rst:2813 msgid "" ">>> 'straße'.swapcase().swapcase()\n" "'strasse'" @@ -4503,17 +4531,17 @@ msgstr "" ">>> 'straße'.swapcase().swapcase()\n" "'strasse'" -#: ../../library/stdtypes.rst:2803 +#: ../../library/stdtypes.rst:2818 msgid "See also :meth:`str.lower` and :meth:`str.upper`." msgstr "另請參閱 :meth:`str.lower` 和 :meth:`str.upper`。" -#: ../../library/stdtypes.rst:2808 +#: ../../library/stdtypes.rst:2823 msgid "" "Return a titlecased version of the string where words start with an " "uppercase character and the remaining characters are lowercase." msgstr "" -#: ../../library/stdtypes.rst:2813 +#: ../../library/stdtypes.rst:2828 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -4521,7 +4549,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2816 ../../library/stdtypes.rst:4265 +#: ../../library/stdtypes.rst:2831 ../../library/stdtypes.rst:4280 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " @@ -4529,7 +4557,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2821 +#: ../../library/stdtypes.rst:2836 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -4537,19 +4565,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2824 +#: ../../library/stdtypes.rst:2839 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2827 +#: ../../library/stdtypes.rst:2842 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2830 +#: ../../library/stdtypes.rst:2845 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -4569,11 +4597,11 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2839 +#: ../../library/stdtypes.rst:2854 msgid "See also :meth:`istitle`." msgstr "另請參閱 :meth:`istitle`。" -#: ../../library/stdtypes.rst:2844 +#: ../../library/stdtypes.rst:2859 msgid "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " @@ -4585,19 +4613,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2868 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2856 +#: ../../library/stdtypes.rst:2871 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2862 +#: ../../library/stdtypes.rst:2877 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` " @@ -4606,14 +4634,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2868 +#: ../../library/stdtypes.rst:2883 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2875 +#: ../../library/stdtypes.rst:2890 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " @@ -4621,7 +4649,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2883 +#: ../../library/stdtypes.rst:2898 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -4633,27 +4661,27 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2910 +#: ../../library/stdtypes.rst:2925 msgid "Formatted String Literals (f-strings)" msgstr "" -#: ../../library/stdtypes.rst:2913 +#: ../../library/stdtypes.rst:2928 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" -#: ../../library/stdtypes.rst:2916 +#: ../../library/stdtypes.rst:2931 msgid "Added the debug specifier (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2918 +#: ../../library/stdtypes.rst:2933 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../library/stdtypes.rst:2922 +#: ../../library/stdtypes.rst:2937 msgid "" "An :dfn:`f-string` (formally a :dfn:`formatted string literal`) is a string " "literal that is prefixed with ``f`` or ``F``. This type of string literal " @@ -4662,29 +4690,29 @@ msgid "" "replacement field must contain an expression, optionally followed by:" msgstr "" -#: ../../library/stdtypes.rst:2929 +#: ../../library/stdtypes.rst:2944 msgid "a *debug specifier* -- an equal sign (``=``);" msgstr "" -#: ../../library/stdtypes.rst:2930 +#: ../../library/stdtypes.rst:2945 msgid "a *conversion specifier* -- ``!s``, ``!r`` or ``!a``; and/or" msgstr "" -#: ../../library/stdtypes.rst:2931 +#: ../../library/stdtypes.rst:2946 msgid "a *format specifier* prefixed with a colon (``:``)." msgstr "" -#: ../../library/stdtypes.rst:2933 +#: ../../library/stdtypes.rst:2948 msgid "" "See the :ref:`Lexical Analysis section on f-strings ` for details " "on the syntax of these fields." msgstr "" -#: ../../library/stdtypes.rst:2937 +#: ../../library/stdtypes.rst:2952 msgid "Debug specifier" msgstr "" -#: ../../library/stdtypes.rst:2941 +#: ../../library/stdtypes.rst:2956 msgid "" "If a debug specifier -- an equal sign (``=``) -- appears after the " "replacement field expression, the resulting f-string will contain the " @@ -4692,7 +4720,7 @@ msgid "" "is often useful for debugging::" msgstr "" -#: ../../library/stdtypes.rst:2946 +#: ../../library/stdtypes.rst:2961 msgid "" ">>> number = 14.3\n" ">>> f'{number=}'\n" @@ -4702,13 +4730,13 @@ msgstr "" ">>> f'{number=}'\n" "'number=14.3'" -#: ../../library/stdtypes.rst:2950 +#: ../../library/stdtypes.rst:2965 msgid "" "Whitespace before, inside and after the expression, as well as whitespace " "after the equal sign, is significant --- it is retained in the result::" msgstr "" -#: ../../library/stdtypes.rst:2953 +#: ../../library/stdtypes.rst:2968 msgid "" ">>> f'{ number - 4 = }'\n" "' number - 4 = 10.3'" @@ -4716,17 +4744,17 @@ msgstr "" ">>> f'{ number - 4 = }'\n" "' number - 4 = 10.3'" -#: ../../library/stdtypes.rst:2958 +#: ../../library/stdtypes.rst:2973 msgid "Conversion specifier" msgstr "" -#: ../../library/stdtypes.rst:2960 +#: ../../library/stdtypes.rst:2975 msgid "" "By default, the value of a replacement field expression is converted to a " "string using :func:`str`::" msgstr "" -#: ../../library/stdtypes.rst:2963 +#: ../../library/stdtypes.rst:2978 msgid "" ">>> from fractions import Fraction\n" ">>> one_third = Fraction(1, 3)\n" @@ -4738,13 +4766,13 @@ msgstr "" ">>> f'{one_third}'\n" "'1/3'" -#: ../../library/stdtypes.rst:2968 +#: ../../library/stdtypes.rst:2983 msgid "" "When a debug specifier but no format specifier is used, the default " "conversion instead uses :func:`repr`::" msgstr "" -#: ../../library/stdtypes.rst:2971 +#: ../../library/stdtypes.rst:2986 msgid "" ">>> f'{one_third = }'\n" "'one_third = Fraction(1, 3)'" @@ -4752,24 +4780,24 @@ msgstr "" ">>> f'{one_third = }'\n" "'one_third = Fraction(1, 3)'" -#: ../../library/stdtypes.rst:2974 +#: ../../library/stdtypes.rst:2989 msgid "" "The conversion can be specified explicitly using one of these specifiers:" msgstr "" -#: ../../library/stdtypes.rst:2976 +#: ../../library/stdtypes.rst:2991 msgid "``!s`` for :func:`str`" msgstr "``!s`` 用於 :func:`str`" -#: ../../library/stdtypes.rst:2977 +#: ../../library/stdtypes.rst:2992 msgid "``!r`` for :func:`repr`" msgstr "``!r`` 用於 :func:`repr`" -#: ../../library/stdtypes.rst:2978 +#: ../../library/stdtypes.rst:2993 msgid "``!a`` for :func:`ascii`" msgstr "``!a`` 用於 :func:`ascii`" -#: ../../library/stdtypes.rst:2982 +#: ../../library/stdtypes.rst:2997 msgid "" ">>> str(one_third)\n" "'1/3'\n" @@ -4801,11 +4829,11 @@ msgstr "" ">>> f'{string = !a}'\n" "\"string = '\\\\xa1ko\\\\u010dka \\\\U0001f638!'\"" -#: ../../library/stdtypes.rst:2999 +#: ../../library/stdtypes.rst:3014 msgid "Format specifier" msgstr "" -#: ../../library/stdtypes.rst:3001 +#: ../../library/stdtypes.rst:3016 msgid "" "After the expression has been evaluated, and possibly converted using an " "explicit conversion specifier, it is formatted using the :func:`format` " @@ -4815,7 +4843,7 @@ msgid "" "the replacement field. For example::" msgstr "" -#: ../../library/stdtypes.rst:3008 +#: ../../library/stdtypes.rst:3023 msgid "" ">>> from fractions import Fraction\n" ">>> one_third = Fraction(1, 3)\n" @@ -4839,29 +4867,29 @@ msgstr "" ">>> f'{one_third = :~>10}~'\n" "'one_third = ~~~~~~~1/3~'" -#: ../../library/stdtypes.rst:3022 +#: ../../library/stdtypes.rst:3037 msgid "Template String Literals (t-strings)" msgstr "模板字串字面值 (t-strings)" -#: ../../library/stdtypes.rst:3024 +#: ../../library/stdtypes.rst:3039 msgid "" "An :dfn:`t-string` (formally a :dfn:`template string literal`) is a string " "literal that is prefixed with ``t`` or ``T``." msgstr "" -#: ../../library/stdtypes.rst:3027 +#: ../../library/stdtypes.rst:3042 msgid "" "These strings follow the same syntax and evaluation rules as :ref:`formatted " "string literals `, with for the following differences:" msgstr "" -#: ../../library/stdtypes.rst:3031 +#: ../../library/stdtypes.rst:3046 msgid "" "Rather than evaluating to a ``str`` object, template string literals " "evaluate to a :class:`string.templatelib.Template` object." msgstr "" -#: ../../library/stdtypes.rst:3034 +#: ../../library/stdtypes.rst:3049 msgid "" "The :func:`format` protocol is not used. Instead, the format specifier and " "conversions (if any) are passed to a new :class:`~string.templatelib." @@ -4870,7 +4898,7 @@ msgid "" "Template` object to decide how to handle format specifiers and conversions." msgstr "" -#: ../../library/stdtypes.rst:3041 +#: ../../library/stdtypes.rst:3056 msgid "" "Format specifiers containing nested replacement fields are evaluated " "eagerly, prior to being passed to the :class:`~string.templatelib." @@ -4880,7 +4908,7 @@ msgid "" "to be ``2``, the resulting format specifier would be ``'.2f'``." msgstr "" -#: ../../library/stdtypes.rst:3049 +#: ../../library/stdtypes.rst:3064 msgid "" "When the equals sign ``'='`` is provided in an interpolation expression, the " "text of the expression is appended to the literal string that precedes the " @@ -4892,18 +4920,18 @@ msgid "" "behaviour." msgstr "" -#: ../../library/stdtypes.rst:3063 +#: ../../library/stdtypes.rst:3078 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:3076 +#: ../../library/stdtypes.rst:3091 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " "dictionaries correctly)." msgstr "" -#: ../../library/stdtypes.rst:3080 +#: ../../library/stdtypes.rst:3095 msgid "" "Using :ref:`formatted string literals `, the :meth:`str.format` " "interface, or :class:`string.Template` may help avoid these errors. Each of " @@ -4911,7 +4939,7 @@ msgid "" "flexibility, and/or extensibility." msgstr "" -#: ../../library/stdtypes.rst:3085 +#: ../../library/stdtypes.rst:3100 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -4921,7 +4949,7 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:3092 +#: ../../library/stdtypes.rst:3107 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." @@ -4929,7 +4957,7 @@ msgstr "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." -#: ../../library/stdtypes.rst:3097 +#: ../../library/stdtypes.rst:3112 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -4937,36 +4965,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3107 ../../library/stdtypes.rst:4376 +#: ../../library/stdtypes.rst:3122 ../../library/stdtypes.rst:4391 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:3110 ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:3125 ../../library/stdtypes.rst:4394 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:3112 ../../library/stdtypes.rst:4381 +#: ../../library/stdtypes.rst:3127 ../../library/stdtypes.rst:4396 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:3115 ../../library/stdtypes.rst:4384 +#: ../../library/stdtypes.rst:3130 ../../library/stdtypes.rst:4399 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:3118 ../../library/stdtypes.rst:4387 +#: ../../library/stdtypes.rst:3133 ../../library/stdtypes.rst:4402 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" -#: ../../library/stdtypes.rst:3122 ../../library/stdtypes.rst:4391 +#: ../../library/stdtypes.rst:3137 ../../library/stdtypes.rst:4406 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -4974,15 +5002,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:3127 ../../library/stdtypes.rst:4396 +#: ../../library/stdtypes.rst:3142 ../../library/stdtypes.rst:4411 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:3129 ../../library/stdtypes.rst:4398 +#: ../../library/stdtypes.rst:3144 ../../library/stdtypes.rst:4413 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:3131 +#: ../../library/stdtypes.rst:3146 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " @@ -4990,286 +5018,286 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3140 ../../library/stdtypes.rst:4409 +#: ../../library/stdtypes.rst:3155 ../../library/stdtypes.rst:4424 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:3143 ../../library/stdtypes.rst:4412 +#: ../../library/stdtypes.rst:3158 ../../library/stdtypes.rst:4427 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:3152 ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:3167 ../../library/stdtypes.rst:4436 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:3154 ../../library/stdtypes.rst:4423 +#: ../../library/stdtypes.rst:3169 ../../library/stdtypes.rst:4438 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:3154 ../../library/stdtypes.rst:4423 +#: ../../library/stdtypes.rst:3169 ../../library/stdtypes.rst:4438 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:3157 ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:3172 ../../library/stdtypes.rst:4441 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:3157 ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:3172 ../../library/stdtypes.rst:4441 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:3159 ../../library/stdtypes.rst:4428 +#: ../../library/stdtypes.rst:3174 ../../library/stdtypes.rst:4443 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:3159 ../../library/stdtypes.rst:4428 +#: ../../library/stdtypes.rst:3174 ../../library/stdtypes.rst:4443 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:3162 ../../library/stdtypes.rst:4431 +#: ../../library/stdtypes.rst:3177 ../../library/stdtypes.rst:4446 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:3162 ../../library/stdtypes.rst:4431 +#: ../../library/stdtypes.rst:3177 ../../library/stdtypes.rst:4446 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:3165 ../../library/stdtypes.rst:4434 +#: ../../library/stdtypes.rst:3180 ../../library/stdtypes.rst:4449 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:3165 ../../library/stdtypes.rst:4434 +#: ../../library/stdtypes.rst:3180 ../../library/stdtypes.rst:4449 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:3169 ../../library/stdtypes.rst:4438 +#: ../../library/stdtypes.rst:3184 ../../library/stdtypes.rst:4453 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -#: ../../library/stdtypes.rst:3172 ../../library/stdtypes.rst:4441 +#: ../../library/stdtypes.rst:3187 ../../library/stdtypes.rst:4456 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:3175 ../../library/stdtypes.rst:4444 +#: ../../library/stdtypes.rst:3190 ../../library/stdtypes.rst:4459 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:3177 ../../library/stdtypes.rst:4446 +#: ../../library/stdtypes.rst:3192 ../../library/stdtypes.rst:4461 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:3177 ../../library/stdtypes.rst:3179 -#: ../../library/stdtypes.rst:4446 ../../library/stdtypes.rst:4448 +#: ../../library/stdtypes.rst:3192 ../../library/stdtypes.rst:3194 +#: ../../library/stdtypes.rst:4461 ../../library/stdtypes.rst:4463 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:3179 ../../library/stdtypes.rst:4448 +#: ../../library/stdtypes.rst:3194 ../../library/stdtypes.rst:4463 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:3181 ../../library/stdtypes.rst:4450 +#: ../../library/stdtypes.rst:3196 ../../library/stdtypes.rst:4465 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:3181 ../../library/stdtypes.rst:4450 +#: ../../library/stdtypes.rst:3196 ../../library/stdtypes.rst:4465 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:3183 ../../library/stdtypes.rst:4452 +#: ../../library/stdtypes.rst:3198 ../../library/stdtypes.rst:4467 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:3183 ../../library/stdtypes.rst:4452 +#: ../../library/stdtypes.rst:3198 ../../library/stdtypes.rst:4467 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:3185 ../../library/stdtypes.rst:4454 +#: ../../library/stdtypes.rst:3200 ../../library/stdtypes.rst:4469 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:3185 ../../library/stdtypes.rst:4454 +#: ../../library/stdtypes.rst:3200 ../../library/stdtypes.rst:4469 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:3187 ../../library/stdtypes.rst:4456 +#: ../../library/stdtypes.rst:3202 ../../library/stdtypes.rst:4471 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:3187 ../../library/stdtypes.rst:4456 +#: ../../library/stdtypes.rst:3202 ../../library/stdtypes.rst:4471 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:3189 ../../library/stdtypes.rst:4458 +#: ../../library/stdtypes.rst:3204 ../../library/stdtypes.rst:4473 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:3189 ../../library/stdtypes.rst:4458 +#: ../../library/stdtypes.rst:3204 ../../library/stdtypes.rst:4473 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:3191 ../../library/stdtypes.rst:4460 +#: ../../library/stdtypes.rst:3206 ../../library/stdtypes.rst:4475 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:3191 ../../library/stdtypes.rst:4460 +#: ../../library/stdtypes.rst:3206 ../../library/stdtypes.rst:4475 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:3193 ../../library/stdtypes.rst:4462 +#: ../../library/stdtypes.rst:3208 ../../library/stdtypes.rst:4477 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:3193 ../../library/stdtypes.rst:3195 -#: ../../library/stdtypes.rst:4462 ../../library/stdtypes.rst:4464 +#: ../../library/stdtypes.rst:3208 ../../library/stdtypes.rst:3210 +#: ../../library/stdtypes.rst:4477 ../../library/stdtypes.rst:4479 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:3195 ../../library/stdtypes.rst:4464 +#: ../../library/stdtypes.rst:3210 ../../library/stdtypes.rst:4479 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:3197 ../../library/stdtypes.rst:4466 +#: ../../library/stdtypes.rst:3212 ../../library/stdtypes.rst:4481 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:3197 ../../library/stdtypes.rst:4466 +#: ../../library/stdtypes.rst:3212 ../../library/stdtypes.rst:4481 msgid "" "Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:3201 ../../library/stdtypes.rst:4470 +#: ../../library/stdtypes.rst:3216 ../../library/stdtypes.rst:4485 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:3201 ../../library/stdtypes.rst:4470 +#: ../../library/stdtypes.rst:3216 ../../library/stdtypes.rst:4485 msgid "" "Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:3205 ../../library/stdtypes.rst:4474 +#: ../../library/stdtypes.rst:3220 ../../library/stdtypes.rst:4489 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:3205 +#: ../../library/stdtypes.rst:3220 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:3208 ../../library/stdtypes.rst:4487 +#: ../../library/stdtypes.rst:3223 ../../library/stdtypes.rst:4502 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:3208 +#: ../../library/stdtypes.rst:3223 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:3211 ../../library/stdtypes.rst:4481 +#: ../../library/stdtypes.rst:3226 ../../library/stdtypes.rst:4496 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:3211 +#: ../../library/stdtypes.rst:3226 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:3214 ../../library/stdtypes.rst:4484 +#: ../../library/stdtypes.rst:3229 ../../library/stdtypes.rst:4499 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:3214 +#: ../../library/stdtypes.rst:3229 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:3217 ../../library/stdtypes.rst:4490 +#: ../../library/stdtypes.rst:3232 ../../library/stdtypes.rst:4505 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:3217 ../../library/stdtypes.rst:4490 +#: ../../library/stdtypes.rst:3232 ../../library/stdtypes.rst:4505 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:3221 +#: ../../library/stdtypes.rst:3236 msgid "" "For floating-point formats, the result should be correctly rounded to a " "given precision ``p`` of digits after the decimal point. The rounding mode " "matches that of the :func:`round` builtin." msgstr "" -#: ../../library/stdtypes.rst:3228 ../../library/stdtypes.rst:4497 +#: ../../library/stdtypes.rst:3243 ../../library/stdtypes.rst:4512 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:3232 ../../library/stdtypes.rst:4501 +#: ../../library/stdtypes.rst:3247 ../../library/stdtypes.rst:4516 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" -#: ../../library/stdtypes.rst:3236 ../../library/stdtypes.rst:4505 +#: ../../library/stdtypes.rst:3251 ../../library/stdtypes.rst:4520 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:3239 ../../library/stdtypes.rst:4508 +#: ../../library/stdtypes.rst:3254 ../../library/stdtypes.rst:4523 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:3243 ../../library/stdtypes.rst:4512 +#: ../../library/stdtypes.rst:3258 ../../library/stdtypes.rst:4527 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" -#: ../../library/stdtypes.rst:3246 ../../library/stdtypes.rst:4515 +#: ../../library/stdtypes.rst:3261 ../../library/stdtypes.rst:4530 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:3250 ../../library/stdtypes.rst:4519 +#: ../../library/stdtypes.rst:3265 ../../library/stdtypes.rst:4534 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:3253 ../../library/stdtypes.rst:4528 +#: ../../library/stdtypes.rst:3268 ../../library/stdtypes.rst:4543 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:3255 +#: ../../library/stdtypes.rst:3270 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" -#: ../../library/stdtypes.rst:3260 +#: ../../library/stdtypes.rst:3275 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:3271 +#: ../../library/stdtypes.rst:3286 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:3279 +#: ../../library/stdtypes.rst:3294 msgid "" "The core built-in types for manipulating binary data are :class:`bytes` and :" "class:`bytearray`. They are supported by :class:`memoryview` which uses the :" @@ -5277,17 +5305,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:3284 +#: ../../library/stdtypes.rst:3299 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" -#: ../../library/stdtypes.rst:3290 +#: ../../library/stdtypes.rst:3305 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:3294 +#: ../../library/stdtypes.rst:3309 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -5295,40 +5323,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:3302 +#: ../../library/stdtypes.rst:3317 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" -#: ../../library/stdtypes.rst:3305 +#: ../../library/stdtypes.rst:3320 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:3306 +#: ../../library/stdtypes.rst:3321 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:3307 +#: ../../library/stdtypes.rst:3322 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:3309 +#: ../../library/stdtypes.rst:3324 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" -#: ../../library/stdtypes.rst:3313 +#: ../../library/stdtypes.rst:3328 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" -#: ../../library/stdtypes.rst:3317 +#: ../../library/stdtypes.rst:3332 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -5341,29 +5369,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:3327 +#: ../../library/stdtypes.rst:3342 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:3330 +#: ../../library/stdtypes.rst:3345 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:3331 +#: ../../library/stdtypes.rst:3346 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:3332 +#: ../../library/stdtypes.rst:3347 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:3334 +#: ../../library/stdtypes.rst:3349 msgid "Also see the :ref:`bytes ` built-in." msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:3336 +#: ../../library/stdtypes.rst:3351 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -5371,38 +5399,38 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:3342 +#: ../../library/stdtypes.rst:3357 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:3349 +#: ../../library/stdtypes.rst:3364 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:3353 +#: ../../library/stdtypes.rst:3368 msgid "" ":meth:`bytes.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-like " "objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3357 +#: ../../library/stdtypes.rst:3372 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3363 ../../library/stdtypes.rst:3454 +#: ../../library/stdtypes.rst:3378 ../../library/stdtypes.rst:3469 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:3369 +#: ../../library/stdtypes.rst:3384 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -5411,13 +5439,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:3386 +#: ../../library/stdtypes.rst:3401 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" -#: ../../library/stdtypes.rst:3390 +#: ../../library/stdtypes.rst:3405 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " @@ -5425,58 +5453,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3395 +#: ../../library/stdtypes.rst:3410 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:3403 +#: ../../library/stdtypes.rst:3418 msgid "Bytearray Objects" msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:3407 +#: ../../library/stdtypes.rst:3422 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:3413 +#: ../../library/stdtypes.rst:3428 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:3416 +#: ../../library/stdtypes.rst:3431 msgid "Creating an empty instance: ``bytearray()``" msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:3417 +#: ../../library/stdtypes.rst:3432 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:3418 +#: ../../library/stdtypes.rst:3433 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:3419 +#: ../../library/stdtypes.rst:3434 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:3421 +#: ../../library/stdtypes.rst:3436 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" -#: ../../library/stdtypes.rst:3425 +#: ../../library/stdtypes.rst:3440 msgid "Also see the :ref:`bytearray ` built-in." msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:3427 +#: ../../library/stdtypes.rst:3442 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -5484,64 +5512,64 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:3433 +#: ../../library/stdtypes.rst:3448 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:3440 +#: ../../library/stdtypes.rst:3455 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:3444 +#: ../../library/stdtypes.rst:3459 msgid "" ":meth:`bytearray.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-" "like objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3448 +#: ../../library/stdtypes.rst:3463 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3462 +#: ../../library/stdtypes.rst:3477 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:3469 +#: ../../library/stdtypes.rst:3484 msgid "" "Resize the :class:`bytearray` to contain *size* bytes. *size* must be " "greater than or equal to 0." msgstr "" -#: ../../library/stdtypes.rst:3472 +#: ../../library/stdtypes.rst:3487 msgid "" "If the :class:`bytearray` needs to shrink, bytes beyond *size* are truncated." msgstr "" -#: ../../library/stdtypes.rst:3474 +#: ../../library/stdtypes.rst:3489 msgid "" "If the :class:`bytearray` needs to grow, all new bytes, those beyond *size*, " "will be set to null bytes." msgstr "" -#: ../../library/stdtypes.rst:3478 +#: ../../library/stdtypes.rst:3493 msgid "This is equivalent to:" msgstr "等同於:" -#: ../../library/stdtypes.rst:3486 +#: ../../library/stdtypes.rst:3501 msgid "Examples:" msgstr "範例:" -#: ../../library/stdtypes.rst:3499 +#: ../../library/stdtypes.rst:3514 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " @@ -5549,7 +5577,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3504 +#: ../../library/stdtypes.rst:3519 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -5557,17 +5585,17 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:3511 +#: ../../library/stdtypes.rst:3526 msgid "" "For detailed information on thread-safety guarantees for :class:`bytearray` " "objects, see :ref:`thread-safety-bytearray`." msgstr "" -#: ../../library/stdtypes.rst:3518 +#: ../../library/stdtypes.rst:3533 msgid "Bytes and Bytearray Operations" msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:3523 +#: ../../library/stdtypes.rst:3538 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -5576,14 +5604,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:3531 +#: ../../library/stdtypes.rst:3546 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" -#: ../../library/stdtypes.rst:3535 +#: ../../library/stdtypes.rst:3550 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -5591,11 +5619,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:3538 +#: ../../library/stdtypes.rst:3553 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:3540 +#: ../../library/stdtypes.rst:3555 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -5603,60 +5631,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:3543 +#: ../../library/stdtypes.rst:3558 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -#: ../../library/stdtypes.rst:3548 +#: ../../library/stdtypes.rst:3563 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" -#: ../../library/stdtypes.rst:3551 +#: ../../library/stdtypes.rst:3566 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:3557 +#: ../../library/stdtypes.rst:3572 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:3561 ../../library/stdtypes.rst:3666 -#: ../../library/stdtypes.rst:3688 ../../library/stdtypes.rst:3754 -#: ../../library/stdtypes.rst:3767 +#: ../../library/stdtypes.rst:3576 ../../library/stdtypes.rst:3681 +#: ../../library/stdtypes.rst:3703 ../../library/stdtypes.rst:3769 +#: ../../library/stdtypes.rst:3782 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" -#: ../../library/stdtypes.rst:3564 +#: ../../library/stdtypes.rst:3579 msgid "" "If *sub* is empty, returns the number of empty slices between characters " "which is the length of the bytes object plus one." msgstr "" -#: ../../library/stdtypes.rst:3567 ../../library/stdtypes.rst:3678 -#: ../../library/stdtypes.rst:3691 ../../library/stdtypes.rst:3757 -#: ../../library/stdtypes.rst:3770 +#: ../../library/stdtypes.rst:3582 ../../library/stdtypes.rst:3693 +#: ../../library/stdtypes.rst:3706 ../../library/stdtypes.rst:3772 +#: ../../library/stdtypes.rst:3785 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:3574 +#: ../../library/stdtypes.rst:3589 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" -#: ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:3593 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -5668,32 +5696,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:3583 +#: ../../library/stdtypes.rst:3598 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" -#: ../../library/stdtypes.rst:3587 ../../library/stdtypes.rst:3609 -#: ../../library/stdtypes.rst:3742 ../../library/stdtypes.rst:3835 -#: ../../library/stdtypes.rst:3849 ../../library/stdtypes.rst:3879 -#: ../../library/stdtypes.rst:3893 ../../library/stdtypes.rst:3934 -#: ../../library/stdtypes.rst:4004 ../../library/stdtypes.rst:4022 -#: ../../library/stdtypes.rst:4050 ../../library/stdtypes.rst:4189 -#: ../../library/stdtypes.rst:4244 ../../library/stdtypes.rst:4287 -#: ../../library/stdtypes.rst:4308 ../../library/stdtypes.rst:4330 -#: ../../library/stdtypes.rst:4532 +#: ../../library/stdtypes.rst:3602 ../../library/stdtypes.rst:3624 +#: ../../library/stdtypes.rst:3757 ../../library/stdtypes.rst:3850 +#: ../../library/stdtypes.rst:3864 ../../library/stdtypes.rst:3894 +#: ../../library/stdtypes.rst:3908 ../../library/stdtypes.rst:3949 +#: ../../library/stdtypes.rst:4019 ../../library/stdtypes.rst:4037 +#: ../../library/stdtypes.rst:4065 ../../library/stdtypes.rst:4204 +#: ../../library/stdtypes.rst:4259 ../../library/stdtypes.rst:4302 +#: ../../library/stdtypes.rst:4323 ../../library/stdtypes.rst:4345 +#: ../../library/stdtypes.rst:4547 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" -#: ../../library/stdtypes.rst:3596 +#: ../../library/stdtypes.rst:3611 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" -#: ../../library/stdtypes.rst:3600 +#: ../../library/stdtypes.rst:3615 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -5705,15 +5733,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:3605 +#: ../../library/stdtypes.rst:3620 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3618 +#: ../../library/stdtypes.rst:3633 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:3623 +#: ../../library/stdtypes.rst:3638 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -5721,21 +5749,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:3629 +#: ../../library/stdtypes.rst:3644 msgid "" "For performance reasons, the value of *errors* is not checked for validity " "unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" "`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:3635 +#: ../../library/stdtypes.rst:3650 msgid "" "Passing the *encoding* argument to :class:`str` allows decoding any :term:" "`bytes-like object` directly, without needing to make a temporary :class:`!" "bytes` or :class:`!bytearray` object." msgstr "" -#: ../../library/stdtypes.rst:3650 +#: ../../library/stdtypes.rst:3665 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -5743,11 +5771,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3655 +#: ../../library/stdtypes.rst:3670 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3661 +#: ../../library/stdtypes.rst:3676 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " @@ -5755,14 +5783,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:3686 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:3675 +#: ../../library/stdtypes.rst:3690 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -5770,13 +5798,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:3685 +#: ../../library/stdtypes.rst:3700 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:3698 +#: ../../library/stdtypes.rst:3713 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -5786,7 +5814,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:3709 +#: ../../library/stdtypes.rst:3724 msgid "" "This static method returns a translation table usable for :meth:`bytes." "translate` that will map each character in *from* into the character at the " @@ -5794,7 +5822,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:3720 +#: ../../library/stdtypes.rst:3735 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -5803,24 +5831,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:3727 ../../library/stdtypes.rst:3784 +#: ../../library/stdtypes.rst:3742 ../../library/stdtypes.rst:3799 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3733 +#: ../../library/stdtypes.rst:3748 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:3737 +#: ../../library/stdtypes.rst:3752 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3749 +#: ../../library/stdtypes.rst:3764 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -5828,13 +5856,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:3764 +#: ../../library/stdtypes.rst:3779 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3777 +#: ../../library/stdtypes.rst:3792 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -5843,7 +5871,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:3790 +#: ../../library/stdtypes.rst:3805 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -5851,11 +5879,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3795 +#: ../../library/stdtypes.rst:3810 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3801 +#: ../../library/stdtypes.rst:3816 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " @@ -5863,18 +5891,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3806 +#: ../../library/stdtypes.rst:3821 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3809 +#: ../../library/stdtypes.rst:3824 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3812 +#: ../../library/stdtypes.rst:3827 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -5882,11 +5910,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:3830 msgid "*delete* is now supported as a keyword argument." msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3819 +#: ../../library/stdtypes.rst:3834 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -5895,7 +5923,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3828 +#: ../../library/stdtypes.rst:3843 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -5903,7 +5931,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3842 +#: ../../library/stdtypes.rst:3857 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -5911,7 +5939,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3856 +#: ../../library/stdtypes.rst:3871 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -5920,7 +5948,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3862 +#: ../../library/stdtypes.rst:3877 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -5932,14 +5960,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:3882 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3872 +#: ../../library/stdtypes.rst:3887 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -5951,7 +5979,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3886 +#: ../../library/stdtypes.rst:3901 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -5959,7 +5987,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3900 +#: ../../library/stdtypes.rst:3915 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -5969,7 +5997,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3911 +#: ../../library/stdtypes.rst:3926 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -5978,7 +6006,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3917 +#: ../../library/stdtypes.rst:3932 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -5990,14 +6018,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3922 +#: ../../library/stdtypes.rst:3937 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3927 +#: ../../library/stdtypes.rst:3942 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -6009,7 +6037,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3941 +#: ../../library/stdtypes.rst:3956 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -6018,7 +6046,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3947 +#: ../../library/stdtypes.rst:3962 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -6029,7 +6057,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3957 +#: ../../library/stdtypes.rst:3972 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -6049,7 +6077,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3966 +#: ../../library/stdtypes.rst:3981 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -6059,7 +6087,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3976 +#: ../../library/stdtypes.rst:3991 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -6075,7 +6103,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3987 +#: ../../library/stdtypes.rst:4002 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *bytes* argument is a binary sequence specifying the set of " @@ -6084,7 +6112,7 @@ msgid "" "or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3994 +#: ../../library/stdtypes.rst:4009 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -6096,13 +6124,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3999 +#: ../../library/stdtypes.rst:4014 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:4008 +#: ../../library/stdtypes.rst:4023 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " @@ -6110,14 +6138,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:4016 +#: ../../library/stdtypes.rst:4031 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" -#: ../../library/stdtypes.rst:4029 +#: ../../library/stdtypes.rst:4044 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -6133,7 +6161,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:4043 +#: ../../library/stdtypes.rst:4058 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -6145,7 +6173,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:4057 +#: ../../library/stdtypes.rst:4072 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -6154,7 +6182,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:4065 +#: ../../library/stdtypes.rst:4080 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -6166,7 +6194,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:4074 +#: ../../library/stdtypes.rst:4089 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -6174,7 +6202,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:4081 +#: ../../library/stdtypes.rst:4096 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -6186,20 +6214,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:4090 +#: ../../library/stdtypes.rst:4105 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" -#: ../../library/stdtypes.rst:4100 +#: ../../library/stdtypes.rst:4115 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:4106 +#: ../../library/stdtypes.rst:4121 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -6211,13 +6239,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:4115 +#: ../../library/stdtypes.rst:4130 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:4120 +#: ../../library/stdtypes.rst:4135 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -6229,16 +6257,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:4125 ../../library/stdtypes.rst:4167 -#: ../../library/stdtypes.rst:4183 ../../library/stdtypes.rst:4233 -#: ../../library/stdtypes.rst:4302 +#: ../../library/stdtypes.rst:4140 ../../library/stdtypes.rst:4182 +#: ../../library/stdtypes.rst:4198 ../../library/stdtypes.rst:4248 +#: ../../library/stdtypes.rst:4317 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:4133 +#: ../../library/stdtypes.rst:4148 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -6246,14 +6274,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:4142 +#: ../../library/stdtypes.rst:4157 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" -#: ../../library/stdtypes.rst:4148 +#: ../../library/stdtypes.rst:4163 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -6265,14 +6293,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:4157 +#: ../../library/stdtypes.rst:4172 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" -#: ../../library/stdtypes.rst:4162 +#: ../../library/stdtypes.rst:4177 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -6284,13 +6312,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:4175 +#: ../../library/stdtypes.rst:4190 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:4180 +#: ../../library/stdtypes.rst:4195 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -6298,7 +6326,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:4200 +#: ../../library/stdtypes.rst:4215 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " @@ -6306,7 +6334,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:4207 +#: ../../library/stdtypes.rst:4222 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -6318,14 +6346,14 @@ msgstr "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:4212 +#: ../../library/stdtypes.rst:4227 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:4216 +#: ../../library/stdtypes.rst:4231 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -6337,13 +6365,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:4225 +#: ../../library/stdtypes.rst:4240 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -#: ../../library/stdtypes.rst:4230 +#: ../../library/stdtypes.rst:4245 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -6351,7 +6379,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:4237 +#: ../../library/stdtypes.rst:4252 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -6359,14 +6387,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:4251 +#: ../../library/stdtypes.rst:4266 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" -#: ../../library/stdtypes.rst:4257 +#: ../../library/stdtypes.rst:4272 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -6374,7 +6402,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:4260 +#: ../../library/stdtypes.rst:4275 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -6382,7 +6410,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:4270 +#: ../../library/stdtypes.rst:4285 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -6390,12 +6418,12 @@ msgstr "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:4273 +#: ../../library/stdtypes.rst:4288 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:4275 +#: ../../library/stdtypes.rst:4290 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -6417,13 +6445,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:4294 +#: ../../library/stdtypes.rst:4309 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:4299 +#: ../../library/stdtypes.rst:4314 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -6431,7 +6459,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:4315 +#: ../../library/stdtypes.rst:4330 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -6440,7 +6468,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:4323 +#: ../../library/stdtypes.rst:4338 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -6452,11 +6480,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:4337 +#: ../../library/stdtypes.rst:4352 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:4354 +#: ../../library/stdtypes.rst:4369 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -6464,7 +6492,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:4359 +#: ../../library/stdtypes.rst:4374 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -6474,7 +6502,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:4366 +#: ../../library/stdtypes.rst:4381 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -6482,7 +6510,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:4400 +#: ../../library/stdtypes.rst:4415 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " @@ -6490,77 +6518,77 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:4452 +#: ../../library/stdtypes.rst:4467 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/stdtypes.rst:4474 +#: ../../library/stdtypes.rst:4489 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:4477 +#: ../../library/stdtypes.rst:4492 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:4477 +#: ../../library/stdtypes.rst:4492 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:4481 +#: ../../library/stdtypes.rst:4496 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4484 +#: ../../library/stdtypes.rst:4499 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:4487 +#: ../../library/stdtypes.rst:4502 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4487 +#: ../../library/stdtypes.rst:4502 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:4522 +#: ../../library/stdtypes.rst:4537 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4525 +#: ../../library/stdtypes.rst:4540 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4537 +#: ../../library/stdtypes.rst:4552 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:4544 +#: ../../library/stdtypes.rst:4559 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:4546 +#: ../../library/stdtypes.rst:4561 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" -#: ../../library/stdtypes.rst:4552 +#: ../../library/stdtypes.rst:4567 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/stdtypes.rst:4556 +#: ../../library/stdtypes.rst:4571 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " @@ -6568,38 +6596,38 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:4561 +#: ../../library/stdtypes.rst:4576 msgid "" ":class:`!memoryview`\\s are :ref:`generic ` over the type of their " "underlying data." msgstr "" -#: ../../library/stdtypes.rst:4564 +#: ../../library/stdtypes.rst:4579 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which " "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" -#: ../../library/stdtypes.rst:4568 +#: ../../library/stdtypes.rst:4583 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:4571 +#: ../../library/stdtypes.rst:4586 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:4574 +#: ../../library/stdtypes.rst:4589 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:4577 +#: ../../library/stdtypes.rst:4592 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -6621,7 +6649,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:4587 +#: ../../library/stdtypes.rst:4602 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -6632,11 +6660,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:4596 +#: ../../library/stdtypes.rst:4611 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:4598 +#: ../../library/stdtypes.rst:4613 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -6658,13 +6686,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:4608 +#: ../../library/stdtypes.rst:4623 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:4611 +#: ../../library/stdtypes.rst:4626 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -6704,14 +6732,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:4629 +#: ../../library/stdtypes.rst:4644 msgid "" "One-dimensional memoryviews of :term:`hashable` (read-only) types with " "formats 'B', 'b' or 'c' are also hashable. The hash is defined as ``hash(m) " "== hash(m.tobytes())``::" msgstr "" -#: ../../library/stdtypes.rst:4633 +#: ../../library/stdtypes.rst:4648 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -6729,44 +6757,44 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:4641 +#: ../../library/stdtypes.rst:4656 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4645 +#: ../../library/stdtypes.rst:4660 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:4649 +#: ../../library/stdtypes.rst:4664 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:4652 +#: ../../library/stdtypes.rst:4667 msgid "memoryview is now a :term:`generic type`." msgstr "" -#: ../../library/stdtypes.rst:4655 +#: ../../library/stdtypes.rst:4670 msgid ":class:`memoryview` has several methods:" msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:4659 +#: ../../library/stdtypes.rst:4674 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" -#: ../../library/stdtypes.rst:4663 +#: ../../library/stdtypes.rst:4678 msgid "" "For the subset of :mod:`struct` format strings currently supported by :meth:" "`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" msgstr "" -#: ../../library/stdtypes.rst:4666 +#: ../../library/stdtypes.rst:4681 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -6800,14 +6828,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:4682 +#: ../../library/stdtypes.rst:4697 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" -#: ../../library/stdtypes.rst:4686 +#: ../../library/stdtypes.rst:4701 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -6833,25 +6861,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:4698 +#: ../../library/stdtypes.rst:4713 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:4701 +#: ../../library/stdtypes.rst:4716 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:4707 +#: ../../library/stdtypes.rst:4722 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -#: ../../library/stdtypes.rst:4710 +#: ../../library/stdtypes.rst:4725 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -6865,7 +6893,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:4716 +#: ../../library/stdtypes.rst:4731 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -6873,7 +6901,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:4721 +#: ../../library/stdtypes.rst:4736 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -6882,13 +6910,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:4731 +#: ../../library/stdtypes.rst:4746 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:4734 +#: ../../library/stdtypes.rst:4749 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -6898,18 +6926,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:4740 +#: ../../library/stdtypes.rst:4755 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:4747 +#: ../../library/stdtypes.rst:4762 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:4749 +#: ../../library/stdtypes.rst:4764 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -6927,19 +6955,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:4757 +#: ../../library/stdtypes.rst:4772 msgid "" ":meth:`tolist` now supports all single character native formats in :mod:" "`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:4764 +#: ../../library/stdtypes.rst:4779 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:4767 +#: ../../library/stdtypes.rst:4782 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -6965,7 +6993,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:4783 +#: ../../library/stdtypes.rst:4798 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " "objects take special actions when a view is held on them (for example, a :" @@ -6974,14 +7002,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:4789 +#: ../../library/stdtypes.rst:4804 msgid "" "After this method has been called, any further operation on the view raises " "a :class:`ValueError` (except :meth:`release` itself which can be called " "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:4793 +#: ../../library/stdtypes.rst:4808 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -6997,13 +7025,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4800 +#: ../../library/stdtypes.rst:4815 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4803 +#: ../../library/stdtypes.rst:4818 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -7023,7 +7051,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4817 +#: ../../library/stdtypes.rst:4832 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -7032,7 +7060,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4823 +#: ../../library/stdtypes.rst:4838 msgid "" "The destination format is restricted to a single element native format in :" "mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " @@ -7040,11 +7068,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4844 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4831 +#: ../../library/stdtypes.rst:4846 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -7088,11 +7116,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4852 +#: ../../library/stdtypes.rst:4867 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4854 +#: ../../library/stdtypes.rst:4869 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -7116,11 +7144,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4865 +#: ../../library/stdtypes.rst:4880 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4867 +#: ../../library/stdtypes.rst:4882 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -7170,11 +7198,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4891 +#: ../../library/stdtypes.rst:4906 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4893 +#: ../../library/stdtypes.rst:4908 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -7196,33 +7224,33 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:4920 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4910 +#: ../../library/stdtypes.rst:4925 msgid "Count the number of occurrences of *value*." msgstr "計算 *value* 的出現次數" -#: ../../library/stdtypes.rst:4916 +#: ../../library/stdtypes.rst:4931 msgid "" "Return the index of the first occurrence of *value* (at or after index " "*start* and before index *stop*)." msgstr "" -#: ../../library/stdtypes.rst:4919 +#: ../../library/stdtypes.rst:4934 msgid "Raises a :exc:`ValueError` if *value* cannot be found." msgstr "在找不到 *value* 時引發 :exc:`ValueError`。" -#: ../../library/stdtypes.rst:4923 +#: ../../library/stdtypes.rst:4938 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4927 +#: ../../library/stdtypes.rst:4942 msgid "The underlying object of the memoryview::" msgstr "memoryview 的底層物件: ::" -#: ../../library/stdtypes.rst:4929 +#: ../../library/stdtypes.rst:4944 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -7234,14 +7262,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4938 +#: ../../library/stdtypes.rst:4953 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -#: ../../library/stdtypes.rst:4942 +#: ../../library/stdtypes.rst:4957 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -7273,11 +7301,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4957 +#: ../../library/stdtypes.rst:4972 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4959 +#: ../../library/stdtypes.rst:4974 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -7301,11 +7329,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4974 +#: ../../library/stdtypes.rst:4989 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4978 +#: ../../library/stdtypes.rst:4993 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " @@ -7313,17 +7341,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4983 +#: ../../library/stdtypes.rst:4998 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" -#: ../../library/stdtypes.rst:4989 +#: ../../library/stdtypes.rst:5004 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4991 +#: ../../library/stdtypes.rst:5006 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -7343,55 +7371,55 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:5002 +#: ../../library/stdtypes.rst:5017 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:5007 +#: ../../library/stdtypes.rst:5022 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" -#: ../../library/stdtypes.rst:5010 ../../library/stdtypes.rst:5018 +#: ../../library/stdtypes.rst:5025 ../../library/stdtypes.rst:5033 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:5015 +#: ../../library/stdtypes.rst:5030 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" -#: ../../library/stdtypes.rst:5023 +#: ../../library/stdtypes.rst:5038 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:5027 +#: ../../library/stdtypes.rst:5042 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:5033 +#: ../../library/stdtypes.rst:5048 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:5039 +#: ../../library/stdtypes.rst:5054 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5058 msgid "" "For information on the thread safety of :class:`memoryview` objects in the :" "term:`free-threaded build`, see :ref:`thread-safety-memoryview`." msgstr "" -#: ../../library/stdtypes.rst:5050 +#: ../../library/stdtypes.rst:5065 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:5054 +#: ../../library/stdtypes.rst:5069 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -7401,7 +7429,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5076 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " @@ -7409,7 +7437,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:5066 +#: ../../library/stdtypes.rst:5081 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -7421,18 +7449,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:5075 +#: ../../library/stdtypes.rst:5090 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -#: ../../library/stdtypes.rst:5079 +#: ../../library/stdtypes.rst:5094 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:5084 +#: ../../library/stdtypes.rst:5099 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " @@ -7440,92 +7468,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:5090 +#: ../../library/stdtypes.rst:5105 msgid "Sets can be created by several means:" msgstr "集合可以以多種方式建立:" -#: ../../library/stdtypes.rst:5092 +#: ../../library/stdtypes.rst:5107 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:5093 +#: ../../library/stdtypes.rst:5108 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:5094 +#: ../../library/stdtypes.rst:5109 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:5096 +#: ../../library/stdtypes.rst:5111 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:5101 +#: ../../library/stdtypes.rst:5116 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:5105 +#: ../../library/stdtypes.rst:5120 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:5109 +#: ../../library/stdtypes.rst:5124 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:5114 +#: ../../library/stdtypes.rst:5129 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" -#: ../../library/stdtypes.rst:5121 +#: ../../library/stdtypes.rst:5136 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:5125 +#: ../../library/stdtypes.rst:5140 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:5132 +#: ../../library/stdtypes.rst:5147 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:5136 +#: ../../library/stdtypes.rst:5151 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:5143 +#: ../../library/stdtypes.rst:5158 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:5149 +#: ../../library/stdtypes.rst:5164 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:5155 +#: ../../library/stdtypes.rst:5170 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:5161 +#: ../../library/stdtypes.rst:5176 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:5166 +#: ../../library/stdtypes.rst:5181 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:5169 +#: ../../library/stdtypes.rst:5184 msgid "" "Note, the non-operator versions of :meth:`~frozenset.union`, :meth:" "`~frozenset.intersection`, :meth:`~frozenset.difference`, :meth:`~frozenset." @@ -7536,7 +7564,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:5176 +#: ../../library/stdtypes.rst:5191 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -7546,14 +7574,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:5183 +#: ../../library/stdtypes.rst:5198 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" -#: ../../library/stdtypes.rst:5187 +#: ../../library/stdtypes.rst:5202 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " @@ -7561,78 +7589,78 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:5192 +#: ../../library/stdtypes.rst:5207 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -#: ../../library/stdtypes.rst:5195 +#: ../../library/stdtypes.rst:5210 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:5197 +#: ../../library/stdtypes.rst:5212 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -#: ../../library/stdtypes.rst:5201 +#: ../../library/stdtypes.rst:5216 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:5207 +#: ../../library/stdtypes.rst:5222 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:5212 +#: ../../library/stdtypes.rst:5227 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:5217 +#: ../../library/stdtypes.rst:5232 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:5222 +#: ../../library/stdtypes.rst:5237 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:5226 +#: ../../library/stdtypes.rst:5241 msgid "Add element *elem* to the set." msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:5230 +#: ../../library/stdtypes.rst:5245 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:5235 +#: ../../library/stdtypes.rst:5250 msgid "Remove element *elem* from the set if it is present." msgstr "如果 *elem* 存在於集合中則將其移除。" -#: ../../library/stdtypes.rst:5239 +#: ../../library/stdtypes.rst:5254 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:5244 +#: ../../library/stdtypes.rst:5259 msgid "Remove all elements from the set." msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:5247 +#: ../../library/stdtypes.rst:5262 msgid "" "Note, the non-operator versions of the :meth:`~set.update`, :meth:`~set." "intersection_update`, :meth:`~set.difference_update`, and :meth:`~set." "symmetric_difference_update` methods will accept any iterable as an argument." msgstr "" -#: ../../library/stdtypes.rst:5252 +#: ../../library/stdtypes.rst:5267 msgid "" "Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:`~set." "remove`, and :meth:`~set.discard` methods may be a set. To support " @@ -7640,23 +7668,23 @@ msgid "" "*elem*." msgstr "" -#: ../../library/stdtypes.rst:5259 +#: ../../library/stdtypes.rst:5274 msgid "" "For detailed information on thread-safety guarantees for :class:`set` " "objects, see :ref:`thread-safety-set`." msgstr "" -#: ../../library/stdtypes.rst:5262 +#: ../../library/stdtypes.rst:5277 msgid "" "Sets and frozensets are :ref:`generic ` over the type of their " "elements." msgstr "" -#: ../../library/stdtypes.rst:5268 +#: ../../library/stdtypes.rst:5283 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:5278 +#: ../../library/stdtypes.rst:5293 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -7665,7 +7693,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:5284 +#: ../../library/stdtypes.rst:5299 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -7674,33 +7702,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:5295 +#: ../../library/stdtypes.rst:5310 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:5298 +#: ../../library/stdtypes.rst:5313 msgid "Dictionaries can be created by several means:" msgstr "字典可以用數種方式建立:" -#: ../../library/stdtypes.rst:5300 +#: ../../library/stdtypes.rst:5315 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:5302 +#: ../../library/stdtypes.rst:5317 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:5303 +#: ../../library/stdtypes.rst:5318 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:5306 +#: ../../library/stdtypes.rst:5321 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it defines a ``keys()`` method, a " @@ -7713,7 +7741,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:5316 +#: ../../library/stdtypes.rst:5331 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " @@ -7721,7 +7749,7 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:5321 +#: ../../library/stdtypes.rst:5336 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -7730,7 +7758,7 @@ msgid "" "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:5327 +#: ../../library/stdtypes.rst:5342 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -7750,19 +7778,19 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:5336 +#: ../../library/stdtypes.rst:5351 msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" -#: ../../library/stdtypes.rst:5339 +#: ../../library/stdtypes.rst:5354 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:5342 +#: ../../library/stdtypes.rst:5357 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7794,39 +7822,39 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:5357 +#: ../../library/stdtypes.rst:5372 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:5361 +#: ../../library/stdtypes.rst:5376 msgid "" "Dictionaries are :ref:`generic ` over two types, signifying " "(respectively) the types of the dictionary's keys and values." msgstr "" -#: ../../library/stdtypes.rst:5364 +#: ../../library/stdtypes.rst:5379 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:5369 +#: ../../library/stdtypes.rst:5384 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5373 +#: ../../library/stdtypes.rst:5388 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5377 +#: ../../library/stdtypes.rst:5392 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:5382 +#: ../../library/stdtypes.rst:5397 msgid "" "If a subclass of dict defines a method :meth:`~object.__missing__` and *key* " "is not present, the ``d[key]`` operation calls that method with the key " @@ -7837,7 +7865,7 @@ msgid "" "__missing__` must be a method; it cannot be an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:5390 +#: ../../library/stdtypes.rst:5405 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -7861,51 +7889,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:5401 +#: ../../library/stdtypes.rst:5416 msgid "" "The example above shows part of the implementation of :class:`collections." "Counter`. A different :meth:`!__missing__` method is used by :class:" "`collections.defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:5408 +#: ../../library/stdtypes.rst:5423 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:5412 +#: ../../library/stdtypes.rst:5427 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "從 *d* 中移除 ``d[key]``。若 *key* 不在對映中則引發 :exc:`KeyError`。" -#: ../../library/stdtypes.rst:5417 +#: ../../library/stdtypes.rst:5432 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:5421 +#: ../../library/stdtypes.rst:5436 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:5425 +#: ../../library/stdtypes.rst:5440 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5430 +#: ../../library/stdtypes.rst:5445 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:5434 +#: ../../library/stdtypes.rst:5449 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5438 +#: ../../library/stdtypes.rst:5453 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:5440 +#: ../../library/stdtypes.rst:5455 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -7914,70 +7942,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:5448 +#: ../../library/stdtypes.rst:5463 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:5454 +#: ../../library/stdtypes.rst:5469 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5459 +#: ../../library/stdtypes.rst:5474 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:5465 +#: ../../library/stdtypes.rst:5480 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " "*default*. If *default* is not given and *key* is not in the dictionary, a :" "exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:5471 +#: ../../library/stdtypes.rst:5486 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:5474 +#: ../../library/stdtypes.rst:5489 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " "often used in set algorithms. If the dictionary is empty, calling :meth:" "`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:5478 +#: ../../library/stdtypes.rst:5493 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:5484 +#: ../../library/stdtypes.rst:5499 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5491 +#: ../../library/stdtypes.rst:5506 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:5499 +#: ../../library/stdtypes.rst:5514 msgid "" "Update the dictionary with the key/value pairs from *mapping* or *iterable* " "and *kwargs*, overwriting existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:5502 +#: ../../library/stdtypes.rst:5517 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -7986,20 +8014,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:5510 +#: ../../library/stdtypes.rst:5525 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5513 +#: ../../library/stdtypes.rst:5528 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:5517 +#: ../../library/stdtypes.rst:5532 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -8009,25 +8037,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:5523 +#: ../../library/stdtypes.rst:5538 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:5531 +#: ../../library/stdtypes.rst:5546 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:5537 +#: ../../library/stdtypes.rst:5552 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:5539 +#: ../../library/stdtypes.rst:5554 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -8049,27 +8077,27 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:5549 +#: ../../library/stdtypes.rst:5564 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5554 +#: ../../library/stdtypes.rst:5569 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:5560 +#: ../../library/stdtypes.rst:5575 msgid "" "For detailed information on thread-safety guarantees for :class:`dict` " "objects, see :ref:`thread-safety-dict`." msgstr "" -#: ../../library/stdtypes.rst:5567 +#: ../../library/stdtypes.rst:5582 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:5569 +#: ../../library/stdtypes.rst:5584 msgid "" "The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" "`dict.items` are *view objects*. They provide a dynamic view on the " @@ -8077,23 +8105,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:5574 +#: ../../library/stdtypes.rst:5589 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:5579 +#: ../../library/stdtypes.rst:5594 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5583 +#: ../../library/stdtypes.rst:5598 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5586 +#: ../../library/stdtypes.rst:5601 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -8101,39 +8129,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:5591 +#: ../../library/stdtypes.rst:5606 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:5594 +#: ../../library/stdtypes.rst:5609 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:5599 +#: ../../library/stdtypes.rst:5614 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5619 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:5607 +#: ../../library/stdtypes.rst:5622 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5612 +#: ../../library/stdtypes.rst:5627 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:5617 +#: ../../library/stdtypes.rst:5632 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -8147,11 +8175,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:5629 +#: ../../library/stdtypes.rst:5644 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:5631 +#: ../../library/stdtypes.rst:5646 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -8192,11 +8220,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:5673 +#: ../../library/stdtypes.rst:5688 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:5680 +#: ../../library/stdtypes.rst:5695 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -8207,7 +8235,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:5688 +#: ../../library/stdtypes.rst:5703 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -8218,7 +8246,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:5693 +#: ../../library/stdtypes.rst:5708 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -8227,7 +8255,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:5697 +#: ../../library/stdtypes.rst:5712 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -8241,7 +8269,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5707 +#: ../../library/stdtypes.rst:5722 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -8253,7 +8281,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5712 +#: ../../library/stdtypes.rst:5727 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -8264,14 +8292,14 @@ msgstr "" "keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續傳播 " "(propagate)。" -#: ../../library/stdtypes.rst:5717 +#: ../../library/stdtypes.rst:5732 msgid "" "If this method raises an exception while handling an earlier exception from " "the :keyword:`with` block, the new exception is raised, and the original " "exception is stored in its :attr:`~BaseException.__context__` attribute." msgstr "" -#: ../../library/stdtypes.rst:5721 +#: ../../library/stdtypes.rst:5736 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -8283,7 +8311,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" "`~object.__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5727 +#: ../../library/stdtypes.rst:5742 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -8295,7 +8323,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5733 +#: ../../library/stdtypes.rst:5748 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -8310,7 +8338,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5740 +#: ../../library/stdtypes.rst:5755 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -8322,7 +8350,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5748 +#: ../../library/stdtypes.rst:5763 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -8330,7 +8358,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5753 +#: ../../library/stdtypes.rst:5768 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -8338,11 +8366,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5760 +#: ../../library/stdtypes.rst:5775 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5766 +#: ../../library/stdtypes.rst:5781 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -8358,7 +8386,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5776 +#: ../../library/stdtypes.rst:5791 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -8366,7 +8394,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5779 +#: ../../library/stdtypes.rst:5794 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -8374,7 +8402,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5782 +#: ../../library/stdtypes.rst:5797 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " @@ -8386,7 +8414,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5788 +#: ../../library/stdtypes.rst:5803 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -8398,7 +8426,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5794 +#: ../../library/stdtypes.rst:5809 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -8410,7 +8438,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5800 +#: ../../library/stdtypes.rst:5815 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " "``y`` will also be an instance of ``re.Match``, but the return values of ``y." @@ -8423,7 +8451,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5806 +#: ../../library/stdtypes.rst:5821 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -8436,7 +8464,7 @@ msgstr "" "classes>`\\ 的特化可能不是 :class:`types.GenericAlias` 的實例,但它們提供類似" "的功能。" -#: ../../library/stdtypes.rst:5813 +#: ../../library/stdtypes.rst:5828 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -8446,7 +8474,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:5818 +#: ../../library/stdtypes.rst:5833 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -8454,7 +8482,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5821 +#: ../../library/stdtypes.rst:5836 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -8465,7 +8493,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5826 +#: ../../library/stdtypes.rst:5841 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -8473,7 +8501,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5829 +#: ../../library/stdtypes.rst:5844 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -8481,7 +8509,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5832 +#: ../../library/stdtypes.rst:5847 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -8493,7 +8521,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5837 +#: ../../library/stdtypes.rst:5852 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -8505,7 +8533,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5843 +#: ../../library/stdtypes.rst:5858 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -8515,13 +8543,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5847 +#: ../../library/stdtypes.rst:5862 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5850 +#: ../../library/stdtypes.rst:5865 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -8539,13 +8567,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5858 +#: ../../library/stdtypes.rst:5873 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5860 +#: ../../library/stdtypes.rst:5875 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -8559,7 +8587,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5866 +#: ../../library/stdtypes.rst:5881 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -8567,7 +8595,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5869 +#: ../../library/stdtypes.rst:5884 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -8579,7 +8607,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5874 +#: ../../library/stdtypes.rst:5889 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -8589,7 +8617,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5878 +#: ../../library/stdtypes.rst:5893 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -8601,253 +8629,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5885 +#: ../../library/stdtypes.rst:5900 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5887 +#: ../../library/stdtypes.rst:5902 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5890 +#: ../../library/stdtypes.rst:5905 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5891 +#: ../../library/stdtypes.rst:5906 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5892 +#: ../../library/stdtypes.rst:5907 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5893 +#: ../../library/stdtypes.rst:5908 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5894 +#: ../../library/stdtypes.rst:5909 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5895 +#: ../../library/stdtypes.rst:5910 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5896 +#: ../../library/stdtypes.rst:5911 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5897 +#: ../../library/stdtypes.rst:5912 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5898 +#: ../../library/stdtypes.rst:5913 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5899 +#: ../../library/stdtypes.rst:5914 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5900 +#: ../../library/stdtypes.rst:5915 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5901 +#: ../../library/stdtypes.rst:5916 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:5917 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5903 +#: ../../library/stdtypes.rst:5918 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5904 +#: ../../library/stdtypes.rst:5919 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5905 +#: ../../library/stdtypes.rst:5920 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5906 +#: ../../library/stdtypes.rst:5921 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5907 +#: ../../library/stdtypes.rst:5922 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5908 +#: ../../library/stdtypes.rst:5923 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5909 +#: ../../library/stdtypes.rst:5924 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5910 +#: ../../library/stdtypes.rst:5925 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5911 +#: ../../library/stdtypes.rst:5926 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5912 +#: ../../library/stdtypes.rst:5927 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5913 +#: ../../library/stdtypes.rst:5928 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5914 +#: ../../library/stdtypes.rst:5929 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5915 +#: ../../library/stdtypes.rst:5930 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5916 +#: ../../library/stdtypes.rst:5931 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5917 +#: ../../library/stdtypes.rst:5932 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5918 +#: ../../library/stdtypes.rst:5933 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5919 +#: ../../library/stdtypes.rst:5934 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5920 +#: ../../library/stdtypes.rst:5935 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5921 +#: ../../library/stdtypes.rst:5936 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5922 +#: ../../library/stdtypes.rst:5937 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5923 +#: ../../library/stdtypes.rst:5938 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5924 +#: ../../library/stdtypes.rst:5939 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5925 +#: ../../library/stdtypes.rst:5940 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5926 +#: ../../library/stdtypes.rst:5941 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5927 +#: ../../library/stdtypes.rst:5942 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5928 +#: ../../library/stdtypes.rst:5943 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5929 +#: ../../library/stdtypes.rst:5944 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5930 +#: ../../library/stdtypes.rst:5945 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5931 +#: ../../library/stdtypes.rst:5946 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5932 +#: ../../library/stdtypes.rst:5947 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5933 +#: ../../library/stdtypes.rst:5948 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5934 +#: ../../library/stdtypes.rst:5949 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5935 +#: ../../library/stdtypes.rst:5950 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5936 +#: ../../library/stdtypes.rst:5951 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5937 +#: ../../library/stdtypes.rst:5952 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5938 +#: ../../library/stdtypes.rst:5953 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5939 +#: ../../library/stdtypes.rst:5954 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5940 +#: ../../library/stdtypes.rst:5955 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5941 +#: ../../library/stdtypes.rst:5956 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5942 +#: ../../library/stdtypes.rst:5957 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5943 +#: ../../library/stdtypes.rst:5958 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5944 +#: ../../library/stdtypes.rst:5959 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5945 +#: ../../library/stdtypes.rst:5960 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5950 +#: ../../library/stdtypes.rst:5965 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5952 +#: ../../library/stdtypes.rst:5967 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5956 +#: ../../library/stdtypes.rst:5971 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5958 +#: ../../library/stdtypes.rst:5973 msgid "" ">>> list[int].__origin__\n" "" @@ -8855,7 +8883,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5964 +#: ../../library/stdtypes.rst:5979 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " @@ -8864,7 +8892,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5968 +#: ../../library/stdtypes.rst:5983 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -8872,7 +8900,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5974 +#: ../../library/stdtypes.rst:5989 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -8880,7 +8908,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5977 +#: ../../library/stdtypes.rst:5992 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -8894,7 +8922,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5985 +#: ../../library/stdtypes.rst:6000 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -8904,7 +8932,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5992 +#: ../../library/stdtypes.rst:6007 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -8912,19 +8940,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:6000 +#: ../../library/stdtypes.rst:6015 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:6001 +#: ../../library/stdtypes.rst:6016 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:6003 +#: ../../library/stdtypes.rst:6018 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:6004 +#: ../../library/stdtypes.rst:6019 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -8933,7 +8961,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:6008 +#: ../../library/stdtypes.rst:6023 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -8941,18 +8969,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:6009 +#: ../../library/stdtypes.rst:6024 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:6018 +#: ../../library/stdtypes.rst:6033 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:6024 +#: ../../library/stdtypes.rst:6039 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -8965,7 +8993,7 @@ msgstr "" "釋 (type annotation) `。與下標 :data:`typing.Union` 相比,聯合型" "別運算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:6031 +#: ../../library/stdtypes.rst:6046 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " @@ -8976,7 +9004,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:6036 +#: ../../library/stdtypes.rst:6051 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -8984,7 +9012,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:6041 +#: ../../library/stdtypes.rst:6056 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -8997,40 +9025,40 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:6049 +#: ../../library/stdtypes.rst:6064 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:6051 +#: ../../library/stdtypes.rst:6066 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:6053 +#: ../../library/stdtypes.rst:6068 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:6055 +#: ../../library/stdtypes.rst:6070 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:6057 +#: ../../library/stdtypes.rst:6072 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:6059 +#: ../../library/stdtypes.rst:6074 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:6061 +#: ../../library/stdtypes.rst:6076 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:6063 +#: ../../library/stdtypes.rst:6078 msgid "It creates instances of :class:`typing.Union`::" msgstr "它會建立 :class:`typing.Union` 的實例: ::" -#: ../../library/stdtypes.rst:6065 +#: ../../library/stdtypes.rst:6080 msgid "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" @@ -9038,21 +9066,21 @@ msgstr "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" -#: ../../library/stdtypes.rst:6068 +#: ../../library/stdtypes.rst:6083 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:6070 +#: ../../library/stdtypes.rst:6085 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:6075 +#: ../../library/stdtypes.rst:6090 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:6078 +#: ../../library/stdtypes.rst:6093 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -9060,14 +9088,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:6081 +#: ../../library/stdtypes.rst:6096 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:6084 +#: ../../library/stdtypes.rst:6099 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -9077,7 +9105,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:6091 +#: ../../library/stdtypes.rst:6106 msgid "" "The user-exposed type for the union object can be accessed from :class:" "`typing.Union` and used for :func:`isinstance` checks::" @@ -9085,7 +9113,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`typing." "Union` 存取並用於 :func:`isinstance` 檢查: ::" -#: ../../library/stdtypes.rst:6094 +#: ../../library/stdtypes.rst:6109 msgid "" ">>> import typing\n" ">>> isinstance(int | str, typing.Union)\n" @@ -9103,7 +9131,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'typing.Union' instances" -#: ../../library/stdtypes.rst:6103 +#: ../../library/stdtypes.rst:6118 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -9112,7 +9140,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:6107 +#: ../../library/stdtypes.rst:6122 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -9138,32 +9166,32 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:6123 +#: ../../library/stdtypes.rst:6138 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:6129 +#: ../../library/stdtypes.rst:6144 msgid "" "Union objects are now instances of :class:`typing.Union`. Previously, they " "were instances of :class:`types.UnionType`, which remains an alias for :" "class:`typing.Union`." msgstr "" -#: ../../library/stdtypes.rst:6136 +#: ../../library/stdtypes.rst:6151 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:6138 +#: ../../library/stdtypes.rst:6153 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:6145 +#: ../../library/stdtypes.rst:6160 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:6147 +#: ../../library/stdtypes.rst:6162 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " @@ -9174,7 +9202,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:6154 +#: ../../library/stdtypes.rst:6169 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -9185,32 +9213,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:6162 +#: ../../library/stdtypes.rst:6177 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:6170 +#: ../../library/stdtypes.rst:6185 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:6172 +#: ../../library/stdtypes.rst:6187 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:6178 +#: ../../library/stdtypes.rst:6193 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:6180 +#: ../../library/stdtypes.rst:6195 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:6183 +#: ../../library/stdtypes.rst:6198 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -9218,15 +9246,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:6187 +#: ../../library/stdtypes.rst:6202 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:6193 +#: ../../library/stdtypes.rst:6208 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:6197 +#: ../../library/stdtypes.rst:6212 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -9234,7 +9262,7 @@ msgid "" "methods>`. Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:6203 +#: ../../library/stdtypes.rst:6218 msgid "" "If you access a method (a function defined in a class namespace) through an " "instance, you get a special object: a :dfn:`bound method` (also called :ref:" @@ -9247,7 +9275,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:6214 +#: ../../library/stdtypes.rst:6229 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -9258,7 +9286,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:6222 +#: ../../library/stdtypes.rst:6237 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -9286,15 +9314,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:6237 +#: ../../library/stdtypes.rst:6252 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:6245 +#: ../../library/stdtypes.rst:6260 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:6251 +#: ../../library/stdtypes.rst:6266 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -9304,7 +9332,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:6258 +#: ../../library/stdtypes.rst:6273 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -9313,21 +9341,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:6265 +#: ../../library/stdtypes.rst:6280 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:6268 +#: ../../library/stdtypes.rst:6283 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:6274 +#: ../../library/stdtypes.rst:6289 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:6280 +#: ../../library/stdtypes.rst:6295 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -9335,30 +9363,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:6285 +#: ../../library/stdtypes.rst:6300 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:6291 +#: ../../library/stdtypes.rst:6306 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:6293 +#: ../../library/stdtypes.rst:6308 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:6297 +#: ../../library/stdtypes.rst:6312 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:6304 +#: ../../library/stdtypes.rst:6319 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:6306 +#: ../../library/stdtypes.rst:6321 msgid "" "This object is commonly used to indicate that something is omitted. It " "supports no special operations. There is exactly one ellipsis object, " @@ -9366,63 +9394,63 @@ msgid "" "the :const:`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:6311 +#: ../../library/stdtypes.rst:6326 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:6313 +#: ../../library/stdtypes.rst:6328 msgid "" "In typical use, ``...`` as the ``Ellipsis`` object appears in a few " "different places, for instance:" msgstr "" -#: ../../library/stdtypes.rst:6316 +#: ../../library/stdtypes.rst:6331 msgid "" "In type annotations, such as :ref:`callable arguments ` or :ref:`tuple elements `." msgstr "" -#: ../../library/stdtypes.rst:6319 +#: ../../library/stdtypes.rst:6334 msgid "" "As the body of a function instead of a :ref:`pass statement `." msgstr "" -#: ../../library/stdtypes.rst:6321 +#: ../../library/stdtypes.rst:6336 msgid "" "In third-party libraries, such as `Numpy's slicing and striding `_." msgstr "" -#: ../../library/stdtypes.rst:6324 +#: ../../library/stdtypes.rst:6339 msgid "" "Python also uses three dots in ways that are not ``Ellipsis`` objects, for " "instance:" msgstr "" -#: ../../library/stdtypes.rst:6326 +#: ../../library/stdtypes.rst:6341 msgid "" "Doctest's :const:`ELLIPSIS `, as a pattern for missing " "content." msgstr "" -#: ../../library/stdtypes.rst:6328 +#: ../../library/stdtypes.rst:6343 msgid "" "The default Python prompt of the :term:`interactive` shell when partial " "input is incomplete." msgstr "" -#: ../../library/stdtypes.rst:6330 +#: ../../library/stdtypes.rst:6345 msgid "" "Lastly, the Python documentation often uses three dots in conventional " "English usage to mean omitted content, even in code examples that also use " "them as the ``Ellipsis``." msgstr "" -#: ../../library/stdtypes.rst:6338 +#: ../../library/stdtypes.rst:6353 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:6340 +#: ../../library/stdtypes.rst:6355 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " @@ -9430,64 +9458,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:6345 +#: ../../library/stdtypes.rst:6360 msgid "It is written as :code:`NotImplemented`." msgstr "它被寫為 :code:`NotImplemented`。" -#: ../../library/stdtypes.rst:6351 +#: ../../library/stdtypes.rst:6366 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:6353 +#: ../../library/stdtypes.rst:6368 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:6361 +#: ../../library/stdtypes.rst:6376 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:6363 +#: ../../library/stdtypes.rst:6378 msgid "" "The implementation adds a few special read-only attributes to several object " "types, where they are relevant. Some of these are not reported by the :func:" "`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:6370 +#: ../../library/stdtypes.rst:6385 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:6376 +#: ../../library/stdtypes.rst:6391 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:6384 +#: ../../library/stdtypes.rst:6399 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:6389 +#: ../../library/stdtypes.rst:6404 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:6394 +#: ../../library/stdtypes.rst:6409 msgid "" "The :ref:`type parameters ` of generic classes, functions, and :" "ref:`type aliases `. For classes and functions that are not " "generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:6404 +#: ../../library/stdtypes.rst:6419 msgid "Integer string conversion length limitation" msgstr "整數字串轉換長度限制" -#: ../../library/stdtypes.rst:6406 +#: ../../library/stdtypes.rst:6421 msgid "" "CPython has a global limit for converting between :class:`int` and :class:" "`str` to mitigate denial of service attacks. This limit *only* applies to " @@ -9499,7 +9527,7 @@ msgstr "" "進位的數值。十六進位、八進位,還有二進位的轉換則沒有長度限制。此限制值可以被" "調整。" -#: ../../library/stdtypes.rst:6411 +#: ../../library/stdtypes.rst:6426 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -9509,24 +9537,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:6418 +#: ../../library/stdtypes.rst:6433 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:6420 +#: ../../library/stdtypes.rst:6435 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:6424 +#: ../../library/stdtypes.rst:6439 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:6426 +#: ../../library/stdtypes.rst:6441 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -9550,7 +9578,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:6446 +#: ../../library/stdtypes.rst:6461 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -9558,11 +9586,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:6451 +#: ../../library/stdtypes.rst:6466 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:6453 +#: ../../library/stdtypes.rst:6468 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -9580,11 +9608,11 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:6466 +#: ../../library/stdtypes.rst:6481 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:6468 +#: ../../library/stdtypes.rst:6483 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" @@ -9592,74 +9620,74 @@ msgstr "" "此限制僅適用於 :class:`int` 與 :class:`str` 或 :class:`bytes` 之間可能較慢的" "轉換:" -#: ../../library/stdtypes.rst:6471 +#: ../../library/stdtypes.rst:6486 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:6472 +#: ../../library/stdtypes.rst:6487 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "``int(string, base)`` 用於所有非 2 冪次方的底。" -#: ../../library/stdtypes.rst:6473 +#: ../../library/stdtypes.rst:6488 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:6474 +#: ../../library/stdtypes.rst:6489 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:6475 +#: ../../library/stdtypes.rst:6490 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:6478 +#: ../../library/stdtypes.rst:6493 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:6480 +#: ../../library/stdtypes.rst:6495 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "``int(string, base)`` 以 2、4、8、16 或 32 為底。" -#: ../../library/stdtypes.rst:6481 +#: ../../library/stdtypes.rst:6496 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:6482 +#: ../../library/stdtypes.rst:6497 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:6483 +#: ../../library/stdtypes.rst:6498 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr ":ref:`formatspec` 用於十六進位、八進位和二進位數字。" -#: ../../library/stdtypes.rst:6484 +#: ../../library/stdtypes.rst:6499 msgid ":class:`str` to :class:`float`." msgstr ":class:`str` 轉換為 :class:`float`。" -#: ../../library/stdtypes.rst:6485 +#: ../../library/stdtypes.rst:6500 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr ":class:`str` 轉換為 :class:`decimal.Decimal`。" -#: ../../library/stdtypes.rst:6488 +#: ../../library/stdtypes.rst:6503 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:6490 +#: ../../library/stdtypes.rst:6505 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:6493 +#: ../../library/stdtypes.rst:6508 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:6496 +#: ../../library/stdtypes.rst:6511 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -9667,7 +9695,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:6498 +#: ../../library/stdtypes.rst:6513 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " @@ -9676,38 +9704,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:6504 +#: ../../library/stdtypes.rst:6519 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:6507 +#: ../../library/stdtypes.rst:6522 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:6511 +#: ../../library/stdtypes.rst:6526 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:6513 +#: ../../library/stdtypes.rst:6528 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:6515 +#: ../../library/stdtypes.rst:6530 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:6522 +#: ../../library/stdtypes.rst:6537 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -9719,7 +9747,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:6531 +#: ../../library/stdtypes.rst:6546 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -9727,11 +9755,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:6537 +#: ../../library/stdtypes.rst:6552 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:6539 +#: ../../library/stdtypes.rst:6554 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -9739,11 +9767,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:6544 +#: ../../library/stdtypes.rst:6559 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:6546 +#: ../../library/stdtypes.rst:6561 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -9765,38 +9793,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:6556 +#: ../../library/stdtypes.rst:6571 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:6560 +#: ../../library/stdtypes.rst:6575 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:6561 +#: ../../library/stdtypes.rst:6576 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:6564 +#: ../../library/stdtypes.rst:6579 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:6567 +#: ../../library/stdtypes.rst:6582 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:6569 +#: ../../library/stdtypes.rst:6584 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:6572 +#: ../../library/stdtypes.rst:6587 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -9809,13 +9837,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:332 #: ../../library/stdtypes.rst:409 ../../library/stdtypes.rst:1002 #: ../../library/stdtypes.rst:1192 ../../library/stdtypes.rst:1214 -#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:5270 -#: ../../library/stdtypes.rst:6276 +#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:5285 +#: ../../library/stdtypes.rst:6291 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1229 -#: ../../library/stdtypes.rst:5270 +#: ../../library/stdtypes.rst:5285 msgid "statement" msgstr "statement(陳述式)" @@ -9937,11 +9965,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1214 ../../library/stdtypes.rst:1379 #: ../../library/stdtypes.rst:1465 ../../library/stdtypes.rst:1513 #: ../../library/stdtypes.rst:1634 ../../library/stdtypes.rst:1764 -#: ../../library/stdtypes.rst:3273 ../../library/stdtypes.rst:3292 -#: ../../library/stdtypes.rst:3405 ../../library/stdtypes.rst:5052 -#: ../../library/stdtypes.rst:5270 ../../library/stdtypes.rst:5762 -#: ../../library/stdtypes.rst:6020 ../../library/stdtypes.rst:6195 -#: ../../library/stdtypes.rst:6240 +#: ../../library/stdtypes.rst:3288 ../../library/stdtypes.rst:3307 +#: ../../library/stdtypes.rst:3420 ../../library/stdtypes.rst:5067 +#: ../../library/stdtypes.rst:5285 ../../library/stdtypes.rst:5777 +#: ../../library/stdtypes.rst:6035 ../../library/stdtypes.rst:6210 +#: ../../library/stdtypes.rst:6255 msgid "object" msgstr "object(物件)" @@ -10033,9 +10061,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:1002 -#: ../../library/stdtypes.rst:1192 ../../library/stdtypes.rst:5270 -#: ../../library/stdtypes.rst:6247 ../../library/stdtypes.rst:6261 -#: ../../library/stdtypes.rst:6276 +#: ../../library/stdtypes.rst:1192 ../../library/stdtypes.rst:5285 +#: ../../library/stdtypes.rst:6262 ../../library/stdtypes.rst:6276 +#: ../../library/stdtypes.rst:6291 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -10051,8 +10079,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3145 -#: ../../library/stdtypes.rst:4414 +#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3160 +#: ../../library/stdtypes.rst:4429 msgid "+ (plus)" msgstr "+ (加號)" @@ -10064,13 +10092,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3145 -#: ../../library/stdtypes.rst:4414 +#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3160 +#: ../../library/stdtypes.rst:4429 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3102 -#: ../../library/stdtypes.rst:4371 +#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3117 +#: ../../library/stdtypes.rst:4386 msgid "* (asterisk)" msgstr "* (星號)" @@ -10082,8 +10110,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3065 -#: ../../library/stdtypes.rst:4339 +#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3080 +#: ../../library/stdtypes.rst:4354 msgid "% (percent)" msgstr "% (百分號)" @@ -10093,7 +10121,7 @@ msgstr "**" #: ../../library/stdtypes.rst:332 ../../library/stdtypes.rst:409 #: ../../library/stdtypes.rst:1002 ../../library/stdtypes.rst:1229 -#: ../../library/stdtypes.rst:5270 +#: ../../library/stdtypes.rst:5285 msgid "operations on" msgstr "operations on(操作於)" @@ -10102,7 +10130,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:351 ../../library/stdtypes.rst:1832 -#: ../../library/stdtypes.rst:3273 ../../library/stdtypes.rst:6276 +#: ../../library/stdtypes.rst:3288 ../../library/stdtypes.rst:6291 msgid "module" msgstr "模組" @@ -10170,7 +10198,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:899 ../../library/stdtypes.rst:5675 +#: ../../library/stdtypes.rst:899 ../../library/stdtypes.rst:5690 msgid "protocol" msgstr "protocol(協定)" @@ -10196,7 +10224,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:1002 ../../library/stdtypes.rst:5270 +#: ../../library/stdtypes.rst:1002 ../../library/stdtypes.rst:5285 msgid "len" msgstr "len" @@ -10265,14 +10293,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1214 ../../library/stdtypes.rst:3273 -#: ../../library/stdtypes.rst:3405 ../../library/stdtypes.rst:3520 -#: ../../library/stdtypes.rst:4339 +#: ../../library/stdtypes.rst:1214 ../../library/stdtypes.rst:3288 +#: ../../library/stdtypes.rst:3420 ../../library/stdtypes.rst:3535 +#: ../../library/stdtypes.rst:4354 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:5270 -#: ../../library/stdtypes.rst:6020 ../../library/stdtypes.rst:6276 +#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:5285 +#: ../../library/stdtypes.rst:6035 ../../library/stdtypes.rst:6291 msgid "type" msgstr "type(型別)" @@ -10280,7 +10308,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:5270 +#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:5285 msgid "del" msgstr "del" @@ -10289,8 +10317,8 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1634 ../../library/stdtypes.rst:1777 -#: ../../library/stdtypes.rst:1824 ../../library/stdtypes.rst:2893 -#: ../../library/stdtypes.rst:3065 +#: ../../library/stdtypes.rst:1824 ../../library/stdtypes.rst:2908 +#: ../../library/stdtypes.rst:3080 msgid "string" msgstr "string(字串)" @@ -10311,17 +10339,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1797 ../../library/stdtypes.rst:3265 +#: ../../library/stdtypes.rst:1797 ../../library/stdtypes.rst:3280 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1797 ../../library/stdtypes.rst:3273 -#: ../../library/stdtypes.rst:3292 ../../library/stdtypes.rst:3520 -#: ../../library/stdtypes.rst:4339 +#: ../../library/stdtypes.rst:1797 ../../library/stdtypes.rst:3288 +#: ../../library/stdtypes.rst:3307 ../../library/stdtypes.rst:3535 +#: ../../library/stdtypes.rst:4354 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1824 ../../library/stdtypes.rst:3520 +#: ../../library/stdtypes.rst:1824 ../../library/stdtypes.rst:3535 msgid "methods" msgstr "methods(方法)" @@ -10329,242 +10357,249 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2663 ../../library/stdtypes.rst:4193 +#: ../../library/stdtypes.rst:2678 ../../library/stdtypes.rst:4208 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2663 +#: ../../library/stdtypes.rst:2678 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "! formatted string literal" msgstr "! formatted string literals(! 格式化字串常數)" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "formatted string literals" msgstr "formatted string literals(格式化字串常數)" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "! f-string" msgstr "! f-string(! f 字串)" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "! (exclamation mark)" msgstr "! (驚嘆號)" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "= (equals)" msgstr "= (等號)" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2908 msgid "for help in debugging using string literals" msgstr "" -#: ../../library/stdtypes.rst:3065 +#: ../../library/stdtypes.rst:3080 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:3065 +#: ../../library/stdtypes.rst:3080 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:3065 +#: ../../library/stdtypes.rst:3080 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:3065 +#: ../../library/stdtypes.rst:3080 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:3065 ../../library/stdtypes.rst:4339 +#: ../../library/stdtypes.rst:3080 ../../library/stdtypes.rst:4354 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:3065 ../../library/stdtypes.rst:4339 +#: ../../library/stdtypes.rst:3080 ../../library/stdtypes.rst:4354 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:3102 ../../library/stdtypes.rst:4371 +#: ../../library/stdtypes.rst:3117 ../../library/stdtypes.rst:4386 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:3102 ../../library/stdtypes.rst:3145 -#: ../../library/stdtypes.rst:4371 ../../library/stdtypes.rst:4414 +#: ../../library/stdtypes.rst:3117 ../../library/stdtypes.rst:3160 +#: ../../library/stdtypes.rst:4386 ../../library/stdtypes.rst:4429 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:3102 ../../library/stdtypes.rst:4371 +#: ../../library/stdtypes.rst:3117 ../../library/stdtypes.rst:4386 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:3145 ../../library/stdtypes.rst:4414 +#: ../../library/stdtypes.rst:3160 ../../library/stdtypes.rst:4429 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:3145 ../../library/stdtypes.rst:4414 +#: ../../library/stdtypes.rst:3160 ../../library/stdtypes.rst:4429 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:3265 +#: ../../library/stdtypes.rst:3280 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:3273 +#: ../../library/stdtypes.rst:3288 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:3273 +#: ../../library/stdtypes.rst:3288 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:4193 +#: ../../library/stdtypes.rst:4208 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:4193 +#: ../../library/stdtypes.rst:4208 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:4339 +#: ../../library/stdtypes.rst:4354 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:4339 +#: ../../library/stdtypes.rst:4354 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:4339 +#: ../../library/stdtypes.rst:4354 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:4339 +#: ../../library/stdtypes.rst:4354 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:5052 +#: ../../library/stdtypes.rst:5067 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:5270 +#: ../../library/stdtypes.rst:5285 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:5270 +#: ../../library/stdtypes.rst:5285 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:5380 +#: ../../library/stdtypes.rst:5395 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:5675 +#: ../../library/stdtypes.rst:5690 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:5675 +#: ../../library/stdtypes.rst:5690 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:5675 +#: ../../library/stdtypes.rst:5690 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5750 +#: ../../library/stdtypes.rst:5765 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5750 +#: ../../library/stdtypes.rst:5765 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5762 +#: ../../library/stdtypes.rst:5777 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5762 +#: ../../library/stdtypes.rst:5777 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5762 +#: ../../library/stdtypes.rst:5777 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:6020 +#: ../../library/stdtypes.rst:6035 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:6020 +#: ../../library/stdtypes.rst:6035 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:6195 +#: ../../library/stdtypes.rst:6210 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:6240 +#: ../../library/stdtypes.rst:6255 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:6240 +#: ../../library/stdtypes.rst:6255 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:6247 +#: ../../library/stdtypes.rst:6262 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:6247 +#: ../../library/stdtypes.rst:6262 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:6261 +#: ../../library/stdtypes.rst:6276 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:6261 +#: ../../library/stdtypes.rst:6276 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:6300 +#: ../../library/stdtypes.rst:6315 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:6300 +#: ../../library/stdtypes.rst:6315 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號字面值)" +#~ msgid "" +#~ "See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters are a " +#~ "superset of decimal numbers." +#~ msgstr "" +#~ "也請參閱 :meth:`isdecimal` 和 :meth:`isdigit`。數字字元是十進位數字的超" +#~ "集。" + #~ msgid "See also :meth:`join`." #~ msgstr "另請參閱 :meth:`join`。" From a6e8c8b52fe45f0934da2cc073bd1da346a585fb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 10 Jun 2026 00:45:05 +0000 Subject: [PATCH 4/4] sync with cpython 51e83ca7 --- library/argparse.po | 695 +++++++++++++++++++++++--------------------- library/pyexpat.po | 320 +++++++++++--------- library/shutil.po | 256 ++++++++-------- 3 files changed, 685 insertions(+), 586 deletions(-) diff --git a/library/argparse.po b/library/argparse.po index cf709f732a..d3b4e1f3b7 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-04-15 00:29+0000\n" +"POT-Creation-Date: 2026-06-10 00:43+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -264,7 +264,7 @@ msgstr "新增 *exit_on_error* 參數。" msgid "*suggest_on_error* and *color* parameters were added." msgstr "新增 *suggest_on_error* 和 *color* 參數。" -#: ../../library/argparse.rst:137 ../../library/argparse.rst:696 +#: ../../library/argparse.rst:137 ../../library/argparse.rst:695 msgid "The following sections describe how each of these are used." msgstr "以下各節描述了這些參數的使用方式。" @@ -876,14 +876,11 @@ msgstr "" #: ../../library/argparse.rst:445 msgid "" -"Empty lines are treated as empty strings (``''``), which are allowed as " -"values but not as arguments. Empty lines that are read as arguments will " -"result in an \"unrecognized arguments\" error." +"Each line is treated as a single argument, so an empty line is read as an " +"empty string (``''``)." msgstr "" -"空行會被視為空字串 (``''``),可以作為值但不能作為引數。若空行被讀取為引數,會" -"導致 \"unrecognized arguments\" 錯誤。" -#: ../../library/argparse.rst:449 +#: ../../library/argparse.rst:448 msgid "" ":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` " "to read the file containing arguments." @@ -891,7 +888,7 @@ msgstr "" ":class:`ArgumentParser` 使用\\ :term:`檔案系統編碼和錯誤處理函式 `\\ 來讀取包含引數的檔案。" -#: ../../library/argparse.rst:452 +#: ../../library/argparse.rst:451 msgid "" "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " "arguments will never be treated as file references." @@ -899,7 +896,7 @@ msgstr "" "``fromfile_prefix_chars=`` 引數預設值為 ``None``,意味著引數永遠不會被視為檔" "案參照。" -#: ../../library/argparse.rst:455 +#: ../../library/argparse.rst:454 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " "from default (e.g. :func:`locale.getpreferredencoding(False) `。在 Windows 上引數檔案應使用 UTF-8 而非 ANSI 字" "碼頁編碼。" -#: ../../library/argparse.rst:463 +#: ../../library/argparse.rst:462 msgid "argument_default" msgstr "argument_default" -#: ../../library/argparse.rst:465 +#: ../../library/argparse.rst:464 msgid "" "Generally, argument defaults are specified either by passing a default to :" "meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser." @@ -935,7 +932,7 @@ msgstr "" "`ArgumentParser` 來完成。例如若要全域地抑制 :meth:`~ArgumentParser." "parse_args` 呼叫時的屬性建立,我們可以提供 ``argument_default=SUPPRESS``: ::" -#: ../../library/argparse.rst:474 +#: ../../library/argparse.rst:473 msgid "" ">>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" ">>> parser.add_argument('--foo')\n" @@ -953,11 +950,11 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace()" -#: ../../library/argparse.rst:485 +#: ../../library/argparse.rst:484 msgid "allow_abbrev" msgstr "allow_abbrev" -#: ../../library/argparse.rst:487 +#: ../../library/argparse.rst:486 msgid "" "Normally, when you pass an argument list to the :meth:`~ArgumentParser." "parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " @@ -967,11 +964,11 @@ msgstr "" "parse_args` 方法時,它會通常會\\ :ref:`辨識為長選項的縮寫 `。" -#: ../../library/argparse.rst:491 +#: ../../library/argparse.rst:490 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "可以透過將 ``allow_abbrev`` 設為 ``False`` 來停用此功能: ::" -#: ../../library/argparse.rst:493 +#: ../../library/argparse.rst:492 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='store_true')\n" @@ -987,11 +984,11 @@ msgstr "" "usage: PROG [-h] [--foobar] [--foonley]\n" "PROG: error: unrecognized arguments: --foon" -#: ../../library/argparse.rst:504 +#: ../../library/argparse.rst:503 msgid "conflict_handler" msgstr "conflict_handler" -#: ../../library/argparse.rst:506 +#: ../../library/argparse.rst:505 msgid "" ":class:`ArgumentParser` objects do not allow two actions with the same " "option string. By default, :class:`ArgumentParser` objects raise an " @@ -1002,7 +999,7 @@ msgstr "" "下,如果嘗試建立一個使用已存在選項字串的引數,:class:`ArgumentParser` 物件會" "引發例外: ::" -#: ../../library/argparse.rst:511 +#: ../../library/argparse.rst:510 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo', help='old foo help')\n" @@ -1018,7 +1015,7 @@ msgstr "" " ..\n" "ArgumentError: argument --foo: conflicting option string(s): --foo" -#: ../../library/argparse.rst:518 +#: ../../library/argparse.rst:517 msgid "" "Sometimes (e.g. when using parents_) it may be useful to simply override any " "older arguments with the same option string. To get this behavior, the " @@ -1029,7 +1026,7 @@ msgstr "" "要得到此行為,可以將值 ``'resolve'`` 提供給 :class:`ArgumentParser` 的 " "``conflict_handler=`` 引數: ::" -#: ../../library/argparse.rst:523 +#: ../../library/argparse.rst:522 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', " "conflict_handler='resolve')\n" @@ -1055,7 +1052,7 @@ msgstr "" " -f FOO old foo help\n" " --foo FOO new foo help" -#: ../../library/argparse.rst:534 +#: ../../library/argparse.rst:533 msgid "" "Note that :class:`ArgumentParser` objects only remove an action if all of " "its option strings are overridden. So, in the example above, the old ``-f/--" @@ -1066,11 +1063,11 @@ msgstr "" "物件才會移除該 action。因此在上面的範例中,舊的 ``-f/--foo`` action 會保留為 " "``-f`` action,因為只有 ``--foo`` 選項字串被覆寫。" -#: ../../library/argparse.rst:541 +#: ../../library/argparse.rst:540 msgid "add_help" msgstr "add_help" -#: ../../library/argparse.rst:543 +#: ../../library/argparse.rst:542 msgid "" "By default, :class:`ArgumentParser` objects add an option which simply " "displays the parser's help message. If ``-h`` or ``--help`` is supplied at " @@ -1080,7 +1077,7 @@ msgstr "" "明訊息。如果在命令列上提供了 ``-h`` 或 ``--help``,將會印出 :class:`!" "ArgumentParser` 的說明。" -#: ../../library/argparse.rst:547 +#: ../../library/argparse.rst:546 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " "This can be achieved by passing ``False`` as the ``add_help=`` argument to :" @@ -1089,7 +1086,7 @@ msgstr "" "停用自動加入的幫助說明選項 (help option) 有時可能很有用。可以透過將 " "``False`` 作為 ``add_help=`` 引數傳給 :class:`ArgumentParser` 來達成: ::" -#: ../../library/argparse.rst:551 +#: ../../library/argparse.rst:550 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> parser.add_argument('--foo', help='foo help')\n" @@ -1107,7 +1104,7 @@ msgstr "" "options:\n" " --foo FOO foo help" -#: ../../library/argparse.rst:559 +#: ../../library/argparse.rst:558 msgid "" "The help option is typically ``-h/--help``. The exception to this is if the " "``prefix_chars=`` is specified and does not include ``-``, in which case ``-" @@ -1118,7 +1115,7 @@ msgstr "" "包含 ``-``,此時 ``-h`` 和 ``--help`` 不是有效的選項。在這種情況下," "``prefix_chars`` 中的第一個字元會用作幫助說明選項的前綴: ::" -#: ../../library/argparse.rst:565 +#: ../../library/argparse.rst:564 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" ">>> parser.print_help()\n" @@ -1134,11 +1131,11 @@ msgstr "" "options:\n" " +h, ++help show this help message and exit" -#: ../../library/argparse.rst:574 +#: ../../library/argparse.rst:573 msgid "exit_on_error" msgstr "exit_on_error" -#: ../../library/argparse.rst:576 +#: ../../library/argparse.rst:575 msgid "" "Normally, when you pass an invalid argument list to the :meth:" "`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " @@ -1148,7 +1145,7 @@ msgstr "" "parse_args` 方法時,它通常會向 :data:`sys.stderr` 印出一個\\ *訊息*\\ 並以狀" "態碼 2 退出。" -#: ../../library/argparse.rst:580 +#: ../../library/argparse.rst:579 msgid "" "If the user would like to catch errors manually, the feature can be enabled " "by setting ``exit_on_error`` to ``False``::" @@ -1156,7 +1153,7 @@ msgstr "" "如果使用者想要手動捕捉錯誤,可以透過將 ``exit_on_error`` 設為 ``False`` 來啟" "用此功能: ::" -#: ../../library/argparse.rst:583 +#: ../../library/argparse.rst:582 msgid "" ">>> parser = argparse.ArgumentParser(exit_on_error=False)\n" ">>> parser.add_argument('--integers', type=int)\n" @@ -1182,11 +1179,11 @@ msgstr "" "...\n" "Catching an argumentError" -#: ../../library/argparse.rst:596 +#: ../../library/argparse.rst:595 msgid "suggest_on_error" msgstr "suggest_on_error" -#: ../../library/argparse.rst:598 +#: ../../library/argparse.rst:597 msgid "" "By default, when a user passes an invalid argument choice or subparser " "name, :class:`ArgumentParser` will exit with error info and list the " @@ -1197,7 +1194,7 @@ msgstr "" "`ArgumentParser` 會帶著錯誤資訊退出,並將允許的引數選擇(如果有指定的話)或子" "剖析器名稱列為錯誤訊息的一部分。" -#: ../../library/argparse.rst:602 +#: ../../library/argparse.rst:601 msgid "" "If the user would like to enable suggestions for mistyped argument choices " "and subparser names, the feature can be enabled by setting " @@ -1208,7 +1205,7 @@ msgstr "" "``suggest_on_error`` 設為 ``True`` 來啟用此功能。請注意,這僅適用於指定的選擇" "皆為字串的引數: ::" -#: ../../library/argparse.rst:607 +#: ../../library/argparse.rst:606 msgid "" ">>> parser = argparse.ArgumentParser(suggest_on_error=True)\n" ">>> parser.add_argument('--action', choices=['debug', 'dryrun'])\n" @@ -1224,7 +1221,7 @@ msgstr "" "tester.py: error: argument --action: invalid choice: 'debugg', maybe you " "meant 'debug'? (choose from debug, dryrun)" -#: ../../library/argparse.rst:613 +#: ../../library/argparse.rst:612 msgid "" "If you're writing code that needs to be compatible with older Python " "versions and want to opportunistically use ``suggest_on_error`` when it's " @@ -1235,7 +1232,7 @@ msgstr "" "``suggest_on_error`` 可用時伺機使用它,你可以在初始化剖析器後將其設為屬性,而" "非使用關鍵字引數: ::" -#: ../../library/argparse.rst:618 +#: ../../library/argparse.rst:617 msgid "" ">>> parser = argparse.ArgumentParser(description='Process some integers.')\n" ">>> parser.suggest_on_error = True" @@ -1243,11 +1240,11 @@ msgstr "" ">>> parser = argparse.ArgumentParser(description='Process some integers.')\n" ">>> parser.suggest_on_error = True" -#: ../../library/argparse.rst:625 +#: ../../library/argparse.rst:624 msgid "color" msgstr "color" -#: ../../library/argparse.rst:627 +#: ../../library/argparse.rst:626 msgid "" "By default, the help message is printed in color using `ANSI escape " "sequences `__. If you want " @@ -1260,7 +1257,7 @@ msgstr "" "你的本地環境中 `\\ 停用它,或是透過將 ``color`` " "設為 ``False`` 在引數剖析器本身停用: ::" -#: ../../library/argparse.rst:633 +#: ../../library/argparse.rst:632 msgid "" ">>> parser = argparse.ArgumentParser(description='Process some integers.',\n" "... color=False)\n" @@ -1276,7 +1273,7 @@ msgstr "" "... help='an integer for the accumulator')\n" ">>> parser.parse_args(['--help'])" -#: ../../library/argparse.rst:640 +#: ../../library/argparse.rst:639 msgid "" "Note that when ``color=True``, colored output depends on both environment " "variables and terminal capabilities. However, if ``color=False``, colored " @@ -1287,7 +1284,7 @@ msgstr "" "``color=False``,即使設定了 ``FORCE_COLOR`` 之類的環境變數,彩色輸出也是會被" "停用。" -#: ../../library/argparse.rst:647 +#: ../../library/argparse.rst:646 msgid "" "Error messages will include color codes when redirecting stderr to a file. " "To avoid this, set the |NO_COLOR|_ or :envvar:`PYTHON_COLORS` environment " @@ -1297,11 +1294,11 @@ msgstr "" "NO_COLOR|_ 或 :envvar:`PYTHON_COLORS` 環境變數(例如 ``NO_COLOR=1 python " "script.py 2> errors.txt``)。" -#: ../../library/argparse.rst:656 +#: ../../library/argparse.rst:655 msgid "The add_argument() method" msgstr "add_argument() 方法" -#: ../../library/argparse.rst:662 +#: ../../library/argparse.rst:661 msgid "" "Define how a single command-line argument should be parsed. Each parameter " "has its own more detailed description below, but in short they are:" @@ -1309,7 +1306,7 @@ msgstr "" "定義單個命令列引數應如何被剖析。每個參數在下面都有更詳細的描述,簡而言之它們" "是:" -#: ../../library/argparse.rst:665 +#: ../../library/argparse.rst:664 msgid "" "`name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` " "or ``'-f', '--foo'``." @@ -1317,69 +1314,69 @@ msgstr "" "`name or flags`_ - 一個名稱或選項字串的串列,例如 ``'foo'`` 或 ``'-f', '--" "foo'``。" -#: ../../library/argparse.rst:668 +#: ../../library/argparse.rst:667 msgid "" "action_ - The basic type of action to be taken when this argument is " "encountered at the command line." msgstr "action_ - 在命令列遇到此引數時要執行的基本 action 類型。" -#: ../../library/argparse.rst:671 +#: ../../library/argparse.rst:670 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "nargs_ - 應消耗的命令列引數數量。" -#: ../../library/argparse.rst:673 +#: ../../library/argparse.rst:672 msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "const_ - 某些 action_ 和 nargs_ 選擇所需的常數值。" -#: ../../library/argparse.rst:675 +#: ../../library/argparse.rst:674 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "default_ - 如果引數不在命令列中且不在命名空間物件中時所產生的值。" -#: ../../library/argparse.rst:678 +#: ../../library/argparse.rst:677 msgid "" "type_ - The type to which the command-line argument should be converted." msgstr "type_ - 命令列引數應轉換成的型別。" -#: ../../library/argparse.rst:680 +#: ../../library/argparse.rst:679 msgid "choices_ - A sequence of the allowable values for the argument." msgstr "choices_ - 引數允許值的序列。" -#: ../../library/argparse.rst:682 +#: ../../library/argparse.rst:681 msgid "" "required_ - Whether or not the command-line option may be omitted (optionals " "only)." msgstr "required_ - 命令列選項是否可省略(僅限可選引數)。" -#: ../../library/argparse.rst:685 +#: ../../library/argparse.rst:684 msgid "help_ - A brief description of what the argument does." msgstr "help_ - 引數功能的簡短描述。" -#: ../../library/argparse.rst:687 +#: ../../library/argparse.rst:686 msgid "metavar_ - A name for the argument in usage messages." msgstr "metavar_ - 引數在用法訊息中的名稱。" -#: ../../library/argparse.rst:689 +#: ../../library/argparse.rst:688 msgid "" "dest_ - The name of the attribute to be added to the object returned by :" "meth:`parse_args`." msgstr "dest_ - 要加入到 :meth:`parse_args` 回傳物件中的屬性名稱。" -#: ../../library/argparse.rst:692 +#: ../../library/argparse.rst:691 msgid "deprecated_ - Whether or not use of the argument is deprecated." msgstr "deprecated_ - 引數的使用是否已被棄用。" -#: ../../library/argparse.rst:694 +#: ../../library/argparse.rst:693 msgid "The method returns an :class:`Action` object representing the argument." msgstr "" -#: ../../library/argparse.rst:702 +#: ../../library/argparse.rst:701 msgid "name or flags" msgstr "name or flags" -#: ../../library/argparse.rst:704 +#: ../../library/argparse.rst:703 msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " @@ -1392,23 +1389,23 @@ msgstr "" "`~ArgumentParser.add_argument` 的第一個引數必須是一系列旗標或一個簡單的引數名" "稱。" -#: ../../library/argparse.rst:710 +#: ../../library/argparse.rst:709 msgid "For example, an optional argument could be created like::" msgstr "例如,可選引數可以像這樣建立: ::" -#: ../../library/argparse.rst:712 +#: ../../library/argparse.rst:711 msgid ">>> parser.add_argument('-f', '--foo')" msgstr ">>> parser.add_argument('-f', '--foo')" -#: ../../library/argparse.rst:714 +#: ../../library/argparse.rst:713 msgid "while a positional argument could be created like::" msgstr "而位置引數可以像這樣建立: ::" -#: ../../library/argparse.rst:716 +#: ../../library/argparse.rst:715 msgid ">>> parser.add_argument('bar')" msgstr ">>> parser.add_argument('bar')" -#: ../../library/argparse.rst:718 +#: ../../library/argparse.rst:717 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " @@ -1417,7 +1414,7 @@ msgstr "" "當呼叫 :meth:`~ArgumentParser.parse_args` 時,可選引數會透過 ``-`` 前綴來辨" "識,其餘的引數則假設為位置引數: ::" -#: ../../library/argparse.rst:722 +#: ../../library/argparse.rst:721 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo')\n" @@ -1441,7 +1438,7 @@ msgstr "" "usage: PROG [-h] [-f FOO] bar\n" "PROG: error: the following arguments are required: bar" -#: ../../library/argparse.rst:733 +#: ../../library/argparse.rst:732 msgid "" "By default, :mod:`!argparse` automatically handles the internal naming and " "display names of arguments, simplifying the process without requiring " @@ -1455,7 +1452,7 @@ msgstr "" "dest_ 參數預設為引數名稱,以底線 ``_`` 取代連字號 ``-``。metavar_ 參數預設為" "大寫的名稱。例如: ::" -#: ../../library/argparse.rst:741 +#: ../../library/argparse.rst:740 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo-bar')\n" @@ -1479,11 +1476,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo-bar FOO-BAR" -#: ../../library/argparse.rst:756 +#: ../../library/argparse.rst:755 msgid "action" msgstr "action" -#: ../../library/argparse.rst:758 +#: ../../library/argparse.rst:757 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " @@ -1497,13 +1494,13 @@ msgstr "" "meth:`~ArgumentParser.parse_args` 回傳的物件中。``action`` 關鍵字引數指定命令" "列引數應如何被處理。提供的 action 有:" -#: ../../library/argparse.rst:764 +#: ../../library/argparse.rst:763 msgid "" "``'store'`` - This just stores the argument's value. This is the default " "action." msgstr "``'store'`` - 這只是儲存引數的值。這是預設的 action。" -#: ../../library/argparse.rst:767 +#: ../../library/argparse.rst:766 msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " "argument; note that the const_ keyword argument defaults to ``None``. The " @@ -1514,7 +1511,7 @@ msgstr "" "引數預設為 ``None``。``'store_const'`` action 最常與指定某種旗標的可選引數一" "起使用。例如: ::" -#: ../../library/argparse.rst:772 +#: ../../library/argparse.rst:771 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_const', const=42)\n" @@ -1526,7 +1523,7 @@ msgstr "" ">>> parser.parse_args(['--foo'])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:777 +#: ../../library/argparse.rst:776 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " "``'store_const'`` that respectively store the values ``True`` and ``False`` " @@ -1535,7 +1532,7 @@ msgstr "" "``'store_true'`` 和 ``'store_false'`` - 這些是 ``'store_const'`` 的特殊情況," "分別儲存值 ``True`` 和 ``False``,預設值為 ``False`` 和 ``True``: ::" -#: ../../library/argparse.rst:782 +#: ../../library/argparse.rst:781 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -1551,7 +1548,7 @@ msgstr "" ">>> parser.parse_args('--foo --bar'.split())\n" "Namespace(foo=True, bar=False, baz=True)" -#: ../../library/argparse.rst:789 +#: ../../library/argparse.rst:788 msgid "" "``'append'`` - This appends each argument value to a list. It is useful for " "allowing an option to be specified multiple times. If the default value is a " @@ -1563,7 +1560,7 @@ msgstr "" "很有用。如果預設值是一個非空的串列,剖析後的值會以預設串列的元素開始,命令列" "的任何值則會附加在那些預設值之後。使用範例: ::" -#: ../../library/argparse.rst:795 +#: ../../library/argparse.rst:794 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='append', default=['0'])\n" @@ -1575,7 +1572,7 @@ msgstr "" ">>> parser.parse_args('--foo 1 --foo 2'.split())\n" "Namespace(foo=['0', '1', '2'])" -#: ../../library/argparse.rst:800 +#: ../../library/argparse.rst:799 msgid "" "``'append_const'`` - This appends the value specified by the const_ keyword " "argument to a list; note that the const_ keyword argument defaults to " @@ -1586,7 +1583,7 @@ msgstr "" "意 const_ 關鍵字引數預設為 ``None``。``'append_const'`` action 通常在多個引數" "需要將常數儲存到同一個串列時很有用。例如: ::" -#: ../../library/argparse.rst:806 +#: ../../library/argparse.rst:805 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--str', dest='types', action='append_const', " @@ -1604,7 +1601,7 @@ msgstr "" ">>> parser.parse_args('--str --int'.split())\n" "Namespace(types=[, ])" -#: ../../library/argparse.rst:812 +#: ../../library/argparse.rst:811 msgid "" "``'extend'`` - This appends each item from a multi-value argument to a list. " "The ``'extend'`` action is typically used with the nargs_ keyword argument " @@ -1617,7 +1614,7 @@ msgstr "" "``None``\\ (預設值)或 ``'?'`` 時,引數字串的每個字元都會被附加到串列中。使" "用範例: ::" -#: ../../library/argparse.rst:820 +#: ../../library/argparse.rst:819 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " @@ -1633,14 +1630,14 @@ msgstr "" "\"f4\"])\n" "Namespace(foo=['f1', 'f2', 'f3', 'f4'])" -#: ../../library/argparse.rst:827 +#: ../../library/argparse.rst:826 msgid "" "``'count'`` - This counts the number of times an argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" "``'count'`` - 這會計算引數出現的次數。例如,這對於增加詳細程度等級很有用: ::" -#: ../../library/argparse.rst:830 +#: ../../library/argparse.rst:829 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" @@ -1652,11 +1649,11 @@ msgstr "" ">>> parser.parse_args(['-vvv'])\n" "Namespace(verbose=3)" -#: ../../library/argparse.rst:835 +#: ../../library/argparse.rst:834 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "請注意,除非明確設為 *0*,否則 *default* 將為 ``None``。" -#: ../../library/argparse.rst:837 +#: ../../library/argparse.rst:836 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -1667,7 +1664,7 @@ msgstr "" "下,help action 會自動加入到剖析器。有關輸出如何建立的詳情,請參閱 :class:" "`ArgumentParser`。" -#: ../../library/argparse.rst:842 +#: ../../library/argparse.rst:841 msgid "" "``'version'`` - This expects a ``version=`` keyword argument in the :meth:" "`~ArgumentParser.add_argument` call, and prints version information and " @@ -1676,7 +1673,7 @@ msgstr "" "``'version'`` - 這預期在 :meth:`~ArgumentParser.add_argument` 呼叫中有一個 " "``version=`` 關鍵字引數,並在被呼叫時印出版本資訊並退出: ::" -#: ../../library/argparse.rst:846 +#: ../../library/argparse.rst:845 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1692,7 +1689,7 @@ msgstr "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" -#: ../../library/argparse.rst:852 +#: ../../library/argparse.rst:851 msgid "" "You may also specify an arbitrary action by passing an :class:`Action` " "subclass (e.g. :class:`BooleanOptionalAction`) or other object that " @@ -1705,7 +1702,7 @@ msgstr "" "action(例如 ``'store'``、``'append'``、``'extend'`` 或 ``nargs`` 不為零的自" "訂 action)可用於位置引數。" -#: ../../library/argparse.rst:858 +#: ../../library/argparse.rst:857 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` " @@ -1718,11 +1715,11 @@ msgstr "" "使用 :meth:`~ArgumentParser.register` 方法註冊自訂 action,並透過它們的註冊名" "稱來參照。" -#: ../../library/argparse.rst:863 +#: ../../library/argparse.rst:862 msgid "An example of a custom action::" msgstr "自訂 action 的範例: ::" -#: ../../library/argparse.rst:865 +#: ../../library/argparse.rst:864 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1760,15 +1757,15 @@ msgstr "" ">>> args\n" "Namespace(bar='1', foo='2')" -#: ../../library/argparse.rst:883 +#: ../../library/argparse.rst:882 msgid "For more details, see :class:`Action`." msgstr "更多詳情請見 :class:`Action`。" -#: ../../library/argparse.rst:889 +#: ../../library/argparse.rst:888 msgid "nargs" msgstr "nargs" -#: ../../library/argparse.rst:891 +#: ../../library/argparse.rst:890 msgid "" ":class:`ArgumentParser` objects usually associate a single command-line " "argument with a single action to be taken. The ``nargs`` keyword argument " @@ -1780,14 +1777,14 @@ msgstr "" "來。``nargs`` 關鍵字引數會將不同數量的命令列引數與單個 action 關聯。另請參閱" "\\ :ref:`specifying-ambiguous-arguments`。支援的值有:" -#: ../../library/argparse.rst:896 +#: ../../library/argparse.rst:895 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" "``N``\\ (一個整數)。命令列中的 ``N`` 個引數會被收集到一個串列中。例如: ::" -#: ../../library/argparse.rst:899 +#: ../../library/argparse.rst:898 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1801,7 +1798,7 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:905 +#: ../../library/argparse.rst:904 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." @@ -1809,7 +1806,7 @@ msgstr "" "請注意 ``nargs=1`` 會產生一個只有一個項目的串列。這與預設情況不同,預設情況下" "項目會單獨產生。" -#: ../../library/argparse.rst:910 +#: ../../library/argparse.rst:909 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -1823,7 +1820,7 @@ msgstr "" "選項字串存在但後面沒有跟著命令列引數,在這種情況下會產生 const_ 的值。以下是" "這個情況的範例: ::" -#: ../../library/argparse.rst:917 +#: ../../library/argparse.rst:916 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1845,13 +1842,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:927 +#: ../../library/argparse.rst:926 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "``nargs='?'`` 比較常見的用途之一是允許可選的輸入和輸出檔案: ::" -#: ../../library/argparse.rst:930 +#: ../../library/argparse.rst:929 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?')\n" @@ -1873,7 +1870,7 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(infile=None, outfile=None)" -#: ../../library/argparse.rst:942 +#: ../../library/argparse.rst:941 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -1884,7 +1881,7 @@ msgstr "" "``nargs='*'`` 的位置引數通常沒有太大意義,但多個 ``nargs='*'`` 的可選引數是可" "能的。例如: ::" -#: ../../library/argparse.rst:947 +#: ../../library/argparse.rst:946 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1900,7 +1897,7 @@ msgstr "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" -#: ../../library/argparse.rst:956 +#: ../../library/argparse.rst:955 msgid "" "``'+'``. Just like ``'*'``, all command-line arguments present are gathered " "into a list. Additionally, an error message will be generated if there " @@ -1909,7 +1906,7 @@ msgstr "" "``'+'``。與 ``'*'`` 一樣,所有存在的命令列引數都會被收集到一個串列中。此外," "如果沒有至少一個命令列引數存在就會產生一個錯誤訊息。例如: ::" -#: ../../library/argparse.rst:960 +#: ../../library/argparse.rst:959 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1927,7 +1924,7 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:968 +#: ../../library/argparse.rst:967 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1939,11 +1936,11 @@ msgstr "" "意味著會消耗單個命令列引數並產生單個項目(而非串列)。不消耗命令列引數的 " "action(例如 ``'store_const'``)會設定 ``nargs=0``。" -#: ../../library/argparse.rst:978 +#: ../../library/argparse.rst:977 msgid "const" msgstr "const" -#: ../../library/argparse.rst:980 +#: ../../library/argparse.rst:979 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1953,7 +1950,7 @@ msgstr "" ":meth:`~ArgumentParser.add_argument` 的 ``const`` 引數用於保存不從命令列讀取" "但為各種 :class:`ArgumentParser` action 所需的常數值。它最常見的兩種用途是:" -#: ../../library/argparse.rst:984 +#: ../../library/argparse.rst:983 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " @@ -1968,7 +1965,7 @@ msgstr "" "述。如果未向 :meth:`~ArgumentParser.add_argument` 提供 ``const``,它會接收預" "設值 ``None``。" -#: ../../library/argparse.rst:992 +#: ../../library/argparse.rst:991 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1982,7 +1979,7 @@ msgstr "" "數。剖析命令列時,如果遇到選項字串但後面沒有命令列引數,會使用 ``const`` 的" "值。範例請參閱 nargs_ 描述。" -#: ../../library/argparse.rst:999 +#: ../../library/argparse.rst:998 msgid "" "``const=None`` by default, including when ``action='append_const'`` or " "``action='store_const'``." @@ -1990,11 +1987,11 @@ msgstr "" "``const=None`` 為預設值,包括當 ``action='append_const'`` 或 " "``action='store_const'`` 時。" -#: ../../library/argparse.rst:1006 +#: ../../library/argparse.rst:1005 msgid "default" msgstr "default" -#: ../../library/argparse.rst:1008 +#: ../../library/argparse.rst:1007 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -2008,7 +2005,7 @@ msgstr "" "數不存在時應使用的值。對於可選引數,當選項字串不在命令列上時會使用 " "``default`` 值: ::" -#: ../../library/argparse.rst:1015 +#: ../../library/argparse.rst:1014 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -2024,14 +2021,14 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:1022 +#: ../../library/argparse.rst:1021 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not overwrite it::" msgstr "" "如果目標命名空間已經設定了一個屬性,action 的 *default* 不會覆寫它: ::" -#: ../../library/argparse.rst:1025 +#: ../../library/argparse.rst:1024 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -2043,7 +2040,7 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:1030 +#: ../../library/argparse.rst:1029 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " @@ -2054,7 +2051,7 @@ msgstr "" "果有提供 type_ 轉換引數,剖析器會在設定 :class:`Namespace` 回傳值的屬性之前先" "套用它。否則剖析器會直接使用該值: ::" -#: ../../library/argparse.rst:1035 +#: ../../library/argparse.rst:1034 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -2068,7 +2065,7 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:1041 +#: ../../library/argparse.rst:1040 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" @@ -2076,7 +2073,7 @@ msgstr "" "對於 nargs_ 等於 ``?`` 或 ``*`` 的位置引數,當沒有命令列引數存在時會使用 " "``default`` 值: ::" -#: ../../library/argparse.rst:1044 +#: ../../library/argparse.rst:1043 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -2092,7 +2089,14 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:1051 +#: ../../library/argparse.rst:1050 +msgid "" +"Because ``nargs='*'`` gathers any supplied values into a list, an absent " +"positional argument yields an empty list (``[]``). Only a non-``None`` " +"*default* overrides this (so ``default=None`` still gives ``[]``)." +msgstr "" + +#: ../../library/argparse.rst:1054 msgid "" "For required_ arguments, the ``default`` value is ignored. For example, this " "applies to positional arguments with nargs_ values other than ``?`` or " @@ -2101,7 +2105,7 @@ msgstr "" "對於 required_ 引數,``default`` 值會被忽略。例如,這適用於 nargs_ 值不是 ``?" "`` 或 ``*`` 的位置引數,或是標記為 ``required=True`` 的可選引數。" -#: ../../library/argparse.rst:1055 +#: ../../library/argparse.rst:1058 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" @@ -2109,7 +2113,7 @@ msgstr "" "若有提供 ``default=argparse.SUPPRESS``,命令列引數不存在時就不會加入任何屬" "性: ::" -#: ../../library/argparse.rst:1058 +#: ../../library/argparse.rst:1061 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -2125,11 +2129,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:1069 +#: ../../library/argparse.rst:1072 msgid "type" msgstr "type" -#: ../../library/argparse.rst:1071 +#: ../../library/argparse.rst:1074 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -2141,7 +2145,7 @@ msgstr "" "一種型別,例如 :class:`float` 或 :class:`int`。:meth:`~ArgumentParser." "add_argument` 的 ``type`` 關鍵字允許執行任何必要的型別檢查和型別轉換。" -#: ../../library/argparse.rst:1077 +#: ../../library/argparse.rst:1080 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." @@ -2149,7 +2153,7 @@ msgstr "" "如果 type_ 關鍵字與 default_ 關鍵字一起使用,型別轉換器只會在預設值為字串時套" "用。" -#: ../../library/argparse.rst:1080 +#: ../../library/argparse.rst:1083 msgid "" "The argument to ``type`` can be a callable that accepts a single string or " "the name of a registered type (see :meth:`~ArgumentParser.register`) If the " @@ -2162,11 +2166,11 @@ msgstr "" "`ArgumentTypeError`、:exc:`TypeError` 或 :exc:`ValueError`,剖析器會捕捉例外" "並顯示格式良好的錯誤訊息。其他例外型別則不處理。" -#: ../../library/argparse.rst:1086 +#: ../../library/argparse.rst:1089 msgid "Common built-in types and functions can be used as type converters:" msgstr "常見的內建型別和函式可以作為型別轉換器使用:" -#: ../../library/argparse.rst:1088 +#: ../../library/argparse.rst:1091 msgid "" "import argparse\n" "import pathlib\n" @@ -2188,11 +2192,11 @@ msgstr "" "parser.add_argument('code_point', type=ord)\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:1100 +#: ../../library/argparse.rst:1103 msgid "User defined functions can be used as well:" msgstr "也可以用那些使用者定義的函式:" -#: ../../library/argparse.rst:1102 +#: ../../library/argparse.rst:1105 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -2210,7 +2214,7 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1112 +#: ../../library/argparse.rst:1115 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " @@ -2219,7 +2223,7 @@ msgstr "" "不建議使用 :func:`bool` 函式作為型別轉換器。它所做的只是將空字串轉為 " "``False``,將非空字串轉為 ``True``。這通常不是期望的行為::" -#: ../../library/argparse.rst:1116 +#: ../../library/argparse.rst:1119 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> _ = parser.add_argument('--verbose', type=bool)\n" @@ -2231,13 +2235,13 @@ msgstr "" ">>> parser.parse_args(['--verbose', 'False'])\n" "Namespace(verbose=True)" -#: ../../library/argparse.rst:1121 +#: ../../library/argparse.rst:1124 msgid "" "See :class:`BooleanOptionalAction` or ``action='store_true'`` for common " "alternatives." msgstr "" -#: ../../library/argparse.rst:1124 +#: ../../library/argparse.rst:1127 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -2247,7 +2251,7 @@ msgstr "" "一般而言,``type`` 關鍵字是一個便利功能,應只用於只會引發三種支援的例外之一的" "簡單轉換。任何更複雜的錯誤處理或資源管理都應在引數剖析之後的下游進行。" -#: ../../library/argparse.rst:1129 +#: ../../library/argparse.rst:1132 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." @@ -2258,7 +2262,7 @@ msgstr "" "好的報告。:exc:`~json.JSONDecodeError` 無法得到良好的格式化,而 :exc:" "`FileNotFoundError` 例外則完全不會處理。" -#: ../../library/argparse.rst:1134 +#: ../../library/argparse.rst:1137 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses :class:`~argparse.FileType` and then " @@ -2272,17 +2276,17 @@ msgstr "" "報告錯誤但檔案不會自動關閉。在這種情況下,最好等到剖析器執行完畢後,再使用 :" "keyword:`with` 陳述式來管理檔案。" -#: ../../library/argparse.rst:1141 +#: ../../library/argparse.rst:1144 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "對於僅檢查固定值集合的型別檢查器,請考慮改用 choices_ 關鍵字。" -#: ../../library/argparse.rst:1148 +#: ../../library/argparse.rst:1151 msgid "choices" msgstr "choices" -#: ../../library/argparse.rst:1150 +#: ../../library/argparse.rst:1153 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -2294,7 +2298,7 @@ msgstr "" "字引數傳給 :meth:`~ArgumentParser.add_argument` 來處理。剖析命令列時會檢查引" "數值,如果引數不是可接受的值之一,就會顯示錯誤訊息: ::" -#: ../../library/argparse.rst:1156 +#: ../../library/argparse.rst:1159 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -2314,7 +2318,7 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1165 +#: ../../library/argparse.rst:1168 msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." @@ -2322,14 +2326,14 @@ msgstr "" "任何序列都可以作為 *choices* 值傳入,因此 :class:`list` 物件、:class:`tuple` " "物件和自訂序列都有被支援。" -#: ../../library/argparse.rst:1168 +#: ../../library/argparse.rst:1171 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" "不建議使用 :class:`enum.Enum`,因為很難控制它在用法、說明和錯誤訊息中的長相。" -#: ../../library/argparse.rst:1171 +#: ../../library/argparse.rst:1174 msgid "" "Note that *choices* are checked after any type_ conversions have been " "performed, so objects in *choices* should match the type_ specified. This " @@ -2339,7 +2343,7 @@ msgstr "" "物件應符合指定的 type_。這可能使 *choices* 在用法、說明或錯誤訊息中的長相看起" "來不尋常。" -#: ../../library/argparse.rst:1176 +#: ../../library/argparse.rst:1179 msgid "" "To keep *choices* user-friendly, consider a custom type wrapper that " "converts and formats values, or omit type_ and handle conversion in your " @@ -2348,7 +2352,7 @@ msgstr "" "若要保持 *choices* 對使用者友善,請考慮使用自訂型別包裝器來轉換和格式化值,或" "是省略 type_ 並在你的應用程式碼中處理轉換。" -#: ../../library/argparse.rst:1180 +#: ../../library/argparse.rst:1183 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -2359,11 +2363,11 @@ msgstr "" "使用者永遠看不到 *dest* 參數。如果此顯示不理想(也許因為有很多選擇),只需指" "定一個明確的 metavar_。" -#: ../../library/argparse.rst:1189 +#: ../../library/argparse.rst:1192 msgid "required" msgstr "required" -#: ../../library/argparse.rst:1191 +#: ../../library/argparse.rst:1194 msgid "" "In general, the :mod:`!argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -2375,7 +2379,7 @@ msgstr "" "以為 :meth:`~ArgumentParser.add_argument` 的 ``required=`` 關鍵字引數指定 " "``True``: ::" -#: ../../library/argparse.rst:1196 +#: ../../library/argparse.rst:1199 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -2393,7 +2397,7 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1204 +#: ../../library/argparse.rst:1207 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " @@ -2402,7 +2406,7 @@ msgstr "" "如範例所示,如果一個選項被標記為 ``required``,:meth:`~ArgumentParser." "parse_args` 會在該選項不在命令列上時報告錯誤。" -#: ../../library/argparse.rst:1210 +#: ../../library/argparse.rst:1213 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." @@ -2410,11 +2414,11 @@ msgstr "" "必要選項一般認為是不良做法,因為使用者期望\\ *選項*\\ 是\\ *可選的*,因此應盡" "可能避免使用。" -#: ../../library/argparse.rst:1217 +#: ../../library/argparse.rst:1220 msgid "help" msgstr "help" -#: ../../library/argparse.rst:1219 +#: ../../library/argparse.rst:1222 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -2424,7 +2428,7 @@ msgstr "" "``help`` 值是一個包含引數簡短描述的字串。當使用者請求說明(通常是在命令列上使" "用 ``-h`` 或 ``--help``)時,這些 ``help`` 描述會與每個引數一起顯示。" -#: ../../library/argparse.rst:1224 +#: ../../library/argparse.rst:1227 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -2436,7 +2440,7 @@ msgstr "" "內容。可用的說明符號包括程式名稱 ``%(prog)s`` 以及 :meth:`~ArgumentParser." "add_argument` 的大多數關鍵字引數,例如 ``%(default)s``、``%(type)s`` 等: ::" -#: ../../library/argparse.rst:1229 +#: ../../library/argparse.rst:1232 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -2462,7 +2466,7 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1241 +#: ../../library/argparse.rst:1244 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." @@ -2470,7 +2474,7 @@ msgstr "" "由於 help 字串支援 %-格式化,如果你想讓文字 ``%`` 出現在 help 字串中,你必須" "將它跳脫為 ``%%``。" -#: ../../library/argparse.rst:1244 +#: ../../library/argparse.rst:1247 msgid "" ":mod:`!argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" @@ -2478,7 +2482,7 @@ msgstr "" ":mod:`!argparse` 支援透過將 ``help`` 值設為 ``argparse.SUPPRESS`` 來隱藏某些" "選項的說明條目: ::" -#: ../../library/argparse.rst:1247 +#: ../../library/argparse.rst:1250 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -2496,11 +2500,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1259 +#: ../../library/argparse.rst:1262 msgid "metavar" msgstr "metavar" -#: ../../library/argparse.rst:1261 +#: ../../library/argparse.rst:1264 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, :class:`!ArgumentParser` " @@ -2517,7 +2521,7 @@ msgstr "" "值轉為大寫。因此,一個 ``dest='bar'`` 的位置引數稱為 ``bar``。一個應後接單一" "命令列引數的 ``--foo`` 可選引數稱為 ``FOO``。範例: ::" -#: ../../library/argparse.rst:1270 +#: ../../library/argparse.rst:1273 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2549,11 +2553,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1285 +#: ../../library/argparse.rst:1288 msgid "An alternative name can be specified with ``metavar``::" msgstr "可以用 ``metavar`` 指定替代名稱: ::" -#: ../../library/argparse.rst:1287 +#: ../../library/argparse.rst:1290 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2585,7 +2589,7 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1302 +#: ../../library/argparse.rst:1305 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " @@ -2594,7 +2598,7 @@ msgstr "" "請注意 ``metavar`` 只會更改\\ *顯示*\\ 的名稱——:meth:`~ArgumentParser." "parse_args` 物件上的屬性名稱仍由 dest_ 值決定。" -#: ../../library/argparse.rst:1306 +#: ../../library/argparse.rst:1309 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " @@ -2603,7 +2607,7 @@ msgstr "" "不同的 ``nargs`` 值可能導致 metavar 被多次使用。提供一個元組給 ``metavar`` 可" "以為每個引數指定不同的顯示: ::" -#: ../../library/argparse.rst:1310 +#: ../../library/argparse.rst:1313 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2627,11 +2631,11 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1325 +#: ../../library/argparse.rst:1328 msgid "dest" msgstr "dest" -#: ../../library/argparse.rst:1327 +#: ../../library/argparse.rst:1330 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -2645,7 +2649,7 @@ msgstr "" "add_argument` 的 ``dest`` 關鍵字引數決定。對於位置引數 action,``dest`` 通常" "作為 :meth:`~ArgumentParser.add_argument` 的第一個引數提供: ::" -#: ../../library/argparse.rst:1334 +#: ../../library/argparse.rst:1337 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2657,7 +2661,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1339 +#: ../../library/argparse.rst:1342 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2674,7 +2678,7 @@ msgstr "" "的 ``-`` 字元來衍生。任何內部的 ``-`` 字元都會轉為 ``_`` 字元,以確保該字串是" "有效的屬性名稱。以下範例說明了此行為: ::" -#: ../../library/argparse.rst:1348 +#: ../../library/argparse.rst:1351 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2692,11 +2696,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1356 +#: ../../library/argparse.rst:1359 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "``dest`` 允許提供自訂的屬性名稱: ::" -#: ../../library/argparse.rst:1358 +#: ../../library/argparse.rst:1361 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2708,11 +2712,20 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1367 +#: ../../library/argparse.rst:1366 +msgid "" +"Multiple arguments may share the same ``dest``. By default, the value from " +"the last such argument given on the command line wins. Use " +"``action='append'`` to collect values from all of them into a list instead. " +"For conflicting *option strings* rather than ``dest`` names, see " +"conflict_handler_." +msgstr "" + +#: ../../library/argparse.rst:1374 msgid "deprecated" msgstr "deprecated" -#: ../../library/argparse.rst:1369 +#: ../../library/argparse.rst:1376 msgid "" "During a project's lifetime, some arguments may need to be removed from the " "command line. Before removing them, you should inform your users that the " @@ -2728,7 +2741,7 @@ msgstr "" "除。對於引數,如果 ``deprecated`` 為 ``True``,那麼使用該引數時會向 :data:" "`sys.stderr` 印出警告: ::" -#: ../../library/argparse.rst:1379 +#: ../../library/argparse.rst:1386 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='snake.py')\n" @@ -2748,11 +2761,11 @@ msgstr "" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" -#: ../../library/argparse.rst:1392 +#: ../../library/argparse.rst:1399 msgid "Action classes" msgstr "Action 類別" -#: ../../library/argparse.rst:1394 +#: ../../library/argparse.rst:1401 msgid "" ":class:`!Action` classes implement the Action API, a callable which returns " "a callable which processes arguments from the command-line. Any object which " @@ -2763,7 +2776,7 @@ msgstr "" "命令列引數的可呼叫物件。任何遵循此 API 的物件都可以作為 ``action`` 參數傳給 :" "meth:`~ArgumentParser.add_argument`。" -#: ../../library/argparse.rst:1403 +#: ../../library/argparse.rst:1410 msgid "" ":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " "the information needed to parse a single argument from one or more strings " @@ -2776,7 +2789,7 @@ msgstr "" "給 :meth:`ArgumentParser.add_argument` 的任何關鍵字引數(除了 ``action`` 本" "身)。" -#: ../../library/argparse.rst:1409 +#: ../../library/argparse.rst:1416 msgid "" "Instances of :class:`!Action` (or return value of any callable to the " "``action`` parameter) should have attributes :attr:`!dest`, :attr:`!" @@ -2789,7 +2802,7 @@ msgstr "" "attr:`!required`、:attr:`!help` 等屬性。確保這些屬性被定義的最簡單方式是呼" "叫 :meth:`!Action.__init__`。" -#: ../../library/argparse.rst:1417 +#: ../../library/argparse.rst:1424 msgid "" ":class:`!Action` instances should be callable, so subclasses must override " "the :meth:`!__call__` method, which should accept four parameters:" @@ -2797,12 +2810,12 @@ msgstr "" ":class:`!Action` 實例應該是可呼叫的,因此子類別必須覆寫 :meth:`!__call__` 方" "法,它應接受四個參數:" -#: ../../library/argparse.rst:1420 +#: ../../library/argparse.rst:1427 msgid "" "*parser* - The :class:`ArgumentParser` object which contains this action." msgstr "*parser* - 包含此 action 的 :class:`ArgumentParser` 物件。" -#: ../../library/argparse.rst:1422 +#: ../../library/argparse.rst:1429 msgid "" "*namespace* - The :class:`Namespace` object that will be returned by :meth:" "`~ArgumentParser.parse_args`. Most actions add an attribute to this object " @@ -2811,7 +2824,7 @@ msgstr "" "*namespace* - 將由 :meth:`~ArgumentParser.parse_args` 回傳的 :class:" "`Namespace` 物件。大多數 action 使用 :func:`setattr` 將屬性加入此物件。" -#: ../../library/argparse.rst:1426 +#: ../../library/argparse.rst:1433 msgid "" "*values* - The associated command-line arguments, with any type conversions " "applied. Type conversions are specified with the type_ keyword argument to :" @@ -2820,7 +2833,7 @@ msgstr "" "*values* - 相關聯的命令列引數,已套用任何型別轉換。型別轉換透過 :meth:" "`~ArgumentParser.add_argument` 的 type_ 關鍵字引數指定。" -#: ../../library/argparse.rst:1430 +#: ../../library/argparse.rst:1437 msgid "" "*option_string* - The option string that was used to invoke this action. The " "``option_string`` argument is optional, and will be absent if the action is " @@ -2829,7 +2842,7 @@ msgstr "" "*option_string* - 用來呼叫此 action 的選項字串。``option_string`` 引數是可選" "的,如果 action 與位置引數關聯則不會出現。" -#: ../../library/argparse.rst:1434 +#: ../../library/argparse.rst:1441 msgid "" "The :meth:`!__call__` method may perform arbitrary actions, but will " "typically set attributes on the ``namespace`` based on ``dest`` and " @@ -2838,7 +2851,7 @@ msgstr "" ":meth:`!__call__` 方法可以執行任意動作,但通常會根據 ``dest`` 和 ``values`` " "在 ``namespace`` 上設定屬性。" -#: ../../library/argparse.rst:1439 +#: ../../library/argparse.rst:1446 msgid "" ":class:`!Action` subclasses can define a :meth:`!format_usage` method that " "takes no argument and return a string which will be used when printing the " @@ -2849,7 +2862,7 @@ msgstr "" "並回傳一個字串,該字串會在印出程式用法時使用。如果未提供此方法,會使用合理的" "預設值。" -#: ../../library/argparse.rst:1445 +#: ../../library/argparse.rst:1452 msgid "" "A subclass of :class:`Action` for handling boolean flags with positive and " "negative options. Adding a single argument such as ``--foo`` automatically " @@ -2860,7 +2873,7 @@ msgstr "" "foo`` 這樣的單個引數會自動建立 ``--foo`` 和 ``--no-foo`` 選項,其分別儲存 " "``True`` 和 ``False``: ::" -#: ../../library/argparse.rst:1450 +#: ../../library/argparse.rst:1457 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -2874,18 +2887,18 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:1460 +#: ../../library/argparse.rst:1467 msgid "The parse_args() method" msgstr "parse_args() 方法" -#: ../../library/argparse.rst:1464 +#: ../../library/argparse.rst:1471 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" "將引數字串轉換為物件並將它們指定為命名空間的屬性。回傳填充後的命名空間。" -#: ../../library/argparse.rst:1467 +#: ../../library/argparse.rst:1474 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:`!" @@ -2894,24 +2907,24 @@ msgstr "" "先前對 :meth:`add_argument` 的呼叫決定了確切建立什麼物件以及如何指定它們。詳" "情請參閱 :meth:`!add_argument` 的文件。" -#: ../../library/argparse.rst:1471 +#: ../../library/argparse.rst:1478 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "args_ - 要剖析的字串串列。預設值取自 :data:`sys.argv`。" -#: ../../library/argparse.rst:1474 +#: ../../library/argparse.rst:1481 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" "namespace_ - 接收屬性的物件。預設值是一個新的空 :class:`Namespace` 物件。" -#: ../../library/argparse.rst:1479 +#: ../../library/argparse.rst:1486 msgid "Option value syntax" msgstr "選項值語法" -#: ../../library/argparse.rst:1481 +#: ../../library/argparse.rst:1488 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " @@ -2920,7 +2933,7 @@ msgstr "" ":meth:`~ArgumentParser.parse_args` 方法支援多種方式來指定選項的值(如果它接受" "值的話)。在最簡單的情況下,選項和它的值作為兩個獨立的引數傳入: ::" -#: ../../library/argparse.rst:1485 +#: ../../library/argparse.rst:1492 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2938,7 +2951,7 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1493 +#: ../../library/argparse.rst:1500 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " @@ -2947,7 +2960,7 @@ msgstr "" "對於長選項(名稱長度超過一個字元的選項),選項和值也可以作為單個命令列引數傳" "入,使用 ``=`` 來分隔它們: ::" -#: ../../library/argparse.rst:1497 +#: ../../library/argparse.rst:1504 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2955,13 +2968,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1500 +#: ../../library/argparse.rst:1507 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "對於短選項(只有一個字元長的選項),選項和它的值可以串接在一起: ::" -#: ../../library/argparse.rst:1503 +#: ../../library/argparse.rst:1510 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2969,7 +2982,7 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1506 +#: ../../library/argparse.rst:1513 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" @@ -2977,7 +2990,7 @@ msgstr "" "如果只有最後一個選項需要值(或都不需要),多個短選項就可以被合併在一起、只使" "用一個 ``-`` 前綴: ::" -#: ../../library/argparse.rst:1509 +#: ../../library/argparse.rst:1516 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='store_true')\n" @@ -2993,11 +3006,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1518 +#: ../../library/argparse.rst:1525 msgid "Invalid arguments" msgstr "無效引數" -#: ../../library/argparse.rst:1520 +#: ../../library/argparse.rst:1527 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -3008,7 +3021,7 @@ msgstr "" "的選項、無效的型別、無效的選項、錯誤的位置引數數量等。當遇到此類錯誤時,它會" "退出並印出錯誤及用法訊息: ::" -#: ../../library/argparse.rst:1525 +#: ../../library/argparse.rst:1532 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -3048,11 +3061,11 @@ msgstr "" "usage: PROG [-h] [--foo FOO] [bar]\n" "PROG: error: extra arguments found: badger" -#: ../../library/argparse.rst:1546 +#: ../../library/argparse.rst:1553 msgid "Arguments containing ``-``" msgstr "包含 ``-`` 的引數" -#: ../../library/argparse.rst:1548 +#: ../../library/argparse.rst:1555 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -3069,7 +3082,7 @@ msgstr "" "位置引數只有在看起來像負數且剖析器中沒有看起來像負數的選項時,才可以用 ``-`` " "開頭: ::" -#: ../../library/argparse.rst:1556 +#: ../../library/argparse.rst:1563 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -3131,7 +3144,7 @@ msgstr "" "usage: PROG [-h] [-1 ONE] [foo]\n" "PROG: error: argument -1: expected one argument" -#: ../../library/argparse.rst:1586 +#: ../../library/argparse.rst:1593 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -3141,7 +3154,7 @@ msgstr "" "如果你有必須以 ``-`` 開頭且不像負數的位置引數,你可以插入偽引數 ``'--'``,它" "會告訴 :meth:`~ArgumentParser.parse_args` 在此之後的所有內容都是位置引數: ::" -#: ../../library/argparse.rst:1591 +#: ../../library/argparse.rst:1598 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -3149,7 +3162,7 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1594 +#: ../../library/argparse.rst:1601 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." @@ -3157,11 +3170,11 @@ msgstr "" "更多詳情請參閱 :ref:`argparse howto 中關於有歧義引數的說明 `。" -#: ../../library/argparse.rst:1600 +#: ../../library/argparse.rst:1607 msgid "Argument abbreviations (prefix matching)" msgstr "引數縮寫 (前綴匹配)" -#: ../../library/argparse.rst:1602 +#: ../../library/argparse.rst:1609 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " @@ -3170,7 +3183,7 @@ msgstr "" ":meth:`~ArgumentParser.parse_args` 方法\\ :ref:`預設 `\\ 允許長" "選項被縮寫為前綴,只要縮寫是無歧義的(前綴匹配到唯一的選項): ::" -#: ../../library/argparse.rst:1606 +#: ../../library/argparse.rst:1613 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -3194,7 +3207,7 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1617 +#: ../../library/argparse.rst:1624 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." @@ -3202,11 +3215,11 @@ msgstr "" "對於可能產生多個選項的引數會產生錯誤。可以透過將 :ref:`allow_abbrev` 設為 " "``False`` 來停用此功能。" -#: ../../library/argparse.rst:1623 +#: ../../library/argparse.rst:1630 msgid "Beyond ``sys.argv``" msgstr "``sys.argv`` 之外" -#: ../../library/argparse.rst:1625 +#: ../../library/argparse.rst:1632 msgid "" "Sometimes it may be useful to have an :class:`ArgumentParser` parse " "arguments other than those of :data:`sys.argv`. This can be accomplished by " @@ -3217,7 +3230,7 @@ msgstr "" "這可以透過將字串串列傳給 :meth:`~ArgumentParser.parse_args` 來完成。這對於在" "互動式提示中測試很有用: ::" -#: ../../library/argparse.rst:1630 +#: ../../library/argparse.rst:1637 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -3243,11 +3256,11 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1645 +#: ../../library/argparse.rst:1652 msgid "The Namespace object" msgstr "命名空間物件" -#: ../../library/argparse.rst:1649 +#: ../../library/argparse.rst:1656 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." @@ -3255,7 +3268,7 @@ msgstr "" ":meth:`~ArgumentParser.parse_args` 預設使用的簡單類別,用來建立保存屬性的物件" "並回傳它。" -#: ../../library/argparse.rst:1652 +#: ../../library/argparse.rst:1659 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " @@ -3264,7 +3277,7 @@ msgstr "" "這個類別刻意保持簡單,只是一個具有可讀字串表示的 :class:`object` 子類別。如果" "你偏好以類字典的方式檢視屬性,可以使用標準 Python 慣用寫法 :func:`vars`: ::" -#: ../../library/argparse.rst:1656 +#: ../../library/argparse.rst:1663 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3278,7 +3291,7 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1662 +#: ../../library/argparse.rst:1669 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " @@ -3288,7 +3301,7 @@ msgstr "" "`Namespace` 物件也可能很有用。這可以透過指定 ``namespace=`` 關鍵字引數來達" "成: ::" -#: ../../library/argparse.rst:1666 +#: ../../library/argparse.rst:1673 msgid "" ">>> class C:\n" "... pass\n" @@ -3310,15 +3323,15 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1678 +#: ../../library/argparse.rst:1685 msgid "Other utilities" msgstr "其他工具" -#: ../../library/argparse.rst:1681 +#: ../../library/argparse.rst:1688 msgid "Subcommands" msgstr "子命令" -#: ../../library/argparse.rst:1688 +#: ../../library/argparse.rst:1695 msgid "" "Many programs split up their functionality into a number of subcommands, for " "example, the ``svn`` program can invoke subcommands like ``svn checkout``, " @@ -3341,11 +3354,11 @@ msgstr "" "class:`!ArgumentParser` 建構函式引數,並回傳一個可以像往常一樣修改的 :class:" "`!ArgumentParser` 物件。" -#: ../../library/argparse.rst:1700 +#: ../../library/argparse.rst:1707 msgid "Description of parameters:" msgstr "參數的解釋:" -#: ../../library/argparse.rst:1702 +#: ../../library/argparse.rst:1709 msgid "" "*title* - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " @@ -3354,13 +3367,13 @@ msgstr "" "*title* - 說明輸出中子剖析器群組的標題;預設情況下,若有提供 description 則" "為 \"subcommands\",否則使用位置引數的標題" -#: ../../library/argparse.rst:1706 +#: ../../library/argparse.rst:1713 msgid "" "*description* - description for the sub-parser group in help output, by " "default ``None``" msgstr "*description* - 說明輸出中子剖析器群組的描述,預設為 ``None``" -#: ../../library/argparse.rst:1709 +#: ../../library/argparse.rst:1716 msgid "" "*prog* - usage information that will be displayed with subcommand help, by " "default the name of the program and any positional arguments before the " @@ -3369,7 +3382,7 @@ msgstr "" "*prog* - 將與子命令說明一起顯示的用法資訊,預設為程式名稱和子剖析器引數之前的" "任何位置引數" -#: ../../library/argparse.rst:1713 +#: ../../library/argparse.rst:1720 msgid "" "*parser_class* - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. :class:`ArgumentParser`)" @@ -3377,29 +3390,29 @@ msgstr "" "*parser_class* - 將用來建立子剖析器實例的類別,預設為目前剖析器的類別(例如 :" "class:`ArgumentParser`)" -#: ../../library/argparse.rst:1716 +#: ../../library/argparse.rst:1723 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "action_ - 在命令列遇到此引數時要執行的基本 action 類型" -#: ../../library/argparse.rst:1719 +#: ../../library/argparse.rst:1726 msgid "" "dest_ - name of the attribute under which subcommand name will be stored; by " "default ``None`` and no value is stored" msgstr "dest_ - 用於儲存子命令名稱的屬性名稱;預設為 ``None`` 且不儲存任何值" -#: ../../library/argparse.rst:1722 +#: ../../library/argparse.rst:1729 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "required_ - 是否必須提供子命令,預設為 ``False``\\ (在 3.7 中新增)" -#: ../../library/argparse.rst:1725 +#: ../../library/argparse.rst:1732 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "help_ - 說明輸出中子剖析器群組的說明,預設為 ``None``" -#: ../../library/argparse.rst:1727 +#: ../../library/argparse.rst:1734 msgid "" "metavar_ - string presenting available subcommands in help; by default it is " "``None`` and presents subcommands in form {cmd1, cmd2, ..}" @@ -3407,11 +3420,11 @@ msgstr "" "metavar_ - 在說明中呈現可用子命令的字串;預設為 ``None`` 並以 {cmd1, " "cmd2, ..} 的形式呈現子命令" -#: ../../library/argparse.rst:1730 +#: ../../library/argparse.rst:1737 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1732 +#: ../../library/argparse.rst:1739 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -3453,7 +3466,7 @@ msgstr "" ">>> parser.parse_args(['--foo', 'b', '--baz', 'Z'])\n" "Namespace(baz='Z', foo=True)" -#: ../../library/argparse.rst:1751 +#: ../../library/argparse.rst:1758 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -3467,7 +3480,15 @@ msgstr "" "``foo`` 和 ``bar`` 屬性存在;當指定 ``b`` 命令時,只有 ``foo`` 和 ``baz`` 屬" "性存在。" -#: ../../library/argparse.rst:1758 +#: ../../library/argparse.rst:1765 +msgid "" +"If a subparser defines an argument with the same ``dest`` as the parent " +"parser, the two share a single namespace attribute, so the parent's value " +"won't be retained. Users should give them distinct ``dest`` values to keep " +"both." +msgstr "" + +#: ../../library/argparse.rst:1770 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -3479,7 +3500,7 @@ msgstr "" "包含父剖析器或兄弟剖析器的訊息。(然而每個子剖析器命令的說明訊息可以透過如上" "所述向 :meth:`~_SubParsersAction.add_parser` 提供 ``help=`` 引數來給定。)" -#: ../../library/argparse.rst:1766 +#: ../../library/argparse.rst:1778 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -3537,7 +3558,7 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1794 +#: ../../library/argparse.rst:1806 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " @@ -3546,7 +3567,7 @@ msgstr "" ":meth:`add_subparsers` 方法也支援 ``title`` 和 ``description`` 關鍵字引數。當" "任一者存在時,子剖析器的命令會在說明輸出中以自己的群組出現。例如: ::" -#: ../../library/argparse.rst:1798 +#: ../../library/argparse.rst:1810 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -3582,7 +3603,7 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1815 +#: ../../library/argparse.rst:1827 msgid "" "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " "*aliases* argument, which allows multiple strings to refer to the same " @@ -3593,7 +3614,7 @@ msgstr "" "允許多個字串參照同一個子剖析器。這個範例像 ``svn`` 一樣,將 ``co`` 作為 " "``checkout`` 的簡寫別名: ::" -#: ../../library/argparse.rst:1820 +#: ../../library/argparse.rst:1832 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -3609,7 +3630,7 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1827 +#: ../../library/argparse.rst:1839 msgid "" ":meth:`~_SubParsersAction.add_parser` supports also an additional " "*deprecated* argument, which allows to deprecate the subparser." @@ -3617,7 +3638,7 @@ msgstr "" ":meth:`~_SubParsersAction.add_parser` 也支援一個額外的 *deprecated* 引數,它" "允許棄用子剖析器。" -#: ../../library/argparse.rst:1841 +#: ../../library/argparse.rst:1853 msgid "" "One particularly effective way of handling subcommands is to combine the use " "of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so " @@ -3628,7 +3649,7 @@ msgstr "" "`set_defaults` 的呼叫結合,使每個子剖析器知道它應該執行哪個 Python 函式。例" "如: ::" -#: ../../library/argparse.rst:1846 +#: ../../library/argparse.rst:1858 msgid "" ">>> # subcommand functions\n" ">>> def foo(args):\n" @@ -3694,7 +3715,7 @@ msgstr "" ">>> args.func(args)\n" "((XYZYX))" -#: ../../library/argparse.rst:1878 +#: ../../library/argparse.rst:1890 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -3708,7 +3729,7 @@ msgstr "" "檢查被呼叫的子剖析器名稱,:meth:`add_subparsers` 呼叫的 ``dest`` 關鍵字引數可" "以達成此目的: ::" -#: ../../library/argparse.rst:1885 +#: ../../library/argparse.rst:1897 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -3728,21 +3749,21 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1894 +#: ../../library/argparse.rst:1906 msgid "New *required* keyword-only parameter." msgstr "新增 *required* 僅限關鍵字參數。" -#: ../../library/argparse.rst:1897 +#: ../../library/argparse.rst:1909 msgid "" "Subparser's *prog* is no longer affected by a custom usage message in the " "main parser." msgstr "子剖析器的 *prog* 不再受主剖析器中自訂用法訊息的影響。" -#: ../../library/argparse.rst:1903 +#: ../../library/argparse.rst:1915 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1907 +#: ../../library/argparse.rst:1919 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -3755,7 +3776,7 @@ msgstr "" "衝區大小、編碼和錯誤處理開啟命令列引數作為檔案(更多詳情請參閱 :func:`open` " "函式): ::" -#: ../../library/argparse.rst:1913 +#: ../../library/argparse.rst:1925 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -3773,7 +3794,7 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1919 +#: ../../library/argparse.rst:1931 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " @@ -3783,7 +3804,7 @@ msgstr "" "件的 :data:`sys.stdin` 和可寫 :class:`FileType` 物件的 :data:`sys." "stdout`: ::" -#: ../../library/argparse.rst:1923 +#: ../../library/argparse.rst:1935 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -3795,7 +3816,7 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1930 +#: ../../library/argparse.rst:1942 msgid "" "If one argument uses *FileType* and then a subsequent argument fails, an " "error is reported but the file is not automatically closed. This can also " @@ -3807,15 +3828,15 @@ msgstr "" "自動關閉。這也可能覆蓋輸出檔案。在這種情況下,最好等到剖析器執行完畢後,再使" "用 :keyword:`with` 陳述式來管理檔案。" -#: ../../library/argparse.rst:1936 +#: ../../library/argparse.rst:1948 msgid "Added the *encoding* and *errors* parameters." msgstr "新增了 *encoding* 和 *errors* 參數。" -#: ../../library/argparse.rst:1943 +#: ../../library/argparse.rst:1955 msgid "Argument groups" msgstr "引數群組" -#: ../../library/argparse.rst:1948 +#: ../../library/argparse.rst:1960 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3827,7 +3848,7 @@ msgstr "" "引數」和「選項」兩組。當引數有比此預設分組更好的概念性分組時,可以使用 :meth:" "`!add_argument_group` 方法建立適當的群組: ::" -#: ../../library/argparse.rst:1954 +#: ../../library/argparse.rst:1966 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3851,7 +3872,7 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:1965 +#: ../../library/argparse.rst:1977 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" @@ -3867,7 +3888,7 @@ msgstr "" "引數。:meth:`!add_argument_group` 方法接受 *title* 和 *description* 引數,可" "以用來自訂此顯示: ::" -#: ../../library/argparse.rst:1973 +#: ../../library/argparse.rst:1985 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3905,7 +3926,7 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1991 +#: ../../library/argparse.rst:2003 msgid "" "The optional, keyword-only parameters argument_default_ and " "conflict_handler_ allow for finer-grained control of the behavior of the " @@ -3917,7 +3938,7 @@ msgstr "" "的行為進行更精細的控制。這些參數的意義與 :class:`ArgumentParser` 建構函式中的" "相同,但專門適用於引數群組而非整個剖析器。" -#: ../../library/argparse.rst:1996 +#: ../../library/argparse.rst:2008 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." @@ -3925,13 +3946,13 @@ msgstr "" "請注意,任何不在使用者定義群組中的引數會歸入一般的「位置引數」和「可選引數」" "區段。" -#: ../../library/argparse.rst:1999 +#: ../../library/argparse.rst:2011 msgid "" "Within each argument group, arguments are displayed in help output in the " "order in which they are added." msgstr "" -#: ../../library/argparse.rst:2002 +#: ../../library/argparse.rst:2014 msgid "" "Calling :meth:`add_argument_group` on an argument group now raises an " "exception. This nesting was never supported, often failed to work correctly, " @@ -3940,15 +3961,15 @@ msgstr "" "在引數群組上呼叫 :meth:`add_argument_group` 現在會引發例外。這種巢狀用法從未" "被支援,通常無法正確運作,是因為繼承而無意間被公開出來的。" -#: ../../library/argparse.rst:2007 +#: ../../library/argparse.rst:2019 msgid "Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated." msgstr "將 prefix_chars_ 傳給 :meth:`add_argument_group` 的用法現在已棄用。" -#: ../../library/argparse.rst:2013 +#: ../../library/argparse.rst:2025 msgid "Mutual exclusion" msgstr "互斥" -#: ../../library/argparse.rst:2017 +#: ../../library/argparse.rst:2029 msgid "" "Create a mutually exclusive group. :mod:`!argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " @@ -3957,7 +3978,7 @@ msgstr "" "建立一個互斥群組。:mod:`!argparse` 會確保互斥群組中只有一個引數出現在命令列" "上: ::" -#: ../../library/argparse.rst:2021 +#: ../../library/argparse.rst:2033 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3983,7 +4004,7 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:2033 +#: ../../library/argparse.rst:2045 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " @@ -3992,7 +4013,7 @@ msgstr "" ":meth:`add_mutually_exclusive_group` 方法也接受一個 *required* 引數,用來指示" "至少需要一個互斥引數: ::" -#: ../../library/argparse.rst:2037 +#: ../../library/argparse.rst:2049 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -4010,7 +4031,7 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:2045 +#: ../../library/argparse.rst:2057 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -4021,7 +4042,7 @@ msgstr "" "*title* 和 *description* 引數。然而互斥群組可以加入到具有標題和描述的引數群組" "中。例如: ::" -#: ../../library/argparse.rst:2051 +#: ../../library/argparse.rst:2063 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -4057,7 +4078,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:2068 +#: ../../library/argparse.rst:2080 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group now raises an exception. This nesting was " @@ -4068,11 +4089,11 @@ msgstr "" "`add_mutually_exclusive_group` 現在會引發例外。這種巢狀用法從未支援,通常無法" "正確運作,且是因為繼承而無意間被公開出來的。" -#: ../../library/argparse.rst:2076 +#: ../../library/argparse.rst:2088 msgid "Parser defaults" msgstr "剖析器預設值" -#: ../../library/argparse.rst:2080 +#: ../../library/argparse.rst:2092 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -4084,7 +4105,7 @@ msgstr "" "數 action 來決定。:meth:`set_defaults` 允許加入一些無需檢查命令列即可決定的額" "外屬性: ::" -#: ../../library/argparse.rst:2086 +#: ../../library/argparse.rst:2098 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -4098,7 +4119,7 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:2092 +#: ../../library/argparse.rst:2104 msgid "" "Note that defaults can be set at both the parser level using :meth:" "`set_defaults` and at the argument level using :meth:`add_argument`. If both " @@ -4109,7 +4130,7 @@ msgstr "" "級使用 :meth:`add_argument` 設定。如果兩者都為同一個引數呼叫,會使用最後設定" "的預設值: ::" -#: ../../library/argparse.rst:2096 +#: ../../library/argparse.rst:2108 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -4123,7 +4144,7 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:2102 +#: ../../library/argparse.rst:2114 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " @@ -4132,7 +4153,7 @@ msgstr "" "在使用多個剖析器時,剖析器層級的預設值可能特別有用。請參閱 :meth:" "`~ArgumentParser.add_subparsers` 方法以了解這類範例。" -#: ../../library/argparse.rst:2108 +#: ../../library/argparse.rst:2120 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" @@ -4140,7 +4161,7 @@ msgstr "" "取得命名空間屬性的預設值,由 :meth:`~ArgumentParser.add_argument` 或 :meth:" "`~ArgumentParser.set_defaults` 設定: ::" -#: ../../library/argparse.rst:2112 +#: ../../library/argparse.rst:2124 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -4152,11 +4173,11 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:2119 +#: ../../library/argparse.rst:2131 msgid "Printing help" msgstr "印出幫助訊息" -#: ../../library/argparse.rst:2121 +#: ../../library/argparse.rst:2133 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " @@ -4165,7 +4186,7 @@ msgstr "" "在大多數典型的應用程式中,:meth:`~ArgumentParser.parse_args` 會處理格式化和印" "出任何用法或錯誤訊息。然而,有幾個格式化方法可以使用:" -#: ../../library/argparse.rst:2127 +#: ../../library/argparse.rst:2139 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " @@ -4174,7 +4195,7 @@ msgstr "" "印出 :class:`ArgumentParser` 在命令列上呼叫方式的簡短描述。如果 *file* 為 " "``None``,則假設為 :data:`sys.stdout`。" -#: ../../library/argparse.rst:2133 +#: ../../library/argparse.rst:2145 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " @@ -4183,20 +4204,20 @@ msgstr "" "印出說明訊息,包括程式用法和在 :class:`ArgumentParser` 中註冊的引數相關資訊。" "如果 *file* 為 ``None``,假設為 :data:`sys.stdout`。" -#: ../../library/argparse.rst:2137 +#: ../../library/argparse.rst:2149 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "這些方法也有變體,它們只回傳字串而非印出它:" -#: ../../library/argparse.rst:2142 +#: ../../library/argparse.rst:2154 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" "回傳一個字串,包含 :class:`ArgumentParser` 在命令列上的呼叫方式的簡短描述。" -#: ../../library/argparse.rst:2147 +#: ../../library/argparse.rst:2159 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." @@ -4204,11 +4225,11 @@ msgstr "" "回傳一個字串,包含說明訊息,包括程式用法和在 :class:`ArgumentParser` 中註冊的" "引數相關資訊。" -#: ../../library/argparse.rst:2152 +#: ../../library/argparse.rst:2164 msgid "Partial parsing" msgstr "部分剖析" -#: ../../library/argparse.rst:2156 +#: ../../library/argparse.rst:2168 msgid "" "Sometimes a script only needs to handle a specific set of command-line " "arguments, leaving any unrecognized arguments for another script or program. " @@ -4219,7 +4240,7 @@ msgstr "" "本或程式。在這些情況下,:meth:`~ArgumentParser.parse_known_args` 方法可能很有" "用。" -#: ../../library/argparse.rst:2161 +#: ../../library/argparse.rst:2173 msgid "" "This method works similarly to :meth:`~ArgumentParser.parse_args`, but it " "does not raise an error for extra, unrecognized arguments. Instead, it " @@ -4230,7 +4251,7 @@ msgstr "" "辨識的引數引發錯誤,而是會只剖析已知的引數並回傳一個包含填充後的命名空間和任" "何未辨識引數串列的二元素元組。" -#: ../../library/argparse.rst:2168 +#: ../../library/argparse.rst:2180 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -4244,7 +4265,7 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2175 +#: ../../library/argparse.rst:2187 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -4255,11 +4276,11 @@ msgstr "" "parse_known_args`。即使選項只是其已知選項之一的前綴,剖析器也可能消耗它,而非" "將其留在剩餘引數串列中。" -#: ../../library/argparse.rst:2182 +#: ../../library/argparse.rst:2194 msgid "Customizing file parsing" msgstr "自訂檔案剖析" -#: ../../library/argparse.rst:2186 +#: ../../library/argparse.rst:2198 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -4270,7 +4291,7 @@ msgstr "" "*fromfile_prefix_chars* 關鍵字引數)每行讀取一個引數。可以覆寫 :meth:" "`convert_arg_line_to_args` 以進行更精細的讀取。" -#: ../../library/argparse.rst:2191 +#: ../../library/argparse.rst:2203 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " @@ -4279,7 +4300,7 @@ msgstr "" "此方法接受單個引數 *arg_line*,它是從引數檔案讀取的字串。它回傳從此字串剖析出" "的引數串列。此方法對從引數檔案讀取的每一行依序呼叫一次。" -#: ../../library/argparse.rst:2195 +#: ../../library/argparse.rst:2207 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" @@ -4287,7 +4308,7 @@ msgstr "" "此方法的一個有用覆寫是將每個以空格分隔的詞作為引數。以下範例示範了如何做到這" "一點: ::" -#: ../../library/argparse.rst:2198 +#: ../../library/argparse.rst:2210 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -4297,11 +4318,17 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2204 +#: ../../library/argparse.rst:2214 +msgid "" +"Note that with this override an argument can no longer contain spaces, since " +"each space-separated word becomes a separate argument." +msgstr "" + +#: ../../library/argparse.rst:2219 msgid "Exiting methods" msgstr "退出方法" -#: ../../library/argparse.rst:2208 +#: ../../library/argparse.rst:2223 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " @@ -4311,7 +4338,7 @@ msgstr "" "`sys.stderr` 印出一個 *message*。使用者可以覆寫此方法來以不同方式處理這些步" "驟: ::" -#: ../../library/argparse.rst:2212 +#: ../../library/argparse.rst:2227 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -4325,7 +4352,7 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2220 +#: ../../library/argparse.rst:2235 msgid "" "This method prints a usage message, including the *message*, to :data:`sys." "stderr` and terminates the program with a status code of 2." @@ -4333,11 +4360,11 @@ msgstr "" "此方法將用法訊息(包含 *message*)印出到 :data:`sys.stderr`,並以狀態碼 2 終" "止程式。" -#: ../../library/argparse.rst:2225 +#: ../../library/argparse.rst:2240 msgid "Intermixed parsing" msgstr "交錯剖析" -#: ../../library/argparse.rst:2230 +#: ../../library/argparse.rst:2245 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -4348,7 +4375,7 @@ msgstr "" "parse_intermixed_args` 和 :meth:`~ArgumentParser." "parse_known_intermixed_args` 方法支援此剖析風格。" -#: ../../library/argparse.rst:2235 +#: ../../library/argparse.rst:2250 msgid "" "These parsers do not support all the :mod:`!argparse` features, and will " "raise exceptions if unsupported features are used. In particular, " @@ -4358,7 +4385,7 @@ msgstr "" "這些剖析器不支援所有 :mod:`!argparse` 功能,如果使用了不支援的功能會引發例" "外。特別是不支援子剖析器,以及同時包含可選引數和位置引數的互斥群組。" -#: ../../library/argparse.rst:2240 +#: ../../library/argparse.rst:2255 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -4369,7 +4396,7 @@ msgstr "" "`~ArgumentParser.parse_intermixed_args` 之間的差異:前者回傳 ``['2', '3']`` " "作為未剖析的引數,而後者將所有位置引數收集到 ``rest`` 中。 ::" -#: ../../library/argparse.rst:2246 +#: ../../library/argparse.rst:2261 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -4389,7 +4416,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2255 +#: ../../library/argparse.rst:2270 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -4400,11 +4427,11 @@ msgstr "" "填充後的命名空間和剩餘引數字串的串列。:meth:`~ArgumentParser." "parse_intermixed_args` 在有任何剩餘未剖析的引數字串時會引發錯誤。" -#: ../../library/argparse.rst:2264 +#: ../../library/argparse.rst:2279 msgid "Registering custom types or actions" msgstr "註冊自訂型別或 action" -#: ../../library/argparse.rst:2268 +#: ../../library/argparse.rst:2283 msgid "" "Sometimes it's desirable to use a custom string in error messages to provide " "more user-friendly output. In these cases, :meth:`!register` can be used to " @@ -4415,7 +4442,7 @@ msgstr "" "用 :meth:`!register` 向剖析器註冊自訂 action 或型別,讓你可以透過註冊名稱而非" "可呼叫物件名稱來參照型別。" -#: ../../library/argparse.rst:2273 +#: ../../library/argparse.rst:2288 msgid "" "The :meth:`!register` method accepts three arguments - a *registry_name*, " "specifying the internal registry where the object will be stored (e.g., " @@ -4426,12 +4453,12 @@ msgstr "" "錄檔(例如 ``action``、``type``);*value*,用於註冊物件的鍵值;以及 object," "要註冊的可呼叫物件。" -#: ../../library/argparse.rst:2278 +#: ../../library/argparse.rst:2293 msgid "" "The following example shows how to register a custom type with a parser::" msgstr "以下範例展示如何向剖析器註冊自訂型別: ::" -#: ../../library/argparse.rst:2280 +#: ../../library/argparse.rst:2295 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -4459,42 +4486,50 @@ msgstr "" "usage: PROG [-h] [--foo FOO]\n" "PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" -#: ../../library/argparse.rst:2292 +#: ../../library/argparse.rst:2307 msgid "Exceptions" msgstr "例外" -#: ../../library/argparse.rst:2296 +#: ../../library/argparse.rst:2311 msgid "An error from creating or using an argument (optional or positional)." msgstr "建立或使用引數(可選或位置引數)時的錯誤。" -#: ../../library/argparse.rst:2298 +#: ../../library/argparse.rst:2313 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "此例外的字串值是訊息,附帶了導致錯誤的引數的相關資訊。" -#: ../../library/argparse.rst:2303 +#: ../../library/argparse.rst:2318 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "當將命令列字串轉換為型別時出錯時引發。" -#: ../../library/argparse.rst:2307 +#: ../../library/argparse.rst:2322 msgid "Guides and Tutorials" msgstr "指南與教學" -#: ../../library/argparse.rst:908 +#: ../../library/argparse.rst:907 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:908 ../../library/argparse.rst:940 -#: ../../library/argparse.rst:954 +#: ../../library/argparse.rst:907 ../../library/argparse.rst:939 +#: ../../library/argparse.rst:953 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:940 +#: ../../library/argparse.rst:939 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:954 +#: ../../library/argparse.rst:953 msgid "+ (plus)" msgstr "+ (加號)" + +#~ msgid "" +#~ "Empty lines are treated as empty strings (``''``), which are allowed as " +#~ "values but not as arguments. Empty lines that are read as arguments will " +#~ "result in an \"unrecognized arguments\" error." +#~ msgstr "" +#~ "空行會被視為空字串 (``''``),可以作為值但不能作為引數。若空行被讀取為引" +#~ "數,會導致 \"unrecognized arguments\" 錯誤。" diff --git a/library/pyexpat.po b/library/pyexpat.po index 04d1f67f7e..89128bc32c 100644 --- a/library/pyexpat.po +++ b/library/pyexpat.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-18 00:20+0000\n" +"POT-Creation-Date: 2026-06-10 00:43+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -283,58 +283,73 @@ msgid "" msgstr "" #: ../../library/pyexpat.rst:241 +#, fuzzy msgid "" -":class:`!xmlparser` objects have the following methods to mitigate some " -"common XML vulnerabilities." +":class:`!xmlparser` objects have the following methods to tune protections " +"against some common XML vulnerabilities." msgstr ":class:`!xmlparser` 物件擁有以下方法來減輕一些常見的 XML 漏洞。" #: ../../library/pyexpat.rst:246 msgid "" -"Sets the number of allocated bytes of dynamic memory needed to activate " -"protection against disproportionate use of RAM." +"Sets the number of output bytes needed to activate protection against " +"`billion laughs`_ attacks." msgstr "" #: ../../library/pyexpat.rst:249 msgid "" -"By default, parser objects have an allocation activation threshold of 64 " -"MiB, or equivalently 67,108,864 bytes." +"The number of output bytes includes amplification from entity expansion and " +"reading DTD files." msgstr "" #: ../../library/pyexpat.rst:252 msgid "" +"Parser objects usually have a protection activation threshold of 8 MiB, but " +"the actual default value depends on the underlying Expat library." +msgstr "" + +#: ../../library/pyexpat.rst:255 ../../library/pyexpat.rst:307 +msgid "" "An :exc:`ExpatError` is raised if this method is called on a |xml-non-root-" "parser| parser. The corresponding :attr:`~ExpatError.lineno` and :attr:" "`~ExpatError.offset` should not be used as they may have no special meaning." msgstr "" -#: ../../library/pyexpat.rst:261 +#: ../../library/pyexpat.rst:262 msgid "" -"Sets the maximum amplification factor between direct input and bytes of " -"dynamic memory allocated." +"Activation thresholds below 4 MiB are known to break support for DITA 1.3 " +"payload and are hence not recommended." msgstr "" -#: ../../library/pyexpat.rst:264 +#: ../../library/pyexpat.rst:269 msgid "" -"The amplification factor is calculated as ``allocated / direct`` while " -"parsing, where ``direct`` is the number of bytes read from the primary " -"document in parsing and ``allocated`` is the number of bytes of dynamic " -"memory allocated in the parser hierarchy." +"Sets the maximum tolerated amplification factor for protection against " +"`billion laughs`_ attacks." msgstr "" -#: ../../library/pyexpat.rst:269 +#: ../../library/pyexpat.rst:272 +msgid "" +"The amplification factor is calculated as ``(direct + indirect) / direct`` " +"while parsing, where ``direct`` is the number of bytes read from the primary " +"document in parsing and ``indirect`` is the number of bytes added by " +"expanding entities and reading of external DTD files." +msgstr "" + +#: ../../library/pyexpat.rst:277 msgid "" "The *max_factor* value must be a non-NaN :class:`float` value greater than " -"or equal to 1.0. Amplification factors greater than 100.0 can be observed " -"near the start of parsing even with benign files in practice. In particular, " -"the activation threshold should be carefully chosen to avoid false positives." +"or equal to 1.0. Peak amplifications of factor 15,000 for the entire payload " +"and of factor 30,000 in the middle of parsing have been observed with small " +"benign files in practice. In particular, the activation threshold should be " +"carefully chosen to avoid false positives." msgstr "" -#: ../../library/pyexpat.rst:274 +#: ../../library/pyexpat.rst:283 ../../library/pyexpat.rst:329 msgid "" -"By default, parser objects have a maximum amplification factor of 100.0." +"Parser objects usually have a maximum amplification factor of 100, but the " +"actual default value depends on the underlying Expat library." msgstr "" -#: ../../library/pyexpat.rst:276 +#: ../../library/pyexpat.rst:286 ../../library/pyexpat.rst:332 msgid "" "An :exc:`ExpatError` is raised if this method is called on a |xml-non-root-" "parser| parser or if *max_factor* is outside the valid range. The " @@ -342,24 +357,65 @@ msgid "" "should not be used as they may have no special meaning." msgstr "" -#: ../../library/pyexpat.rst:283 +#: ../../library/pyexpat.rst:293 +msgid "" +"The maximum amplification factor is only considered if the threshold that " +"can be adjusted by :meth:`." +"SetBillionLaughsAttackProtectionActivationThreshold` is exceeded." +msgstr "" + +#: ../../library/pyexpat.rst:301 +msgid "" +"Sets the number of allocated bytes of dynamic memory needed to activate " +"protection against disproportionate use of RAM." +msgstr "" + +#: ../../library/pyexpat.rst:304 +msgid "" +"Parser objects usually have an allocation activation threshold of 64 MiB, " +"but the actual default value depends on the underlying Expat library." +msgstr "" + +#: ../../library/pyexpat.rst:316 +msgid "" +"Sets the maximum amplification factor between direct input and bytes of " +"dynamic memory allocated." +msgstr "" + +#: ../../library/pyexpat.rst:319 +msgid "" +"The amplification factor is calculated as ``allocated / direct`` while " +"parsing, where ``direct`` is the number of bytes read from the primary " +"document in parsing and ``allocated`` is the number of bytes of dynamic " +"memory allocated in the parser hierarchy." +msgstr "" + +#: ../../library/pyexpat.rst:324 +msgid "" +"The *max_factor* value must be a non-NaN :class:`float` value greater than " +"or equal to 1.0. Amplification factors greater than 100.0 can be observed " +"near the start of parsing even with benign files in practice. In particular, " +"the activation threshold should be carefully chosen to avoid false positives." +msgstr "" + +#: ../../library/pyexpat.rst:339 msgid "" "The maximum amplification factor is only considered if the threshold that " "can be adjusted by :meth:`.SetAllocTrackerActivationThreshold` is exceeded." msgstr "" -#: ../../library/pyexpat.rst:290 +#: ../../library/pyexpat.rst:346 msgid ":class:`xmlparser` objects have the following attributes:" msgstr ":class:`xmlparser` 物件擁有以下屬性:" -#: ../../library/pyexpat.rst:295 +#: ../../library/pyexpat.rst:351 msgid "" "The size of the buffer used when :attr:`buffer_text` is true. A new buffer " "size can be set by assigning a new integer value to this attribute. When the " "size is changed, the buffer will be flushed." msgstr "" -#: ../../library/pyexpat.rst:303 +#: ../../library/pyexpat.rst:359 msgid "" "Setting this to true causes the :class:`xmlparser` object to buffer textual " "content returned by Expat to avoid multiple calls to the :meth:" @@ -370,14 +426,14 @@ msgid "" "newlines may be chunked too." msgstr "" -#: ../../library/pyexpat.rst:314 +#: ../../library/pyexpat.rst:370 msgid "" "If :attr:`buffer_text` is enabled, the number of bytes stored in the buffer. " "These bytes represent UTF-8 encoded text. This attribute has no meaningful " "interpretation when :attr:`buffer_text` is false." msgstr "" -#: ../../library/pyexpat.rst:321 +#: ../../library/pyexpat.rst:377 msgid "" "Setting this attribute to a non-zero integer causes the attributes to be " "reported as a list rather than a dictionary. The attributes are presented " @@ -387,7 +443,7 @@ msgid "" "is false; it may be changed at any time." msgstr "" -#: ../../library/pyexpat.rst:331 +#: ../../library/pyexpat.rst:387 msgid "" "If set to a non-zero integer, the parser will report only those attributes " "which were specified in the document instance and not those which were " @@ -398,7 +454,7 @@ msgid "" "time." msgstr "" -#: ../../library/pyexpat.rst:339 +#: ../../library/pyexpat.rst:395 msgid "" "The following attributes contain values relating to the most recent error " "encountered by an :class:`xmlparser` object, and will only have correct " @@ -406,26 +462,26 @@ msgid "" "`xml.parsers.expat.ExpatError` exception." msgstr "" -#: ../../library/pyexpat.rst:347 +#: ../../library/pyexpat.rst:403 msgid "Byte index at which an error occurred." msgstr "" -#: ../../library/pyexpat.rst:352 +#: ../../library/pyexpat.rst:408 msgid "" "Numeric code specifying the problem. This value can be passed to the :func:" "`ErrorString` function, or compared to one of the constants defined in the " "``errors`` object." msgstr "" -#: ../../library/pyexpat.rst:359 +#: ../../library/pyexpat.rst:415 msgid "Column number at which an error occurred." msgstr "" -#: ../../library/pyexpat.rst:364 +#: ../../library/pyexpat.rst:420 msgid "Line number at which an error occurred." msgstr "" -#: ../../library/pyexpat.rst:366 +#: ../../library/pyexpat.rst:422 msgid "" "The following attributes contain values relating to the current parse " "location in an :class:`xmlparser` object. During a callback reporting a " @@ -435,19 +491,19 @@ msgid "" "whether there was an associated callback)." msgstr "" -#: ../../library/pyexpat.rst:376 +#: ../../library/pyexpat.rst:432 msgid "Current byte index in the parser input." msgstr "" -#: ../../library/pyexpat.rst:381 +#: ../../library/pyexpat.rst:437 msgid "Current column number in the parser input." msgstr "" -#: ../../library/pyexpat.rst:386 +#: ../../library/pyexpat.rst:442 msgid "Current line number in the parser input." msgstr "" -#: ../../library/pyexpat.rst:388 +#: ../../library/pyexpat.rst:444 msgid "" "Here is the list of handlers that can be set. To set a handler on an :class:" "`xmlparser` object *o*, use ``o.handlername = func``. *handlername* must be " @@ -456,7 +512,7 @@ msgid "" "unless otherwise stated." msgstr "" -#: ../../library/pyexpat.rst:397 +#: ../../library/pyexpat.rst:453 msgid "" "Called when the XML declaration is parsed. The XML declaration is the " "(optional) declaration of the applicable version of the XML recommendation, " @@ -467,7 +523,7 @@ msgid "" "only available with Expat version 1.95.0 or newer." msgstr "" -#: ../../library/pyexpat.rst:408 +#: ../../library/pyexpat.rst:464 msgid "" "Called when Expat begins parsing the document type declaration (``'``." msgstr "" -#: ../../library/pyexpat.rst:525 +#: ../../library/pyexpat.rst:581 msgid "" "Called at the start of a CDATA section. This and :attr:" "`EndCdataSectionHandler` are needed to be able to identify the syntactical " "start and end for CDATA sections." msgstr "" -#: ../../library/pyexpat.rst:532 +#: ../../library/pyexpat.rst:588 msgid "Called at the end of a CDATA section." msgstr "在 CDATA 區塊結束時呼叫。" -#: ../../library/pyexpat.rst:537 +#: ../../library/pyexpat.rst:593 msgid "" "Called for any characters in the XML document for which no applicable " "handler has been specified. This means characters that are part of a " @@ -601,14 +657,14 @@ msgid "" "supplied." msgstr "" -#: ../../library/pyexpat.rst:544 +#: ../../library/pyexpat.rst:600 msgid "" "This is the same as the :func:`DefaultHandler`, but doesn't inhibit " "expansion of internal entities. The entity reference will not be passed to " "the default handler." msgstr "" -#: ../../library/pyexpat.rst:551 +#: ../../library/pyexpat.rst:607 msgid "" "Called if the XML document hasn't been declared as being a standalone " "document. This happens when there is an external subset or a reference to a " @@ -618,7 +674,7 @@ msgid "" "set, no exception is raised by the parser for this condition." msgstr "" -#: ../../library/pyexpat.rst:563 +#: ../../library/pyexpat.rst:619 msgid "" "Implementing a handler that accesses local files and/or the network may " "create a vulnerability to `external entity attacks `_ before implementing this handler." msgstr "" -#: ../../library/pyexpat.rst:570 +#: ../../library/pyexpat.rst:626 msgid "" "Called for references to external entities. *base* is the current base, as " "set by a previous call to :meth:`SetBase`. The public and system " @@ -636,7 +692,7 @@ msgid "" "is opaque and should only be used as described below." msgstr "" -#: ../../library/pyexpat.rst:576 +#: ../../library/pyexpat.rst:632 msgid "" "For external entities to be parsed, this handler must be implemented. It is " "responsible for creating the sub-parser using " @@ -646,28 +702,28 @@ msgid "" "`XML_ERROR_EXTERNAL_ENTITY_HANDLING` error, otherwise parsing will continue." msgstr "" -#: ../../library/pyexpat.rst:584 +#: ../../library/pyexpat.rst:640 msgid "" "If this handler is not provided, external entities are reported by the :attr:" "`DefaultHandler` callback, if provided." msgstr "" -#: ../../library/pyexpat.rst:591 +#: ../../library/pyexpat.rst:647 msgid "ExpatError Exceptions" msgstr "ExpatError 例外" -#: ../../library/pyexpat.rst:596 +#: ../../library/pyexpat.rst:652 msgid ":exc:`ExpatError` exceptions have a number of interesting attributes:" msgstr "" -#: ../../library/pyexpat.rst:601 +#: ../../library/pyexpat.rst:657 msgid "" "Expat's internal error number for the specific error. The :data:`errors." "messages ` dictionary maps these error " "numbers to Expat's error messages. For example::" msgstr "" -#: ../../library/pyexpat.rst:605 +#: ../../library/pyexpat.rst:661 msgid "" "from xml.parsers.expat import ParserCreate, ExpatError, errors\n" "\n" @@ -685,36 +741,36 @@ msgstr "" "except ExpatError as err:\n" " print(\"Error:\", errors.messages[err.code])" -#: ../../library/pyexpat.rst:613 +#: ../../library/pyexpat.rst:669 msgid "" "The :mod:`~xml.parsers.expat.errors` module also provides error message " "constants and a dictionary :data:`~xml.parsers.expat.errors.codes` mapping " "these messages back to the error codes, see below." msgstr "" -#: ../../library/pyexpat.rst:620 +#: ../../library/pyexpat.rst:676 msgid "" "Line number on which the error was detected. The first line is numbered " "``1``." msgstr "" -#: ../../library/pyexpat.rst:625 +#: ../../library/pyexpat.rst:681 msgid "" "Character offset into the line where the error occurred. The first column " "is numbered ``0``." msgstr "" -#: ../../library/pyexpat.rst:632 +#: ../../library/pyexpat.rst:688 msgid "Example" msgstr "範例" -#: ../../library/pyexpat.rst:634 +#: ../../library/pyexpat.rst:690 msgid "" "The following program defines three handlers that just print out their " "arguments. ::" msgstr "" -#: ../../library/pyexpat.rst:637 +#: ../../library/pyexpat.rst:693 msgid "" "import xml.parsers.expat\n" "\n" @@ -758,11 +814,11 @@ msgstr "" "More text\n" "\"\"\", 1)" -#: ../../library/pyexpat.rst:658 +#: ../../library/pyexpat.rst:714 msgid "The output from this program is::" msgstr "這個程式的輸出是: ::" -#: ../../library/pyexpat.rst:660 +#: ../../library/pyexpat.rst:716 msgid "" "Start element: parent {'id': 'top'}\n" "Start element: child1 {'name': 'paul'}\n" @@ -786,76 +842,76 @@ msgstr "" "Character data: '\\n'\n" "End element: parent" -#: ../../library/pyexpat.rst:675 +#: ../../library/pyexpat.rst:731 msgid "Content Model Descriptions" msgstr "" -#: ../../library/pyexpat.rst:681 +#: ../../library/pyexpat.rst:737 msgid "" "Content models are described using nested tuples. Each tuple contains four " "values: the type, the quantifier, the name, and a tuple of children. " "Children are simply additional content model descriptions." msgstr "" -#: ../../library/pyexpat.rst:685 +#: ../../library/pyexpat.rst:741 msgid "" "The values of the first two fields are constants defined in the :mod:`!xml." "parsers.expat.model` module. These constants can be collected in two " "groups: the model type group and the quantifier group." msgstr "" -#: ../../library/pyexpat.rst:689 +#: ../../library/pyexpat.rst:745 msgid "The constants in the model type group are:" msgstr "" -#: ../../library/pyexpat.rst:695 +#: ../../library/pyexpat.rst:751 msgid "" "The element named by the model name was declared to have a content model of " "``ANY``." msgstr "" -#: ../../library/pyexpat.rst:702 +#: ../../library/pyexpat.rst:758 msgid "" "The named element allows a choice from a number of options; this is used for " "content models such as ``(A | B | C)``." msgstr "" -#: ../../library/pyexpat.rst:709 +#: ../../library/pyexpat.rst:765 msgid "Elements which are declared to be ``EMPTY`` have this model type." msgstr "" -#: ../../library/pyexpat.rst:723 +#: ../../library/pyexpat.rst:779 msgid "" "Models which represent a series of models which follow one after the other " "are indicated with this model type. This is used for models such as ``(A, " "B, C)``." msgstr "" -#: ../../library/pyexpat.rst:726 +#: ../../library/pyexpat.rst:782 msgid "The constants in the quantifier group are:" msgstr "" -#: ../../library/pyexpat.rst:732 +#: ../../library/pyexpat.rst:788 msgid "No modifier is given, so it can appear exactly once, as for ``A``." msgstr "" -#: ../../library/pyexpat.rst:738 +#: ../../library/pyexpat.rst:794 msgid "The model is optional: it can appear once or not at all, as for ``A?``." msgstr "" -#: ../../library/pyexpat.rst:744 +#: ../../library/pyexpat.rst:800 msgid "The model must occur one or more times (like ``A+``)." msgstr "" -#: ../../library/pyexpat.rst:750 +#: ../../library/pyexpat.rst:806 msgid "The model must occur zero or more times, as for ``A*``." msgstr "" -#: ../../library/pyexpat.rst:756 +#: ../../library/pyexpat.rst:812 msgid "Expat error constants" msgstr "Expat 錯誤常數" -#: ../../library/pyexpat.rst:760 +#: ../../library/pyexpat.rst:816 msgid "" "The following constants are provided in the :mod:`!xml.parsers.expat.errors` " "module. These constants are useful in interpreting some of the attributes " @@ -866,210 +922,210 @@ msgid "" "XML_ERROR_{CONSTANT_NAME}]`." msgstr "" -#: ../../library/pyexpat.rst:768 +#: ../../library/pyexpat.rst:824 msgid "The ``errors`` module has the following attributes:" msgstr "``errors`` 模組有以下屬性:" -#: ../../library/pyexpat.rst:772 +#: ../../library/pyexpat.rst:828 msgid "A dictionary mapping string descriptions to their error codes." msgstr "" -#: ../../library/pyexpat.rst:779 +#: ../../library/pyexpat.rst:835 msgid "A dictionary mapping numeric error codes to their string descriptions." msgstr "" -#: ../../library/pyexpat.rst:789 +#: ../../library/pyexpat.rst:845 msgid "" "An entity reference in an attribute value referred to an external entity " "instead of an internal entity." msgstr "" -#: ../../library/pyexpat.rst:795 +#: ../../library/pyexpat.rst:851 msgid "" "A character reference referred to a character which is illegal in XML (for " "example, character ``0``, or '``�``')." msgstr "" -#: ../../library/pyexpat.rst:801 +#: ../../library/pyexpat.rst:857 msgid "" "An entity reference referred to an entity which was declared with a " "notation, so cannot be parsed." msgstr "" -#: ../../library/pyexpat.rst:807 +#: ../../library/pyexpat.rst:863 msgid "An attribute was used more than once in a start tag." msgstr "" -#: ../../library/pyexpat.rst:815 +#: ../../library/pyexpat.rst:871 msgid "" "Raised when an input byte could not properly be assigned to a character; for " "example, a NUL byte (value ``0``) in a UTF-8 input stream." msgstr "" -#: ../../library/pyexpat.rst:821 +#: ../../library/pyexpat.rst:877 msgid "Something other than whitespace occurred after the document element." msgstr "" -#: ../../library/pyexpat.rst:826 +#: ../../library/pyexpat.rst:882 msgid "" "An XML declaration was found somewhere other than the start of the input " "data." msgstr "" -#: ../../library/pyexpat.rst:831 +#: ../../library/pyexpat.rst:887 msgid "" "The document contains no elements (XML requires all documents to contain " "exactly one top-level element).." msgstr "" -#: ../../library/pyexpat.rst:837 +#: ../../library/pyexpat.rst:893 msgid "Expat was not able to allocate memory internally." msgstr "" -#: ../../library/pyexpat.rst:842 +#: ../../library/pyexpat.rst:898 msgid "A parameter entity reference was found where it was not allowed." msgstr "" -#: ../../library/pyexpat.rst:847 +#: ../../library/pyexpat.rst:903 msgid "An incomplete character was found in the input." msgstr "" -#: ../../library/pyexpat.rst:852 +#: ../../library/pyexpat.rst:908 msgid "" "An entity reference contained another reference to the same entity; possibly " "via a different name, and possibly indirectly." msgstr "" -#: ../../library/pyexpat.rst:858 +#: ../../library/pyexpat.rst:914 msgid "Some unspecified syntax error was encountered." msgstr "" -#: ../../library/pyexpat.rst:863 +#: ../../library/pyexpat.rst:919 msgid "An end tag did not match the innermost open start tag." msgstr "" -#: ../../library/pyexpat.rst:868 +#: ../../library/pyexpat.rst:924 msgid "" "Some token (such as a start tag) was not closed before the end of the stream " "or the next token was encountered." msgstr "" -#: ../../library/pyexpat.rst:874 +#: ../../library/pyexpat.rst:930 msgid "A reference was made to an entity which was not defined." msgstr "" -#: ../../library/pyexpat.rst:879 +#: ../../library/pyexpat.rst:935 msgid "The document encoding is not supported by Expat." msgstr "" -#: ../../library/pyexpat.rst:884 +#: ../../library/pyexpat.rst:940 msgid "A CDATA marked section was not closed." msgstr "以 CDATA 標記的區塊未被關閉。" -#: ../../library/pyexpat.rst:892 +#: ../../library/pyexpat.rst:948 msgid "" "The parser determined that the document was not \"standalone\" though it " "declared itself to be in the XML declaration, and the :attr:" "`NotStandaloneHandler` was set and returned ``0``." msgstr "" -#: ../../library/pyexpat.rst:905 +#: ../../library/pyexpat.rst:961 msgid "" "An operation was requested that requires DTD support to be compiled in, but " "Expat was configured without DTD support. This should never be reported by " "a standard build of the :mod:`!xml.parsers.expat` module." msgstr "" -#: ../../library/pyexpat.rst:912 +#: ../../library/pyexpat.rst:968 msgid "" "A behavioral change was requested after parsing started that can only be " "changed before parsing has started. This is (currently) only raised by :" "meth:`UseForeignDTD`." msgstr "" -#: ../../library/pyexpat.rst:919 +#: ../../library/pyexpat.rst:975 msgid "An undeclared prefix was found when namespace processing was enabled." msgstr "" -#: ../../library/pyexpat.rst:924 +#: ../../library/pyexpat.rst:980 msgid "" "The document attempted to remove the namespace declaration associated with a " "prefix." msgstr "" -#: ../../library/pyexpat.rst:930 +#: ../../library/pyexpat.rst:986 msgid "A parameter entity contained incomplete markup." msgstr "" -#: ../../library/pyexpat.rst:935 +#: ../../library/pyexpat.rst:991 msgid "The document contained no document element at all." msgstr "" -#: ../../library/pyexpat.rst:940 +#: ../../library/pyexpat.rst:996 msgid "There was an error parsing a text declaration in an external entity." msgstr "" -#: ../../library/pyexpat.rst:945 +#: ../../library/pyexpat.rst:1001 msgid "Characters were found in the public id that are not allowed." msgstr "" -#: ../../library/pyexpat.rst:950 +#: ../../library/pyexpat.rst:1006 msgid "" "The requested operation was made on a suspended parser, but isn't allowed. " "This includes attempts to provide additional input or to stop the parser." msgstr "" -#: ../../library/pyexpat.rst:956 +#: ../../library/pyexpat.rst:1012 msgid "" "An attempt to resume the parser was made when the parser had not been " "suspended." msgstr "" -#: ../../library/pyexpat.rst:961 ../../library/pyexpat.rst:994 -#: ../../library/pyexpat.rst:999 +#: ../../library/pyexpat.rst:1017 ../../library/pyexpat.rst:1050 +#: ../../library/pyexpat.rst:1055 msgid "This should not be reported to Python applications." msgstr "" -#: ../../library/pyexpat.rst:966 +#: ../../library/pyexpat.rst:1022 msgid "" "The requested operation was made on a parser which was finished parsing " "input, but isn't allowed. This includes attempts to provide additional " "input or to stop the parser." msgstr "" -#: ../../library/pyexpat.rst:976 +#: ../../library/pyexpat.rst:1032 msgid "" "An attempt was made to undeclare reserved namespace prefix ``xml`` or to " "bind it to another namespace URI." msgstr "" -#: ../../library/pyexpat.rst:983 +#: ../../library/pyexpat.rst:1039 msgid "" "An attempt was made to declare or undeclare reserved namespace prefix " "``xmlns``." msgstr "" -#: ../../library/pyexpat.rst:988 +#: ../../library/pyexpat.rst:1044 msgid "" "An attempt was made to bind the URI of one the reserved namespace prefixes " "``xml`` and ``xmlns`` to another namespace prefix." msgstr "" -#: ../../library/pyexpat.rst:1004 +#: ../../library/pyexpat.rst:1060 msgid "" "The limit on input amplification factor (from DTD and entities) has been " "breached." msgstr "" -#: ../../library/pyexpat.rst:1010 +#: ../../library/pyexpat.rst:1066 msgid "The parser was tried to be stopped or suspended before it started." msgstr "" -#: ../../library/pyexpat.rst:1016 +#: ../../library/pyexpat.rst:1072 msgid "Footnotes" msgstr "註腳" -#: ../../library/pyexpat.rst:1017 +#: ../../library/pyexpat.rst:1073 msgid "" "The encoding string included in XML output should conform to the appropriate " "standards. For example, \"UTF-8\" is valid, but \"UTF8\" is not. See https://" diff --git a/library/shutil.po b/library/shutil.po index 1d2321d537..7d987d1731 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-06-03 00:49+0000\n" +"POT-Creation-Date: 2026-06-10 00:43+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -126,7 +126,7 @@ msgstr "" #: ../../library/shutil.rst:88 ../../library/shutil.rst:199 #: ../../library/shutil.rst:231 ../../library/shutil.rst:301 -#: ../../library/shutil.rst:414 +#: ../../library/shutil.rst:418 msgid "" "Platform-specific fast-copy syscalls may be used internally in order to copy " "the file more efficiently. See :ref:`shutil-platform-dependent-efficient-" @@ -507,13 +507,21 @@ msgstr "" #: ../../library/shutil.rst:391 msgid "" -"If the destination is on the current filesystem, then :func:`os.rename` is " -"used. Otherwise, *src* is copied to the destination using *copy_function* " -"and then removed. In case of symlinks, a new symlink pointing to the target " -"of *src* will be created as the destination and *src* will be removed." +":func:`os.rename` is preferably used internally when *src* and the " +"destination are on the same filesystem. In case :func:`os.rename` fails due " +"to :exc:`OSError` (e.g. the user has write permission to the destination " +"file but not to its parent directory), this method falls back to using " +"*copy_function*, in which case *src* is copied to the destination using " +"*copy_function* and then removed." msgstr "" -#: ../../library/shutil.rst:396 +#: ../../library/shutil.rst:397 +msgid "" +"In case of symlinks, a new symlink pointing to the target of *src* will be " +"created in or as the destination, and *src* will be removed." +msgstr "" + +#: ../../library/shutil.rst:400 msgid "" "If *copy_function* is given, it must be a callable that takes two arguments, " "*src* and the destination, and will be used to copy *src* to the destination " @@ -524,7 +532,7 @@ msgid "" "copy the metadata, at the expense of not copying any of the metadata." msgstr "" -#: ../../library/shutil.rst:404 +#: ../../library/shutil.rst:408 msgid "" "Raises an :ref:`auditing event ` ``shutil.move`` with arguments " "``src``, ``dst``." @@ -532,57 +540,57 @@ msgstr "" "引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." "move``。" -#: ../../library/shutil.rst:406 +#: ../../library/shutil.rst:410 msgid "" "Added explicit symlink handling for foreign filesystems, thus adapting it to " "the behavior of GNU's :program:`mv`. Now returns *dst*." msgstr "" -#: ../../library/shutil.rst:411 +#: ../../library/shutil.rst:415 msgid "Added the *copy_function* keyword argument." msgstr "新增 *copy_function* 關鍵字引數。" -#: ../../library/shutil.rst:419 +#: ../../library/shutil.rst:423 msgid "Accepts a :term:`path-like object` for both *src* and *dst*." msgstr "" -#: ../../library/shutil.rst:424 +#: ../../library/shutil.rst:428 msgid "" "Return disk usage statistics about the given path as a :term:`named tuple` " "with the attributes *total*, *used* and *free*, which are the amount of " "total, used and free space, in bytes. *path* may be a file or a directory." msgstr "" -#: ../../library/shutil.rst:431 +#: ../../library/shutil.rst:435 msgid "" "On Unix filesystems, *path* must point to a path within a **mounted** " "filesystem partition. On those platforms, CPython doesn't attempt to " "retrieve disk usage information from non-mounted filesystems." msgstr "" -#: ../../library/shutil.rst:437 +#: ../../library/shutil.rst:441 msgid "On Windows, *path* can now be a file or directory." msgstr "" -#: ../../library/shutil.rst:440 ../../library/shutil.rst:454 +#: ../../library/shutil.rst:444 ../../library/shutil.rst:458 msgid "Availability" msgstr "可用性" -#: ../../library/shutil.rst:445 +#: ../../library/shutil.rst:449 msgid "Change owner *user* and/or *group* of the given *path*." msgstr "" -#: ../../library/shutil.rst:447 +#: ../../library/shutil.rst:451 msgid "" "*user* can be a system user name or a uid; the same applies to *group*. At " "least one argument is required." msgstr "" -#: ../../library/shutil.rst:450 +#: ../../library/shutil.rst:454 msgid "See also :func:`os.chown`, the underlying function." msgstr "另請參閱 :func:`os.chown`,它是底層函式。" -#: ../../library/shutil.rst:452 +#: ../../library/shutil.rst:456 msgid "" "Raises an :ref:`auditing event ` ``shutil.chown`` with arguments " "``path``, ``user``, ``group``." @@ -590,23 +598,23 @@ msgstr "" "引發一個附帶引數 ``path``、``user``、``group`` 的\\ :ref:`稽核事件 " "` ``shutil.chown``。" -#: ../../library/shutil.rst:458 +#: ../../library/shutil.rst:462 msgid "Added *dir_fd* and *follow_symlinks* parameters." msgstr "新增 *dir_fd* 和 *follow_symlinks* 參數。" -#: ../../library/shutil.rst:464 +#: ../../library/shutil.rst:468 msgid "" "Return the path to an executable which would be run if the given *cmd* was " "called. If no *cmd* would be called, return ``None``." msgstr "" -#: ../../library/shutil.rst:467 +#: ../../library/shutil.rst:471 msgid "" "*mode* is a permission mask passed to :func:`os.access`, by default " "determining if the file exists and is executable." msgstr "" -#: ../../library/shutil.rst:470 +#: ../../library/shutil.rst:474 msgid "" "*path* is a \"``PATH`` string\" specifying the directories to look in, " "delimited by :data:`os.pathsep`. When no *path* is specified, the :envvar:" @@ -614,14 +622,14 @@ msgid "" "to :data:`os.defpath` if it is not set." msgstr "" -#: ../../library/shutil.rst:475 +#: ../../library/shutil.rst:479 msgid "" "If *cmd* contains a directory component, :func:`!which` only checks the " "specified path directly and does not search the directories listed in *path* " "or in the system's :envvar:`PATH` environment variable." msgstr "" -#: ../../library/shutil.rst:479 +#: ../../library/shutil.rst:483 msgid "" "On Windows, the current directory is prepended to the *path* if *mode* does " "not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the " @@ -631,7 +639,7 @@ msgid "" "environment variable ``NoDefaultCurrentDirectoryInExePath``." msgstr "" -#: ../../library/shutil.rst:486 +#: ../../library/shutil.rst:490 msgid "" "Also on Windows, the :envvar:`PATHEXT` environment variable is used to " "resolve commands that may not already include an extension. For example, if " @@ -640,7 +648,7 @@ msgid "" "directories. For example, on Windows::" msgstr "" -#: ../../library/shutil.rst:492 +#: ../../library/shutil.rst:496 msgid "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" @@ -648,13 +656,13 @@ msgstr "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" -#: ../../library/shutil.rst:495 +#: ../../library/shutil.rst:499 msgid "" "This is also applied when *cmd* is a path that contains a directory " "component::" msgstr "" -#: ../../library/shutil.rst:498 +#: ../../library/shutil.rst:502 msgid "" ">>> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" @@ -662,13 +670,13 @@ msgstr "" ">>> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" -#: ../../library/shutil.rst:503 +#: ../../library/shutil.rst:507 msgid "" "The :class:`bytes` type is now accepted. If *cmd* type is :class:`bytes`, " "the result type is also :class:`bytes`." msgstr "" -#: ../../library/shutil.rst:507 +#: ../../library/shutil.rst:511 msgid "" "On Windows, the current directory is no longer prepended to the search path " "if *mode* includes ``os.X_OK`` and WinAPI " @@ -679,18 +687,18 @@ msgid "" "now be found." msgstr "" -#: ../../library/shutil.rst:518 +#: ../../library/shutil.rst:522 msgid "" "This exception collects exceptions that are raised during a multi-file " "operation. For :func:`copytree`, the exception argument is a list of 3-" "tuples (*srcname*, *dstname*, *exception*)." msgstr "" -#: ../../library/shutil.rst:525 +#: ../../library/shutil.rst:529 msgid "Platform-dependent efficient copy operations" msgstr "" -#: ../../library/shutil.rst:527 +#: ../../library/shutil.rst:531 msgid "" "Starting from Python 3.8, all functions involving a file copy (:func:" "`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" @@ -700,51 +708,51 @@ msgid "" "buffers in Python as in \"``outfd.write(infd.read())``\"." msgstr "" -#: ../../library/shutil.rst:535 +#: ../../library/shutil.rst:539 msgid "On macOS `fcopyfile`_ is used to copy the file content (not metadata)." msgstr "" -#: ../../library/shutil.rst:537 +#: ../../library/shutil.rst:541 msgid "On Linux :func:`os.copy_file_range` or :func:`os.sendfile` is used." msgstr "Linux 上會使用 :func:`os.copy_file_range` 或 :func:`os.sendfile`。" -#: ../../library/shutil.rst:539 +#: ../../library/shutil.rst:543 msgid "On Solaris :func:`os.sendfile` is used." msgstr "Solaris 上會使用 :func:`os.sendfile`。" -#: ../../library/shutil.rst:541 +#: ../../library/shutil.rst:545 msgid "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " "instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." "copyfileobj` is used." msgstr "" -#: ../../library/shutil.rst:545 +#: ../../library/shutil.rst:549 msgid "" "If the fast-copy operation fails and no data was written in the destination " "file then shutil will silently fall back to less efficient :func:" "`copyfileobj` function internally." msgstr "" -#: ../../library/shutil.rst:551 +#: ../../library/shutil.rst:555 msgid "Solaris now uses :func:`os.sendfile`." msgstr "" -#: ../../library/shutil.rst:554 +#: ../../library/shutil.rst:558 msgid "" "Copy-on-write or server-side copy may be used internally via :func:`os." "copy_file_range` on supported Linux filesystems." msgstr "" -#: ../../library/shutil.rst:561 +#: ../../library/shutil.rst:565 msgid "copytree example" msgstr "copytree 範例" -#: ../../library/shutil.rst:563 +#: ../../library/shutil.rst:567 msgid "An example that uses the :func:`ignore_patterns` helper::" msgstr "" -#: ../../library/shutil.rst:565 +#: ../../library/shutil.rst:569 msgid "" "from shutil import copytree, ignore_patterns\n" "\n" @@ -754,17 +762,17 @@ msgstr "" "\n" "copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*'))" -#: ../../library/shutil.rst:569 +#: ../../library/shutil.rst:573 msgid "" "This will copy everything except ``.pyc`` files and files or directories " "whose name starts with ``tmp``." msgstr "" -#: ../../library/shutil.rst:572 +#: ../../library/shutil.rst:576 msgid "Another example that uses the *ignore* argument to add a logging call::" msgstr "" -#: ../../library/shutil.rst:574 +#: ../../library/shutil.rst:578 msgid "" "from shutil import copytree\n" "import logging\n" @@ -784,11 +792,11 @@ msgstr "" "\n" "copytree(source, destination, ignore=_logpath)" -#: ../../library/shutil.rst:587 +#: ../../library/shutil.rst:591 msgid "rmtree example" msgstr "rmtree 範例" -#: ../../library/shutil.rst:589 +#: ../../library/shutil.rst:593 msgid "" "This example shows how to remove a directory tree on Windows where some of " "the files have their read-only bit set. It uses the onexc callback to clear " @@ -796,7 +804,7 @@ msgid "" "propagate. ::" msgstr "" -#: ../../library/shutil.rst:594 +#: ../../library/shutil.rst:598 msgid "" "import os, stat\n" "import shutil\n" @@ -809,31 +817,31 @@ msgid "" "shutil.rmtree(directory, onexc=remove_readonly)" msgstr "" -#: ../../library/shutil.rst:607 +#: ../../library/shutil.rst:611 msgid "Archiving operations" msgstr "" -#: ../../library/shutil.rst:611 +#: ../../library/shutil.rst:615 msgid "Added support for the *xztar* format." msgstr "新增 *xztar* 格式的支援。" -#: ../../library/shutil.rst:615 +#: ../../library/shutil.rst:619 msgid "" "High-level utilities to create and read compressed and archived files are " "also provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules." msgstr "" -#: ../../library/shutil.rst:620 +#: ../../library/shutil.rst:624 msgid "Create an archive file (such as zip or tar) and return its name." msgstr "" -#: ../../library/shutil.rst:622 +#: ../../library/shutil.rst:626 msgid "" "*base_name* is the name of the file to create, including the path, minus any " "format-specific extension." msgstr "" -#: ../../library/shutil.rst:625 +#: ../../library/shutil.rst:629 msgid "" "*format* is the archive format: one of \"zip\" (if the :mod:`zlib` module is " "available), \"tar\", \"gztar\" (if the :mod:`zlib` module is available), " @@ -842,14 +850,14 @@ msgid "" "module is available)." msgstr "" -#: ../../library/shutil.rst:631 +#: ../../library/shutil.rst:635 msgid "" "*root_dir* is a directory that will be the root directory of the archive, " "all paths in the archive will be relative to it; for example, we typically " "chdir into *root_dir* before creating the archive." msgstr "" -#: ../../library/shutil.rst:635 +#: ../../library/shutil.rst:639 msgid "" "*base_dir* is the directory where we start archiving from; i.e. *base_dir* " "will be the common prefix of all files and directories in the archive. " @@ -857,23 +865,23 @@ msgid "" "example-with-basedir` for how to use *base_dir* and *root_dir* together." msgstr "" -#: ../../library/shutil.rst:641 +#: ../../library/shutil.rst:645 msgid "*root_dir* and *base_dir* both default to the current directory." msgstr "" -#: ../../library/shutil.rst:643 +#: ../../library/shutil.rst:647 msgid "" "If *dry_run* is true, no archive is created, but the operations that would " "be executed are logged to *logger*." msgstr "" -#: ../../library/shutil.rst:646 +#: ../../library/shutil.rst:650 msgid "" "*owner* and *group* are used when creating a tar archive. By default, uses " "the current owner and group." msgstr "" -#: ../../library/shutil.rst:649 +#: ../../library/shutil.rst:653 msgid "" "*logger* must be an object compatible with :pep:`282`, usually an instance " "of :class:`logging.Logger`." @@ -881,11 +889,11 @@ msgstr "" "*logger* 必須是與 :pep:`282` 相容的物件,通常是 :class:`logging.Logger` 的實" "例。" -#: ../../library/shutil.rst:652 +#: ../../library/shutil.rst:656 msgid "The *verbose* argument is unused and deprecated." msgstr "*verbose* 引數未被使用且已棄用。" -#: ../../library/shutil.rst:654 +#: ../../library/shutil.rst:658 msgid "" "Raises an :ref:`auditing event ` ``shutil.make_archive`` with " "arguments ``base_name``, ``format``, ``root_dir``, ``base_dir``." @@ -893,7 +901,7 @@ msgstr "" "引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的\\ :" "ref:`稽核事件 ` ``shutil.make_archive``。" -#: ../../library/shutil.rst:658 +#: ../../library/shutil.rst:662 msgid "" "This function is not thread-safe when custom archivers registered with :func:" "`register_archive_format` do not support the *root_dir* argument. In this " @@ -901,66 +909,66 @@ msgid "" "*root_dir* to perform archiving." msgstr "" -#: ../../library/shutil.rst:664 +#: ../../library/shutil.rst:668 msgid "" "The modern pax (POSIX.1-2001) format is now used instead of the legacy GNU " "format for archives created with ``format=\"tar\"``." msgstr "" -#: ../../library/shutil.rst:668 +#: ../../library/shutil.rst:672 msgid "" "This function is now made thread-safe during creation of standard ``.zip`` " "and tar archives." msgstr "" -#: ../../library/shutil.rst:674 +#: ../../library/shutil.rst:678 msgid "" "Return a list of supported formats for archiving. Each element of the " "returned sequence is a tuple ``(name, description)``." msgstr "" -#: ../../library/shutil.rst:677 ../../library/shutil.rst:794 +#: ../../library/shutil.rst:681 ../../library/shutil.rst:798 msgid "By default :mod:`!shutil` provides these formats:" msgstr "預設情況下 :mod:`!shutil` 提供這些格式:" -#: ../../library/shutil.rst:679 +#: ../../library/shutil.rst:683 msgid "*zip*: ZIP file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:680 +#: ../../library/shutil.rst:684 msgid "" "*tar*: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives." msgstr "" -#: ../../library/shutil.rst:681 ../../library/shutil.rst:799 +#: ../../library/shutil.rst:685 ../../library/shutil.rst:803 msgid "*gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:682 ../../library/shutil.rst:800 +#: ../../library/shutil.rst:686 ../../library/shutil.rst:804 msgid "*bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available)." msgstr "" -#: ../../library/shutil.rst:683 ../../library/shutil.rst:801 +#: ../../library/shutil.rst:687 ../../library/shutil.rst:805 msgid "*xztar*: xz'ed tar-file (if the :mod:`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:684 ../../library/shutil.rst:802 +#: ../../library/shutil.rst:688 ../../library/shutil.rst:806 msgid "" "*zstdtar*: Zstandard compressed tar-file (if the :mod:`compression.zstd` " "module is available)." msgstr "" -#: ../../library/shutil.rst:687 +#: ../../library/shutil.rst:691 msgid "" "You can register new formats or provide your own archiver for any existing " "formats, by using :func:`register_archive_format`." msgstr "" -#: ../../library/shutil.rst:693 +#: ../../library/shutil.rst:697 msgid "Register an archiver for the format *name*." msgstr "" -#: ../../library/shutil.rst:695 +#: ../../library/shutil.rst:699 msgid "" "*function* is the callable that will be used to create archives. The " "callable will receive the *base_name* of the file to create, followed by the " @@ -969,7 +977,7 @@ msgid "" "*dry_run* and *logger* (as passed in :func:`make_archive`)." msgstr "" -#: ../../library/shutil.rst:701 +#: ../../library/shutil.rst:705 msgid "" "If *function* has the custom attribute ``function.supports_root_dir`` set to " "``True``, the *root_dir* argument is passed as a keyword argument. Otherwise " @@ -978,37 +986,37 @@ msgid "" "not thread-safe." msgstr "" -#: ../../library/shutil.rst:707 +#: ../../library/shutil.rst:711 msgid "" "If given, *extra_args* is a sequence of ``(name, value)`` pairs that will be " "used as extra keywords arguments when the archiver callable is used." msgstr "" -#: ../../library/shutil.rst:710 +#: ../../library/shutil.rst:714 msgid "" "*description* is used by :func:`get_archive_formats` which returns the list " "of archivers. Defaults to an empty string." msgstr "" -#: ../../library/shutil.rst:713 +#: ../../library/shutil.rst:717 msgid "Added support for functions supporting the *root_dir* argument." msgstr "" -#: ../../library/shutil.rst:719 +#: ../../library/shutil.rst:723 msgid "Remove the archive format *name* from the list of supported formats." msgstr "" -#: ../../library/shutil.rst:724 +#: ../../library/shutil.rst:728 msgid "Unpack an archive. *filename* is the full path of the archive." msgstr "" -#: ../../library/shutil.rst:726 +#: ../../library/shutil.rst:730 msgid "" "*extract_dir* is the name of the target directory where the archive is " "unpacked. If not provided, the current working directory is used." msgstr "" -#: ../../library/shutil.rst:729 +#: ../../library/shutil.rst:733 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", " "\"bztar\", \"xztar\", or \"zstdtar\". Or any other format registered with :" @@ -1017,7 +1025,7 @@ msgid "" "for that extension. In case none is found, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/shutil.rst:736 +#: ../../library/shutil.rst:740 msgid "" "The keyword-only *filter* argument is passed to the underlying unpacking " "function. For zip files, *filter* is not accepted. For tar files, it is " @@ -1026,7 +1034,7 @@ msgid "" "extraction-filter` for details.)" msgstr "" -#: ../../library/shutil.rst:742 +#: ../../library/shutil.rst:746 msgid "" "Raises an :ref:`auditing event ` ``shutil.unpack_archive`` with " "arguments ``filename``, ``extract_dir``, ``format``." @@ -1034,7 +1042,7 @@ msgstr "" "引發一個附帶引數 ``filename``、``extract_dir``、``format`` 的\\ :ref:`稽核事" "件 ` ``shutil.unpack_archive``。" -#: ../../library/shutil.rst:746 +#: ../../library/shutil.rst:750 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of the path specified in the " @@ -1042,7 +1050,7 @@ msgid "" "filenames with \"..\" components." msgstr "" -#: ../../library/shutil.rst:751 +#: ../../library/shutil.rst:755 msgid "" "Since Python 3.14, the defaults for both built-in formats (zip and tar " "files) will prevent the most dangerous of such security issues, but will not " @@ -1050,91 +1058,91 @@ msgid "" "verification` section for tar-specific details." msgstr "" -#: ../../library/shutil.rst:757 +#: ../../library/shutil.rst:761 msgid "Accepts a :term:`path-like object` for *filename* and *extract_dir*." msgstr "" -#: ../../library/shutil.rst:760 +#: ../../library/shutil.rst:764 msgid "Added the *filter* argument." msgstr "新增 *filter* 引數。" -#: ../../library/shutil.rst:765 +#: ../../library/shutil.rst:769 msgid "" "Registers an unpack format. *name* is the name of the format and " "*extensions* is a list of extensions corresponding to the format, like ``." "zip`` for Zip files." msgstr "" -#: ../../library/shutil.rst:769 +#: ../../library/shutil.rst:773 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive:" msgstr "" -#: ../../library/shutil.rst:772 +#: ../../library/shutil.rst:776 msgid "the path of the archive, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:773 +#: ../../library/shutil.rst:777 msgid "" "the directory the archive must be extracted to, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:774 +#: ../../library/shutil.rst:778 msgid "" "possibly a *filter* keyword argument, if it was given to :func:" "`unpack_archive`;" msgstr "" -#: ../../library/shutil.rst:776 +#: ../../library/shutil.rst:780 msgid "" "additional keyword arguments, specified by *extra_args* as a sequence of " "``(name, value)`` tuples." msgstr "" -#: ../../library/shutil.rst:779 +#: ../../library/shutil.rst:783 msgid "" "*description* can be provided to describe the format, and will be returned " "by the :func:`get_unpack_formats` function." msgstr "" -#: ../../library/shutil.rst:785 +#: ../../library/shutil.rst:789 msgid "Unregister an unpack format. *name* is the name of the format." msgstr "" -#: ../../library/shutil.rst:790 +#: ../../library/shutil.rst:794 msgid "" "Return a list of all registered formats for unpacking. Each element of the " "returned sequence is a tuple ``(name, extensions, description)``." msgstr "" -#: ../../library/shutil.rst:796 +#: ../../library/shutil.rst:800 msgid "" "*zip*: ZIP file (unpacking compressed files works only if the corresponding " "module is available)." msgstr "" -#: ../../library/shutil.rst:798 +#: ../../library/shutil.rst:802 msgid "*tar*: uncompressed tar file." msgstr "" -#: ../../library/shutil.rst:805 +#: ../../library/shutil.rst:809 msgid "" "You can register new formats or provide your own unpacker for any existing " "formats, by using :func:`register_unpack_format`." msgstr "" -#: ../../library/shutil.rst:812 +#: ../../library/shutil.rst:816 msgid "Archiving example" msgstr "" -#: ../../library/shutil.rst:814 +#: ../../library/shutil.rst:818 msgid "" "In this example, we create a gzip'ed tar-file archive containing all files " "found in the :file:`.ssh` directory of the user::" msgstr "" -#: ../../library/shutil.rst:817 +#: ../../library/shutil.rst:821 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1150,11 +1158,11 @@ msgstr "" ">>> make_archive(archive_name, 'gztar', root_dir)\n" "'/Users/tarek/myarchive.tar.gz'" -#: ../../library/shutil.rst:824 +#: ../../library/shutil.rst:828 msgid "The resulting archive contains:" msgstr "" -#: ../../library/shutil.rst:826 +#: ../../library/shutil.rst:830 msgid "" "$ tar -tzvf /Users/tarek/myarchive.tar.gz\n" "drwx------ tarek/staff 0 2010-02-01 16:23:40 ./\n" @@ -1176,18 +1184,18 @@ msgstr "" "-rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub\n" "-rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts" -#: ../../library/shutil.rst:842 +#: ../../library/shutil.rst:846 msgid "Archiving example with *base_dir*" msgstr "" -#: ../../library/shutil.rst:844 +#: ../../library/shutil.rst:848 msgid "" "In this example, similar to the `one above `_, we " "show how to use :func:`make_archive`, but this time with the usage of " "*base_dir*. We now have the following directory structure:" msgstr "" -#: ../../library/shutil.rst:848 +#: ../../library/shutil.rst:852 msgid "" "$ tree tmp\n" "tmp\n" @@ -1205,13 +1213,13 @@ msgstr "" " └── please_add.txt\n" " └── do_not_add.txt" -#: ../../library/shutil.rst:858 +#: ../../library/shutil.rst:862 msgid "" "In the final archive, :file:`please_add.txt` should be included, but :file:" "`do_not_add.txt` should not. Therefore we use the following::" msgstr "" -#: ../../library/shutil.rst:861 +#: ../../library/shutil.rst:865 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1235,11 +1243,11 @@ msgstr "" "... )\n" "'/Users/tarek/myarchive.tar'" -#: ../../library/shutil.rst:872 +#: ../../library/shutil.rst:876 msgid "Listing the files in the resulting archive gives us:" msgstr "" -#: ../../library/shutil.rst:874 +#: ../../library/shutil.rst:878 msgid "" "$ python -m tarfile -l /Users/tarek/myarchive.tar\n" "structure/content/\n" @@ -1249,29 +1257,29 @@ msgstr "" "structure/content/\n" "structure/content/please_add.txt" -#: ../../library/shutil.rst:882 +#: ../../library/shutil.rst:886 msgid "Querying the size of the output terminal" msgstr "" -#: ../../library/shutil.rst:886 +#: ../../library/shutil.rst:890 msgid "Get the size of the terminal window." msgstr "" -#: ../../library/shutil.rst:888 +#: ../../library/shutil.rst:892 msgid "" "For each of the two dimensions, the environment variable, ``COLUMNS`` and " "``LINES`` respectively, is checked. If the variable is defined and the value " "is a positive integer, it is used." msgstr "" -#: ../../library/shutil.rst:892 +#: ../../library/shutil.rst:896 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " "terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" "`os.get_terminal_size`." msgstr "" -#: ../../library/shutil.rst:896 +#: ../../library/shutil.rst:900 msgid "" "If the terminal size cannot be successfully queried, either because the " "system doesn't support querying, or because we are not connected to a " @@ -1280,17 +1288,17 @@ msgid "" "emulators." msgstr "" -#: ../../library/shutil.rst:902 +#: ../../library/shutil.rst:906 msgid "The value returned is a named tuple of type :class:`os.terminal_size`." msgstr "" -#: ../../library/shutil.rst:904 +#: ../../library/shutil.rst:908 msgid "" "See also: The Single UNIX Specification, Version 2, `Other Environment " "Variables`_." msgstr "" -#: ../../library/shutil.rst:909 +#: ../../library/shutil.rst:913 msgid "" "The ``fallback`` values are also used if :func:`os.get_terminal_size` " "returns zeroes."