From 68e6b2037eb1cc112b292f2720b638d462241952 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 11 May 2025 14:58:16 +0000 Subject: [PATCH 01/14] sync with cpython 927da992 --- deprecations/index.po | 15 +- deprecations/pending-removal-in-3.15.po | 83 +- whatsnew/3.12.po | 1381 +++++++++++------------ whatsnew/3.13.po | 15 +- 4 files changed, 743 insertions(+), 751 deletions(-) diff --git a/deprecations/index.po b/deprecations/index.po index 05c5babe57..4d0a235824 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-30 00:15+0000\n" +"POT-Creation-Date: 2025-05-11 14:57+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-" @@ -431,6 +431,15 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:95 +msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " "it has yet to be supported by any major type checker." @@ -439,11 +448,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:93 +#: ../../deprecations/pending-removal-in-3.15.rst:100 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:95 +#: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index 726d403414..902e9adc10 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-28 00:14+0000\n" +"POT-Creation-Date: 2025-05-11 14:57+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-" @@ -25,10 +25,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to " -"set :attr:`__spec__.cached ` is " -"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " -"into consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -36,11 +36,10 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to " -"set :attr:`__spec__.parent ` is " -"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " -"take into consideration by the import system or standard library. " -"(:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," @@ -94,17 +93,15 @@ msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 " -"(:gh:`90817`), but has been postponed to Python 3.15. " -"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " -"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " -"in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" -"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " -"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" -"獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" @@ -112,11 +109,11 @@ msgstr ":mod:`pathlib`:" #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" -"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" @@ -170,9 +167,9 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" -"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " -"於 :gh:`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" @@ -180,10 +177,10 @@ msgstr ":mod:`typing`:" #: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " -"3.13. Use the class-based syntax or the functional syntax instead." +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" @@ -191,6 +188,15 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:95 +msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " "it has yet to be supported by any major type checker." @@ -199,17 +205,16 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:93 +#: ../../deprecations/pending-removal-in-3.15.rst:100 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:95 +#: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " -"deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" -"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " -"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index b03e6092a8..e6ce46ad51 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-30 00:15+0000\n" +"POT-Creation-Date: 2025-05-11 14:57+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-" @@ -31,8 +31,8 @@ msgstr "Adam Turner" #: ../../whatsnew/3.12.rst:48 msgid "" "This article explains the new features in Python 3.12, compared to 3.11. " -"Python 3.12 was released on October 2, 2023. For full details, see " -"the :ref:`changelog `." +"Python 3.12 was released on October 2, 2023. For full details, see the :ref:" +"`changelog `." msgstr "" "本文介紹了 Python 3.12 與 3.11 相比多了哪些新功能。 Python 3.12 於 2023 年 " "10 月 2 日發布。完整詳情請見 :ref:`changelog `。" @@ -55,18 +55,18 @@ msgid "" "improvements, and several modules have better performance." msgstr "" "Python 3.12 是 Python 程式語言的穩定版本,包含了語言和標準函式庫的綜合變更。" -"標準函式庫的變更主要集中在清理棄用的 API、可用性和正確性。值得注意的" -"是,:mod:`!distutils` 套件已從標準函式庫中移除。:mod:`os` 和 :mod:`pathlib` " -"中的檔案系統支援進行了許多改進,並且有數個模組得到更好的效能。" +"標準函式庫的變更主要集中在清理棄用的 API、可用性和正確性。值得注意的是,:mod:" +"`!distutils` 套件已從標準函式庫中移除。:mod:`os` 和 :mod:`pathlib` 中的檔案系" +"統支援進行了許多改進,並且有數個模組得到更好的效能。" #: ../../whatsnew/3.12.rst:69 msgid "" "The language changes focus on usability, as :term:`f-strings ` " "have had many limitations removed and 'Did you mean ...' suggestions " "continue to improve. The new :ref:`type parameter syntax ` and :keyword:`type` statement improve ergonomics for " -"using :term:`generic types ` and :term:`type aliases ` with static type checkers." +"pep695>` and :keyword:`type` statement improve ergonomics for using :term:" +"`generic types ` and :term:`type aliases ` with " +"static type checkers." msgstr "" "語言變更主要集中在可用性,因為 :term:`f-字串 `\\ 已經移除了許多限" "制,並且持續改進 'Did you mean ...' 建議。新的\\ :ref:`型別參數語法 " @@ -95,8 +95,8 @@ msgstr "新增語法特性:" #: ../../whatsnew/3.12.rst:92 msgid "" -":ref:`PEP 695 `, type parameter syntax and " -"the :keyword:`type` statement" +":ref:`PEP 695 `, type parameter syntax and the :keyword:" +"`type` statement" msgstr "" ":ref:`PEP 695 `,型別參數語法和 :keyword:`type` 陳述式" @@ -129,8 +129,8 @@ msgstr ":ref:`PEP 669 `,低影響監控" #: ../../whatsnew/3.12.rst:103 msgid "" -"`Improved 'Did you mean ...' suggestions `_ " -"for :exc:`NameError`, :exc:`ImportError`, and :exc:`SyntaxError` exceptions" +"`Improved 'Did you mean ...' suggestions `_ for :" +"exc:`NameError`, :exc:`ImportError`, and :exc:`SyntaxError` exceptions" msgstr "" #: ../../whatsnew/3.12.rst:106 @@ -157,15 +157,15 @@ msgstr ":mod:`os` 模組在 Windows 支援上有了數項改進" #: ../../whatsnew/3.12.rst:115 msgid "" -"A :ref:`command-line interface ` has been added to " -"the :mod:`sqlite3` module" +"A :ref:`command-line interface ` has been added to the :mod:" +"`sqlite3` module" msgstr "" "一個\\ :ref:`命令列介面 `\\ 已被加入 :mod:`sqlite3` 模組中" #: ../../whatsnew/3.12.rst:117 msgid "" -":func:`isinstance` checks against :func:`runtime-checkable protocols " -"` enjoy a speed up of between two and 20 times" +":func:`isinstance` checks against :func:`runtime-checkable protocols ` enjoy a speed up of between two and 20 times" msgstr "" #: ../../whatsnew/3.12.rst:119 @@ -236,8 +236,8 @@ msgid "" ":ref:`PEP 692 `, using :class:`~typing.TypedDict` to " "annotate :term:`**kwargs `" msgstr "" -":ref:`PEP 692 `、使用 :class:`~typing.TypedDict` 來標" -"註 :term:`**kwargs `" +":ref:`PEP 692 `、使用 :class:`~typing.TypedDict` 來標註 :" +"term:`**kwargs `" #: ../../whatsnew/3.12.rst:149 msgid ":ref:`PEP 698 `, :func:`typing.override` decorator" @@ -277,9 +277,9 @@ msgid "" "removed, along with several :class:`unittest.TestCase` `method aliases " "`_." msgstr "" -":mod:`!asynchat`、:mod:`!asyncore` 和 :mod:`!imp` 模組以及幾" -"個 :class:`unittest.TestCase` 的\\ `方法別名 `_\\ 已被刪除。" +":mod:`!asynchat`、:mod:`!asyncore` 和 :mod:`!imp` 模組以及幾個 :class:" +"`unittest.TestCase` 的\\ `方法別名 `_\\ " +"已被刪除。" #: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1840 msgid "New Features" @@ -298,8 +298,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:187 msgid "" -":pep:`695` introduces a new, more compact and explicit way to " -"create :ref:`generic classes ` and :ref:`functions ` and :ref:`functions `::" msgstr "" @@ -346,9 +346,9 @@ msgstr "type Point[T] = tuple[T, T]" #: ../../whatsnew/3.12.rst:210 msgid "" -"The new syntax allows declaring :class:`~typing.TypeVarTuple` " -"and :class:`~typing.ParamSpec` parameters, as well " -"as :class:`~typing.TypeVar` parameters with bounds or constraints::" +"The new syntax allows declaring :class:`~typing.TypeVarTuple` and :class:" +"`~typing.ParamSpec` parameters, as well as :class:`~typing.TypeVar` " +"parameters with bounds or constraints::" msgstr "" #: ../../whatsnew/3.12.rst:214 @@ -444,11 +444,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:290 msgid "" "Backslashes and unicode characters: before Python 3.12 f-string expressions " -"couldn't contain any ``\\`` character. This also affected " -"unicode :ref:`escape sequences ` (such as ``\\N{snowman}" -"``) as these contain the ``\\N`` part that previously could not be part of " -"expression components of f-strings. Now, you can define expressions like " -"this:" +"couldn't contain any ``\\`` character. This also affected unicode :ref:" +"`escape sequences ` (such as ``\\N{snowman}``) as these " +"contain the ``\\N`` part that previously could not be part of expression " +"components of f-strings. Now, you can define expressions like this:" msgstr "" #: ../../whatsnew/3.12.rst:303 @@ -588,17 +587,16 @@ msgstr "" #: ../../whatsnew/3.12.rst:386 msgid "" ":pep:`688` introduces a way to use the :ref:`buffer protocol " -"` from Python code. Classes that implement " -"the :meth:`~object.__buffer__` method are now usable as buffer types." +"` from Python code. Classes that implement the :meth:`~object." +"__buffer__` method are now usable as buffer types." msgstr "" #: ../../whatsnew/3.12.rst:390 msgid "" "The new :class:`collections.abc.Buffer` ABC provides a standard way to " -"represent buffer objects, for example in type annotations. The " -"new :class:`inspect.BufferFlags` enum represents the flags that can be used " -"to customize buffer creation. (Contributed by Jelle Zijlstra " -"in :gh:`102500`.)" +"represent buffer objects, for example in type annotations. The new :class:" +"`inspect.BufferFlags` enum represents the flags that can be used to " +"customize buffer creation. (Contributed by Jelle Zijlstra in :gh:`102500`.)" msgstr "" #: ../../whatsnew/3.12.rst:399 @@ -677,8 +675,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:459 msgid "" "Improve the :exc:`SyntaxError` error message when the user types ``import x " -"from y`` instead of ``from y import x``. (Contributed by Pablo Galindo " -"in :gh:`98931`.)" +"from y`` instead of ``from y import x``. (Contributed by Pablo Galindo in :" +"gh:`98931`.)" msgstr "" #: ../../whatsnew/3.12.rst:469 @@ -695,8 +693,8 @@ msgstr "型別提示相關的新特性" #: ../../whatsnew/3.12.rst:482 msgid "" -"This section covers major changes affecting :pep:`type hints <484>` and " -"the :mod:`typing` module." +"This section covers major changes affecting :pep:`type hints <484>` and the :" +"mod:`typing` module." msgstr "" "本節涵蓋了影響\\ :pep:`型別提示 <484>`\\ 和 :mod:`typing` 模組的主要變更。" @@ -803,18 +801,17 @@ msgid "" "a :exc:`SyntaxWarning`, instead of :exc:`DeprecationWarning`. For example, " "``re.compile(\"\\d+\\.\\d+\")`` now emits a :exc:`SyntaxWarning` " "(``\"\\d\"`` is an invalid escape sequence, use raw strings for regular " -"expression: ``re.compile(r\"\\d+\\.\\d+\")``). In a future Python " -"version, :exc:`SyntaxError` will eventually be raised, instead " -"of :exc:`SyntaxWarning`. (Contributed by Victor Stinner in :gh:`98401`.)" +"expression: ``re.compile(r\"\\d+\\.\\d+\")``). In a future Python version, :" +"exc:`SyntaxError` will eventually be raised, instead of :exc:" +"`SyntaxWarning`. (Contributed by Victor Stinner in :gh:`98401`.)" msgstr "" #: ../../whatsnew/3.12.rst:557 msgid "" "Octal escapes with value larger than ``0o377`` (ex: ``\"\\477\"``), " -"deprecated in Python 3.11, now produce a :exc:`SyntaxWarning`, instead " -"of :exc:`DeprecationWarning`. In a future Python version they will be " -"eventually a :exc:`SyntaxError`. (Contributed by Victor Stinner " -"in :gh:`98401`.)" +"deprecated in Python 3.11, now produce a :exc:`SyntaxWarning`, instead of :" +"exc:`DeprecationWarning`. In a future Python version they will be eventually " +"a :exc:`SyntaxError`. (Contributed by Victor Stinner in :gh:`98401`.)" msgstr "" #: ../../whatsnew/3.12.rst:563 @@ -837,9 +834,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:574 msgid "" "When a ``try-except*`` construct handles the entire :exc:`ExceptionGroup` " -"and raises one other exception, that exception is no longer wrapped in " -"an :exc:`ExceptionGroup`. Also changed in version 3.11.4. (Contributed by " -"Irit Katriel in :gh:`103590`.)" +"and raises one other exception, that exception is no longer wrapped in an :" +"exc:`ExceptionGroup`. Also changed in version 3.11.4. (Contributed by Irit " +"Katriel in :gh:`103590`.)" msgstr "" #: ../../whatsnew/3.12.rst:579 @@ -848,8 +845,8 @@ msgid "" "Python bytecode evaluation loop instead of object allocations. The GC can " "also run when :c:func:`PyErr_CheckSignals` is called so C extensions that " "need to run for a long time without executing any Python code also have a " -"chance to execute the GC periodically. (Contributed by Pablo Galindo " -"in :gh:`97922`.)" +"chance to execute the GC periodically. (Contributed by Pablo Galindo in :gh:" +"`97922`.)" msgstr "" #: ../../whatsnew/3.12.rst:586 @@ -905,13 +902,12 @@ msgstr "" #: ../../whatsnew/3.12.rst:616 msgid "" "Add :ref:`support for the perf profiler ` through the new " -"environment variable :envvar:`PYTHONPERFSUPPORT` and command-line " -"option :option:`-X perf <-X>`, as well as the " -"new :func:`sys.activate_stack_trampoline`, :func:`sys.deactivate_stack_trampoline`, " -"and :func:`sys.is_stack_trampoline_active` functions. (Design by Pablo " -"Galindo. Contributed by Pablo Galindo and Christian Heimes with " -"contributions from Gregory P. Smith [Google] and Mark Shannon " -"in :gh:`96123`.)" +"environment variable :envvar:`PYTHONPERFSUPPORT` and command-line option :" +"option:`-X perf <-X>`, as well as the new :func:`sys." +"activate_stack_trampoline`, :func:`sys.deactivate_stack_trampoline`, and :" +"func:`sys.is_stack_trampoline_active` functions. (Design by Pablo Galindo. " +"Contributed by Pablo Galindo and Christian Heimes with contributions from " +"Gregory P. Smith [Google] and Mark Shannon in :gh:`96123`.)" msgstr "" #: ../../whatsnew/3.12.rst:628 @@ -932,8 +928,8 @@ msgstr "array" #: ../../whatsnew/3.12.rst:639 msgid "" -"The :class:`array.array` class now supports subscripting, making it " -"a :term:`generic type`. (Contributed by Jelle Zijlstra in :gh:`98658`.)" +"The :class:`array.array` class now supports subscripting, making it a :term:" +"`generic type`. (Contributed by Jelle Zijlstra in :gh:`98658`.)" msgstr "" #: ../../whatsnew/3.12.rst:643 @@ -950,28 +946,25 @@ msgstr "" #: ../../whatsnew/3.12.rst:650 msgid "" -"Add :func:`asyncio.eager_task_factory` " -"and :func:`asyncio.create_eager_task_factory` functions to allow opting an " -"event loop in to eager task execution, making some use-cases 2x to 5x " -"faster. (Contributed by Jacob Bower & Itamar Oren " -"in :gh:`102853`, :gh:`104140`, and :gh:`104138`)" +"Add :func:`asyncio.eager_task_factory` and :func:`asyncio." +"create_eager_task_factory` functions to allow opting an event loop in to " +"eager task execution, making some use-cases 2x to 5x faster. (Contributed by " +"Jacob Bower & Itamar Oren in :gh:`102853`, :gh:`104140`, and :gh:`104138`)" msgstr "" #: ../../whatsnew/3.12.rst:655 msgid "" "On Linux, :mod:`asyncio` uses :class:`asyncio.PidfdChildWatcher` by default " -"if :func:`os.pidfd_open` is available and functional instead " -"of :class:`asyncio.ThreadedChildWatcher`. (Contributed by Kumar Aditya " -"in :gh:`98024`.)" +"if :func:`os.pidfd_open` is available and functional instead of :class:" +"`asyncio.ThreadedChildWatcher`. (Contributed by Kumar Aditya in :gh:`98024`.)" msgstr "" #: ../../whatsnew/3.12.rst:660 msgid "" -"The event loop now uses the best available child watcher for each platform " -"(:class:`asyncio.PidfdChildWatcher` if supported " -"and :class:`asyncio.ThreadedChildWatcher` otherwise), so manually " -"configuring a child watcher is not recommended. (Contributed by Kumar Aditya " -"in :gh:`94597`.)" +"The event loop now uses the best available child watcher for each platform (:" +"class:`asyncio.PidfdChildWatcher` if supported and :class:`asyncio." +"ThreadedChildWatcher` otherwise), so manually configuring a child watcher is " +"not recommended. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" #: ../../whatsnew/3.12.rst:666 @@ -988,9 +981,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:673 msgid "" -":func:`asyncio.iscoroutine` now returns ``False`` for generators " -"as :mod:`asyncio` does not support legacy generator-based coroutines. " -"(Contributed by Kumar Aditya in :gh:`102748`.)" +":func:`asyncio.iscoroutine` now returns ``False`` for generators as :mod:" +"`asyncio` does not support legacy generator-based coroutines. (Contributed " +"by Kumar Aditya in :gh:`102748`.)" msgstr "" #: ../../whatsnew/3.12.rst:677 @@ -1006,8 +999,8 @@ msgstr "calendar" #: ../../whatsnew/3.12.rst:684 msgid "" "Add enums :data:`calendar.Month` and :data:`calendar.Day` defining months of " -"the year and days of the week. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"the year and days of the week. (Contributed by Prince Roshan in :gh:" +"`103636`.)" msgstr "" #: ../../whatsnew/3.12.rst:689 @@ -1017,8 +1010,8 @@ msgstr "csv" #: ../../whatsnew/3.12.rst:691 msgid "" "Add :const:`csv.QUOTE_NOTNULL` and :const:`csv.QUOTE_STRINGS` flags to " -"provide finer grained control of ``None`` and empty strings " -"by :class:`~csv.reader` and :class:`~csv.writer` objects." +"provide finer grained control of ``None`` and empty strings by :class:`~csv." +"reader` and :class:`~csv.writer` objects." msgstr "" #: ../../whatsnew/3.12.rst:696 @@ -1028,10 +1021,10 @@ msgstr "dis" #: ../../whatsnew/3.12.rst:698 msgid "" "Pseudo instruction opcodes (which are used by the compiler but do not appear " -"in executable bytecode) are now exposed in the :mod:`dis` " -"module. :opcode:`HAVE_ARGUMENT` is still relevant to real opcodes, but it is " -"not useful for pseudo instructions. Use the new :data:`dis.hasarg` " -"collection instead. (Contributed by Irit Katriel in :gh:`94216`.)" +"in executable bytecode) are now exposed in the :mod:`dis` module. :opcode:" +"`HAVE_ARGUMENT` is still relevant to real opcodes, but it is not useful for " +"pseudo instructions. Use the new :data:`dis.hasarg` collection instead. " +"(Contributed by Irit Katriel in :gh:`94216`.)" msgstr "" #: ../../whatsnew/3.12.rst:706 @@ -1125,8 +1118,8 @@ msgid "" "Add :func:`math.sumprod` for computing a sum of products. (Contributed by " "Raymond Hettinger in :gh:`100485`.)" msgstr "" -"新增 :func:`math.sumprod` 以計算乘積總和。(由 Raymond Hettinger " -"於 :gh:`100485` 中貢獻。)" +"新增 :func:`math.sumprod` 以計算乘積總和。(由 Raymond Hettinger 於 :gh:" +"`100485` 中貢獻。)" #: ../../whatsnew/3.12.rst:752 msgid "" @@ -1141,16 +1134,16 @@ msgstr "os" #: ../../whatsnew/3.12.rst:759 msgid "" -"Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process " -"with :func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar " -"Aditya in :gh:`93312`.)" +"Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process with :" +"func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar Aditya in :" +"gh:`93312`.)" msgstr "" #: ../../whatsnew/3.12.rst:763 msgid "" ":class:`os.DirEntry` now includes an :meth:`os.DirEntry.is_junction` method " -"to check if the entry is a junction. (Contributed by Charles Machalow " -"in :gh:`99547`.)" +"to check if the entry is a junction. (Contributed by Charles Machalow in :gh:" +"`99547`.)" msgstr "" #: ../../whatsnew/3.12.rst:767 @@ -1169,8 +1162,8 @@ msgid "" "with other platforms). ``st_dev`` may be up to 64 bits and ``st_ino`` up to " "128 bits depending on your file system, and ``st_rdev`` is always set to " "zero rather than incorrect values. Both functions may be significantly " -"faster on newer releases of Windows. (Contributed by Steve Dower " -"in :gh:`99726`.)" +"faster on newer releases of Windows. (Contributed by Steve Dower in :gh:" +"`99726`.)" msgstr "" #: ../../whatsnew/3.12.rst:782 @@ -1199,10 +1192,10 @@ msgstr "pathlib" #: ../../whatsnew/3.12.rst:793 msgid "" -"Add support for subclassing :class:`pathlib.PurePath` " -"and :class:`pathlib.Path`, plus their Posix- and Windows-specific variants. " -"Subclasses may override the :meth:`pathlib.PurePath.with_segments` method to " -"pass information between path instances." +"Add support for subclassing :class:`pathlib.PurePath` and :class:`pathlib." +"Path`, plus their Posix- and Windows-specific variants. Subclasses may " +"override the :meth:`pathlib.PurePath.with_segments` method to pass " +"information between path instances." msgstr "" #: ../../whatsnew/3.12.rst:798 @@ -1216,23 +1209,22 @@ msgstr "" msgid "" "Add *walk_up* optional parameter to :meth:`pathlib.PurePath.relative_to` to " "allow the insertion of ``..`` entries in the result; this behavior is more " -"consistent with :func:`os.path.relpath`. (Contributed by Domenico Ragusa " -"in :gh:`84538`.)" +"consistent with :func:`os.path.relpath`. (Contributed by Domenico Ragusa in :" +"gh:`84538`.)" msgstr "" #: ../../whatsnew/3.12.rst:807 msgid "" -"Add :meth:`pathlib.Path.is_junction` as a proxy " -"to :func:`os.path.isjunction`. (Contributed by Charles Machalow " -"in :gh:`99547`.)" +"Add :meth:`pathlib.Path.is_junction` as a proxy to :func:`os.path." +"isjunction`. (Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" #: ../../whatsnew/3.12.rst:810 msgid "" -"Add *case_sensitive* optional parameter " -"to :meth:`pathlib.Path.glob`, :meth:`pathlib.Path.rglob` " -"and :meth:`pathlib.PurePath.match` for matching the path's case sensitivity, " -"allowing for more precise control over the matching process." +"Add *case_sensitive* optional parameter to :meth:`pathlib.Path.glob`, :meth:" +"`pathlib.Path.rglob` and :meth:`pathlib.PurePath.match` for matching the " +"path's case sensitivity, allowing for more precise control over the matching " +"process." msgstr "" #: ../../whatsnew/3.12.rst:815 @@ -1264,8 +1256,8 @@ msgstr "random" #: ../../whatsnew/3.12.rst:833 msgid "" -"Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger " -"in :gh:`81620`.)" +"Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger in :gh:" +"`81620`.)" msgstr "" "新增 :func:`random.binomialvariate`。(由 Raymond Hettinger 於 :gh:`81620` 中" "貢獻。)" @@ -1329,31 +1321,29 @@ msgid "" "Add a :ref:`command-line interface `. (Contributed by Erlend E. " "Aasland in :gh:`77617`.)" msgstr "" -"新增\\ :ref:`命令列介面 `。(由 Erlend E. Aasland " -"於 :gh:`77617` 中貢獻。)" +"新增\\ :ref:`命令列介面 `。(由 Erlend E. Aasland 於 :gh:" +"`77617` 中貢獻。)" #: ../../whatsnew/3.12.rst:874 msgid "" -"Add the :attr:`sqlite3.Connection.autocommit` attribute " -"to :class:`sqlite3.Connection` and the *autocommit* parameter " -"to :func:`sqlite3.connect` to control :pep:`249`-compliant :ref:`transaction " -"handling `. (Contributed by Erlend " -"E. Aasland in :gh:`83638`.)" +"Add the :attr:`sqlite3.Connection.autocommit` attribute to :class:`sqlite3." +"Connection` and the *autocommit* parameter to :func:`sqlite3.connect` to " +"control :pep:`249`-compliant :ref:`transaction handling `. (Contributed by Erlend E. Aasland in :gh:`83638`.)" msgstr "" #: ../../whatsnew/3.12.rst:881 msgid "" -"Add *entrypoint* keyword-only parameter " -"to :meth:`sqlite3.Connection.load_extension`, for overriding the SQLite " -"extension entry point. (Contributed by Erlend E. Aasland in :gh:`103015`.)" +"Add *entrypoint* keyword-only parameter to :meth:`sqlite3.Connection." +"load_extension`, for overriding the SQLite extension entry point. " +"(Contributed by Erlend E. Aasland in :gh:`103015`.)" msgstr "" #: ../../whatsnew/3.12.rst:886 msgid "" -"Add :meth:`sqlite3.Connection.getconfig` " -"and :meth:`sqlite3.Connection.setconfig` to :class:`sqlite3.Connection` to " -"make configuration changes to a database connection. (Contributed by Erlend " -"E. Aasland in :gh:`103489`.)" +"Add :meth:`sqlite3.Connection.getconfig` and :meth:`sqlite3.Connection." +"setconfig` to :class:`sqlite3.Connection` to make configuration changes to a " +"database connection. (Contributed by Erlend E. Aasland in :gh:`103489`.)" msgstr "" #: ../../whatsnew/3.12.rst:892 @@ -1374,28 +1364,27 @@ msgstr "sys" #: ../../whatsnew/3.12.rst:901 msgid "" "Add the :mod:`sys.monitoring` namespace to expose the new :ref:`PEP 669 " -"` monitoring API. (Contributed by Mark Shannon " -"in :gh:`103082`.)" +"` monitoring API. (Contributed by Mark Shannon in :gh:" +"`103082`.)" msgstr "" #: ../../whatsnew/3.12.rst:905 msgid "" -"Add :func:`sys.activate_stack_trampoline` " -"and :func:`sys.deactivate_stack_trampoline` for activating and deactivating " -"stack profiler trampolines, and :func:`sys.is_stack_trampoline_active` for " -"querying if stack profiler trampolines are active. (Contributed by Pablo " -"Galindo and Christian Heimes with contributions from Gregory P. Smith " -"[Google] and Mark Shannon in :gh:`96123`.)" +"Add :func:`sys.activate_stack_trampoline` and :func:`sys." +"deactivate_stack_trampoline` for activating and deactivating stack profiler " +"trampolines, and :func:`sys.is_stack_trampoline_active` for querying if " +"stack profiler trampolines are active. (Contributed by Pablo Galindo and " +"Christian Heimes with contributions from Gregory P. Smith [Google] and Mark " +"Shannon in :gh:`96123`.)" msgstr "" #: ../../whatsnew/3.12.rst:914 msgid "" "Add :data:`sys.last_exc` which holds the last unhandled exception that was " "raised (for post-mortem debugging use cases). Deprecate the three fields " -"that have the same information in its legacy " -"form: :data:`sys.last_type`, :data:`sys.last_value` " -"and :data:`sys.last_traceback`. (Contributed by Irit Katriel " -"in :gh:`102778`.)" +"that have the same information in its legacy form: :data:`sys.last_type`, :" +"data:`sys.last_value` and :data:`sys.last_traceback`. (Contributed by Irit " +"Katriel in :gh:`102778`.)" msgstr "" #: ../../whatsnew/3.12.rst:920 ../../whatsnew/3.12.rst:1739 @@ -1439,10 +1428,10 @@ msgstr "threading" #: ../../whatsnew/3.12.rst:940 msgid "" -"Add :func:`threading.settrace_all_threads` " -"and :func:`threading.setprofile_all_threads` that allow to set tracing and " -"profiling functions in all running threads in addition to the calling one. " -"(Contributed by Pablo Galindo in :gh:`93503`.)" +"Add :func:`threading.settrace_all_threads` and :func:`threading." +"setprofile_all_threads` that allow to set tracing and profiling functions in " +"all running threads in addition to the calling one. (Contributed by Pablo " +"Galindo in :gh:`93503`.)" msgstr "" #: ../../whatsnew/3.12.rst:946 @@ -1466,9 +1455,9 @@ msgstr "tokenize" #: ../../whatsnew/3.12.rst:959 msgid "" "The :mod:`tokenize` module includes the changes introduced in :pep:`701`. " -"(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) " -"See :ref:`whatsnew312-porting-to-python312` for more information on the " -"changes to the :mod:`tokenize` module." +"(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) See :" +"ref:`whatsnew312-porting-to-python312` for more information on the changes " +"to the :mod:`tokenize` module." msgstr "" #: ../../whatsnew/3.12.rst:965 @@ -1477,9 +1466,9 @@ msgstr "types" #: ../../whatsnew/3.12.rst:967 msgid "" -"Add :func:`types.get_original_bases` to allow for further introspection " -"of :ref:`user-defined-generics` when subclassed. (Contributed by James " -"Hilton-Balfe and Alex Waygood in :gh:`101827`.)" +"Add :func:`types.get_original_bases` to allow for further introspection of :" +"ref:`user-defined-generics` when subclassed. (Contributed by James Hilton-" +"Balfe and Alex Waygood in :gh:`101827`.)" msgstr "" #: ../../whatsnew/3.12.rst:974 @@ -1488,16 +1477,15 @@ msgstr "typing" #: ../../whatsnew/3.12.rst:976 msgid "" -":func:`isinstance` checks against :func:`runtime-checkable protocols " -"` now use :func:`inspect.getattr_static` rather " -"than :func:`hasattr` to lookup whether attributes exist. This means that " -"descriptors and :meth:`~object.__getattr__` methods are no longer " -"unexpectedly evaluated during ``isinstance()`` checks against runtime-" -"checkable protocols. However, it may also mean that some objects which used " -"to be considered instances of a runtime-checkable protocol may no longer be " -"considered instances of that protocol on Python 3.12+, and vice versa. Most " -"users are unlikely to be affected by this change. (Contributed by Alex " -"Waygood in :gh:`102433`.)" +":func:`isinstance` checks against :func:`runtime-checkable protocols ` now use :func:`inspect.getattr_static` rather than :func:" +"`hasattr` to lookup whether attributes exist. This means that descriptors " +"and :meth:`~object.__getattr__` methods are no longer unexpectedly evaluated " +"during ``isinstance()`` checks against runtime-checkable protocols. However, " +"it may also mean that some objects which used to be considered instances of " +"a runtime-checkable protocol may no longer be considered instances of that " +"protocol on Python 3.12+, and vice versa. Most users are unlikely to be " +"affected by this change. (Contributed by Alex Waygood in :gh:`102433`.)" msgstr "" #: ../../whatsnew/3.12.rst:987 @@ -1558,8 +1546,8 @@ msgid "" "Most ``isinstance()`` checks against protocols with only a few members " "should be at least 2x faster than in 3.11, and some may be 20x faster or " "more. However, ``isinstance()`` checks against protocols with many members " -"may be slower than in Python 3.11. (Contributed by Alex Waygood " -"in :gh:`74690` and :gh:`103193`.)" +"may be slower than in Python 3.11. (Contributed by Alex Waygood in :gh:" +"`74690` and :gh:`103193`.)" msgstr "" #: ../../whatsnew/3.12.rst:1020 @@ -1662,8 +1650,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1072 msgid "" -"Speed up the regular expression substitution (functions :func:`re.sub` " -"and :func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " +"Speed up the regular expression substitution (functions :func:`re.sub` and :" +"func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " "replacement strings containing group references by 2--3 times. (Contributed " "by Serhiy Storchaka in :gh:`91524`.)" msgstr "" @@ -1679,16 +1667,16 @@ msgstr "" #: ../../whatsnew/3.12.rst:1080 msgid "" "The :func:`tokenize.tokenize` and :func:`tokenize.generate_tokens` functions " -"are up to 64% faster as a side effect of the changes required to " -"cover :pep:`701` in the :mod:`tokenize` module. (Contributed by Marta Gómez " -"Macías and Pablo Galindo in :gh:`102856`.)" +"are up to 64% faster as a side effect of the changes required to cover :pep:" +"`701` in the :mod:`tokenize` module. (Contributed by Marta Gómez Macías and " +"Pablo Galindo in :gh:`102856`.)" msgstr "" #: ../../whatsnew/3.12.rst:1085 msgid "" -"Speed up :func:`super` method calls and attribute loads via the " -"new :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and " -"Vladimir Matveev in :gh:`103497`.)" +"Speed up :func:`super` method calls and attribute loads via the new :opcode:" +"`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and Vladimir " +"Matveev in :gh:`103497`.)" msgstr "" #: ../../whatsnew/3.12.rst:1091 @@ -1697,29 +1685,28 @@ msgstr "CPython 位元組碼變更" #: ../../whatsnew/3.12.rst:1093 msgid "" -"Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged " -"into :opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the " -"old :opcode:`!LOAD_METHOD` instruction if the low bit of its oparg is set. " -"(Contributed by Ken Jin in :gh:`93429`.)" +"Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged into :" +"opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the old :opcode:" +"`!LOAD_METHOD` instruction if the low bit of its oparg is set. (Contributed " +"by Ken Jin in :gh:`93429`.)" msgstr "" -"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併" -"至 :opcode:`LOAD_ATTR`。:opcode:`LOAD_ATTR` 現在會像舊的 :opcode:`!" -"LOAD_METHOD` 指令一樣行為,如果其 oparg 的低位元 (low bit) 有被設定。(由 " -"Ken Jin 於 :gh:`93429` 中貢獻。)" +"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併至 :opcode:`LOAD_ATTR`。:opcode:" +"`LOAD_ATTR` 現在會像舊的 :opcode:`!LOAD_METHOD` 指令一樣行為,如果其 oparg 的" +"低位元 (low bit) 有被設定。(由 Ken Jin 於 :gh:`93429` 中貢獻。)" #: ../../whatsnew/3.12.rst:1098 msgid "" "Remove the :opcode:`!JUMP_IF_FALSE_OR_POP` and :opcode:`!" -"JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel " -"in :gh:`102859`.)" +"JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel in :gh:" +"`102859`.)" msgstr "" "移除 :opcode:`!JUMP_IF_FALSE_OR_POP` 和 :opcode:`!JUMP_IF_TRUE_OR_POP` 指令。" "(由 Irit Katriel 於 :gh:`102859` 中貢獻。)" #: ../../whatsnew/3.12.rst:1101 msgid "" -"Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon " -"in :gh:`92925`.)" +"Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon in :" +"gh:`92925`.)" msgstr "" "移除 :opcode:`!PRECALL` 指令。(由 Mark Shannon 於 :gh:`92925` 中貢獻。)" @@ -1757,8 +1744,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1116 msgid "" -"Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon " -"in :gh:`103082`.)" +"Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon in :gh:" +"`103082`.)" msgstr "" "新增 :opcode:`!END_SEND` 指令。(由 Mark Shannon 於 :gh:`103082` 中貢獻。)" @@ -1780,31 +1767,30 @@ msgstr "" #: ../../whatsnew/3.12.rst:1125 msgid "" -"Add " -"the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:`LOAD_FROM_DICT_OR_GLOBALS`, " -"and :opcode:`LOAD_LOCALS` opcodes as part of the implementation " -"of :pep:`695`. Remove the :opcode:`!LOAD_CLASSDEREF` opcode, which can be " -"replaced with :opcode:`LOAD_LOCALS` plus :opcode:`LOAD_FROM_DICT_OR_DEREF`. " -"(Contributed by Jelle Zijlstra in :gh:`103764`.)" +"Add the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:" +"`LOAD_FROM_DICT_OR_GLOBALS`, and :opcode:`LOAD_LOCALS` opcodes as part of " +"the implementation of :pep:`695`. Remove the :opcode:`!LOAD_CLASSDEREF` " +"opcode, which can be replaced with :opcode:`LOAD_LOCALS` plus :opcode:" +"`LOAD_FROM_DICT_OR_DEREF`. (Contributed by Jelle Zijlstra in :gh:`103764`.)" msgstr "" "新增 :opcode:`LOAD_FROM_DICT_OR_DEREF`、:opcode:`LOAD_FROM_DICT_OR_GLOBALS` " "和 :opcode:`LOAD_LOCALS` 操作碼作為 :pep:`695` 實作的一部分。移除 :opcode:`!" -"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加" -"上 :opcode:`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra " -"於 :gh:`103764` 中貢獻。)" +"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加上 :opcode:" +"`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra 於 :gh:`103764` 中貢" +"獻。)" #: ../../whatsnew/3.12.rst:1131 msgid "" "Add the :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer " "and Vladimir Matveev in :gh:`103497`.)" msgstr "" -"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev " -"於 :gh:`103497` 中貢獻。)" +"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev 於 :" +"gh:`103497` 中貢獻。)" #: ../../whatsnew/3.12.rst:1134 msgid "" -"Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang " -"in :gh:`101632`.)" +"Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang in :" +"gh:`101632`.)" msgstr "" "新增 :opcode:`RETURN_CONST` 指令。(由 Wenyang Wang 於 :gh:`101632` 中貢" "獻。)" @@ -1881,8 +1867,8 @@ msgstr ":class:`!ast.Ellipsis`" #: ../../whatsnew/3.12.rst:1168 #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " -"in :gh:`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" +"`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" @@ -1894,23 +1880,24 @@ msgstr ":mod:`asyncio`:" #: ../../whatsnew/3.12.rst:1173 msgid "" -"The child watcher " -"classes :class:`asyncio.MultiLoopChildWatcher`, :class:`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` " -"and :class:`asyncio.SafeChildWatcher` are deprecated and will be removed in " -"Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +"The child watcher classes :class:`asyncio.MultiLoopChildWatcher`, :class:" +"`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` and :class:" +"`asyncio.SafeChildWatcher` are deprecated and will be removed in Python " +"3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" #: ../../whatsnew/3.12.rst:1179 #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated " -"and will be removed in Python 3.14. (Contributed by Kumar Aditya " -"in :gh:`94597`.)" +":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" +"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." +"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " +"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " -"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:" +"`asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`asyncio." +"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" +"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../whatsnew/3.12.rst:1185 #: ../../deprecations/pending-removal-in-3.14.rst:36 @@ -1928,9 +1915,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:39 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` " -"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " @@ -1940,27 +1926,24 @@ msgstr "" msgid "" ":mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`. " "Prefer :class:`Sequence` or :class:`collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" +"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." +"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" msgstr "" #: ../../whatsnew/3.12.rst:1199 msgid "" -":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime.utcnow` " -"and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and will be " -"removed in a future version. Instead, use timezone-aware objects to " -"represent datetimes in UTC: respectively, " -"call :meth:`~datetime.datetime.now` " -"and :meth:`~datetime.datetime.fromtimestamp` with the *tz* parameter set " -"to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" +":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime." +"utcnow` and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and " +"will be removed in a future version. Instead, use timezone-aware objects to " +"represent datetimes in UTC: respectively, call :meth:`~datetime.datetime." +"now` and :meth:`~datetime.datetime.fromtimestamp` with the *tz* parameter " +"set to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" msgstr "" #: ../../whatsnew/3.12.rst:1207 msgid "" -":mod:`email`: Deprecate the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecate the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 中貢獻。)" @@ -2011,8 +1994,8 @@ msgid "" ":mod:`itertools`: Deprecate the support for copy, deepcopy, and pickle " "operations, which is undocumented, inefficient, historically buggy, and " "inconsistent. This will be removed in 3.14 for a significant reduction in " -"code volume and maintenance burden. (Contributed by Raymond Hettinger " -"in :gh:`101588`.)" +"code volume and maintenance burden. (Contributed by Raymond Hettinger in :gh:" +"`101588`.)" msgstr "" #: ../../whatsnew/3.12.rst:1230 @@ -2021,19 +2004,17 @@ msgid "" "start method will change to a safer one on Linux, BSDs, and other non-macOS " "POSIX platforms where ``'fork'`` is currently the default (:gh:`84559`). " "Adding a runtime warning about this was deemed too disruptive as the " -"majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`contexts and start methods " -"`." +"majority of code is not expected to care. Use the :func:`~multiprocessing." +"get_context` or :func:`~multiprocessing.set_start_method` APIs to explicitly " +"specify when your code *requires* ``'fork'``. See :ref:`contexts and start " +"methods `." msgstr "" #: ../../whatsnew/3.12.rst:1240 msgid "" ":mod:`pkgutil`: :func:`pkgutil.find_loader` and :func:`pkgutil.get_loader` " -"are deprecated and will be removed in Python 3.14; " -"use :func:`importlib.util.find_spec` instead. (Contributed by Nikita Sobolev " -"in :gh:`97850`.)" +"are deprecated and will be removed in Python 3.14; use :func:`importlib.util." +"find_spec` instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`pkgutil.find_loader` 和 :func:`pkgutil.get_loader` 已" "被棄用並將在 Python 3.14 中移除;請改用 :func:`importlib.util.find_spec`。" @@ -2062,31 +2043,30 @@ msgstr "" #: ../../whatsnew/3.12.rst:1258 msgid "" -"On POSIX platforms, :func:`os.fork` can now raise " -"a :exc:`DeprecationWarning` when it can detect being called from a " -"multithreaded process. There has always been a fundamental incompatibility " -"with the POSIX platform when doing so. Even if such code *appeared* to work. " -"We added the warning to raise awareness as issues encountered by code doing " -"this are becoming more frequent. See the :func:`os.fork` documentation for " -"more details along with `this discussion on fork being incompatible with " -"threads `_ for *why* we're now surfacing this longstanding " +"On POSIX platforms, :func:`os.fork` can now raise a :exc:" +"`DeprecationWarning` when it can detect being called from a multithreaded " +"process. There has always been a fundamental incompatibility with the POSIX " +"platform when doing so. Even if such code *appeared* to work. We added the " +"warning to raise awareness as issues encountered by code doing this are " +"becoming more frequent. See the :func:`os.fork` documentation for more " +"details along with `this discussion on fork being incompatible with threads " +"`_ for *why* we're now surfacing this longstanding " "platform compatibility problem to developers." msgstr "" #: ../../whatsnew/3.12.rst:1268 msgid "" -"When this warning appears due to usage of :mod:`multiprocessing` " -"or :mod:`concurrent.futures` the fix is to use a " -"different :mod:`multiprocessing` start method such as ``\"spawn\"`` or " -"``\"forkserver\"``." +"When this warning appears due to usage of :mod:`multiprocessing` or :mod:" +"`concurrent.futures` the fix is to use a different :mod:`multiprocessing` " +"start method such as ``\"spawn\"`` or ``\"forkserver\"``." msgstr "" #: ../../whatsnew/3.12.rst:1272 msgid "" ":mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is " -"deprecated; use *onexc* instead. (Contributed by Irit Katriel " -"in :gh:`102828`.)" +"deprecated; use *onexc* instead. (Contributed by Irit Katriel in :gh:" +"`102828`.)" msgstr "" ":mod:`shutil`::func:`shutil.rmtree` 的 *onerror* 引數已被棄用,請改用 " "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" @@ -2115,14 +2095,13 @@ msgstr "" #: ../../whatsnew/3.12.rst:1290 msgid "" -":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` " -"and :data:`sys.last_traceback` fields are deprecated. " -"Use :data:`sys.last_exc` instead. (Contributed by Irit Katriel " -"in :gh:`102778`.)" +":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys." +"last_traceback` fields are deprecated. Use :data:`sys.last_exc` instead. " +"(Contributed by Irit Katriel in :gh:`102778`.)" msgstr "" -":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` " -"和 :data:`sys.last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。" -"(由 Irit Katriel 於 :gh:`102778` 中貢獻。)" +":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` 和 :data:`sys." +"last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。(由 Irit Katriel " +"於 :gh:`102778` 中貢獻。)" #: ../../whatsnew/3.12.rst:1294 msgid "" @@ -2138,16 +2117,16 @@ msgstr ":mod:`typing`:" #: ../../whatsnew/3.12.rst:1300 msgid "" -":class:`typing.Hashable` and :class:`typing.Sized`, aliases " -"for :class:`collections.abc.Hashable` and :class:`collections.abc.Sized` " -"respectively, are deprecated. (:gh:`94309`.)" +":class:`typing.Hashable` and :class:`typing.Sized`, aliases for :class:" +"`collections.abc.Hashable` and :class:`collections.abc.Sized` respectively, " +"are deprecated. (:gh:`94309`.)" msgstr "" #: ../../whatsnew/3.12.rst:1304 msgid "" -":class:`typing.ByteString`, deprecated since Python 3.9, now causes " -"a :exc:`DeprecationWarning` to be emitted when it is used. (Contributed by " -"Alex Waygood in :gh:`91896`.)" +":class:`typing.ByteString`, deprecated since Python 3.9, now causes a :exc:" +"`DeprecationWarning` to be emitted when it is used. (Contributed by Alex " +"Waygood in :gh:`91896`.)" msgstr "" #: ../../whatsnew/3.12.rst:1308 @@ -2161,26 +2140,26 @@ msgstr "" #: ../../whatsnew/3.12.rst:1314 msgid "" "The 3-arg signatures (type, value, traceback) of :meth:`coroutine throw() " -"`, :meth:`generator throw() ` " -"and :meth:`async generator throw() ` are deprecated and may be " -"removed in a future version of Python. Use the single-arg versions of these " -"functions instead. (Contributed by Ofey Chan in :gh:`89874`.)" +"`, :meth:`generator throw() ` and :meth:" +"`async generator throw() ` are deprecated and may be removed in " +"a future version of Python. Use the single-arg versions of these functions " +"instead. (Contributed by Ofey Chan in :gh:`89874`.)" msgstr "" #: ../../whatsnew/3.12.rst:1320 msgid "" ":exc:`DeprecationWarning` is now raised when :attr:`~module.__package__` on " -"a module differs from :attr:`__spec__.parent " -"` (previously it " -"was :exc:`ImportWarning`). (Contributed by Brett Cannon in :gh:`65961`.)" +"a module differs from :attr:`__spec__.parent ` (previously it was :exc:`ImportWarning`). (Contributed by Brett " +"Cannon in :gh:`65961`.)" msgstr "" #: ../../whatsnew/3.12.rst:1326 msgid "" "Setting :attr:`~module.__package__` or :attr:`~module.__cached__` on a " "module is deprecated, and will cease to be set or taken into consideration " -"by the import system in Python 3.14. (Contributed by Brett Cannon " -"in :gh:`65961`.)" +"by the import system in Python 3.14. (Contributed by Brett Cannon in :gh:" +"`65961`.)" msgstr "" #: ../../whatsnew/3.12.rst:1330 @@ -2195,13 +2174,13 @@ msgstr "" #: ../../whatsnew/3.12.rst:1336 msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " -"Python 3.10 via :pep:`626`, but it only got a " -"proper :exc:`DeprecationWarning` in 3.12. May be removed in 3.15. " -"(Contributed by Nikita Sobolev in :gh:`101866`.)" +"Python 3.10 via :pep:`626`, but it only got a proper :exc:" +"`DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita " +"Sobolev in :gh:`101866`.)" msgstr "" -"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已" -"在 :pep:`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。" -"可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" +"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已在 :pep:" +"`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。可能在 " +"3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.13.rst:2 msgid "Pending Removal in Python 3.13" @@ -2393,35 +2372,32 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" -"The child watcher " -"classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " -"and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " +"The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" +"`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" +"class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類" -"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " -"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" -"獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." +"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." +"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " +"Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" -msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" -"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" -"時,請改用聯集,如 ``bytes | bytearray``," -"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" -"獻。)" +"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." +"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +msgstr "" +":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" +"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" +"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " +"Shantanu Jain 於 :gh:`91896` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" -":mod:`email`: Deprecated the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" @@ -2447,25 +2423,24 @@ msgid "" "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" -"用 :func:`~multiprocessing.get_context` " -"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" -"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" +"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " +"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" +"`multiprocessing-start-methods`。" #: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " -"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " -"deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " -"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" +"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" @@ -2474,9 +2449,8 @@ msgid "" "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改" -"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" -"獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." +"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" @@ -2496,9 +2470,9 @@ msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " -"if :ref:`named placeholders ` are used and " -"*parameters* is a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders ` are used and *parameters* is " +"a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" @@ -2515,8 +2489,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith " -"in :gh:`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" @@ -2533,10 +2507,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to " -"set :attr:`__spec__.cached ` is " -"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " -"into consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -2544,11 +2518,10 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to " -"set :attr:`__spec__.parent ` is " -"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " -"take into consideration by the import system or standard library. " -"(:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," @@ -2603,17 +2576,15 @@ msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 " -"(:gh:`90817`), but has been postponed to Python 3.15. " -"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " -"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " -"in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" -"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " -"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" -"獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" @@ -2621,11 +2592,11 @@ msgstr ":mod:`pathlib`:" #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" -"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" @@ -2679,16 +2650,16 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" -"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " -"於 :gh:`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " -"3.13. Use the class-based syntax or the functional syntax instead." +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" @@ -2696,6 +2667,15 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:95 +msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " "it has yet to be supported by any major type checker." @@ -2704,20 +2684,19 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:93 +#: ../../deprecations/pending-removal-in-3.15.rst:100 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:95 +#: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " -"deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" -"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " -"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" @@ -2725,10 +2704,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to " -"set :attr:`__spec__.loader ` is " -"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " -"taken into consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "` 的做法將於 Python 3.16 被棄用。在 " @@ -2755,8 +2734,8 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " -"於 :gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 #: ../../deprecations/pending-removal-in-future.rst:10 @@ -2862,17 +2841,17 @@ msgid "" "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of " -"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " -"and :keyword:`or`. In a future release it will be changed to a syntax " -"error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" -"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " -"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" -"法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" +"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" +"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" +"本中,它將被更改為語法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:24 msgid "" @@ -2885,18 +2864,18 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:27 msgid "" -"Support for ``__float__()`` method returning a strict subclass " -"of :class:`float`: these methods will be required to return an instance " -"of :class:`float`." +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:30 msgid "" -"Support for ``__complex__()`` method returning a strict subclass " -"of :class:`complex`: these methods will be required to return an instance " -"of :class:`complex`." +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" @@ -2907,10 +2886,10 @@ msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:34 msgid "" -"Passing a complex number as the *real* or *imag* argument in " -"the :func:`complex` constructor is now deprecated; it should only be passed " -"as a single positional argument. (Contributed by Serhiy Storchaka " -"in :gh:`109218`.)" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" @@ -2928,19 +2907,19 @@ msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:49 msgid "" -":meth:`~datetime.datetime.utcnow`: use " -"``datetime.datetime.now(tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 " -"``datetime.datetime.now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." +"now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:51 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`gettext`: Plural value must be an integer." @@ -2971,8 +2950,8 @@ msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" -"用 :meth:`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:69 msgid "" @@ -3029,11 +3008,11 @@ msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:92 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " -"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " -"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" +"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" #: ../../deprecations/pending-removal-in-future.rst:95 msgid "``ssl.OP_NO_SSL*`` options" @@ -3081,11 +3060,11 @@ msgstr ":mod:`threading` 方法:" #: ../../deprecations/pending-removal-in-future.rst:108 msgid "" -":meth:`!threading.Condition.notifyAll`: " -"use :meth:`~threading.Condition.notify_all`." +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請" -"用 :meth:`~threading.Condition.notify_all`。" +":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." +"notify_all`。" #: ../../deprecations/pending-removal-in-future.rst:109 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." @@ -3093,19 +3072,19 @@ msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set` #: ../../deprecations/pending-removal-in-future.rst:110 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " -"use :attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:112 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " -"use :attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" -"用 :attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" +"attr:`threading.Thread.name` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:114 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." @@ -3181,13 +3160,13 @@ msgstr "``to_bytes()``" #: ../../deprecations/pending-removal-in-future.rst:136 msgid "" -":mod:`urllib.request`: :class:`~urllib.request.URLopener` " -"and :class:`~urllib.request.FancyURLopener` style of invoking requests is " -"deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods." +":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" +"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " +"Use newer :func:`~urllib.request.urlopen` functions and methods." msgstr "" -":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " -"和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" -"的 :func:`~urllib.request.urlopen` 函式和方法。" +":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" +"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" +"`~urllib.request.urlopen` 函式和方法。" #: ../../deprecations/pending-removal-in-future.rst:140 msgid "" @@ -3197,22 +3176,22 @@ msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分 #: ../../deprecations/pending-removal-in-future.rst:143 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of " -"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " -"release it will always return ``True``. Prefer explicit ``len(elem)`` or " -"``elem is not None`` tests instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用" -"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" -"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." +"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " +"``len(elem)`` 或 ``elem is not None`` 測試。" #: ../../deprecations/pending-removal-in-future.rst:148 msgid "" -":meth:`zipimport.zipimporter.load_module` is deprecated: " -"use :meth:`~zipimport.zipimporter.exec_module` instead." +":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" +"`~zipimport.zipimporter.exec_module` instead." msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" -"用 :meth:`~zipimport.zipimporter.exec_module`。" +":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." +"zipimporter.exec_module`。" #: ../../whatsnew/3.12.rst:1355 ../../whatsnew/3.12.rst:2237 msgid "Removed" @@ -3253,16 +3232,16 @@ msgid "" ":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " "shorter :class:`~configparser.ConfigParser` name instead." msgstr "" -":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短" -"的 :class:`~configparser.ConfigParser` 名稱。" +":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短的 :class:" +"`~configparser.ConfigParser` 名稱。" #: ../../whatsnew/3.12.rst:1376 msgid "" -":class:`configparser.ConfigParser` no longer has a ``readfp`` method. " -"Use :meth:`~configparser.ConfigParser.read_file` instead." +":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" +"meth:`~configparser.ConfigParser.read_file` instead." msgstr "" -":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改" -"用 :meth:`~configparser.ConfigParser.read_file`。" +":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改用 :meth:" +"`~configparser.ConfigParser.read_file`。" #: ../../whatsnew/3.12.rst:1382 msgid "distutils" @@ -3342,8 +3321,8 @@ msgid "" "Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " "deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " "instead. In write mode, the ``filename`` attribute added ``'.gz'`` file " -"extension if it was not present. (Contributed by Victor Stinner " -"in :gh:`94196`.)" +"extension if it was not present. (Contributed by Victor Stinner in :gh:" +"`94196`.)" msgstr "" #: ../../whatsnew/3.12.rst:1435 @@ -3352,11 +3331,11 @@ msgstr "hashlib" #: ../../whatsnew/3.12.rst:1437 msgid "" -"Remove the pure Python implementation " -"of :mod:`hashlib`'s :func:`hashlib.pbkdf2_hmac`, deprecated in Python 3.10. " -"Python 3.10 and newer requires OpenSSL 1.1.1 (:pep:`644`): this OpenSSL " -"version provides a C implementation of :func:`~hashlib.pbkdf2_hmac` which is " -"faster. (Contributed by Victor Stinner in :gh:`94199`.)" +"Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." +"pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires " +"OpenSSL 1.1.1 (:pep:`644`): this OpenSSL version provides a C implementation " +"of :func:`~hashlib.pbkdf2_hmac` which is faster. (Contributed by Victor " +"Stinner in :gh:`94199`.)" msgstr "" #: ../../whatsnew/3.12.rst:1444 ../../whatsnew/3.12.rst:1473 @@ -3402,8 +3381,8 @@ msgstr "imp" #: ../../whatsnew/3.12.rst:1467 msgid "" -"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw " -"in :gh:`98040`.)" +"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" +"gh:`98040`.)" msgstr ":mod:`!imp` 模組已被移除。(由 Barry Warsaw 在 :gh:`98040` 中貢獻。)" #: ../../whatsnew/3.12.rst:1470 @@ -3448,11 +3427,11 @@ msgstr "``imp.get_suffixes()``" #: ../../whatsnew/3.12.rst:1479 msgid "" -":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery.EXTENSION_SUFFIXES`, " -"and :const:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery." +"EXTENSION_SUFFIXES`, and :const:`importlib.machinery.BYTECODE_SUFFIXES`" msgstr "" -":const:`importlib.machinery.SOURCE_SUFFIXES`、:const:`importlib.machinery.EXTENSION_SUFFIXES` " -"和 :const:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`、:const:`importlib.machinery." +"EXTENSION_SUFFIXES` 和 :const:`importlib.machinery.BYTECODE_SUFFIXES`" #: ../../whatsnew/3.12.rst:1480 msgid "``imp.get_tag()``" @@ -3583,10 +3562,10 @@ msgstr "io" #: ../../whatsnew/3.12.rst:1521 msgid "" "Remove :mod:`io`'s ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated " -"in Python 3.10: just use :func:`open` instead. The :func:`open` " -"(:func:`io.open`) function is a built-in function. Since Python " -"3.10, :func:`!_pyio.open` is also a static method. (Contributed by Victor " -"Stinner in :gh:`94169`.)" +"in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io." +"open`) function is a built-in function. Since Python 3.10, :func:`!_pyio." +"open` is also a static method. (Contributed by Victor Stinner in :gh:" +"`94169`.)" msgstr "" #: ../../whatsnew/3.12.rst:1528 @@ -3606,10 +3585,10 @@ msgstr "smtpd" #: ../../whatsnew/3.12.rst:1537 msgid "" -"The ``smtpd`` module has been removed according to the schedule " -"in :pep:`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use " -"the :pypi:`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server " -"instead. (Contributed by Oleg Iarygin in :gh:`93243`.)" +"The ``smtpd`` module has been removed according to the schedule in :pep:" +"`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use the :pypi:" +"`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server instead. " +"(Contributed by Oleg Iarygin in :gh:`93243`.)" msgstr "" "根據 :pep:`594` 的時間表移除 ``smtpd`` 模組,它在 Python 3.4.7 和 3.5.4 中已" "被棄用。請改用 PyPI 上的 :pypi:`aiosmtpd` 模組或任何其他基於 :mod:`asyncio` " @@ -3639,9 +3618,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1555 msgid "" -"The ``sqlite3.OptimizedUnicode`` text factory has been an alias " -"for :class:`str` since Python 3.3. Code that previously set the text factory " -"to ``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the " +"The ``sqlite3.OptimizedUnicode`` text factory has been an alias for :class:" +"`str` since Python 3.3. Code that previously set the text factory to " +"``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the " "default value which is also ``str``." msgstr "" @@ -3671,12 +3650,12 @@ msgstr "" #: ../../whatsnew/3.12.rst:1575 msgid "" "Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: " -"instead, create a :class:`ssl.SSLContext` object and call " -"its :class:`ssl.SSLContext.wrap_socket` method. Any package that still " -"uses :func:`!ssl.wrap_socket` is broken and insecure. The function neither " -"sends a SNI TLS extension nor validates the server hostname. Code is subject " -"to :cwe:`295` (Improper Certificate Validation). (Contributed by Victor " -"Stinner in :gh:`94199`.)" +"instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl." +"SSLContext.wrap_socket` method. Any package that still uses :func:`!ssl." +"wrap_socket` is broken and insecure. The function neither sends a SNI TLS " +"extension nor validates the server hostname. Code is subject to :cwe:`295` " +"(Improper Certificate Validation). (Contributed by Victor Stinner in :gh:" +"`94199`.)" msgstr "" #: ../../whatsnew/3.12.rst:1586 @@ -3834,9 +3813,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1618 msgid "" -"Undocumented :meth:`TestLoader.loadTestsFromModule " -"` parameter *use_load_tests* " -"(deprecated and ignored since Python 3.5)." +"Undocumented :meth:`TestLoader.loadTestsFromModule ` parameter *use_load_tests* (deprecated and ignored " +"since Python 3.5)." msgstr "" #: ../../whatsnew/3.12.rst:1622 @@ -3882,9 +3861,8 @@ msgstr "zipimport" #: ../../whatsnew/3.12.rst:1646 msgid "" "Remove :mod:`zipimport`'s ``find_loader()`` and ``find_module()`` methods, " -"deprecated in Python 3.10: use the ``find_spec()`` method instead. " -"See :pep:`451` for the rationale. (Contributed by Victor Stinner " -"in :gh:`94379`.)" +"deprecated in Python 3.10: use the ``find_spec()`` method instead. See :pep:" +"`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.)" msgstr "" #: ../../whatsnew/3.12.rst:1652 @@ -3893,20 +3871,20 @@ msgstr "其他" #: ../../whatsnew/3.12.rst:1654 msgid "" -"Remove the ``suspicious`` rule from the documentation :file:`Makefile` " -"and :file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint `_. (Contributed by Julien Palard " -"in :gh:`98179`.)" +"Remove the ``suspicious`` rule from the documentation :file:`Makefile` and :" +"file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint `_. (Contributed by Julien Palard in :gh:" +"`98179`.)" msgstr "" #: ../../whatsnew/3.12.rst:1659 msgid "" -"Remove the *keyfile* and *certfile* parameters from " -"the :mod:`ftplib`, :mod:`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, " -"and the *key_file*, *cert_file* and *check_hostname* parameters from " -"the :mod:`http.client` module, all deprecated since Python 3.6. Use the " -"*context* parameter (*ssl_context* in :mod:`imaplib`) instead. (Contributed " -"by Victor Stinner in :gh:`94172`.)" +"Remove the *keyfile* and *certfile* parameters from the :mod:`ftplib`, :mod:" +"`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, and the *key_file*, " +"*cert_file* and *check_hostname* parameters from the :mod:`http.client` " +"module, all deprecated since Python 3.6. Use the *context* parameter " +"(*ssl_context* in :mod:`imaplib`) instead. (Contributed by Victor Stinner " +"in :gh:`94172`.)" msgstr "" #: ../../whatsnew/3.12.rst:1667 @@ -3919,8 +3897,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1670 msgid "" -"Remove ``_use_broken_old_ctypes_structure_semantics_`` flag " -"from :mod:`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" +"Remove ``_use_broken_old_ctypes_structure_semantics_`` flag from :mod:" +"`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" msgstr "" "移除 :mod:`ctypes` 模組中的 ``_use_broken_old_ctypes_structure_semantics_`` " "旗標。(由 Nikita Sobolev 於 :gh:`99285` 中貢獻。)" @@ -3956,8 +3934,8 @@ msgid "" "integer values such as ``randrange(10.5)`` or ``randrange('10')`` has been " "changed from :exc:`ValueError` to :exc:`TypeError`. This also prevents bugs " "where ``randrange(1e25)`` would silently select from a larger range than " -"``randrange(10**25)``. (Originally suggested by Serhiy " -"Storchaka :gh:`86388`.)" +"``randrange(10**25)``. (Originally suggested by Serhiy Storchaka :gh:" +"`86388`.)" msgstr "" #: ../../whatsnew/3.12.rst:1701 @@ -3973,8 +3951,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1707 msgid "" "Remove the ``asyncore``-based ``smtpd`` module deprecated in Python 3.4.7 " -"and 3.5.4. A recommended replacement is the :mod:`asyncio`-" -"based :pypi:`aiosmtpd` PyPI module." +"and 3.5.4. A recommended replacement is the :mod:`asyncio`-based :pypi:" +"`aiosmtpd` PyPI module." msgstr "" #: ../../whatsnew/3.12.rst:1711 @@ -3986,10 +3964,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:1716 msgid "" -"The :mod:`os` module no longer accepts bytes-like paths, " -"like :class:`bytearray` and :class:`memoryview` types: only the " -"exact :class:`bytes` type is accepted for bytes strings. (Contributed by " -"Victor Stinner in :gh:`98393`.)" +"The :mod:`os` module no longer accepts bytes-like paths, like :class:" +"`bytearray` and :class:`memoryview` types: only the exact :class:`bytes` " +"type is accepted for bytes strings. (Contributed by Victor Stinner in :gh:" +"`98393`.)" msgstr "" #: ../../whatsnew/3.12.rst:1721 @@ -4018,23 +3996,21 @@ msgstr "" #: ../../whatsnew/3.12.rst:1743 msgid "" -"When extracting tar files using :mod:`tarfile` " -"or :func:`shutil.unpack_archive`, pass the *filter* argument to limit " -"features that may be surprising or dangerous. See :ref:`tarfile-extraction-" -"filter` for details." +"When extracting tar files using :mod:`tarfile` or :func:`shutil." +"unpack_archive`, pass the *filter* argument to limit features that may be " +"surprising or dangerous. See :ref:`tarfile-extraction-filter` for details." msgstr "" #: ../../whatsnew/3.12.rst:1748 msgid "" -"The output of the :func:`tokenize.tokenize` " -"and :func:`tokenize.generate_tokens` functions is now changed due to the " -"changes introduced in :pep:`701`. This means that ``STRING`` tokens are not " -"emitted any more for f-strings and the tokens described in :pep:`701` are " -"now produced instead: ``FSTRING_START``, ``FSTRING_MIDDLE`` and " -"``FSTRING_END`` are now emitted for f-string \"string\" parts in addition to " -"the appropriate tokens for the tokenization in the expression components. " -"For example for the f-string ``f\"start {1+1} end\"`` the old version of the " -"tokenizer emitted::" +"The output of the :func:`tokenize.tokenize` and :func:`tokenize." +"generate_tokens` functions is now changed due to the changes introduced in :" +"pep:`701`. This means that ``STRING`` tokens are not emitted any more for f-" +"strings and the tokens described in :pep:`701` are now produced instead: " +"``FSTRING_START``, ``FSTRING_MIDDLE`` and ``FSTRING_END`` are now emitted " +"for f-string \"string\" parts in addition to the appropriate tokens for the " +"tokenization in the expression components. For example for the f-string " +"``f\"start {1+1} end\"`` the old version of the tokenizer emitted::" msgstr "" #: ../../whatsnew/3.12.rst:1757 @@ -4139,11 +4115,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:1813 msgid "" -"Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to " -"override :mod:`compileall` options (default: ``-j0``) in ``make install``. " -"Also merged the 3 ``compileall`` commands into a single command to " -"build .pyc files for all optimization levels (0, 1, 2) at once. (Contributed " -"by Victor Stinner in :gh:`99289`.)" +"Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to override :mod:" +"`compileall` options (default: ``-j0``) in ``make install``. Also merged the " +"3 ``compileall`` commands into a single command to build .pyc files for all " +"optimization levels (0, 1, 2) at once. (Contributed by Victor Stinner in :gh:" +"`99289`.)" msgstr "" #: ../../whatsnew/3.12.rst:1819 @@ -4262,8 +4238,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1873 msgid "" ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` added " -"to allow safely extending certain variable-sized types, " -"including :c:var:`PyType_Type`." +"to allow safely extending certain variable-sized types, including :c:var:" +"`PyType_Type`." msgstr "" #: ../../whatsnew/3.12.rst:1876 @@ -4278,10 +4254,10 @@ msgstr "(由 Petr Viktorin 於 :gh:`103509` 中貢獻。)" #: ../../whatsnew/3.12.rst:1881 msgid "" -"Add the new :ref:`limited C API ` " -"function :c:func:`PyType_FromMetaclass`, which generalizes the " -"existing :c:func:`PyType_FromModuleAndSpec` using an additional metaclass " -"argument. (Contributed by Wenzel Jakob in :gh:`93012`.)" +"Add the new :ref:`limited C API ` function :c:func:" +"`PyType_FromMetaclass`, which generalizes the existing :c:func:" +"`PyType_FromModuleAndSpec` using an additional metaclass argument. " +"(Contributed by Wenzel Jakob in :gh:`93012`.)" msgstr "" #: ../../whatsnew/3.12.rst:1886 @@ -4313,16 +4289,16 @@ msgid "" "makes vectorcall safe to use with mutable types (i.e. heap types without the " "immutable flag, :c:macro:`Py_TPFLAGS_IMMUTABLETYPE`). Mutable types that do " "not override :c:member:`~PyTypeObject.tp_call` now inherit the " -"``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin " -"in :gh:`93274`.)" +"``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin in :gh:" +"`93274`.)" msgstr "" #: ../../whatsnew/3.12.rst:1903 msgid "" -"The :c:macro:`Py_TPFLAGS_MANAGED_DICT` " -"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows " -"extensions classes to support object :attr:`~object.__dict__` and weakrefs " -"with less bookkeeping, using less memory and with faster access." +"The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " +"classes to support object :attr:`~object.__dict__` and weakrefs with less " +"bookkeeping, using less memory and with faster access." msgstr "" #: ../../whatsnew/3.12.rst:1908 @@ -4352,9 +4328,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1920 msgid "" -"Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` " -"and :c:func:`PyEval_SetTraceAllThreads`, that allow to set tracing and " -"profiling functions in all running threads in addition to the calling one. " +"Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` and :c:" +"func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling " +"functions in all running threads in addition to the calling one. " "(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" @@ -4367,11 +4343,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:1930 msgid "" -"The C API now permits registering callbacks " -"via :c:func:`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to " -"be called whenever a dictionary is modified. This is intended for use by " -"optimizing interpreters, JIT compilers, or debuggers. (Contributed by Carl " -"Meyer in :gh:`91052`.)" +"The C API now permits registering callbacks via :c:func:" +"`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to be called " +"whenever a dictionary is modified. This is intended for use by optimizing " +"interpreters, JIT compilers, or debuggers. (Contributed by Carl Meyer in :gh:" +"`91052`.)" msgstr "" #: ../../whatsnew/3.12.rst:1936 @@ -4391,18 +4367,18 @@ msgstr "" #: ../../whatsnew/3.12.rst:1945 msgid "" "Add :c:func:`PyFrame_GetVar` and :c:func:`PyFrame_GetVarString` functions to " -"get a frame variable by its name. (Contributed by Victor Stinner " -"in :gh:`91248`.)" +"get a frame variable by its name. (Contributed by Victor Stinner in :gh:" +"`91248`.)" msgstr "" #: ../../whatsnew/3.12.rst:1949 msgid "" -"Add :c:func:`PyErr_GetRaisedException` " -"and :c:func:`PyErr_SetRaisedException` for saving and restoring the current " -"exception. These functions return and accept a single exception object, " -"rather than the triple arguments of the now-deprecated :c:func:`PyErr_Fetch` " -"and :c:func:`PyErr_Restore`. This is less error prone and a bit more " -"efficient. (Contributed by Mark Shannon in :gh:`101578`.)" +"Add :c:func:`PyErr_GetRaisedException` and :c:func:" +"`PyErr_SetRaisedException` for saving and restoring the current exception. " +"These functions return and accept a single exception object, rather than the " +"triple arguments of the now-deprecated :c:func:`PyErr_Fetch` and :c:func:" +"`PyErr_Restore`. This is less error prone and a bit more efficient. " +"(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:1957 @@ -4415,9 +4391,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1961 msgid "" "Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs` as " -"convenience functions for retrieving and modifying " -"the :attr:`~BaseException.args` passed to the exception's constructor. " -"(Contributed by Mark Shannon in :gh:`101578`.)" +"convenience functions for retrieving and modifying the :attr:`~BaseException." +"args` passed to the exception's constructor. (Contributed by Mark Shannon " +"in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:1966 @@ -4486,18 +4462,17 @@ msgstr "(由 Eddie Elizondo 於 :gh:`84436` 中貢獻。)" #: ../../whatsnew/3.12.rst:1990 msgid "" -":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function " -"and :c:type:`PyInterpreterConfig`, which may be used to create sub-" -"interpreters with their own GILs. (See :ref:`whatsnew312-pep684` for more " -"info.) (Contributed by Eric Snow in :gh:`104110`.)" +":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function and :" +"c:type:`PyInterpreterConfig`, which may be used to create sub-interpreters " +"with their own GILs. (See :ref:`whatsnew312-pep684` for more info.) " +"(Contributed by Eric Snow in :gh:`104110`.)" msgstr "" #: ../../whatsnew/3.12.rst:1996 msgid "" -"In the limited C API version 3.12, :c:func:`Py_INCREF` " -"and :c:func:`Py_DECREF` functions are now implemented as opaque function " -"calls to hide implementation details. (Contributed by Victor Stinner " -"in :gh:`105387`.)" +"In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:" +"`Py_DECREF` functions are now implemented as opaque function calls to hide " +"implementation details. (Contributed by Victor Stinner in :gh:`105387`.)" msgstr "" #: ../../whatsnew/3.12.rst:2004 @@ -4532,9 +4507,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:2023 msgid "" -"To get a list of subclasses, call the Python " -"method :py:meth:`~type.__subclasses__` (using :c:func:`PyObject_CallMethod`, " -"for example)." +"To get a list of subclasses, call the Python method :py:meth:`~type." +"__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." msgstr "" #: ../../whatsnew/3.12.rst:2027 @@ -4542,38 +4516,37 @@ msgid "" "Add support of more formatting options (left aligning, octals, uppercase " "hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C " "strings, variable width and precision) in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka " -"in :gh:`98836`.)" +"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka in :gh:" +"`98836`.)" msgstr "" #: ../../whatsnew/3.12.rst:2033 msgid "" -"An unrecognized format character in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In " -"previous versions it caused all the rest of the format string to be copied " -"as-is to the result string, and any extra arguments discarded. (Contributed " -"by Serhiy Storchaka in :gh:`95781`.)" +"An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:" +"func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous " +"versions it caused all the rest of the format string to be copied as-is to " +"the result string, and any extra arguments discarded. (Contributed by Serhiy " +"Storchaka in :gh:`95781`.)" msgstr "" #: ../../whatsnew/3.12.rst:2039 msgid "" -"Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Philip Georgi " -"in :gh:`95504`.)" +"Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` and :c:func:" +"`PyUnicode_FromFormatV`. (Contributed by Philip Georgi in :gh:`95504`.)" msgstr "" #: ../../whatsnew/3.12.rst:2043 msgid "" "Extension classes wanting to add a :attr:`~object.__dict__` or weak " -"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` " -"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " +"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " "``tp_weaklistoffset``, respectively. The use of ``tp_dictoffset`` and " "``tp_weaklistoffset`` is still supported, but does not fully support " "multiple inheritance (:gh:`95589`), and performance may be worse. Classes " "declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` must call :c:func:`!" "_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict` to " -"traverse and clear their instance's dictionaries. To clear weakrefs, " -"call :c:func:`PyObject_ClearWeakRefs`, as before." +"traverse and clear their instance's dictionaries. To clear weakrefs, call :c:" +"func:`PyObject_ClearWeakRefs`, as before." msgstr "" #: ../../whatsnew/3.12.rst:2055 @@ -4594,10 +4567,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:2065 msgid "" -"The interpreter's error indicator is now always normalized. This means " -"that :c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other " -"functions that set the error indicator now normalize the exception before " -"storing it. (Contributed by Mark Shannon in :gh:`101578`.)" +"The interpreter's error indicator is now always normalized. This means that :" +"c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other functions " +"that set the error indicator now normalize the exception before storing it. " +"(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:2070 @@ -4637,8 +4610,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:2087 msgid "" "Note that :c:func:`PyType_FromMetaclass` (added in Python 3.12) already " -"disallows creating classes whose metaclass overrides ``tp_new`` " -"(:meth:`~object.__new__` in Python)." +"disallows creating classes whose metaclass overrides ``tp_new`` (:meth:" +"`~object.__new__` in Python)." msgstr "" #: ../../whatsnew/3.12.rst:2091 @@ -4656,16 +4629,16 @@ msgstr "" #: ../../whatsnew/3.12.rst:2100 msgid "" -"If initialization can be skipped, it can be done " -"in :c:member:`~PyTypeObject.tp_init` instead." +"If initialization can be skipped, it can be done in :c:member:`~PyTypeObject." +"tp_init` instead." msgstr "" #: ../../whatsnew/3.12.rst:2102 msgid "" "If the metaclass doesn't need to be instantiated from Python, set its " -"``tp_new`` to ``NULL`` using " -"the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag. This makes it " -"acceptable for ``PyType_From*`` functions." +"``tp_new`` to ``NULL`` using the :c:macro:" +"`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag. This makes it acceptable for " +"``PyType_From*`` functions." msgstr "" #: ../../whatsnew/3.12.rst:2107 @@ -4701,10 +4674,10 @@ msgid "" ":c:struct:`PyLongObject` has had its internals changed for better " "performance. Although the internals of :c:struct:`PyLongObject` are private, " "they are used by some extension modules. The internal fields should no " -"longer be accessed directly, instead the API functions beginning " -"``PyLong_...`` should be used instead. Two new *unstable* API functions are " -"provided for efficient access to the value of :c:struct:`PyLongObject`\\s " -"which fit into a single machine word:" +"longer be accessed directly, instead the API functions beginning ``PyLong_..." +"`` should be used instead. Two new *unstable* API functions are provided for " +"efficient access to the value of :c:struct:`PyLongObject`\\s which fit into " +"a single machine word:" msgstr "" #: ../../whatsnew/3.12.rst:2131 @@ -4726,11 +4699,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:2144 msgid "" -"In accordance with :pep:`699`, the ``ma_version_tag`` field " -"in :c:type:`PyDictObject` is deprecated for extension modules. Accessing " -"this field will generate a compiler warning at compile time. This field will " -"be removed in Python 3.14. (Contributed by Ramvikrams and Kumar Aditya " -"in :gh:`101193`. PEP by Ken Jin.)" +"In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:" +"`PyDictObject` is deprecated for extension modules. Accessing this field " +"will generate a compiler warning at compile time. This field will be removed " +"in Python 3.14. (Contributed by Ramvikrams and Kumar Aditya in :gh:`101193`. " +"PEP by Ken Jin.)" msgstr "" #: ../../whatsnew/3.12.rst:2149 @@ -4780,8 +4753,8 @@ msgstr "" msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`" msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`: 請改" -"用 :c:member:`PyConfig.use_environment`" +":c:var:`Py_IgnoreEnvironmentFlag`: 請改用 :c:member:`PyConfig." +"use_environment`" #: ../../whatsnew/3.12.rst:2161 msgid "" @@ -4793,8 +4766,8 @@ msgstr "" msgid "" ":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`" msgstr "" -":c:var:`Py_NoUserSiteDirectory`: 請改" -"用 :c:member:`PyConfig.user_site_directory`" +":c:var:`Py_NoUserSiteDirectory`: 請改用 :c:member:`PyConfig." +"user_site_directory`" #: ../../whatsnew/3.12.rst:2163 msgid "" @@ -4816,57 +4789,56 @@ msgstr ":c:var:`Py_IsolatedFlag`: 請改用 :c:member:`PyConfig.isolated`" #: ../../whatsnew/3.12.rst:2167 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"use :c:member:`PyPreConfig.legacy_windows_fs_encoding`" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`" msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`" #: ../../whatsnew/3.12.rst:2168 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"use :c:member:`PyConfig.legacy_windows_stdio`" +":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." +"legacy_windows_stdio`" msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`: 請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`" +":c:var:`Py_LegacyWindowsStdioFlag`: 請改用 :c:member:`PyConfig." +"legacy_windows_stdio`" #: ../../whatsnew/3.12.rst:2169 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: " -"use :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." +"filesystem_encoding`" msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`: 請改" -"用 :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_FileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." +"filesystem_encoding`" #: ../../whatsnew/3.12.rst:2170 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: " -"use :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." +"filesystem_encoding`" msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改" -"用 :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." +"filesystem_encoding`" #: ../../whatsnew/3.12.rst:2171 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"use :c:member:`PyConfig.filesystem_errors`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." +"filesystem_errors`" msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改" -"用 :c:member:`PyConfig.filesystem_errors`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改用 :c:member:`PyConfig." +"filesystem_errors`" #: ../../whatsnew/3.12.rst:2172 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:" +"`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參見 :c:" +"func:`Py_PreInitialize`)" #: ../../whatsnew/3.12.rst:2174 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead. (Contributed by Victor Stinner " -"in :gh:`77782`.)" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.)" msgstr "" ":c:func:`Py_InitializeFromConfig` API 應改為與 :c:type:`PyConfig` 一起使用。" "(由 Victor Stinner 於 :gh:`77782` 中貢獻。)" @@ -4891,11 +4863,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:2187 msgid "" -":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` " -"and :c:func:`PyMember_SetOne`" +":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` and :c:func:" +"`PyMember_SetOne`" msgstr "" -":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` " -"和 :c:func:`PyMember_SetOne`" +":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` 和 :c:func:" +"`PyMember_SetOne`" #: ../../whatsnew/3.12.rst:2189 msgid "" @@ -4905,11 +4877,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:2191 msgid "" -"The flags :c:macro:`Py_READONLY` (previously ``READONLY``) " -"and :c:macro:`Py_AUDIT_READ` (previously all uppercase)" +"The flags :c:macro:`Py_READONLY` (previously ``READONLY``) and :c:macro:" +"`Py_AUDIT_READ` (previously all uppercase)" msgstr "" -":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)" -"和 :c:macro:`Py_AUDIT_READ`\\ (先前全大寫)旗標" +":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)和 :c:macro:" +"`Py_AUDIT_READ`\\ (先前全大寫)旗標" #: ../../whatsnew/3.12.rst:2194 msgid "Several items are not exposed from :file:`Python.h`:" @@ -4929,17 +4901,16 @@ msgstr "不做任何事的巨集 ``WRITE_RESTRICTED``。" #: ../../whatsnew/3.12.rst:2199 msgid "" -"The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents " -"of :c:macro:`Py_AUDIT_READ`." +"The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of :c:macro:" +"`Py_AUDIT_READ`." msgstr "" -"``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當" -"於 :c:macro:`Py_AUDIT_READ`。" +"``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當於 :c:macro:" +"`Py_AUDIT_READ`。" #: ../../whatsnew/3.12.rst:2201 msgid "" -"In some configurations, ```` is not included " -"from :file:`Python.h`. It should be included manually when using " -"``offsetof()``." +"In some configurations, ```` is not included from :file:`Python." +"h`. It should be included manually when using ``offsetof()``." msgstr "" #: ../../whatsnew/3.12.rst:2204 @@ -4957,10 +4928,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:2212 msgid "" -":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. " -"Use :c:func:`PyErr_GetRaisedException` " -"and :c:func:`PyErr_SetRaisedException` instead. (Contributed by Mark Shannon " -"in :gh:`101578`.)" +":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. Use :c:" +"func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` " +"instead. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:2217 @@ -4981,30 +4951,29 @@ msgstr "" #: ../../whatsnew/3.12.rst:2223 msgid "" -"Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` " -"or :c:func:`PyType_FromModuleAndSpec` to create a class whose metaclass " -"overrides :c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass " -"instead." +"Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` or :c:" +"func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" +"c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass instead." msgstr "" -"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` " -"或 :c:func:`PyType_FromModuleAndSpec` 建立一個其元類別覆" -"寫 :c:member:`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" +"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` 或 :c:" +"func:`PyType_FromModuleAndSpec` 建立一個其元類別覆寫 :c:member:" +"`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " -"(:pep:`699`;:gh:`101193`)。" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" +"`699`;:gh:`101193`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" "Creating :c:data:`immutable types ` with mutable " "bases (:gh:`95388`)." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 ` " -"(:gh:`95388`)。" +"使用可變基底建立\\ :c:data:`不可變型別 ` (:gh:" +"`95388`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 msgid "" @@ -5034,8 +5003,8 @@ msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" @@ -5092,24 +5061,24 @@ msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment`。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." +"use_environment`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode`。" +":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." +"write_bytecode`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: " -"Use :c:member:`PyConfig.user_site_directory` instead." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory`。" +":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." +"user_site_directory`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" @@ -5132,51 +5101,51 @@ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"Use :c:member:`PyConfig.legacy_windows_stdio` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." +"legacy_windows_stdio`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` instead." +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` instead." +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"Use :c:member:`PyConfig.filesystem_errors` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors`。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." +"filesystem_errors`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +"c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" +"func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "The bundled copy of ``libmpdecimal``." @@ -5184,27 +5153,27 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: " -"Use :c:func:`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改" -"用 :c:func:`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" +"`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -"Use :c:func:`PyWeakref_GetRef` instead." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -"用 :c:func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " -"Use :c:type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" -"用 :c:type:`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" @@ -5215,16 +5184,16 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " -"和 :data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" +"data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid "" -":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " -"and :data:`sys.exec_prefix` instead." +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." msgstr "" -":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " -"與 :data:`sys.exec_prefix`。" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." @@ -5235,8 +5204,8 @@ msgid "" ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " "instead." msgstr "" -":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " -"與 :data:`sys.prefix`。" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." @@ -5248,11 +5217,11 @@ msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or " -"the :envvar:`PYTHONHOME` environment variable instead." +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" +"`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " -"或 :envvar:`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" +"`PYTHONHOME` 環境變數。" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -5273,8 +5242,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改" -"用 :c:func:`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改用 :c:func:" +"`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -5294,11 +5263,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " -"and :c:func:`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " -"和 :c:func:`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" +"`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" @@ -5344,8 +5313,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" -"叫 :c:func:`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" +"`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." @@ -5391,9 +5360,9 @@ msgid "" "C API. The :file:`token.h` header file was only designed to be used by " "Python internals. (Contributed by Victor Stinner in :gh:`92651`.)" msgstr "" -"移除 :file:`token.h` 標頭檔案。從未有任何公開的 tokenizer C " -"API。:file:`token.h` 標頭檔案的設計是僅限用於 Python 內部。(由 Victor " -"Stinner 於 :gh:`92651` 中貢獻。)" +"移除 :file:`token.h` 標頭檔案。從未有任何公開的 tokenizer C API。:file:" +"`token.h` 標頭檔案的設計是僅限用於 Python 內部。(由 Victor Stinner 於 :gh:" +"`92651` 中貢獻。)" #: ../../whatsnew/3.12.rst:2244 msgid "Legacy Unicode APIs have been removed. See :pep:`623` for detail." @@ -5440,8 +5409,8 @@ msgid "" "Remove the ``PyUnicode_InternImmortal()`` function macro. (Contributed by " "Victor Stinner in :gh:`85858`.)" msgstr "" -"移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner " -"於 :gh:`85858` 中貢獻。)" +"移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner 於 :gh:" +"`85858` 中貢獻。)" #~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" #~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index 00b971f26a..9fc480f716 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-07 00:15+0000\n" +"POT-Creation-Date: 2025-05-11 14:57+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-" @@ -3008,7 +3008,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:2005 -#: ../../deprecations/pending-removal-in-3.15.rst:93 +#: ../../deprecations/pending-removal-in-3.15.rst:100 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" @@ -3408,6 +3408,15 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:95 +msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " "it has yet to be supported by any major type checker." @@ -3416,7 +3425,7 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:95 +#: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" From 58b250140f2a9158e48522ac0c9ace989a28be23 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 13 May 2025 00:16:59 +0000 Subject: [PATCH 02/14] sync with cpython 50b45c4f --- library/math.po | 264 +++++++------- library/unittest.mock.po | 736 +++++++++++++++++++------------------- library/urllib.request.po | 484 +++++++++++++------------ 3 files changed, 740 insertions(+), 744 deletions(-) diff --git a/library/math.po b/library/math.po index 1c6cb27a07..5c395482ea 100644 --- a/library/math.po +++ b/library/math.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-19 00:14+0000\n" +"POT-Creation-Date: 2025-05-13 00:15+0000\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -620,7 +620,7 @@ msgstr "" "因為此值等同於 ``(1 + x)ⁿ`` 進行多項式展開後第 k 項的係數,所以又稱為二項式係" "數。" -#: ../../library/math.rst:139 ../../library/math.rst:205 +#: ../../library/math.rst:139 ../../library/math.rst:204 msgid "" "Raises :exc:`TypeError` if either of the arguments are not integers. Raises :" "exc:`ValueError` if either of the arguments are negative." @@ -629,17 +629,14 @@ msgstr "" "`ValueError`。" #: ../../library/math.rst:147 -msgid "" -"Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is not " -"integral or is negative." +msgid "Return factorial of the nonnegative integer *n*." msgstr "" -"以整數回傳 *n* 的階乘。若 *n* 非整數型別或其值為負會引發 :exc:`ValueError`。" -#: ../../library/math.rst:150 +#: ../../library/math.rst:149 msgid "Floats with integral values (like ``5.0``) are no longer accepted." msgstr "其值為整數的浮點數(如:``5.0``)已不再被接受。" -#: ../../library/math.rst:156 +#: ../../library/math.rst:155 msgid "" "Return the greatest common divisor of the specified integer arguments. If " "any of the arguments is nonzero, then the returned value is the largest " @@ -651,13 +648,13 @@ msgstr "" "最大的正整數。若所有引數皆為零,則回傳值為 ``0``。``gcd()`` 若未傳入任何引數" "也將回傳 ``0``。" -#: ../../library/math.rst:164 +#: ../../library/math.rst:163 msgid "" "Added support for an arbitrary number of arguments. Formerly, only two " "arguments were supported." msgstr "新增支援任意數量的引數。先前僅支援兩個引數。" -#: ../../library/math.rst:171 +#: ../../library/math.rst:170 msgid "" "Return the integer square root of the nonnegative integer *n*. This is the " "floor of the exact square root of *n*, or equivalently the greatest integer " @@ -666,7 +663,7 @@ msgstr "" "回傳非負整數 *n* 的整數平方根。此值為 *n* 精確平方根經下取整的值,亦等同於滿" "足 *a*\\ ² |nbsp| ≤ |nbsp| *n* 的最大整數值 *a*。" -#: ../../library/math.rst:175 +#: ../../library/math.rst:174 msgid "" "For some applications, it may be more convenient to have the least integer " "*a* such that *n* |nbsp| ≤ |nbsp| *a*\\ ², or in other words the ceiling of " @@ -677,7 +674,7 @@ msgstr "" "者說 *n* 精確平方根經上取整的值 ── 會更加方便。對正數 *n*,此值可使用 ``a = " "1 + isqrt(n - 1)`` 計算。" -#: ../../library/math.rst:185 +#: ../../library/math.rst:184 msgid "" "Return the least common multiple of the specified integer arguments. If all " "arguments are nonzero, then the returned value is the smallest positive " @@ -689,29 +686,29 @@ msgstr "" "最小的正整數。若存在任一引數值為零,則回傳值為 ``0``。``lcm()`` 若未傳入任何" "引數將回傳 ``1``。" -#: ../../library/math.rst:196 +#: ../../library/math.rst:195 msgid "" "Return the number of ways to choose *k* items from *n* items without " "repetition and with order." msgstr "" -#: ../../library/math.rst:199 +#: ../../library/math.rst:198 msgid "" "Evaluates to ``n! / (n - k)!`` when ``k <= n`` and evaluates to zero when " "``k > n``." msgstr "" -#: ../../library/math.rst:202 +#: ../../library/math.rst:201 msgid "" "If *k* is not specified or is ``None``, then *k* defaults to *n* and the " "function returns ``n!``." msgstr "" -#: ../../library/math.rst:212 +#: ../../library/math.rst:211 msgid "Floating point arithmetic" msgstr "" -#: ../../library/math.rst:216 +#: ../../library/math.rst:215 msgid "" "Return the ceiling of *x*, the smallest integer greater than or equal to " "*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ `,並回傳 :class:`~numbers." "Integral` 型別的值。" -#: ../../library/math.rst:223 +#: ../../library/math.rst:222 msgid "Return the absolute value of *x*." msgstr "回傳 *x* 的絕對值。" -#: ../../library/math.rst:228 +#: ../../library/math.rst:227 msgid "" "Return the floor of *x*, the largest integer less than or equal to *x*. If " "*x* is not a float, delegates to :meth:`x.__floor__ `, " @@ -735,7 +732,7 @@ msgstr "" "將委派給 :meth:`x.__floor__ `,並回傳 :class:`~numbers." "Integral` 型別的值。" -#: ../../library/math.rst:235 +#: ../../library/math.rst:234 msgid "" "Fused multiply-add operation. Return ``(x * y) + z``, computed as though " "with infinite precision and range followed by a single round to the " @@ -743,7 +740,7 @@ msgid "" "direct expression ``(x * y) + z``." msgstr "" -#: ../../library/math.rst:240 +#: ../../library/math.rst:239 msgid "" "This function follows the specification of the fusedMultiplyAdd operation " "described in the IEEE 754 standard. The standard leaves one case " @@ -752,7 +749,7 @@ msgid "" "not raise any exception." msgstr "" -#: ../../library/math.rst:251 +#: ../../library/math.rst:250 msgid "" "Return the floating-point remainder of ``x / y``, as defined by the platform " "C library function ``fmod(x, y)``. Note that the Python expression ``x % y`` " @@ -777,13 +774,13 @@ msgstr "" "``1e100``。因此,處理浮點數時通常會選擇函式 :func:`fmod`,而處理整數時會選擇 " "Python 運算式 ``x % y``。" -#: ../../library/math.rst:267 +#: ../../library/math.rst:266 msgid "" "Return the fractional and integer parts of *x*. Both results carry the sign " "of *x* and are floats." msgstr "" -#: ../../library/math.rst:270 +#: ../../library/math.rst:269 msgid "" "Note that :func:`modf` has a different call/return pattern than its C " "equivalents: it takes a single argument and return a pair of values, rather " @@ -791,7 +788,7 @@ msgid "" "is no such thing in Python)." msgstr "" -#: ../../library/math.rst:278 +#: ../../library/math.rst:277 msgid "" "Return the IEEE 754-style remainder of *x* with respect to *y*. For finite " "*x* and finite nonzero *y*, this is the difference ``x - n*y``, where ``n`` " @@ -801,7 +798,7 @@ msgid "" "thus always satisfies ``abs(r) <= 0.5 * abs(y)``." msgstr "" -#: ../../library/math.rst:285 +#: ../../library/math.rst:284 msgid "" "Special cases follow IEEE 754: in particular, ``remainder(x, math.inf)`` is " "*x* for any finite *x*, and ``remainder(x, 0)`` and ``remainder(math.inf, " @@ -809,13 +806,13 @@ msgid "" "remainder operation is zero, that zero will have the same sign as *x*." msgstr "" -#: ../../library/math.rst:291 +#: ../../library/math.rst:290 msgid "" "On platforms using IEEE 754 binary floating point, the result of this " "operation is always exactly representable: no rounding error is introduced." msgstr "" -#: ../../library/math.rst:299 +#: ../../library/math.rst:298 msgid "" "Return *x* with the fractional part removed, leaving the integer part. This " "rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " @@ -824,7 +821,7 @@ msgid "" "class:`~numbers.Integral` value." msgstr "" -#: ../../library/math.rst:306 +#: ../../library/math.rst:305 msgid "" "For the :func:`ceil`, :func:`floor`, and :func:`modf` functions, note that " "*all* floating-point numbers of sufficiently large magnitude are exact " @@ -833,11 +830,11 @@ msgid "" "``abs(x) >= 2**52`` necessarily has no fractional bits." msgstr "" -#: ../../library/math.rst:314 +#: ../../library/math.rst:313 msgid "Floating point manipulation functions" msgstr "" -#: ../../library/math.rst:318 +#: ../../library/math.rst:317 msgid "" "Return a float with the magnitude (absolute value) of *x* but the sign of " "*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)`` " @@ -846,7 +843,7 @@ msgstr "" "回傳與 *x* 相同長度(絕對值)且與 *y* 同號的浮點數。在支援帶符號零的平臺上," "``copysign(1.0, -0.0)`` 回傳 *-1.0*。" -#: ../../library/math.rst:325 +#: ../../library/math.rst:324 msgid "" "Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a " "float and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is " @@ -857,7 +854,7 @@ msgstr "" "數,且兩者精確地使 ``x == m * 2**e``。若 *x* 為零,回傳 ``(0.0, 0)``,否則令 " "``0.5 <= abs(m) < 1``。此函式用於以可攜的方式「分割」浮點數內部表示法。" -#: ../../library/math.rst:330 +#: ../../library/math.rst:329 msgid "" "Note that :func:`frexp` has a different call/return pattern than its C " "equivalents: it takes a single argument and return a pair of values, rather " @@ -865,13 +862,13 @@ msgid "" "is no such thing in Python)." msgstr "" -#: ../../library/math.rst:337 +#: ../../library/math.rst:336 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "若 *a* 及 *b* 兩值足夠接近便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:340 +#: ../../library/math.rst:339 msgid "" "Whether or not two values are considered close is determined according to " "given absolute and relative tolerances. If no errors occur, the result will " @@ -880,7 +877,7 @@ msgstr "" "兩數是否足夠接近取決於給定的絕對及相對容許偏差 (tolerance)。如果沒有錯誤發" "生,結果將為:``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``。" -#: ../../library/math.rst:344 +#: ../../library/math.rst:343 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " @@ -894,7 +891,7 @@ msgstr "" "設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須不為負" "且小於 ``1.0``。" -#: ../../library/math.rst:351 +#: ../../library/math.rst:350 msgid "" "*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " "nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " @@ -903,7 +900,7 @@ msgid "" "argument to the call." msgstr "" -#: ../../library/math.rst:357 +#: ../../library/math.rst:356 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -914,11 +911,11 @@ msgstr "" "處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " "及 ``-inf`` 皆只與自身接近。" -#: ../../library/math.rst:366 +#: ../../library/math.rst:365 msgid ":pep:`485` -- A function for testing approximate equality" msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/math.rst:371 +#: ../../library/math.rst:370 msgid "" "Return ``True`` if *x* is neither an infinity nor a NaN, and ``False`` " "otherwise. (Note that ``0.0`` *is* considered finite.)" @@ -926,128 +923,128 @@ msgstr "" "若 *x* 不是無限值或 ``NaN`` 便回傳 ``True``,否則回傳 ``False``。(注意 " "``0.0`` 被視為有限數。)" -#: ../../library/math.rst:379 +#: ../../library/math.rst:378 msgid "" "Return ``True`` if *x* is a positive or negative infinity, and ``False`` " "otherwise." msgstr "若 *x* 是正無限值或負無限值便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:385 +#: ../../library/math.rst:384 msgid "" "Return ``True`` if *x* is a NaN (not a number), and ``False`` otherwise." msgstr "" "若 *x* 是 ``NaN`` ── 即非數字(NaN, not a number)── 便回傳 ``True``,否則回" "傳 ``False``。" -#: ../../library/math.rst:390 +#: ../../library/math.rst:389 msgid "" "Return ``x * (2**i)``. This is essentially the inverse of function :func:" "`frexp`." msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式。" -#: ../../library/math.rst:396 +#: ../../library/math.rst:395 msgid "Return the floating-point value *steps* steps after *x* towards *y*." msgstr "" -#: ../../library/math.rst:398 +#: ../../library/math.rst:397 msgid "If *x* is equal to *y*, return *y*, unless *steps* is zero." msgstr "" -#: ../../library/math.rst:400 +#: ../../library/math.rst:399 msgid "Examples:" msgstr "範例:" -#: ../../library/math.rst:402 +#: ../../library/math.rst:401 msgid "``math.nextafter(x, math.inf)`` goes up: towards positive infinity." msgstr "" -#: ../../library/math.rst:403 +#: ../../library/math.rst:402 msgid "``math.nextafter(x, -math.inf)`` goes down: towards minus infinity." msgstr "" -#: ../../library/math.rst:404 +#: ../../library/math.rst:403 msgid "``math.nextafter(x, 0.0)`` goes towards zero." msgstr "" -#: ../../library/math.rst:405 +#: ../../library/math.rst:404 msgid "``math.nextafter(x, math.copysign(math.inf, x))`` goes away from zero." msgstr "" -#: ../../library/math.rst:407 +#: ../../library/math.rst:406 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`。" -#: ../../library/math.rst:411 +#: ../../library/math.rst:410 msgid "Added the *steps* argument." msgstr "新增 *steps* 引數。" -#: ../../library/math.rst:417 +#: ../../library/math.rst:416 msgid "Return the value of the least significant bit of the float *x*:" msgstr "" -#: ../../library/math.rst:419 +#: ../../library/math.rst:418 msgid "If *x* is a NaN (not a number), return *x*." msgstr "" -#: ../../library/math.rst:420 +#: ../../library/math.rst:419 msgid "If *x* is negative, return ``ulp(-x)``." msgstr "若 *x* 為負值,回傳 ``ulp(-x)``。" -#: ../../library/math.rst:421 +#: ../../library/math.rst:420 msgid "If *x* is a positive infinity, return *x*." msgstr "若 *x* 為正無限值,回傳 *x*。" -#: ../../library/math.rst:422 +#: ../../library/math.rst:421 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " "representable float (smaller than the minimum positive *normalized* float, :" "data:`sys.float_info.min `)." msgstr "" -#: ../../library/math.rst:425 +#: ../../library/math.rst:424 msgid "" "If *x* is equal to the largest positive representable float, return the " "value of the least significant bit of *x*, such that the first float smaller " "than *x* is ``x - ulp(x)``." msgstr "" -#: ../../library/math.rst:428 +#: ../../library/math.rst:427 msgid "" "Otherwise (*x* is a positive finite number), return the value of the least " "significant bit of *x*, such that the first float bigger than *x* is ``x + " "ulp(x)``." msgstr "" -#: ../../library/math.rst:432 +#: ../../library/math.rst:431 msgid "ULP stands for \"Unit in the Last Place\"." msgstr "" -#: ../../library/math.rst:434 +#: ../../library/math.rst:433 msgid "" "See also :func:`math.nextafter` and :data:`sys.float_info.epsilon `." msgstr "" -#: ../../library/math.rst:441 +#: ../../library/math.rst:440 msgid "Power, exponential and logarithmic functions" msgstr "" -#: ../../library/math.rst:445 +#: ../../library/math.rst:444 msgid "Return the cube root of *x*." msgstr "" -#: ../../library/math.rst:452 +#: ../../library/math.rst:451 msgid "" "Return *e* raised to the power *x*, where *e* = 2.718281... is the base of " "natural logarithms. This is usually more accurate than ``math.e ** x`` or " "``pow(math.e, x)``." msgstr "" -#: ../../library/math.rst:459 +#: ../../library/math.rst:458 msgid "Return *2* raised to the power *x*." msgstr "" -#: ../../library/math.rst:466 +#: ../../library/math.rst:465 msgid "" "Return *e* raised to the power *x*, minus 1. Here *e* is the base of " "natural logarithms. For small floats *x*, the subtraction in ``exp(x) - 1`` " @@ -1056,41 +1053,41 @@ msgid "" "compute this quantity to full precision:" msgstr "" -#: ../../library/math.rst:483 +#: ../../library/math.rst:482 msgid "With one argument, return the natural logarithm of *x* (to base *e*)." msgstr "" -#: ../../library/math.rst:485 +#: ../../library/math.rst:484 msgid "" "With two arguments, return the logarithm of *x* to the given *base*, " "calculated as ``log(x)/log(base)``." msgstr "" -#: ../../library/math.rst:491 +#: ../../library/math.rst:490 msgid "" "Return the natural logarithm of *1+x* (base *e*). The result is calculated " "in a way which is accurate for *x* near zero." msgstr "" -#: ../../library/math.rst:497 +#: ../../library/math.rst:496 msgid "" "Return the base-2 logarithm of *x*. This is usually more accurate than " "``log(x, 2)``." msgstr "" -#: ../../library/math.rst:504 +#: ../../library/math.rst:503 msgid "" ":meth:`int.bit_length` returns the number of bits necessary to represent an " "integer in binary, excluding the sign and leading zeros." msgstr "" -#: ../../library/math.rst:510 +#: ../../library/math.rst:509 msgid "" "Return the base-10 logarithm of *x*. This is usually more accurate than " "``log(x, 10)``." msgstr "" -#: ../../library/math.rst:516 +#: ../../library/math.rst:515 msgid "" "Return *x* raised to the power *y*. Exceptional cases follow the IEEE 754 " "standard as far as possible. In particular, ``pow(1.0, x)`` and ``pow(x, " @@ -1099,44 +1096,44 @@ msgid "" "y)`` is undefined, and raises :exc:`ValueError`." msgstr "" -#: ../../library/math.rst:523 +#: ../../library/math.rst:522 msgid "" "Unlike the built-in ``**`` operator, :func:`math.pow` converts both its " "arguments to type :class:`float`. Use ``**`` or the built-in :func:`pow` " "function for computing exact integer powers." msgstr "" -#: ../../library/math.rst:527 +#: ../../library/math.rst:526 msgid "" "The special cases ``pow(0.0, -inf)`` and ``pow(-0.0, -inf)`` were changed to " "return ``inf`` instead of raising :exc:`ValueError`, for consistency with " "IEEE 754." msgstr "" -#: ../../library/math.rst:535 +#: ../../library/math.rst:534 msgid "Return the square root of *x*." msgstr "" -#: ../../library/math.rst:539 +#: ../../library/math.rst:538 msgid "Summation and product functions" msgstr "" -#: ../../library/math.rst:543 +#: ../../library/math.rst:542 msgid "" "Return the Euclidean distance between two points *p* and *q*, each given as " "a sequence (or iterable) of coordinates. The two points must have the same " "dimension." msgstr "" -#: ../../library/math.rst:547 ../../library/math.rst:608 +#: ../../library/math.rst:546 ../../library/math.rst:607 msgid "Roughly equivalent to::" msgstr "" -#: ../../library/math.rst:549 +#: ../../library/math.rst:548 msgid "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" msgstr "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" -#: ../../library/math.rst:556 +#: ../../library/math.rst:555 msgid "" "Return an accurate floating-point sum of values in the iterable. Avoids " "loss of precision by tracking multiple intermediate partial sums." @@ -1144,7 +1141,7 @@ msgstr "" "回傳可疊代物件(iterable)中所有值的精確浮點數和。透過追蹤過程中多個部分和" "(partial sum)以避免精確度損失。" -#: ../../library/math.rst:559 +#: ../../library/math.rst:558 msgid "" "The algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the " "typical case where the rounding mode is half-even. On some non-Windows " @@ -1156,7 +1153,7 @@ msgstr "" "有些非 Windows 平台建置時,底層 C 函式庫使用延伸精度加法運算,而可能導致對過" "程中同一部分和重複捨入,並使其最低有效位不如預期。" -#: ../../library/math.rst:565 +#: ../../library/math.rst:564 msgid "" "For further discussion and two alternative approaches, see the `ASPN " "cookbook recipes for accurate floating-point summation `_。" -#: ../../library/math.rst:572 +#: ../../library/math.rst:571 msgid "" "Return the Euclidean norm, ``sqrt(sum(x**2 for x in coordinates))``. This is " "the length of the vector from the origin to the point given by the " "coordinates." msgstr "" -#: ../../library/math.rst:576 +#: ../../library/math.rst:575 msgid "" "For a two dimensional point ``(x, y)``, this is equivalent to computing the " "hypotenuse of a right triangle using the Pythagorean theorem, ``sqrt(x*x + " "y*y)``." msgstr "" -#: ../../library/math.rst:580 +#: ../../library/math.rst:579 msgid "" "Added support for n-dimensional points. Formerly, only the two dimensional " "case was supported." msgstr "" -#: ../../library/math.rst:584 +#: ../../library/math.rst:583 msgid "" "Improved the algorithm's accuracy so that the maximum error is under 1 ulp " "(unit in the last place). More typically, the result is almost always " "correctly rounded to within 1/2 ulp." msgstr "" -#: ../../library/math.rst:592 +#: ../../library/math.rst:591 msgid "" "Calculate the product of all the elements in the input *iterable*. The " "default *start* value for the product is ``1``." msgstr "" -#: ../../library/math.rst:595 +#: ../../library/math.rst:594 msgid "" "When the iterable is empty, return the start value. This function is " "intended specifically for use with numeric values and may reject non-numeric " "types." msgstr "" -#: ../../library/math.rst:604 +#: ../../library/math.rst:603 msgid "Return the sum of products of values from two iterables *p* and *q*." msgstr "" -#: ../../library/math.rst:606 +#: ../../library/math.rst:605 msgid "Raises :exc:`ValueError` if the inputs do not have the same length." msgstr "" -#: ../../library/math.rst:610 +#: ../../library/math.rst:609 msgid "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" -#: ../../library/math.rst:612 +#: ../../library/math.rst:611 msgid "" "For float and mixed int/float inputs, the intermediate products and sums are " "computed with extended precision." msgstr "" -#: ../../library/math.rst:619 +#: ../../library/math.rst:618 msgid "Angular conversion" msgstr "" -#: ../../library/math.rst:623 +#: ../../library/math.rst:622 msgid "Convert angle *x* from radians to degrees." msgstr "" -#: ../../library/math.rst:628 +#: ../../library/math.rst:627 msgid "Convert angle *x* from degrees to radians." msgstr "" -#: ../../library/math.rst:632 +#: ../../library/math.rst:631 msgid "Trigonometric functions" msgstr "" -#: ../../library/math.rst:636 +#: ../../library/math.rst:635 msgid "" "Return the arc cosine of *x*, in radians. The result is between ``0`` and " "``pi``." msgstr "" -#: ../../library/math.rst:642 +#: ../../library/math.rst:641 msgid "" "Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " "``pi/2``." msgstr "" -#: ../../library/math.rst:648 +#: ../../library/math.rst:647 msgid "" "Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " "and ``pi/2``." msgstr "" -#: ../../library/math.rst:654 +#: ../../library/math.rst:653 msgid "" "Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " "``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " @@ -1268,78 +1265,78 @@ msgid "" "``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." msgstr "" -#: ../../library/math.rst:664 +#: ../../library/math.rst:663 msgid "Return the cosine of *x* radians." msgstr "" -#: ../../library/math.rst:669 +#: ../../library/math.rst:668 msgid "Return the sine of *x* radians." msgstr "" -#: ../../library/math.rst:674 +#: ../../library/math.rst:673 msgid "Return the tangent of *x* radians." msgstr "" -#: ../../library/math.rst:678 +#: ../../library/math.rst:677 msgid "Hyperbolic functions" msgstr "" -#: ../../library/math.rst:680 +#: ../../library/math.rst:679 msgid "" "`Hyperbolic functions `_ " "are analogs of trigonometric functions that are based on hyperbolas instead " "of circles." msgstr "" -#: ../../library/math.rst:686 +#: ../../library/math.rst:685 msgid "Return the inverse hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:691 +#: ../../library/math.rst:690 msgid "Return the inverse hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:696 +#: ../../library/math.rst:695 msgid "Return the inverse hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:701 +#: ../../library/math.rst:700 msgid "Return the hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:706 +#: ../../library/math.rst:705 msgid "Return the hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:711 +#: ../../library/math.rst:710 msgid "Return the hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:715 +#: ../../library/math.rst:714 msgid "Special functions" msgstr "特殊函式" -#: ../../library/math.rst:719 +#: ../../library/math.rst:718 msgid "" "Return the `error function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:722 +#: ../../library/math.rst:721 msgid "" "The :func:`erf` function can be used to compute traditional statistical " "functions such as the `cumulative standard normal distribution `_::" msgstr "" -#: ../../library/math.rst:726 +#: ../../library/math.rst:725 msgid "" "def phi(x):\n" " 'Cumulative distribution function for the standard normal distribution'\n" " return (1.0 + erf(x / sqrt(2.0))) / 2.0" msgstr "" -#: ../../library/math.rst:735 +#: ../../library/math.rst:734 msgid "" "Return the complementary error function at *x*. The `complementary error " "function `_ is defined as " @@ -1348,31 +1345,31 @@ msgid "" "Loss_of_significance>`_\\." msgstr "" -#: ../../library/math.rst:746 +#: ../../library/math.rst:745 msgid "" "Return the `Gamma function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:754 +#: ../../library/math.rst:753 msgid "" "Return the natural logarithm of the absolute value of the Gamma function at " "*x*." msgstr "" -#: ../../library/math.rst:761 +#: ../../library/math.rst:760 msgid "Constants" msgstr "常數" -#: ../../library/math.rst:765 +#: ../../library/math.rst:764 msgid "The mathematical constant *π* = 3.141592..., to available precision." msgstr "" -#: ../../library/math.rst:770 +#: ../../library/math.rst:769 msgid "The mathematical constant *e* = 2.718281..., to available precision." msgstr "" -#: ../../library/math.rst:775 +#: ../../library/math.rst:774 msgid "" "The mathematical constant *τ* = 6.283185..., to available precision. Tau is " "a circle constant equal to 2\\ *π*, the ratio of a circle's circumference to " @@ -1381,13 +1378,13 @@ msgid "" "celebrating `Tau day `_ by eating twice as much pie!" msgstr "" -#: ../../library/math.rst:786 +#: ../../library/math.rst:785 msgid "" "A floating-point positive infinity. (For negative infinity, use ``-math." "inf``.) Equivalent to the output of ``float('inf')``." msgstr "" -#: ../../library/math.rst:794 +#: ../../library/math.rst:793 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to the output of " "``float('nan')``. Due to the requirements of the `IEEE-754 standard \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,15 +50,15 @@ msgstr "" #: ../../library/unittest.mock.rst:26 msgid "" "Additionally, mock provides a :func:`patch` decorator that handles patching " -"module and class level attributes within the scope of a test, along " -"with :const:`sentinel` for creating unique objects. See the `quick guide`_ " -"for some examples of how to use :class:`Mock`, :class:`MagicMock` " -"and :func:`patch`." +"module and class level attributes within the scope of a test, along with :" +"const:`sentinel` for creating unique objects. See the `quick guide`_ for " +"some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" +"`patch`." msgstr "" "此外,mock 還提供了一個 :func:`patch` 裝飾器,用於 patching 測試範圍內對 " -"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件" -"的 :const:`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` " -"和 :func:`patch` 的一些範例,請參閱\\ `快速導引 `_。" +"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件的 :const:" +"`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` 和 :func:" +"`patch` 的一些範例,請參閱\\ `快速導引 `_。" #: ../../library/unittest.mock.rst:32 msgid "" @@ -222,11 +222,11 @@ msgid "" "replacing, and any functions and methods (including constructors) have the " "same call signature as the real object." msgstr "" -"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用" -"\\ :ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch " -"的 *autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock " -"物件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函" -"式)都具有與真實物件相同的呼叫簽名(call signature)。" +"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用\\ :" +"ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch 的 " +"*autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock 物" +"件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函式)" +"都具有與真實物件相同的呼叫簽名(call signature)。" #: ../../library/unittest.mock.rst:177 msgid "" @@ -264,12 +264,12 @@ msgstr "" msgid "" ":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods " "pre-created and ready to use. There are also non-callable variants, useful " -"when you are mocking out objects that aren't " -"callable: :class:`NonCallableMock` and :class:`NonCallableMagicMock`" +"when you are mocking out objects that aren't callable: :class:" +"`NonCallableMock` and :class:`NonCallableMagicMock`" msgstr "" ":class:`MagicMock` 是 :class:`Mock` 的子類別,其中所有魔術方法均已預先建立並" -"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有" -"用::class:`NonCallableMock` 和 :class:`NonCallableMagicMock`" +"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有用::class:" +"`NonCallableMock` 和 :class:`NonCallableMagicMock`" #: ../../library/unittest.mock.rst:224 msgid "" @@ -279,8 +279,8 @@ msgid "" "class of :class:`Mock` using the *new_callable* argument to :func:`patch`." msgstr "" ":func:`patch` 裝飾器可以輕鬆地用 :class:`Mock` 物件臨時替換特定模組中的類別。" -"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使" -"用 :func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" +"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使用 :" +"func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" #: ../../library/unittest.mock.rst:232 msgid "" @@ -300,18 +300,18 @@ msgid "" msgstr "" "*spec*:這可以是字串的 list(串列),也可以是充當 mock 物件規格的現有物件(類" "別或實例)。如果傳入一個物件,則通過對該物件呼叫 dir 來形成字串的串列(不包括" -"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引" -"發 :exc:`AttributeError`。" +"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引發 :exc:" +"`AttributeError`。" #: ../../library/unittest.mock.rst:241 msgid "" -"If *spec* is an object (rather than a list of strings) " -"then :attr:`~object.__class__` returns the class of the spec object. This " -"allows mocks to pass :func:`isinstance` tests." +"If *spec* is an object (rather than a list of strings) then :attr:`~object." +"__class__` returns the class of the spec object. This allows mocks to pass :" +"func:`isinstance` tests." msgstr "" -"如果 *spec* 是一個物件(而不是一個字串的串列),那" -"麼 :attr:`~object.__class__` 會回傳 spec 物件的類別。這允許 mocks 通" -"過 :func:`isinstance` 測試。" +"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~object." +"__class__` 會回傳 spec 物件的類別。這允許 mocks 通過 :func:`isinstance` 測" +"試。" #: ../../library/unittest.mock.rst:245 msgid "" @@ -320,13 +320,13 @@ msgid "" "will raise an :exc:`AttributeError`." msgstr "" "*spec_set*:*spec* 的一個更嚴格的變體。如果使用 *spec_set*,在 mock 上嘗試 " -"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引" -"發 :exc:`AttributeError`。" +"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引發 :exc:" +"`AttributeError`。" #: ../../library/unittest.mock.rst:249 msgid "" -"*side_effect*: A function to be called whenever the Mock is called. See " -"the :attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " +"*side_effect*: A function to be called whenever the Mock is called. See the :" +"attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " "dynamically changing return values. The function is called with the same " "arguments as the mock, and unless it returns :data:`DEFAULT`, the return " "value of this function is used as the return value." @@ -367,8 +367,8 @@ msgstr "" #: ../../library/unittest.mock.rst:267 msgid "" "*unsafe*: By default, accessing any attribute whose name starts with " -"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise " -"an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to these " +"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise an :exc:" +"`AttributeError`. Passing ``unsafe=True`` will allow access to these " "attributes." msgstr "" "*unsafe*:預設情況下,存取任何以 *assert*、*assret*、*asert*、*aseert* 或 " @@ -381,13 +381,13 @@ msgid "" "calling the Mock will pass the call through to the wrapped object (returning " "the real result). Attribute access on the mock will return a Mock object " "that wraps the corresponding attribute of the wrapped object (so attempting " -"to access an attribute that doesn't exist will raise " -"an :exc:`AttributeError`)." +"to access an attribute that doesn't exist will raise an :exc:" +"`AttributeError`)." msgstr "" "*wraps*:被 mock 物件包裝的項目。如果 *wraps* 不是 ``None``,那麼呼叫 Mock 將" "通過被包裝的物件(回傳真實結果)。存取 mock 的屬性將會回傳一個 Mock 物件,該" -"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引" -"發 :exc:`AttributeError`\\ )。" +"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引發 :exc:" +"`AttributeError`\\ )。" #: ../../library/unittest.mock.rst:281 msgid "" @@ -408,8 +408,8 @@ msgstr "" #: ../../library/unittest.mock.rst:288 msgid "" "Mocks can also be called with arbitrary keyword arguments. These will be " -"used to set attributes on the mock after it is created. See " -"the :meth:`configure_mock` method for details." +"used to set attributes on the mock after it is created. See the :meth:" +"`configure_mock` method for details." msgstr "" "Mocks 還可以使用任意的關鍵字引數進行呼叫。這些關鍵字引數將在建立 mock 之後用" "於設定 mock 的屬性。欲知更多,請參見 :meth:`configure_mock` 方法。" @@ -440,19 +440,19 @@ msgstr "斷言 mock 已經被使用指定的引數呼叫。" #: ../../library/unittest.mock.rst:351 msgid "" -"The assert passes if the mock has *ever* been called, " -"unlike :meth:`assert_called_with` and :meth:`assert_called_once_with` that " -"only pass if the call is the most recent one, and in the case " -"of :meth:`assert_called_once_with` it must also be the only call." +"The assert passes if the mock has *ever* been called, unlike :meth:" +"`assert_called_with` and :meth:`assert_called_once_with` that only pass if " +"the call is the most recent one, and in the case of :meth:" +"`assert_called_once_with` it must also be the only call." msgstr "" -"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` " -"和 :meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對" -"於 :meth:`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" +"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` 和 :" +"meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對於 :meth:" +"`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" #: ../../library/unittest.mock.rst:364 msgid "" -"assert the mock has been called with the specified calls. " -"The :attr:`mock_calls` list is checked for the calls." +"assert the mock has been called with the specified calls. The :attr:" +"`mock_calls` list is checked for the calls." msgstr "" "斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列" "中的呼叫。" @@ -553,9 +553,9 @@ msgstr "" #: ../../library/unittest.mock.rst:441 msgid "" -"Note that :meth:`reset_mock` *doesn't* clear " -"the :attr:`return_value`, :attr:`side_effect` or any child attributes you " -"have set using normal assignment by default." +"Note that :meth:`reset_mock` *doesn't* clear the :attr:`return_value`, :attr:" +"`side_effect` or any child attributes you have set using normal assignment " +"by default." msgstr "" #: ../../library/unittest.mock.rst:445 @@ -581,8 +581,8 @@ msgstr "如果 *spec_set* 為 true,那麼只能設定在規格中的屬性。" #: ../../library/unittest.mock.rst:461 msgid "" "Attach a mock as an attribute of this one, replacing its name and parent. " -"Calls to the attached mock will be recorded in the :attr:`method_calls` " -"and :attr:`mock_calls` attributes of this one." +"Calls to the attached mock will be recorded in the :attr:`method_calls` and :" +"attr:`mock_calls` attributes of this one." msgstr "" "將一個 mock 作為這個 Mock 的屬性附加,取代它的名稱和上代 (parent)。對附加的 " "mock 的呼叫將被記錄在這個 Mock 的 :attr:`method_calls` 和 :attr:`mock_calls` " @@ -679,17 +679,17 @@ msgid "" "returns :data:`DEFAULT` then the mock will return its normal value (from " "the :attr:`return_value`)." msgstr "" -"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回" -"傳 :data:`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何" -"值。如果函式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值" -"(從 :attr:`return_value` 得到)。" +"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回傳 :data:" +"`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何值。如果函" +"式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值(從 :attr:" +"`return_value` 得到)。" #: ../../library/unittest.mock.rst:583 msgid "" "If you pass in an iterable, it is used to retrieve an iterator which must " "yield a value on every call. This value can either be an exception instance " -"to be raised, or a value to be returned from the call to the mock " -"(:data:`DEFAULT` handling is identical to the function case)." +"to be raised, or a value to be returned from the call to the mock (:data:" +"`DEFAULT` handling is identical to the function case)." msgstr "" "如果你傳遞一個可疊代物件,它將被用於檢索一個疊代器,該疊代器必須在每次呼叫時" "產出 (yield) 一個值。這個值可以是要引發的例外實例,或者是對 mock 呼叫時要回傳" @@ -737,15 +737,14 @@ msgstr "" #: ../../library/unittest.mock.rst:672 msgid "" -":attr:`call_args`, along with members of the " -"lists :attr:`call_args_list`, :attr:`method_calls` and :attr:`mock_calls` " -"are :data:`call` objects. These are tuples, so they can be unpacked to get " -"at the individual arguments and make more complex assertions. " -"See :ref:`calls as tuples `." +":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" +"attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " +"are tuples, so they can be unpacked to get at the individual arguments and " +"make more complex assertions. See :ref:`calls as tuples `." msgstr "" -":attr:`call_args`,以及串列 :attr:`call_args_list`、:attr:`method_calls` " -"和 :attr:`mock_calls` 的成員都是 :data:`call` 物件。這些都是元組,因此可以解" -"包以取得各個引數並進行更複雜的斷言。參見 :ref:`calls as tuples `。" #: ../../library/unittest.mock.rst:678 @@ -757,8 +756,8 @@ msgid "" "This is a list of all the calls made to the mock object in sequence (so the " "length of the list is the number of times it has been called). Before any " "calls have been made it is an empty list. The :data:`call` object can be " -"used for conveniently constructing lists of calls to compare " -"with :attr:`call_args_list`." +"used for conveniently constructing lists of calls to compare with :attr:" +"`call_args_list`." msgstr "" "這是按順序列出所有呼叫 mock 物件的串列(因此串列的長度表示它被呼叫的次數)。" "在任何呼叫發生之前,它會是一個空的串列。 :data:`call` 物件可用於方便地建構呼" @@ -829,8 +828,8 @@ msgstr "" #: ../../library/unittest.mock.rst:772 msgid "" -":attr:`!__class__` is assignable to, this allows a mock to pass " -"an :func:`isinstance` check without forcing you to use a spec:" +":attr:`!__class__` is assignable to, this allows a mock to pass an :func:" +"`isinstance` check without forcing you to use a spec:" msgstr "" ":attr:`!__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不" "需要強制使用 spec:" @@ -849,13 +848,13 @@ msgid "" "Mock objects that use a class or an instance as a :attr:`!spec` or :attr:`!" "spec_set` are able to pass :func:`isinstance` tests:" msgstr "" -"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通" -"過 :func:`isinstance` 測試:" +"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通過 :" +"func:`isinstance` 測試:" #: ../../library/unittest.mock.rst:796 msgid "" -"The :class:`Mock` classes have support for mocking magic methods. " -"See :ref:`magic methods ` for the full details." +"The :class:`Mock` classes have support for mocking magic methods. See :ref:" +"`magic methods ` for the full details." msgstr "" ":class:`Mock` 類別支援 mock 魔術方法。細節請參考\\ :ref:`魔術方法 `。" @@ -867,9 +866,9 @@ msgid "" "are passed to the constructor of the mock being created. The keyword " "arguments are for configuring attributes of the mock:" msgstr "" -"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對" -"於 :func:`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵" -"字引數用於配置 mock 的屬性:" +"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對於 :func:" +"`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵字引數用" +"於配置 mock 的屬性:" #: ../../library/unittest.mock.rst:810 msgid "" @@ -911,15 +910,15 @@ msgstr "" #: ../../library/unittest.mock.rst:838 msgid "" -"This applies " -"to :meth:`~Mock.assert_called_with`, :meth:`~Mock.assert_called_once_with`, :meth:`~Mock.assert_has_calls` " -"and :meth:`~Mock.assert_any_call`. When :ref:`auto-speccing`, it will also " -"apply to method calls on the mock object." +"This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." +"assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." +"assert_any_call`. When :ref:`auto-speccing`, it will also apply to method " +"calls on the mock object." msgstr "" -"這適用" -"於 :meth:`~Mock.assert_called_with`、:meth:`~Mock.assert_called_once_with`、:meth:`~Mock.assert_has_calls` " -"和 :meth:`~Mock.assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 " -"mock 物件的方法呼叫。" +"這適用於 :meth:`~Mock.assert_called_with`、:meth:`~Mock." +"assert_called_once_with`、:meth:`~Mock.assert_has_calls` 和 :meth:`~Mock." +"assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 mock 物件的方法" +"呼叫。" #: ../../library/unittest.mock.rst:843 msgid "Added signature introspection on specced and autospecced mock objects." @@ -929,14 +928,14 @@ msgstr "" #: ../../library/unittest.mock.rst:849 msgid "" -"A mock intended to be used as a :class:`property`, or " -"other :term:`descriptor`, on a class. :class:`PropertyMock` " -"provides :meth:`~object.__get__` and :meth:`~object.__set__` methods so you " -"can specify a return value when it is fetched." +"A mock intended to be used as a :class:`property`, or other :term:" +"`descriptor`, on a class. :class:`PropertyMock` provides :meth:`~object." +"__get__` and :meth:`~object.__set__` methods so you can specify a return " +"value when it is fetched." msgstr "" -"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 " -"mock。:class:`PropertyMock` 提供了 :meth:`~object.__get__` " -"和 :meth:`~object.__set__` 方法,因此你可以在它被提取時指定回傳值。" +"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 mock。:" +"class:`PropertyMock` 提供了 :meth:`~object.__get__` 和 :meth:`~object." +"__set__` 方法,因此你可以在它被提取時指定回傳值。" #: ../../library/unittest.mock.rst:854 msgid "" @@ -986,9 +985,9 @@ msgstr "" #: ../../library/unittest.mock.rst:875 msgid "" -"Because of the way mock attributes are stored you can't directly attach " -"a :class:`PropertyMock` to a mock object. Instead you can attach it to the " -"mock type object::" +"Because of the way mock attributes are stored you can't directly attach a :" +"class:`PropertyMock` to a mock object. Instead you can attach it to the mock " +"type object::" msgstr "" "由於 mock 屬性的儲存方式,你無法直接將 :class:`PropertyMock` 附加到 mock 物" "件。但是你可以將其附加到 mock 型別的物件: ::" @@ -1091,18 +1090,18 @@ msgstr "" #: ../../library/unittest.mock.rst:940 msgid "" -"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, " -"or :class:`AsyncMock` to a class with asynchronous and synchronous functions " -"will automatically detect the synchronous functions and set them " -"as :class:`MagicMock` (if the parent mock is :class:`AsyncMock` " -"or :class:`MagicMock`) or :class:`Mock` (if the parent mock " -"is :class:`Mock`). All asynchronous functions will be :class:`AsyncMock`." +"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, or :class:" +"`AsyncMock` to a class with asynchronous and synchronous functions will " +"automatically detect the synchronous functions and set them as :class:" +"`MagicMock` (if the parent mock is :class:`AsyncMock` or :class:`MagicMock`) " +"or :class:`Mock` (if the parent mock is :class:`Mock`). All asynchronous " +"functions will be :class:`AsyncMock`." msgstr "" "將 :class:`Mock`、:class:`MagicMock` 或 :class:`AsyncMock` 的 *spec* 設定為具" -"有同步和非同步函式的類別,會自動檢測同步函式並將其設定" -"為 :class:`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` " -"或 :class:`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock " -"為 :class:`Mock`\\ )。所有非同步函式將被設定為 :class:`AsyncMock`。" +"有同步和非同步函式的類別,會自動檢測同步函式並將其設定為 :class:" +"`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` 或 :class:" +"`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock 為 :class:`Mock`\\ )。所" +"有非同步函式將被設定為 :class:`AsyncMock`。" #: ../../library/unittest.mock.rst:968 msgid "" @@ -1132,8 +1131,8 @@ msgstr "斷言 mock 曾經被使用指定的引數等待過。" #: ../../library/unittest.mock.rst:1053 msgid "" -"Assert the mock has been awaited with the specified calls. " -"The :attr:`await_args_list` list is checked for the awaits." +"Assert the mock has been awaited with the specified calls. The :attr:" +"`await_args_list` list is checked for the awaits." msgstr "" "斷言 mock 已被使用指定的呼叫進行等待。:attr:`await_args_list` 串列將被檢查以" "確認等待的內容。" @@ -1151,8 +1150,8 @@ msgid "" "If *any_order* is true then the awaits can be in any order, but they must " "all appear in :attr:`await_args_list`." msgstr "" -"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現" -"在 :attr:`await_args_list` 中。" +"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現在 :" +"attr:`await_args_list` 中。" #: ../../library/unittest.mock.rst:1080 msgid "Assert that the mock was never awaited." @@ -1160,11 +1159,11 @@ msgstr "斷言 mock 從未被等待。" #: ../../library/unittest.mock.rst:1087 msgid "" -"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to " -"0, :attr:`await_args` to None, and clears the :attr:`await_args_list`." +"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to 0, :attr:" +"`await_args` to None, and clears the :attr:`await_args_list`." msgstr "" -"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 " -"0,:attr:`await_args` 設定為 None,並清除 :attr:`await_args_list`。" +"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 0,:attr:" +"`await_args` 設定為 None,並清除 :attr:`await_args_list`。" #: ../../library/unittest.mock.rst:1092 msgid "" @@ -1174,8 +1173,8 @@ msgstr "一個整數,用來記錄 mock 物件已被等待的次數。" #: ../../library/unittest.mock.rst:1107 msgid "" "This is either ``None`` (if the mock hasn’t been awaited), or the arguments " -"that the mock was last awaited with. Functions the same " -"as :attr:`Mock.call_args`." +"that the mock was last awaited with. Functions the same as :attr:`Mock." +"call_args`." msgstr "" "這可能是 ``None``\\ (如果 mock 尚未被等待),或者是上次等待 mock 時使用的引" "數。與 :attr:`Mock.call_args` 的功能相同。" @@ -1191,9 +1190,9 @@ msgstr "" #: ../../library/unittest.mock.rst:1145 msgid "" -"A version of :class:`MagicMock` for multithreading tests. " -"The :class:`ThreadingMock` object provides extra methods to wait for a call " -"to be invoked, rather than assert on it immediately." +"A version of :class:`MagicMock` for multithreading tests. The :class:" +"`ThreadingMock` object provides extra methods to wait for a call to be " +"invoked, rather than assert on it immediately." msgstr "" #: ../../library/unittest.mock.rst:1149 @@ -1205,8 +1204,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1152 msgid "" -"You can configure the global default timeout by " -"setting :attr:`ThreadingMock.DEFAULT_TIMEOUT`." +"You can configure the global default timeout by setting :attr:`ThreadingMock." +"DEFAULT_TIMEOUT`." msgstr "" #: ../../library/unittest.mock.rst:1156 @@ -1226,14 +1225,14 @@ msgstr "等到直到 mock 被以特定引數呼叫。" #: ../../library/unittest.mock.rst:1172 msgid "" -"If a timeout was passed at the creation of the mock the function raises " -"an :exc:`AssertionError` if the call is not performed in time." +"If a timeout was passed at the creation of the mock the function raises an :" +"exc:`AssertionError` if the call is not performed in time." msgstr "" #: ../../library/unittest.mock.rst:1183 msgid "" -"Global default timeout in seconds to create instances " -"of :class:`ThreadingMock`." +"Global default timeout in seconds to create instances of :class:" +"`ThreadingMock`." msgstr "" #: ../../library/unittest.mock.rst:1189 @@ -1242,11 +1241,11 @@ msgstr "呼叫" #: ../../library/unittest.mock.rst:1191 msgid "" -"Mock objects are callable. The call will return the value set as " -"the :attr:`~Mock.return_value` attribute. The default return value is a new " -"Mock object; it is created the first time the return value is accessed " -"(either explicitly or by calling the Mock) - but it is stored and the same " -"one returned each time." +"Mock objects are callable. The call will return the value set as the :attr:" +"`~Mock.return_value` attribute. The default return value is a new Mock " +"object; it is created the first time the return value is accessed (either " +"explicitly or by calling the Mock) - but it is stored and the same one " +"returned each time." msgstr "" "Mock 物件可被呼叫。呼叫將回傳設定為 :attr:`~Mock.return_value` 屬性的值。預設" "的回傳值是一個新的 Mock 物件;它會在第一次存取回傳值時(無論是顯式存取還是透" @@ -1254,11 +1253,11 @@ msgstr "" #: ../../library/unittest.mock.rst:1197 msgid "" -"Calls made to the object will be recorded in the attributes " -"like :attr:`~Mock.call_args` and :attr:`~Mock.call_args_list`." +"Calls made to the object will be recorded in the attributes like :attr:" +"`~Mock.call_args` and :attr:`~Mock.call_args_list`." msgstr "" -"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` " -"和 :attr:`~Mock.call_args_list` 等屬性中。" +"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` 和 :attr:`~Mock." +"call_args_list` 等屬性中。" #: ../../library/unittest.mock.rst:1200 msgid "" @@ -1271,8 +1270,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1204 msgid "" -"The simplest way to make a mock raise an exception when called is to " -"make :attr:`~Mock.side_effect` an exception class or instance:" +"The simplest way to make a mock raise an exception when called is to make :" +"attr:`~Mock.side_effect` an exception class or instance:" msgstr "" "呼叫 mock 時引發例外的最簡單方式是將 :attr:`~Mock.side_effect` 設定為例外類別" "或實例:" @@ -1296,8 +1295,8 @@ msgid "" "return :data:`DEFAULT`:" msgstr "" "如果你希望 mock 仍然回傳預設的回傳值(一個新的 mock),或者是任何已設定的回傳" -"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回" -"傳 :attr:`~Mock.return_value`,或回傳 :data:`DEFAULT`:" +"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回傳 :attr:`~Mock." +"return_value`,或回傳 :data:`DEFAULT`:" #: ../../library/unittest.mock.rst:1257 msgid "" @@ -1372,8 +1371,8 @@ msgid "" "You \"block\" attributes by deleting them. Once deleted, accessing an " "attribute will raise an :exc:`AttributeError`." msgstr "" -"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引" -"發 :exc:`AttributeError`。" +"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引發 :exc:" +"`AttributeError`。" #: ../../library/unittest.mock.rst:1331 msgid "Mock names and the name attribute" @@ -1383,8 +1382,8 @@ msgstr "Mock 名稱與名稱屬性" msgid "" "Since \"name\" is an argument to the :class:`Mock` constructor, if you want " "your mock object to have a \"name\" attribute you can't just pass it in at " -"creation time. There are two alternatives. One option is to " -"use :meth:`~Mock.configure_mock`::" +"creation time. There are two alternatives. One option is to use :meth:`~Mock." +"configure_mock`::" msgstr "" "由於 \"name\" 是傳遞給 :class:`Mock` 建構函式的引數,如果你想讓你的 mock 物件" "擁有 \"name\" 屬性,你不能在建立時直接傳遞它。有兩種替代方法。其中一個選擇是" @@ -1447,8 +1446,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1381 msgid "" "Mocks created for you by :func:`patch` are automatically given names. To " -"attach mocks that have names to a parent you use " -"the :meth:`~Mock.attach_mock` method::" +"attach mocks that have names to a parent you use the :meth:`~Mock." +"attach_mock` method::" msgstr "" "由 :func:`patch` 為你建立的 mock 會自動被賦予名稱。若要將具有名稱的 mock 附加" "到上代,你可以使用 :meth:`~Mock.attach_mock` 方法: ::" @@ -1490,10 +1489,10 @@ msgid "" "a new Mock object when it expects a magic method. If you need magic method " "support see :ref:`magic methods `." msgstr "" -"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引" -"發 :exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到" -"一個魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需" -"要魔術方法的支援,請參閱\\ :ref:`魔術方法 `。" +"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引發 :" +"exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到一個" +"魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需要魔" +"術方法的支援,請參閱\\ :ref:`魔術方法 `。" #: ../../library/unittest.mock.rst:1408 msgid "The patchers" @@ -1540,11 +1539,10 @@ msgid "" "If :func:`patch` is used as a context manager the created mock is returned " "by the context manager." msgstr "" -"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換" -"為 :class:`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做" -"為裝飾器使用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函" -"式。如果 :func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回" -"傳。" +"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換為 :class:" +"`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做為裝飾器使" +"用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函式。如果 :" +"func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回傳。" #: ../../library/unittest.mock.rst:1438 msgid "" @@ -1555,14 +1553,14 @@ msgid "" "function is executed, not at decoration time." msgstr "" "*target* 應該是以 ``'package.module.ClassName'`` 形式出現的字串。*target* 會" -"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼" -"叫 :func:`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝" -"飾器作用時 (decoration time)。" +"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼叫 :func:" +"`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝飾器作用" +"時 (decoration time)。" #: ../../library/unittest.mock.rst:1444 msgid "" -"The *spec* and *spec_set* keyword arguments are passed to " -"the :class:`MagicMock` if patch is creating one for you." +"The *spec* and *spec_set* keyword arguments are passed to the :class:" +"`MagicMock` if patch is creating one for you." msgstr "" "*spec* 和 *spec_set* 關鍵字引數會傳遞給 :class:`MagicMock`,如果 patch 正在為" "你建立一個。" @@ -1578,9 +1576,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1450 msgid "" "*new_callable* allows you to specify a different class, or callable object, " -"that will be called to create the *new* object. By " -"default :class:`AsyncMock` is used for async functions " -"and :class:`MagicMock` for the rest." +"that will be called to create the *new* object. By default :class:" +"`AsyncMock` is used for async functions and :class:`MagicMock` for the rest." msgstr "" "*new_callable* 允許你指定一個不同的類別或可呼叫的物件,用於被呼叫並建立 " "*new* 物件。預設情況下,對於非同步函式使用 :class:`AsyncMock`,而對於其他情況" @@ -1594,15 +1591,15 @@ msgid "" "attribute of the object being replaced. Methods and functions being mocked " "will have their arguments checked and will raise a :exc:`TypeError` if they " "are called with the wrong signature. For mocks replacing a class, their " -"return value (the 'instance') will have the same spec as the class. See " -"the :func:`create_autospec` function and :ref:`auto-speccing`." +"return value (the 'instance') will have the same spec as the class. See the :" +"func:`create_autospec` function and :ref:`auto-speccing`." msgstr "" "*spec* 的一種更強大的形式是 *autospec*。如果你設定 ``autospec=True``,則該 " "mock 將使用被替換物件的規格來建立。該 mock 的所有屬性也將具有被替換物件的對應" "屬性的規格。被 mock 的方法和函式將檢查其引數,如果呼叫時引數與規格不符(被使" "用錯誤的簽名 (signature) 呼叫),將引發 :exc:`TypeError`。對於替換類別的 " -"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參" -"閱 :func:`create_autospec` 函式和 :ref:`auto-speccing`。" +"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參閱 :func:" +"`create_autospec` 函式和 :ref:`auto-speccing`。" #: ../../library/unittest.mock.rst:1464 msgid "" @@ -1641,10 +1638,10 @@ msgid "" "Patch can be used as a :class:`~unittest.TestCase` class decorator. It works " "by decorating each test method in the class. This reduces the boilerplate " "code when your test methods share a common patchings set. :func:`patch` " -"finds tests by looking for method names that start with " -"``patch.TEST_PREFIX``. By default this is ``'test'``, which matches the " -"way :mod:`unittest` finds tests. You can specify an alternative prefix by " -"setting ``patch.TEST_PREFIX``." +"finds tests by looking for method names that start with ``patch." +"TEST_PREFIX``. By default this is ``'test'``, which matches the way :mod:" +"`unittest` finds tests. You can specify an alternative prefix by setting " +"``patch.TEST_PREFIX``." msgstr "" "patch 可以做為 :class:`~unittest.TestCase` 類別的裝飾器使用。它透過裝飾類別中" "的每個測試方法來運作。當你的測試方法共享一組常見的 patch 時,這會減少繁冗的代" @@ -1665,9 +1662,9 @@ msgstr "" #: ../../library/unittest.mock.rst:1493 msgid "" -":func:`patch` takes arbitrary keyword arguments. These will be passed " -"to :class:`AsyncMock` if the patched object is asynchronous, " -"to :class:`MagicMock` otherwise or to *new_callable* if specified." +":func:`patch` takes arbitrary keyword arguments. These will be passed to :" +"class:`AsyncMock` if the patched object is asynchronous, to :class:" +"`MagicMock` otherwise or to *new_callable* if specified." msgstr "" ":func:`patch` 接受任意的關鍵字引數。如果被 patch 的物件是非同步的,這些將會被" "傳遞給 :class:`AsyncMock`,如果是同步的則會傳遞給 :class:`MagicMock`,或如果" @@ -1707,18 +1704,18 @@ msgstr "" #: ../../library/unittest.mock.rst:1510 msgid "" "Patching a class replaces the class with a :class:`MagicMock` *instance*. If " -"the class is instantiated in the code under test then it will be " -"the :attr:`~Mock.return_value` of the mock that will be used." +"the class is instantiated in the code under test then it will be the :attr:" +"`~Mock.return_value` of the mock that will be used." msgstr "" "Patch 一個類別會以 :class:`MagicMock`\\ *實例*\\ 取代該類別。如果該類別在被" -"測試的程式碼中實例化,那麼它將是會被使用的 mock " -"的 :attr:`~Mock.return_value`。" +"測試的程式碼中實例化,那麼它將是會被使用的 mock 的 :attr:`~Mock." +"return_value`。" #: ../../library/unittest.mock.rst:1514 msgid "" -"If the class is instantiated multiple times you could " -"use :attr:`~Mock.side_effect` to return a new mock each time. Alternatively " -"you can set the *return_value* to be anything you want." +"If the class is instantiated multiple times you could use :attr:`~Mock." +"side_effect` to return a new mock each time. Alternatively you can set the " +"*return_value* to be anything you want." msgstr "" "如果該類別被實例化多次,你可以使用 :attr:`~Mock.side_effect` 來每次回傳一個新" "的 mock。 或者你可以將 *return_value* 設定成你想要的任何值。" @@ -1728,8 +1725,8 @@ msgid "" "To configure return values on methods of *instances* on the patched class " "you must do this on the :attr:`~Mock.return_value`. For example::" msgstr "" -"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須" -"在 :attr:`~Mock.return_value` 上進行配置。例如: ::" +"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須在 :attr:`~Mock." +"return_value` 上進行配置。例如: ::" #: ../../library/unittest.mock.rst:1521 msgid "" @@ -1870,16 +1867,16 @@ msgstr "" #: ../../library/unittest.mock.rst:1580 msgid "" -"As well as attributes on the created mock attributes, like " -"the :attr:`~Mock.return_value` and :attr:`~Mock.side_effect`, of child mocks " -"can also be configured. These aren't syntactically valid to pass in directly " -"as keyword arguments, but a dictionary with these as keys can still be " -"expanded into a :func:`patch` call using ``**``::" +"As well as attributes on the created mock attributes, like the :attr:`~Mock." +"return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " +"configured. These aren't syntactically valid to pass in directly as keyword " +"arguments, but a dictionary with these as keys can still be expanded into a :" +"func:`patch` call using ``**``::" msgstr "" -"除了被建立的 mock 上的屬性外,還可以配置 child mock " -"的 :attr:`~Mock.return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能" -"直接作為關鍵字引數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一" -"個 :func:`patch` 呼叫: ::" +"除了被建立的 mock 上的屬性外,還可以配置 child mock 的 :attr:`~Mock." +"return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能直接作為關鍵字引" +"數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一個 :func:`patch` 呼" +"叫: ::" #: ../../library/unittest.mock.rst:1586 msgid "" @@ -1906,8 +1903,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1596 msgid "" "By default, attempting to patch a function in a module (or a method or an " -"attribute in a class) that does not exist will fail " -"with :exc:`AttributeError`::" +"attribute in a class) that does not exist will fail with :exc:" +"`AttributeError`::" msgstr "" "預設情況下,嘗試 patch 模組中不存在的函式(或類別中的方法或屬性)將會失敗,並" "引發 :exc:`AttributeError`: ::" @@ -1979,19 +1976,19 @@ msgstr "" msgid "" ":func:`patch.object` can be used as a decorator, class decorator or a " "context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " -"and *new_callable* have the same meaning as for :func:`patch`. " -"Like :func:`patch`, :func:`patch.object` takes arbitrary keyword arguments " -"for configuring the mock object it creates." +"and *new_callable* have the same meaning as for :func:`patch`. Like :func:" +"`patch`, :func:`patch.object` takes arbitrary keyword arguments for " +"configuring the mock object it creates." msgstr "" ":func:`patch.object` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 *new*、" -"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與" -"在 :func:`patch` 中的引數具有相同的意義。與 :func:`patch` 一" -"樣,:func:`patch.object` 接受任意關鍵字引數來配置它所建立的 mock 物件。" +"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與在 :func:" +"`patch` 中的引數具有相同的意義。與 :func:`patch` 一樣,:func:`patch.object` " +"接受任意關鍵字引數來配置它所建立的 mock 物件。" #: ../../library/unittest.mock.rst:1636 msgid "" -"When used as a class decorator :func:`patch.object` honours " -"``patch.TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.object` honours ``patch." +"TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.object` 會遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" @@ -2081,9 +2078,8 @@ msgstr ":func:`patch.dict` 可以做為情境管理器、裝飾器或類別裝 #: ../../library/unittest.mock.rst:1698 msgid "" -"When used as a class decorator :func:`patch.dict` honours " -"``patch.TEST_PREFIX`` (default to ``'test'``) for choosing which methods to " -"wrap:" +"When used as a class decorator :func:`patch.dict` honours ``patch." +"TEST_PREFIX`` (default to ``'test'``) for choosing which methods to wrap:" msgstr "" "當作為類別裝飾器使用時,:func:`patch.dict` 會遵循 ``patch.TEST_PREFIX``\\ " "(預設為 ``'test'``\\ )來選擇要包裝的方法:" @@ -2118,14 +2114,15 @@ msgid "" ":func:`patch.dict` can be used with dictionary like objects that aren't " "actually dictionaries. At the very minimum they must support item getting, " "setting, deleting and either iteration or membership test. This corresponds " -"to the magic " -"methods :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__` " -"and either :meth:`~container.__iter__` or :meth:`~object.__contains__`." +"to the magic methods :meth:`~object.__getitem__`, :meth:`~object." +"__setitem__`, :meth:`~object.__delitem__` and either :meth:`~container." +"__iter__` or :meth:`~object.__contains__`." msgstr "" ":func:`patch.dict` 可以與實際上不是字典的類字典物件一起使用。最低限度它們必須" -"支援項目的取得、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中" -"的 :meth:`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object.__delitem__` " -"以及 :meth:`~container.__iter__` 或 :meth:`~object.__contains__`。" +"支援項目的取得、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中的 :meth:" +"`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object." +"__delitem__` 以及 :meth:`~container.__iter__` 或 :meth:`~object." +"__contains__`。" #: ../../library/unittest.mock.rst:1774 msgid "patch.multiple" @@ -2152,12 +2149,12 @@ msgstr "" msgid "" "Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " "create mocks for you. In this case the created mocks are passed into a " -"decorated function by keyword, and a dictionary is returned " -"when :func:`patch.multiple` is used as a context manager." +"decorated function by keyword, and a dictionary is returned when :func:" +"`patch.multiple` is used as a context manager." msgstr "" "如果你想要 :func:`patch.multiple` 為你建立 mock,請使用 :data:`DEFAULT` 作為" -"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且" -"當 :func:`patch.multiple` 作為情境管理器時會回傳字典。" +"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且當 :" +"func:`patch.multiple` 作為情境管理器時會回傳字典。" #: ../../library/unittest.mock.rst:1790 msgid "" @@ -2167,14 +2164,14 @@ msgid "" "will be applied to *all* patches done by :func:`patch.multiple`." msgstr "" ":func:`patch.multiple` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 " -"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與" -"在 :func:`patch` 中的引數具有相同的意義。這些引數將應用於" -"由 :func:`patch.multiple` 完成的\\ *所有* patch。" +"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與在 :func:" +"`patch` 中的引數具有相同的意義。這些引數將應用於由 :func:`patch.multiple` 完" +"成的\\ *所有* patch。" #: ../../library/unittest.mock.rst:1795 msgid "" -"When used as a class decorator :func:`patch.multiple` honours " -"``patch.TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.multiple` honours ``patch." +"TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.multiple` 遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" @@ -2186,9 +2183,9 @@ msgid "" "decorator then the created mocks are passed into the decorated function by " "keyword. ::" msgstr "" -"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使" -"用 :data:`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼" -"被建立的 mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" +"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使用 :data:" +"`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼被建立的 " +"mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" #: ../../library/unittest.mock.rst:1802 msgid "" @@ -2289,9 +2286,9 @@ msgid "" "then call :meth:`!start` to put the patch in place and :meth:`!stop` to undo " "it." msgstr "" -"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` " -"或 :func:`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼" -"叫 :meth:`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" +"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` 或 :func:" +"`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼叫 :meth:" +"`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" #: ../../library/unittest.mock.rst:1848 msgid "" @@ -2371,8 +2368,8 @@ msgstr "" msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the ``setUp`` then ``tearDown`` is not " -"called. :meth:`unittest.TestCase.addCleanup` makes this easier::" +"exception is raised in the ``setUp`` then ``tearDown`` is not called. :meth:" +"`unittest.TestCase.addCleanup` makes this easier::" msgstr "" "如果你使用這個技巧,你必須確保透過呼叫 ``stop`` 來 \"取消\" patch。這可能會比" "你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就" @@ -2408,8 +2405,8 @@ msgstr "作為額外的好處,你不再需要保留對 ``patcher`` 物件的 #: ../../library/unittest.mock.rst:1902 msgid "" -"It is also possible to stop all patches which have been started by " -"using :func:`patch.stopall`." +"It is also possible to stop all patches which have been started by using :" +"func:`patch.stopall`." msgstr "也可以使用 :func:`patch.stopall` 來停止所有已啟動的 patch。" #: ../../library/unittest.mock.rst:1907 @@ -2457,14 +2454,14 @@ msgid "" "the :class:`unittest.TestLoader` finds test methods by default." msgstr "" "所有 patcher 都可以作為類別裝飾器使用。以這種方式使用時,它們包裝了類別上的每" -"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這" -"與 :class:`unittest.TestLoader` 預設尋找測試方法的方式相同。" +"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這與 :class:" +"`unittest.TestLoader` 預設尋找測試方法的方式相同。" #: ../../library/unittest.mock.rst:1936 msgid "" "It is possible that you want to use a different prefix for your tests. You " -"can inform the patchers of the different prefix by setting " -"``patch.TEST_PREFIX``::" +"can inform the patchers of the different prefix by setting ``patch." +"TEST_PREFIX``::" msgstr "" "你可能會想為你的測試使用不同的前綴。你可以透過設定 ``patch.TEST_PREFIX`` 來告" "知 patcher 使用不同的前綴: ::" @@ -2579,10 +2576,10 @@ msgstr "" msgid "" "Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " "using :func:`patch`. The problem is that when we import module b, which we " -"will have to do when it imports ``SomeClass`` from module a. If we " -"use :func:`patch` to mock out ``a.SomeClass`` then it will have no effect on " -"our test; module b already has a reference to the *real* ``SomeClass`` and " -"it looks like our patching had no effect." +"will have to do when it imports ``SomeClass`` from module a. If we use :func:" +"`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; " +"module b already has a reference to the *real* ``SomeClass`` and it looks " +"like our patching had no effect." msgstr "" "現在我們想要測試 ``some_function``,但我們想使用 :func:`patch` mock " "``SomeClass``。問題是,當我們 import 模組 b 時(我們必須這樣做),它會從模組 " @@ -2608,10 +2605,10 @@ msgstr "@patch('b.SomeClass')" #: ../../library/unittest.mock.rst:2021 msgid "" "However, consider the alternative scenario where instead of ``from a import " -"SomeClass`` module b does ``import a`` and ``some_function`` uses " -"``a.SomeClass``. Both of these import forms are common. In this case the " -"class we want to patch is being looked up in the module and so we have to " -"patch ``a.SomeClass`` instead::" +"SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." +"SomeClass``. Both of these import forms are common. In this case the class " +"we want to patch is being looked up in the module and so we have to patch " +"``a.SomeClass`` instead::" msgstr "" "然而,考慮另一種情況,其中模組 b 並不是使用 ``from a import SomeClass``,而" "是 ``import a``,然後 ``some_function`` 使用 ``a.SomeClass``。這兩種 import " @@ -2631,14 +2628,14 @@ msgid "" "Both patch_ and patch.object_ correctly patch and restore descriptors: class " "methods, static methods and properties. You should patch these on the " "*class* rather than an instance. They also work with *some* objects that " -"proxy attribute access, like the `django settings object `_." msgstr "" "patch_ 和 patch.object_ 都正確地 patch 和還原描述器:類別方法、靜態方法以及屬" "性。你應該在 *類別* 而不是實例上 patch 它們。它們還可以使用代理屬性存取的\\ *" -"一些*\\ 物件,例如 `django 設定物件 `_。" #: ../../library/unittest.mock.rst:2040 @@ -2651,9 +2648,9 @@ msgstr "Mock 魔術方法" #: ../../library/unittest.mock.rst:2047 msgid "" -":class:`Mock` supports mocking the Python protocol methods, also known " -"as :term:`\"magic methods\" `. This allows mock objects to " -"replace containers or other objects that implement Python protocols." +":class:`Mock` supports mocking the Python protocol methods, also known as :" +"term:`\"magic methods\" `. This allows mock objects to replace " +"containers or other objects that implement Python protocols." msgstr "" ":class:`Mock` 支援 mock Python 協定方法,其也被稱作 :term:`\"魔術方法\" " "`。這允許 mock 物件替換容器或實作 Python 協定的其他物件。" @@ -2680,8 +2677,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2079 msgid "" -"One use case for this is for mocking objects used as context managers in " -"a :keyword:`with` statement:" +"One use case for this is for mocking objects used as context managers in a :" +"keyword:`with` statement:" msgstr "一個用法是在 :keyword:`with` 陳述式中 mock 作為情境管理器使用的物件:" #: ../../library/unittest.mock.rst:2091 @@ -2689,14 +2686,14 @@ msgid "" "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " "are recorded in :attr:`~Mock.mock_calls`." msgstr "" -"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄" -"在 :attr:`~Mock.mock_calls` 內。" +"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄在 :" +"attr:`~Mock.mock_calls` 內。" #: ../../library/unittest.mock.rst:2096 msgid "" "If you use the *spec* keyword argument to create a mock then attempting to " -"set a magic method that isn't in the spec will raise " -"an :exc:`AttributeError`." +"set a magic method that isn't in the spec will raise an :exc:" +"`AttributeError`." msgstr "" "如果你使用\\ *spec*\\ 關鍵字引數來建立一個 mock,則嘗試設定規格中未包含的魔術" "方法將引發一個 :exc:`AttributeError`。" @@ -2821,11 +2818,11 @@ msgstr "Magic Mock" #: ../../library/unittest.mock.rst:2141 msgid "" -"There are two ``MagicMock`` variants: :class:`MagicMock` " -"and :class:`NonCallableMagicMock`." +"There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" +"`NonCallableMagicMock`." msgstr "" -"``MagicMock`` 有兩個變體::class:`MagicMock` " -"和 :class:`NonCallableMagicMock`。" +"``MagicMock`` 有兩個變體::class:`MagicMock` 和 :class:" +"`NonCallableMagicMock`。" #: ../../library/unittest.mock.rst:2146 msgid "" @@ -2960,13 +2957,13 @@ msgstr "舉例來說:" #: ../../library/unittest.mock.rst:2212 msgid "" "The two equality methods, :meth:`!__eq__` and :meth:`!__ne__`, are special. " -"They do the default equality comparison on identity, using " -"the :attr:`~Mock.side_effect` attribute, unless you change their return " -"value to return something else::" +"They do the default equality comparison on identity, using the :attr:`~Mock." +"side_effect` attribute, unless you change their return value to return " +"something else::" msgstr "" -":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使" -"用 :attr:`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非" -"你變更它們的回傳值以回傳其他內容: ::" +":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使用 :attr:" +"`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非你變更它" +"們的回傳值以回傳其他內容: ::" #: ../../library/unittest.mock.rst:2217 msgid "" @@ -3090,8 +3087,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2284 msgid "" -"The ``sentinel`` attributes now preserve their identity when they " -"are :mod:`copied ` or :mod:`pickled `." +"The ``sentinel`` attributes now preserve their identity when they are :mod:" +"`copied ` or :mod:`pickled `." msgstr "" "``哨兵``\\ 屬性現在當被\\ :mod:`複製 `\\ 或\\ :mod:`序列化 `\\ " "時會保留其識別性。" @@ -3109,8 +3106,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2293 msgid "" -"In this example we monkey patch ``method`` to return " -"``sentinel.some_object``:" +"In this example we monkey patch ``method`` to return ``sentinel." +"some_object``:" msgstr "" "在這個例子中,我們 monkey patch ``method`` 以回傳 ``sentinel.some_object``:" @@ -3120,13 +3117,13 @@ msgstr "DEFAULT" #: ../../library/unittest.mock.rst:2310 msgid "" -"The :data:`DEFAULT` object is a pre-created sentinel (actually " -"``sentinel.DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions " -"to indicate that the normal return value should be used." +"The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." +"DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " +"indicate that the normal return value should be used." msgstr "" -":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 " -"``sentinel.DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示" -"正常的回傳值應該被使用。" +":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 ``sentinel." +"DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示正常的回傳值" +"應該被使用。" #: ../../library/unittest.mock.rst:2316 msgid "call" @@ -3135,13 +3132,14 @@ msgstr "call" #: ../../library/unittest.mock.rst:2320 msgid "" ":func:`call` is a helper object for making simpler assertions, for comparing " -"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock.mock_calls` " -"and :attr:`~Mock.method_calls`. :func:`call` can also be used " +"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." +"mock_calls` and :attr:`~Mock.method_calls`. :func:`call` can also be used " "with :meth:`~Mock.assert_has_calls`." msgstr "" -"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock.mock_calls` " -"和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更簡單的斷言的" -"輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一起使用。" +"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock." +"mock_calls` 和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更" +"簡單的斷言的輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一" +"起使用。" #: ../../library/unittest.mock.rst:2333 msgid "" @@ -3173,24 +3171,22 @@ msgid "" "A ``call`` object is either a tuple of (positional args, keyword args) or " "(name, positional args, keyword args) depending on how it was constructed. " "When you construct them yourself this isn't particularly interesting, but " -"the ``call`` objects that are in " -"the :attr:`Mock.call_args`, :attr:`Mock.call_args_list` " -"and :attr:`Mock.mock_calls` attributes can be introspected to get at the " -"individual arguments they contain." +"the ``call`` objects that are in the :attr:`Mock.call_args`, :attr:`Mock." +"call_args_list` and :attr:`Mock.mock_calls` attributes can be introspected " +"to get at the individual arguments they contain." msgstr "" "取決於它的建構方式,一個 ``call`` 物件會是(位置引數, 關鍵字引數)的元組,或" "是 (名稱, 位置引數, 關鍵字引數) 的元組。當你自己建構它們時,這並不是那麼有" -"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` " -"和 :attr:`Mock.mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各" -"個引數。" +"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` 和 :attr:`Mock." +"mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各個引數。" #: ../../library/unittest.mock.rst:2366 msgid "" -"The ``call`` objects in :attr:`Mock.call_args` " -"and :attr:`Mock.call_args_list` are two-tuples of (positional args, keyword " -"args) whereas the ``call`` objects in :attr:`Mock.mock_calls`, along with " -"ones you construct yourself, are three-tuples of (name, positional args, " -"keyword args)." +"The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." +"call_args_list` are two-tuples of (positional args, keyword args) whereas " +"the ``call`` objects in :attr:`Mock.mock_calls`, along with ones you " +"construct yourself, are three-tuples of (name, positional args, keyword " +"args)." msgstr "" ":attr:`Mock.call_args` 和 :attr:`Mock.call_args_list` 中的 ``call`` 物件是" "(位置引數, 關鍵字引數)的二元組,而 :attr:`Mock.mock_calls` 中的 ``call`` 物" @@ -3229,8 +3225,8 @@ msgid "" "If *spec_set* is ``True`` then attempting to set attributes that don't exist " "on the spec object will raise an :exc:`AttributeError`." msgstr "" -"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引" -"發 :exc:`AttributeError`。" +"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引發 :exc:" +"`AttributeError`。" #: ../../library/unittest.mock.rst:2418 msgid "" @@ -3253,8 +3249,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2426 msgid "" -"See :ref:`auto-speccing` for examples of how to use auto-speccing " -"with :func:`create_autospec` and the *autospec* argument to :func:`patch`." +"See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" +"`create_autospec` and the *autospec* argument to :func:`patch`." msgstr "" "請參閱 :ref:`auto-speccing` 以得知如何以 :func:`create_autospec` 使用自動規格" "以及如何在 :func:`patch` 中使用 *autospec* 引數的範例。" @@ -3264,8 +3260,8 @@ msgid "" ":func:`create_autospec` now returns an :class:`AsyncMock` if the target is " "an async function." msgstr "" -"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一" -"個 :class:`AsyncMock`。" +"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一個 :class:" +"`AsyncMock`。" #: ../../library/unittest.mock.rst:2437 msgid "ANY" @@ -3284,18 +3280,17 @@ msgstr "" #: ../../library/unittest.mock.rst:2446 msgid "" "To ignore certain arguments you can pass in objects that compare equal to " -"*everything*. Calls to :meth:`~Mock.assert_called_with` " -"and :meth:`~Mock.assert_called_once_with` will then succeed no matter what " -"was passed in." +"*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." +"assert_called_once_with` will then succeed no matter what was passed in." msgstr "" "要忽略某些引數,你可以傳入對\\ *所有物件*\\ 來說都相等的物件。那麼無論傳入什" -"麼內容,對 :meth:`~Mock.assert_used_with` " -"和 :meth:`~Mock.assert_used_once_with` 的呼叫都會成功。" +"麼內容,對 :meth:`~Mock.assert_used_with` 和 :meth:`~Mock." +"assert_used_once_with` 的呼叫都會成功。" #: ../../library/unittest.mock.rst:2455 msgid "" -":data:`ANY` can also be used in comparisons with call lists " -"like :attr:`~Mock.mock_calls`:" +":data:`ANY` can also be used in comparisons with call lists like :attr:" +"`~Mock.mock_calls`:" msgstr "" ":data:`ANY` 也可以用來與呼叫串列進行比較,例如 :attr:`~Mock.mock_calls`:" @@ -3328,8 +3323,8 @@ msgid "" ":data:`FILTER_DIR` is a module level variable that controls the way mock " "objects respond to :func:`dir`. The default is ``True``, which uses the " "filtering described below, to only show useful members. If you dislike this " -"filtering, or need to switch it off for diagnostic purposes, then set " -"``mock.FILTER_DIR = False``." +"filtering, or need to switch it off for diagnostic purposes, then set ``mock." +"FILTER_DIR = False``." msgstr "" ":data:`FILTER_DIR` 是一個模組級別的變數,用於控制 mock 物件回應 :func:`dir` " "的方式。其預設值為 ``True``,它使用以下描述的過濾方式來只顯示有用的成員。如果" @@ -3431,8 +3426,8 @@ msgid "" "of :const:`FILTER_DIR`." msgstr "" "或者,你可以只使用 ``vars(my_mock)``\\ (實例成員)和 " -"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考" -"慮 :const:`FILTER_DIR`。" +"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考慮 :const:" +"`FILTER_DIR`。" #: ../../library/unittest.mock.rst:2540 msgid "mock_open" @@ -3457,25 +3452,23 @@ msgstr "" #: ../../library/unittest.mock.rst:2551 msgid "" -"*read_data* is a string for " -"the :meth:`~io.RawIOBase.read`, :meth:`~io.IOBase.readline`, " -"and :meth:`~io.IOBase.readlines` methods of the file handle to return. " -"Calls to those methods will take data from *read_data* until it is " -"depleted. The mock of these methods is pretty simplistic: every time the " -"*mock* is called, the *read_data* is rewound to the start. If you need more " -"control over the data that you are feeding to the tested code you will need " -"to customize this mock for yourself. When that is insufficient, one of the " -"in-memory filesystem packages on `PyPI `_ can offer a " -"realistic filesystem for testing." -msgstr "" -"*read_data* 是檔案處理方" -"法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase.readline` " -"和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 *read_data* " -"取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 *mock* 時," -"*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行更多控制," -"你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的" -"其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測試的真實檔" -"案系統。" +"*read_data* is a string for the :meth:`~io.RawIOBase.read`, :meth:`~io." +"IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file " +"handle to return. Calls to those methods will take data from *read_data* " +"until it is depleted. The mock of these methods is pretty simplistic: every " +"time the *mock* is called, the *read_data* is rewound to the start. If you " +"need more control over the data that you are feeding to the tested code you " +"will need to customize this mock for yourself. When that is insufficient, " +"one of the in-memory filesystem packages on `PyPI `_ can " +"offer a realistic filesystem for testing." +msgstr "" +"*read_data* 是檔案處理方法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase." +"readline` 和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 " +"*read_data* 取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 " +"*mock* 時,*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行" +"更多控制,你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測" +"試的真實檔案系統。" #: ../../library/unittest.mock.rst:2561 msgid "" @@ -3483,9 +3476,9 @@ msgid "" "The mock of :meth:`~io.RawIOBase.read` changed to consume *read_data* rather " "than returning it on each call." msgstr "" -"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支" -"援。:meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼" -"叫時回傳它。" +"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支援。:" +"meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼叫時回" +"傳它。" #: ../../library/unittest.mock.rst:2566 msgid "*read_data* is now reset on each call to the *mock*." @@ -3518,8 +3511,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2579 msgid "" "The issue is that even if you mock out the call to :func:`open` it is the " -"*returned object* that is used as a context manager (and " -"has :meth:`~object.__enter__` and :meth:`~object.__exit__` called)." +"*returned object* that is used as a context manager (and has :meth:`~object." +"__enter__` and :meth:`~object.__exit__` called)." msgstr "" "問題是,即使你 mock 了對 :func:`open` 的呼叫,它也是作為情境管理器使用的\\ *" "回傳物件*\\ (且其 :meth:`~object.__enter__` 和 :meth:`~ object.__exit__` 已" @@ -3593,8 +3586,8 @@ msgid "" "limits the api of mocks to the api of an original object (the spec), but it " "is recursive (implemented lazily) so that attributes of mocks only have the " "same api as the attributes of the spec. In addition mocked functions / " -"methods have the same call signature as the original so they raise " -"a :exc:`TypeError` if they are called incorrectly." +"methods have the same call signature as the original so they raise a :exc:" +"`TypeError` if they are called incorrectly." msgstr "" "自動規格以 mock 現有的 :attr:`!spec` 功能作為基礎。它將 mock 的 api 限制為原" "始物件(規格)的 api,但它是遞迴的(惰性 (lazily) 實現),因此 mock 的屬性僅" @@ -3654,10 +3647,11 @@ msgid "" msgstr "該規格僅適用於 mock 本身,因此在 mock 上的任何方法仍然有相同的問題:" #: ../../library/unittest.mock.rst:2654 +#, fuzzy msgid "" -">>> mock.has_data()\n" +">>> mock.header_items()\n" "\n" -">>> mock.has_data.assret_called_with() # Intentional typo!" +">>> mock.header_items.assret_called_with() # Intentional typo!" msgstr "" ">>> mock.has_data()\n" "\n" @@ -3665,8 +3659,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2660 msgid "" -"Auto-speccing solves this problem. You can either pass ``autospec=True`` " -"to :func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " +"Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" +"func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " "function to create a mock with a spec. If you use the ``autospec=True`` " "argument to :func:`patch` then the object that is being replaced will be " "used as the spec object. Because the speccing is done \"lazily\" (the spec " @@ -3674,12 +3668,12 @@ msgid "" "complex or deeply nested objects (like modules that import modules that " "import modules) without a big performance hit." msgstr "" -"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞" -"給 :func:`patch` / :func:`patch.object` 或使用 :func:`create_autospec` 函式建" -"立帶有規格的 mock。如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取" -"代的物件將作為規格物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時" -"作為屬性被建立的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引" -"用的模組)一起使用,而不會過於影響性能。" +"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞給 :func:`patch` / :" +"func:`patch.object` 或使用 :func:`create_autospec` 函式建立帶有規格的 mock。" +"如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取代的物件將作為規格" +"物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時作為屬性被建立" +"的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引用的模組)一起" +"使用,而不會過於影響性能。" #: ../../library/unittest.mock.rst:2669 msgid "Here's an example of it in use::" @@ -3705,9 +3699,9 @@ msgstr "" #: ../../library/unittest.mock.rst:2679 msgid "" -"You can see that :class:`!request.Request` has a spec. :class:`!" -"request.Request` takes two arguments in the constructor (one of which is " -"*self*). Here's what happens if we try to call it incorrectly::" +"You can see that :class:`!request.Request` has a spec. :class:`!request." +"Request` takes two arguments in the constructor (one of which is *self*). " +"Here's what happens if we try to call it incorrectly::" msgstr "" "你可以看到 :class:`!request.Request` 有一個規格。:class:`!request.Request` 在" "建構函式中接受兩個引數(其中之一是 *self*\\ )。如果我們錯誤地呼叫它,會發生" @@ -3781,11 +3775,11 @@ msgstr "" #: ../../library/unittest.mock.rst:2711 msgid "" -"As well as using *autospec* through :func:`patch` there is " -"a :func:`create_autospec` for creating autospecced mocks directly:" +"As well as using *autospec* through :func:`patch` there is a :func:" +"`create_autospec` for creating autospecced mocks directly:" msgstr "" -"除了透過 :func:`patch` 使用 *autospec* 之外,還有一" -"個 :func:`create_autospec` 用於直接建立有自動規格的 mock:" +"除了透過 :func:`patch` 使用 *autospec* 之外,還有一個 :func:" +"`create_autospec` 用於直接建立有自動規格的 mock:" #: ../../library/unittest.mock.rst:2719 msgid "" @@ -4027,11 +4021,11 @@ msgstr "*wraps*" #: ../../library/unittest.mock.rst:2857 msgid "" -"If all three are set, mock will return the value " -"from :attr:`~Mock.side_effect`, ignoring :attr:`~Mock.return_value` and the " -"wrapped object altogether. If any two are set, the one with the higher " -"precedence will return the value. Regardless of the order of which was set " -"first, the order of precedence remains unchanged." +"If all three are set, mock will return the value from :attr:`~Mock." +"side_effect`, ignoring :attr:`~Mock.return_value` and the wrapped object " +"altogether. If any two are set, the one with the higher precedence will " +"return the value. Regardless of the order of which was set first, the order " +"of precedence remains unchanged." msgstr "" "如果這三個都有設定,mock 將會回傳來自 :attr:`~Mock.side_effect` 的值,並忽" "略 :attr:`~Mock.return_value` 和被包裝物件。如果設定了任兩項,則優先順序較高" @@ -4041,8 +4035,8 @@ msgstr "" msgid "" "As ``None`` is the default value of :attr:`~Mock.side_effect`, if you " "reassign its value back to ``None``, the order of precedence will be checked " -"between :attr:`~Mock.return_value` and the wrapped object, " -"ignoring :attr:`~Mock.side_effect`." +"between :attr:`~Mock.return_value` and the wrapped object, ignoring :attr:" +"`~Mock.side_effect`." msgstr "" "由於 ``None`` 是 :attr:`~Mock.side_effect` 的預設值,如果將其值重新賦值回為 " "``None``,則會檢查 :attr:`~Mock.return_value` 和被包裝物件之間的優先順序,忽" @@ -4059,11 +4053,11 @@ msgstr "" #: ../../library/unittest.mock.rst:2893 msgid "" -"When :class:`Mock` wraps an object, the default value " -"of :attr:`~Mock.return_value` will be :data:`DEFAULT`." +"When :class:`Mock` wraps an object, the default value of :attr:`~Mock." +"return_value` will be :data:`DEFAULT`." msgstr "" -"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將" -"為 :data:`DEFAULT`。" +"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將為 :" +"data:`DEFAULT`。" #: ../../library/unittest.mock.rst:2902 msgid "" @@ -4106,18 +4100,18 @@ msgstr "" #~ msgid "" #~ "This can be useful where you want to make a series of assertions that " -#~ "reuse the same object. Note that :meth:`reset_mock` *doesn't* clear " -#~ "the :attr:`return_value`, :attr:`side_effect` or any child attributes you " -#~ "have set using normal assignment by default. In case you want to " -#~ "reset :attr:`return_value` or :attr:`side_effect`, then pass the " -#~ "corresponding parameter as ``True``. Child mocks and the return value " -#~ "mock (if any) are reset as well." +#~ "reuse the same object. Note that :meth:`reset_mock` *doesn't* clear the :" +#~ "attr:`return_value`, :attr:`side_effect` or any child attributes you have " +#~ "set using normal assignment by default. In case you want to reset :attr:" +#~ "`return_value` or :attr:`side_effect`, then pass the corresponding " +#~ "parameter as ``True``. Child mocks and the return value mock (if any) are " +#~ "reset as well." #~ msgstr "" #~ "這在你想要進行一系列重複使用同一物件的斷言時非常有用。請注意,預設情況" -#~ "下,:meth:`reset_mock` *不會*\\ 清" -#~ "除 :attr:`return_value`、:attr:`side_effect` 或使用普通賦值設定的任何子屬" -#~ "性。如果你想要重置 :attr:`return_value` 或 :attr:`side_effect`,則將相應的" -#~ "參數設置為 ``True``。Child mock 和回傳值 mock(如果有的話)也會被重置。" +#~ "下,:meth:`reset_mock` *不會*\\ 清除 :attr:`return_value`、:attr:" +#~ "`side_effect` 或使用普通賦值設定的任何子屬性。如果你想要重置 :attr:" +#~ "`return_value` 或 :attr:`side_effect`,則將相應的參數設置為 ``True``。" +#~ "Child mock 和回傳值 mock(如果有的話)也會被重置。" #~ msgid "*return_value*, and *side_effect* are keyword-only arguments." #~ msgstr "*return_value* 和 *side_effect* 是僅限關鍵字引數。" diff --git a/library/urllib.request.po b/library/urllib.request.po index 0e3384e9e9..be0c52f527 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-24 00:15+0000\n" +"POT-Creation-Date: 2025-05-13 00:15+0000\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,8 +42,8 @@ msgid "" "The `Requests package `_ is " "recommended for a higher-level HTTP client interface." msgstr "" -"有關於更高階的 HTTP 用戶端介面,推薦使用 `Requests 套件 `_。" +"有關於更高階的 HTTP 用戶端介面,推薦使用 `Requests 套件 `_。" #: ../../library/urllib.request.rst:26 msgid "" @@ -74,8 +74,8 @@ msgid "" "Open *url*, which can be either a string containing a valid, properly " "encoded URL, or a :class:`Request` object." msgstr "" -"打開 *url*,其值可以是一個包含有效且適當編碼 URL 的字串或是一" -"個 :class:`Request` 物件。" +"打開 *url*,其值可以是一個包含有效且適當編碼 URL 的字串或是一個 :class:" +"`Request` 物件。" #: ../../library/urllib.request.rst:42 msgid "" @@ -108,8 +108,8 @@ msgstr "" #: ../../library/urllib.request.rst:54 msgid "" "If *context* is specified, it must be a :class:`ssl.SSLContext` instance " -"describing the various SSL options. " -"See :class:`~http.client.HTTPSConnection` for more details." +"describing the various SSL options. See :class:`~http.client." +"HTTPSConnection` for more details." msgstr "" "若 *context* 有被指定時,它必須是一個 :class:`ssl.SSLContext` 的實例並描述著" "各種 SSL 選項。更多細節請見 :class:`~http.client.HTTPSConnection`。" @@ -117,37 +117,37 @@ msgstr "" #: ../../library/urllib.request.rst:58 msgid "" "This function always returns an object which can work as a :term:`context " -"manager` and has the properties *url*, *headers*, and *status*. " -"See :class:`urllib.response.addinfourl` for more detail on these properties." +"manager` and has the properties *url*, *headers*, and *status*. See :class:" +"`urllib.response.addinfourl` for more detail on these properties." msgstr "" "這個函式總是回傳一個可作為 :term:`context manager` 使用的物件,並有著特性 " -"(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參" -"見 :class:`urllib.response.addinfourl`。" +"(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參見 :class:" +"`urllib.response.addinfourl`。" #: ../../library/urllib.request.rst:62 msgid "" -"For HTTP and HTTPS URLs, this function returns " -"a :class:`http.client.HTTPResponse` object slightly modified. In addition to " -"the three new methods above, the msg attribute contains the same information " -"as the :attr:`~http.client.HTTPResponse.reason` attribute --- the reason " -"phrase returned by server --- instead of the response headers as it is " -"specified in the documentation for :class:`~http.client.HTTPResponse`." +"For HTTP and HTTPS URLs, this function returns a :class:`http.client." +"HTTPResponse` object slightly modified. In addition to the three new methods " +"above, the msg attribute contains the same information as the :attr:`~http." +"client.HTTPResponse.reason` attribute --- the reason phrase returned by " +"server --- instead of the response headers as it is specified in the " +"documentation for :class:`~http.client.HTTPResponse`." msgstr "" -"對於 HTTP 與 HTTPS 的 URLs,這個函式回傳一個稍有不同" -"的 :class:`http.client.HTTPResponse` 物件。除了上述提到的三個方法外,另有 " -"msg 屬性並有著與 :attr:`~http.client.HTTPResponse.reason` 相同的資訊 --- 由伺" -"服器回傳的原因敘述 (reason phrase),而不是" -"在 :class:`~http.client.HTTPResponse` 文件中提到的回應 headers。" +"對於 HTTP 與 HTTPS 的 URLs,這個函式回傳一個稍有不同的 :class:`http.client." +"HTTPResponse` 物件。除了上述提到的三個方法外,另有 msg 屬性並有著與 :attr:" +"`~http.client.HTTPResponse.reason` 相同的資訊 --- 由伺服器回傳的原因敘述 " +"(reason phrase),而不是在 :class:`~http.client.HTTPResponse` 文件中提到的回" +"應 headers。" #: ../../library/urllib.request.rst:70 msgid "" -"For FTP, file, and data URLs and requests explicitly handled by " -"legacy :class:`URLopener` and :class:`FancyURLopener` classes, this function " -"returns a :class:`urllib.response.addinfourl` object." +"For FTP, file, and data URLs and requests explicitly handled by legacy :" +"class:`URLopener` and :class:`FancyURLopener` classes, this function returns " +"a :class:`urllib.response.addinfourl` object." msgstr "" -"對於 FTP、檔案、資料的 URLs、以及那些由傳統 classes :class:`URLopener` " -"與 :class:`FancyURLopener` 所處理的請求,這個函式會回傳一" -"個 :class:`urllib.response.addinfourl` 物件。" +"對於 FTP、檔案、資料的 URLs、以及那些由傳統 classes :class:`URLopener` 與 :" +"class:`FancyURLopener` 所處理的請求,這個函式會回傳一個 :class:`urllib." +"response.addinfourl` 物件。" #: ../../library/urllib.request.rst:74 msgid "Raises :exc:`~urllib.error.URLError` on protocol errors." @@ -156,8 +156,8 @@ msgstr "當遇到協定上的錯誤時會引發 :exc:`~urllib.error.URLError`。 #: ../../library/urllib.request.rst:76 msgid "" "Note that ``None`` may be returned if no handler handles the request (though " -"the default installed global :class:`OpenerDirector` " -"uses :class:`UnknownHandler` to ensure this never happens)." +"the default installed global :class:`OpenerDirector` uses :class:" +"`UnknownHandler` to ensure this never happens)." msgstr "" "請注意若沒有 handler 處理請求時,``None`` 值將會被回傳。(即使有預設的全域類" "別 :class:`OpenerDirector` 使用 :class:`UnknownHandler` 來確保這種情況不會發" @@ -166,9 +166,9 @@ msgstr "" #: ../../library/urllib.request.rst:80 msgid "" "In addition, if proxy settings are detected (for example, when a ``*_proxy`` " -"environment variable like :envvar:`!http_proxy` is " -"set), :class:`ProxyHandler` is default installed and makes sure the requests " -"are handled through the proxy." +"environment variable like :envvar:`!http_proxy` is set), :class:" +"`ProxyHandler` is default installed and makes sure the requests are handled " +"through the proxy." msgstr "" "另外,若有偵測到代理服務的設定(例如當 ``*_proxy`` 環境變數像是::envvar:!" "http_proxy` 有被設置時),:class:`ProxyHandler` 會被預設使用以確保請求有透過" @@ -179,19 +179,19 @@ msgid "" "The legacy ``urllib.urlopen`` function from Python 2.6 and earlier has been " "discontinued; :func:`urllib.request.urlopen` corresponds to the old " "``urllib2.urlopen``. Proxy handling, which was done by passing a dictionary " -"parameter to ``urllib.urlopen``, can be obtained by " -"using :class:`ProxyHandler` objects." +"parameter to ``urllib.urlopen``, can be obtained by using :class:" +"`ProxyHandler` objects." msgstr "" -"Python 2.6 或更早版本的遺留函式 ``urllib.urlopen`` 已經不再被維護;新函" -"式 :func:`urllib.request.urlopen` 對應到舊函式 ``urllib2.urlopen``。有關代理" -"服務的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得" -"的,現在則可以透過 :class:`ProxyHandler` 物件來取得。" +"Python 2.6 或更早版本的遺留函式 ``urllib.urlopen`` 已經不再被維護;新函式 :" +"func:`urllib.request.urlopen` 對應到舊函式 ``urllib2.urlopen``。有關代理服務" +"的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得的," +"現在則可以透過 :class:`ProxyHandler` 物件來取得。" #: ../../library/urllib.request.rst:91 ../../library/urllib.request.rst:93 msgid "" -"The default opener raises an :ref:`auditing event ` " -"``urllib.Request`` with arguments ``fullurl``, ``data``, ``headers``, " -"``method`` taken from the request object." +"The default opener raises an :ref:`auditing event ` ``urllib." +"Request`` with arguments ``fullurl``, ``data``, ``headers``, ``method`` " +"taken from the request object." msgstr "" "預設的 opener 會觸發一個 :ref:`auditing event ` ``urllib.Request`` " "與其從請求物件中所獲得的引數 ``fullurl``、``data``、``headers``、``method``。" @@ -202,8 +202,8 @@ msgstr "新增 *cafile* 與 *capath*。" #: ../../library/urllib.request.rst:100 msgid "" -"HTTPS virtual hosts are now supported if possible (that is, " -"if :const:`ssl.HAS_SNI` is true)." +"HTTPS virtual hosts are now supported if possible (that is, if :const:`ssl." +"HAS_SNI` is true)." msgstr "" "HTTPS 虛擬主機 (virtual hosts) 現已支援,只要 :const:`ssl.HAS_SNI` 的值為 " "true。" @@ -222,13 +222,13 @@ msgstr "*context* 被新增。" #: ../../library/urllib.request.rst:111 msgid "" -"HTTPS connection now send an ALPN extension with protocol indicator ``http/" -"1.1`` when no *context* is given. Custom *context* should set ALPN protocols " -"with :meth:`~ssl.SSLContext.set_alpn_protocols`." +"HTTPS connection now send an ALPN extension with protocol indicator " +"``http/1.1`` when no *context* is given. Custom *context* should set ALPN " +"protocols with :meth:`~ssl.SSLContext.set_alpn_protocols`." msgstr "" -"當 *context* 沒有被指定時,HTTPS 連線現在會傳送一個帶有協定指示器 ``http/" -"1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利" -"用 :meth:`~ssl.SSLContext.set_alpn_protocols` 來自行設定 ALPN 協定。" +"當 *context* 沒有被指定時,HTTPS 連線現在會傳送一個帶有協定指示器 " +"``http/1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利用 :meth:`~ssl." +"SSLContext.set_alpn_protocols` 來自行設定 ALPN 協定。" #: ../../library/urllib.request.rst:116 msgid "" @@ -240,16 +240,15 @@ msgstr "" msgid "" "Install an :class:`OpenerDirector` instance as the default global opener. " "Installing an opener is only necessary if you want urlopen to use that " -"opener; otherwise, simply call :meth:`OpenerDirector.open` instead " -"of :func:`~urllib.request.urlopen`. The code does not check for a " -"real :class:`OpenerDirector`, and any class with the appropriate interface " -"will work." +"opener; otherwise, simply call :meth:`OpenerDirector.open` instead of :func:" +"`~urllib.request.urlopen`. The code does not check for a real :class:" +"`OpenerDirector`, and any class with the appropriate interface will work." msgstr "" "安裝一個 :class:`OpenerDirector` 實例作為預設的全域 opener。僅在當你想要讓 " -"urlopen 使用該 opener 時安裝一個 opener,否則的話應直接呼" -"叫 :meth:`OpenerDirector.open` 而非 :func:`~urllib.request.urlopen`。程式碼不" -"會檢查 class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 " -"class 都能適用。" +"urlopen 使用該 opener 時安裝一個 opener,否則的話應直接呼叫 :meth:" +"`OpenerDirector.open` 而非 :func:`~urllib.request.urlopen`。程式碼不會檢查 " +"class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 class 都能適" +"用。" #: ../../library/urllib.request.rst:133 msgid "" @@ -259,15 +258,19 @@ msgid "" "call the constructor without any parameters). Instances of the following " "classes will be in front of the *handler*\\s, unless the *handler*\\s " "contain them, instances of them or subclasses of them: :class:`ProxyHandler` " -"(if proxy settings are " -"detected), :class:`UnknownHandler`, :class:`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:`HTTPErrorProcessor`." +"(if proxy settings are detected), :class:`UnknownHandler`, :class:" +"`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:" +"`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:" +"`HTTPErrorProcessor`." msgstr "" "回傳一個 :class:`OpenerDirector` 實例,以給定的順序把 handlers 串接起來。" "*handler*\\s 可以是 :class:`BaseHandler` 的實例,亦或是 :class:`BaseHandler` " "的 subclasses(這個情況下必須有不帶參數的建構函式能夠被呼叫)。以下 classes " "的實例順位會在 *handler*\\s 之前,除非 *handler*\\s 已經包含它們,是它們的實" "例,或是它們的 subclasses::class:`ProxyHandler`\\ (如果代理服務設定被偵測" -"到)、:class:`UnknownHandler`、:class:`HTTPHandler`、:class:`HTTPDefaultErrorHandler`、:class:`HTTPRedirectHandler`、:class:`FTPHandler`、:class:`FileHandler`、:class:`HTTPErrorProcessor`。" +"到)、:class:`UnknownHandler`、:class:`HTTPHandler`、:class:" +"`HTTPDefaultErrorHandler`、:class:`HTTPRedirectHandler`、:class:" +"`FTPHandler`、:class:`FileHandler`、:class:`HTTPErrorProcessor`。" #: ../../library/urllib.request.rst:143 msgid "" @@ -287,10 +290,10 @@ msgstr "" #: ../../library/urllib.request.rst:152 msgid "" -"Convert the given local path to a ``file:`` URL. This function " -"uses :func:`~urllib.parse.quote` function to encode the path. For historical " -"reasons, the return value omits the ``file:`` scheme prefix. This example " -"shows the function being used on Windows::" +"Convert the given local path to a ``file:`` URL. This function uses :func:" +"`~urllib.parse.quote` function to encode the path. For historical reasons, " +"the return value omits the ``file:`` scheme prefix. This example shows the " +"function being used on Windows::" msgstr "" #: ../../library/urllib.request.rst:157 @@ -307,10 +310,10 @@ msgstr "" #: ../../library/urllib.request.rst:165 msgid "" -"Convert the given ``file:`` URL to a local path. This function " -"uses :func:`~urllib.parse.unquote` to decode the URL. For historical " -"reasons, the given value *must* omit the ``file:`` scheme prefix. This " -"example shows the function being used on Windows::" +"Convert the given ``file:`` URL to a local path. This function uses :func:" +"`~urllib.parse.unquote` to decode the URL. For historical reasons, the given " +"value *must* omit the ``file:`` scheme prefix. This example shows the " +"function being used on Windows::" msgstr "" #: ../../library/urllib.request.rst:170 @@ -392,11 +395,11 @@ msgstr "" #: ../../library/urllib.request.rst:214 msgid "" -"For an HTTP POST request method, *data* should be a buffer in the " -"standard :mimetype:`application/x-www-form-urlencoded` format. " -"The :func:`urllib.parse.urlencode` function takes a mapping or sequence of 2-" -"tuples and returns an ASCII string in this format. It should be encoded to " -"bytes before being used as the *data* parameter." +"For an HTTP POST request method, *data* should be a buffer in the standard :" +"mimetype:`application/x-www-form-urlencoded` format. The :func:`urllib." +"parse.urlencode` function takes a mapping or sequence of 2-tuples and " +"returns an ASCII string in this format. It should be encoded to bytes before " +"being used as the *data* parameter." msgstr "" "對於一個 HTTP POST 請求方法,*data* 應為一個標準 :mimetype:`application/x-" "www-form-urlencoded` 格式的 buffer。:func:`urllib.parse.urlencode` 方法接受一" @@ -405,10 +408,10 @@ msgstr "" #: ../../library/urllib.request.rst:220 msgid "" -"*headers* should be a dictionary, and will be treated as " -"if :meth:`add_header` was called with each key and value as arguments. This " -"is often used to \"spoof\" the ``User-Agent`` header value, which is used by " -"a browser to identify itself -- some HTTP servers only allow requests coming " +"*headers* should be a dictionary, and will be treated as if :meth:" +"`add_header` was called with each key and value as arguments. This is often " +"used to \"spoof\" the ``User-Agent`` header value, which is used by a " +"browser to identify itself -- some HTTP servers only allow requests coming " "from common browsers as opposed to scripts. For example, Mozilla Firefox may " "identify itself as ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 " "Firefox/2.0.0.11\"``, while :mod:`urllib`'s default user agent string is " @@ -419,9 +422,10 @@ msgstr "" "叫 :meth:`add_header`。經常用於「偽裝」 ``User-Agent`` header 的值,這個 " "header 是用來讓一個瀏覽器向伺服器表明自己的身分 --- 有些 HTTP 伺服器僅允許來" "自普通瀏覽器的請求,而不接受來自程式腳本的請求。例如,Mozilla Firefox 會將 " -"header 的值設為 ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/" -"2.0.0.11\"``,而 :mod:`urllib` 的值則是 ``\"Python-urllib/2.6\"``\\ (在 " -"Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳送。" +"header 的值設為 ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 " +"Firefox/2.0.0.11\"``,而 :mod:`urllib` 的值則是 ``\"Python-urllib/2.6\"``\\ " +"(在 Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳" +"送。" #: ../../library/urllib.request.rst:231 msgid "" @@ -444,16 +448,16 @@ msgstr "" #: ../../library/urllib.request.rst:239 msgid "" "*origin_req_host* should be the request-host of the origin transaction, as " -"defined by :rfc:`2965`. It defaults to " -"``http.cookiejar.request_host(self)``. This is the host name or IP address " -"of the original request that was initiated by the user. For example, if the " -"request is for an image in an HTML document, this should be the request-host " -"of the request for the page containing the image." +"defined by :rfc:`2965`. It defaults to ``http.cookiejar." +"request_host(self)``. This is the host name or IP address of the original " +"request that was initiated by the user. For example, if the request is for " +"an image in an HTML document, this should be the request-host of the request " +"for the page containing the image." msgstr "" -"*origin_req_host* 應為原始傳輸互動的請求主機 (request-host),如同" -"在 :rfc:`2965` 中的定義。預設值為 ``http.cookiejar.request_host(self)``。這是" -"使用者發起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中" -"的一個影像,則這個屬性應為請求包含影像頁面的請求主機。" +"*origin_req_host* 應為原始傳輸互動的請求主機 (request-host),如同在 :rfc:" +"`2965` 中的定義。預設值為 ``http.cookiejar.request_host(self)``。這是使用者發" +"起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中的一個影" +"像,則這個屬性應為請求包含影像頁面的請求主機。" #: ../../library/urllib.request.rst:247 msgid "" @@ -471,11 +475,11 @@ msgstr "" #: ../../library/urllib.request.rst:254 msgid "" "*method* should be a string that indicates the HTTP request method that will " -"be used (e.g. ``'HEAD'``). If provided, its value is stored in " -"the :attr:`~Request.method` attribute and is used by :meth:`get_method`. The " -"default is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. " -"Subclasses may indicate a different default method by setting " -"the :attr:`~Request.method` attribute in the class itself." +"be used (e.g. ``'HEAD'``). If provided, its value is stored in the :attr:" +"`~Request.method` attribute and is used by :meth:`get_method`. The default " +"is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. Subclasses may " +"indicate a different default method by setting the :attr:`~Request.method` " +"attribute in the class itself." msgstr "" "*method* 應為一個標示 HTTP 請求方法的字串(例如:``'HEAD'``)。如果有提供值," "則會被存在 :attr:`~Request.method` 屬性中且被 :meth:`get_method` 所使用。當 " @@ -594,9 +598,9 @@ msgstr "" msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " -"that is compatible with :class:`HTTPPasswordMgr`; refer to " -"section :ref:`http-password-mgr` for information on the interface that must " -"be supported. If *passwd_mgr* also provides ``is_authenticated`` and " +"that is compatible with :class:`HTTPPasswordMgr`; refer to section :ref:" +"`http-password-mgr` for information on the interface that must be " +"supported. If *passwd_mgr* also provides ``is_authenticated`` and " "``update_authenticated`` methods (see :ref:`http-password-mgr-with-prior-" "auth`), then the handler will use the ``is_authenticated`` result for a " "given URI to determine whether or not to send authentication credentials " @@ -634,9 +638,8 @@ msgstr "" msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " -"that is compatible with :class:`HTTPPasswordMgr`; refer to " -"section :ref:`http-password-mgr` for information on the interface that must " -"be supported." +"that is compatible with :class:`HTTPPasswordMgr`; refer to section :ref:" +"`http-password-mgr` for information on the interface that must be supported." msgstr "" #: ../../library/urllib.request.rst:404 @@ -712,9 +715,9 @@ msgstr "" #: ../../library/urllib.request.rst:487 msgid "" -"Request.full_url is a property with setter, getter and a deleter. " -"Getting :attr:`~Request.full_url` returns the original request URL with the " -"fragment, if it was present." +"Request.full_url is a property with setter, getter and a deleter. Getting :" +"attr:`~Request.full_url` returns the original request URL with the fragment, " +"if it was present." msgstr "" #: ../../library/urllib.request.rst:493 @@ -749,8 +752,8 @@ msgstr "" #: ../../library/urllib.request.rst:519 msgid "" -"boolean, indicates whether the request is unverifiable as defined " -"by :rfc:`2965`." +"boolean, indicates whether the request is unverifiable as defined by :rfc:" +"`2965`." msgstr "" #: ../../library/urllib.request.rst:524 @@ -772,10 +775,10 @@ msgstr "" #: ../../library/urllib.request.rst:541 msgid "" -"Return a string indicating the HTTP request method. " -"If :attr:`Request.method` is not ``None``, return its value, otherwise " -"return ``'GET'`` if :attr:`Request.data` is ``None``, or ``'POST'`` if it's " -"not. This is only meaningful for HTTP requests." +"Return a string indicating the HTTP request method. If :attr:`Request." +"method` is not ``None``, return its value, otherwise return ``'GET'`` if :" +"attr:`Request.data` is ``None``, or ``'POST'`` if it's not. This is only " +"meaningful for HTTP requests." msgstr "" #: ../../library/urllib.request.rst:546 @@ -856,10 +859,10 @@ msgid "" "*handler* should be an instance of :class:`BaseHandler`. The following " "methods are searched, and added to the possible chains (note that HTTP " "errors are a special case). Note that, in the following, *protocol* should " -"be replaced with the actual protocol to handle, for " -"example :meth:`http_response` would be the HTTP protocol response handler. " -"Also *type* should be replaced with the actual HTTP code, for " -"example :meth:`http_error_404` would handle HTTP 404 errors." +"be replaced with the actual protocol to handle, for example :meth:" +"`http_response` would be the HTTP protocol response handler. Also *type* " +"should be replaced with the actual HTTP code, for example :meth:" +"`http_error_404` would handle HTTP 404 errors." msgstr "" #: ../../library/urllib.request.rst:631 @@ -953,27 +956,25 @@ msgstr "" #: ../../library/urllib.request.rst:689 msgid "" "Handlers with a method named like :meth:`!_open` are called to " -"handle the request. This stage ends when a handler either returns a non-" -"\\ :const:`None` value (ie. a response), or raises an exception " -"(usually :exc:`~urllib.error.URLError`). Exceptions are allowed to " -"propagate." +"handle the request. This stage ends when a handler either returns a non-\\ :" +"const:`None` value (ie. a response), or raises an exception (usually :exc:" +"`~urllib.error.URLError`). Exceptions are allowed to propagate." msgstr "" #: ../../library/urllib.request.rst:694 msgid "" -"In fact, the above algorithm is first tried for methods " -"named :meth:`~BaseHandler.default_open`. If all such methods " -"return :const:`None`, the algorithm is repeated for methods named " -"like :meth:`!_open`. If all such methods return :const:`None`, " -"the algorithm is repeated for methods " +"In fact, the above algorithm is first tried for methods named :meth:" +"`~BaseHandler.default_open`. If all such methods return :const:`None`, the " +"algorithm is repeated for methods named like :meth:`!_open`. If " +"all such methods return :const:`None`, the algorithm is repeated for methods " "named :meth:`~BaseHandler.unknown_open`." msgstr "" #: ../../library/urllib.request.rst:700 msgid "" "Note that the implementation of these methods may involve calls of the " -"parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` " -"and :meth:`~OpenerDirector.error` methods." +"parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and :" +"meth:`~OpenerDirector.error` methods." msgstr "" #: ../../library/urllib.request.rst:704 @@ -1010,8 +1011,8 @@ msgstr "" #: ../../library/urllib.request.rst:732 msgid "" "The convention has been adopted that subclasses defining :meth:`!" -"_request` or :meth:`!_response` methods are " -"named :class:`!\\*Processor`; all others are named :class:`!\\*Handler`." +"_request` or :meth:`!_response` methods are named :class:" +"`!\\*Processor`; all others are named :class:`!\\*Handler`." msgstr "" #: ../../library/urllib.request.rst:739 @@ -1028,13 +1029,12 @@ msgstr "" #: ../../library/urllib.request.rst:748 msgid "" -"This method, if implemented, will be called by the " -"parent :class:`OpenerDirector`. It should return a file-like object as " -"described in the return value of the :meth:`~OpenerDirector.open` method " -"of :class:`OpenerDirector`, or ``None``. It should " -"raise :exc:`~urllib.error.URLError`, unless a truly exceptional thing " -"happens (for example, :exc:`MemoryError` should not be mapped " -"to :exc:`~urllib.error.URLError`)." +"This method, if implemented, will be called by the parent :class:" +"`OpenerDirector`. It should return a file-like object as described in the " +"return value of the :meth:`~OpenerDirector.open` method of :class:" +"`OpenerDirector`, or ``None``. It should raise :exc:`~urllib.error." +"URLError`, unless a truly exceptional thing happens (for example, :exc:" +"`MemoryError` should not be mapped to :exc:`~urllib.error.URLError`)." msgstr "" #: ../../library/urllib.request.rst:755 @@ -1049,9 +1049,9 @@ msgstr "" #: ../../library/urllib.request.rst:765 msgid "" -"This method, if defined, will be called by the " -"parent :class:`OpenerDirector`. Return values should be the same as " -"for :meth:`~BaseHandler.default_open`." +"This method, if defined, will be called by the parent :class:" +"`OpenerDirector`. Return values should be the same as for :meth:" +"`~BaseHandler.default_open`." msgstr "" #: ../../library/urllib.request.rst:771 @@ -1063,18 +1063,18 @@ msgstr "" #: ../../library/urllib.request.rst:775 msgid "" -"This method, if implemented, will be called by " -"the :attr:`parent` :class:`OpenerDirector`. Return values should be the " -"same as for :meth:`default_open`." +"This method, if implemented, will be called by the :attr:`parent` :class:" +"`OpenerDirector`. Return values should be the same as for :meth:" +"`default_open`." msgstr "" #: ../../library/urllib.request.rst:782 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "override it if they intend to provide a catch-all for otherwise unhandled " -"HTTP errors. It will be called automatically by " -"the :class:`OpenerDirector` getting the error, and should not normally be " -"called in other circumstances." +"HTTP errors. It will be called automatically by the :class:" +"`OpenerDirector` getting the error, and should not normally be called in " +"other circumstances." msgstr "" #: ../../library/urllib.request.rst:787 @@ -1087,8 +1087,8 @@ msgstr "" #: ../../library/urllib.request.rst:792 msgid "" -"Return values and exceptions raised should be the same as those " -"of :func:`urlopen`." +"Return values and exceptions raised should be the same as those of :func:" +"`urlopen`." msgstr "" #: ../../library/urllib.request.rst:799 @@ -1104,8 +1104,8 @@ msgstr "" #: ../../library/urllib.request.rst:805 msgid "" -"Arguments, return values and exceptions raised should be the same as " -"for :meth:`~BaseHandler.http_error_default`." +"Arguments, return values and exceptions raised should be the same as for :" +"meth:`~BaseHandler.http_error_default`." msgstr "" #: ../../library/urllib.request.rst:813 @@ -1116,9 +1116,9 @@ msgstr "" #: ../../library/urllib.request.rst:816 msgid "" -"This method, if defined, will be called by the " -"parent :class:`OpenerDirector`. *req* will be a :class:`Request` object. The " -"return value should be a :class:`Request` object." +"This method, if defined, will be called by the parent :class:" +"`OpenerDirector`. *req* will be a :class:`Request` object. The return value " +"should be a :class:`Request` object." msgstr "" #: ../../library/urllib.request.rst:825 @@ -1129,11 +1129,11 @@ msgstr "" #: ../../library/urllib.request.rst:828 msgid "" -"This method, if defined, will be called by the " -"parent :class:`OpenerDirector`. *req* will be a :class:`Request` object. " -"*response* will be an object implementing the same interface as the return " -"value of :func:`urlopen`. The return value should implement the same " -"interface as the return value of :func:`urlopen`." +"This method, if defined, will be called by the parent :class:" +"`OpenerDirector`. *req* will be a :class:`Request` object. *response* will " +"be an object implementing the same interface as the return value of :func:" +"`urlopen`. The return value should implement the same interface as the " +"return value of :func:`urlopen`." msgstr "" #: ../../library/urllib.request.rst:838 @@ -1160,19 +1160,18 @@ msgid "" "called by the default implementations of the :meth:`!http_error_30\\*` " "methods when a redirection is received from the server. If a redirection " "should take place, return a new :class:`Request` to allow :meth:`!" -"http_error_30\\*` to perform the redirect to *newurl*. Otherwise, " -"raise :exc:`~urllib.error.HTTPError` if no other handler should try to " -"handle this URL, or return ``None`` if you can't but another handler might." +"http_error_30\\*` to perform the redirect to *newurl*. Otherwise, raise :" +"exc:`~urllib.error.HTTPError` if no other handler should try to handle this " +"URL, or return ``None`` if you can't but another handler might." msgstr "" #: ../../library/urllib.request.rst:863 msgid "" -"The default implementation of this method does not strictly " -"follow :rfc:`2616`, which says that 301 and 302 responses to ``POST`` " -"requests must not be automatically redirected without confirmation by the " -"user. In reality, browsers do allow automatic redirection of these " -"responses, changing the POST to a ``GET``, and the default implementation " -"reproduces this behavior." +"The default implementation of this method does not strictly follow :rfc:" +"`2616`, which says that 301 and 302 responses to ``POST`` requests must not " +"be automatically redirected without confirmation by the user. In reality, " +"browsers do allow automatic redirection of these responses, changing the " +"POST to a ``GET``, and the default implementation reproduces this behavior." msgstr "" #: ../../library/urllib.request.rst:872 @@ -1237,8 +1236,8 @@ msgstr "HTTPPasswordMgr 物件" #: ../../library/urllib.request.rst:935 msgid "" -"These methods are available on :class:`HTTPPasswordMgr` " -"and :class:`HTTPPasswordMgrWithDefaultRealm` objects." +"These methods are available on :class:`HTTPPasswordMgr` and :class:" +"`HTTPPasswordMgrWithDefaultRealm` objects." msgstr "" #: ../../library/urllib.request.rst:941 @@ -1274,10 +1273,10 @@ msgstr "" #: ../../library/urllib.request.rst:968 msgid "" -"*realm*, *uri*, *user*, *passwd* are as " -"for :meth:`HTTPPasswordMgr.add_password`. *is_authenticated* sets the " -"initial value of the ``is_authenticated`` flag for the given URI or list of " -"URIs. If *is_authenticated* is specified as ``True``, *realm* is ignored." +"*realm*, *uri*, *user*, *passwd* are as for :meth:`HTTPPasswordMgr." +"add_password`. *is_authenticated* sets the initial value of the " +"``is_authenticated`` flag for the given URI or list of URIs. If " +"*is_authenticated* is specified as ``True``, *realm* is ignored." msgstr "" #: ../../library/urllib.request.rst:976 @@ -1303,8 +1302,8 @@ msgid "" "Handle an authentication request by getting a user/password pair, and re-" "trying the request. *authreq* should be the name of the header where the " "information about the realm is included in the request, *host* specifies the " -"URL and path to authenticate for, *req* should be the " -"(failed) :class:`Request` object, and *headers* should be the error headers." +"URL and path to authenticate for, *req* should be the (failed) :class:" +"`Request` object, and *headers* should be the error headers." msgstr "" #: ../../library/urllib.request.rst:1006 @@ -1354,8 +1353,8 @@ msgstr "HTTPHandler 物件" #: ../../library/urllib.request.rst:1078 msgid "" -"Send an HTTP request, which can be either GET or POST, depending on " -"``req.has_data()``." +"Send an HTTP request, which can be either GET or POST, depending on ``req." +"data``." msgstr "" #: ../../library/urllib.request.rst:1085 @@ -1364,8 +1363,8 @@ msgstr "HTTPSHandler 物件" #: ../../library/urllib.request.rst:1090 msgid "" -"Send an HTTPS request, which can be either GET or POST, depending on " -"``req.has_data()``." +"Send an HTTPS request, which can be either GET or POST, depending on ``req." +"data``." msgstr "" #: ../../library/urllib.request.rst:1097 @@ -1446,8 +1445,8 @@ msgstr "" msgid "" "For non-200 error codes, this simply passes the job on to the :meth:`!" "http_error_\\` handler methods, via :meth:`OpenerDirector.error`. " -"Eventually, :class:`HTTPDefaultErrorHandler` will raise " -"an :exc:`~urllib.error.HTTPError` if no other handler handles the error." +"Eventually, :class:`HTTPDefaultErrorHandler` will raise an :exc:`~urllib." +"error.HTTPError` if no other handler handles the error." msgstr "" #: ../../library/urllib.request.rst:1186 @@ -1534,8 +1533,8 @@ msgstr "" #: ../../library/urllib.request.rst:1230 msgid "" -"It is also possible to achieve the same result without using " -"the :term:`context manager` approach::" +"It is also possible to achieve the same result without using the :term:" +"`context manager` approach::" msgstr "" #: ../../library/urllib.request.rst:1233 @@ -1644,11 +1643,11 @@ msgstr "" #: ../../library/urllib.request.rst:1288 msgid "" -":func:`build_opener` provides many handlers by default, including " -"a :class:`ProxyHandler`. By default, :class:`ProxyHandler` uses the " -"environment variables named ``_proxy``, where ```` is the " -"URL scheme involved. For example, the :envvar:`!http_proxy` environment " -"variable is read to obtain the HTTP proxy's URL." +":func:`build_opener` provides many handlers by default, including a :class:" +"`ProxyHandler`. By default, :class:`ProxyHandler` uses the environment " +"variables named ``_proxy``, where ```` is the URL scheme " +"involved. For example, the :envvar:`!http_proxy` environment variable is " +"read to obtain the HTTP proxy's URL." msgstr "" #: ../../library/urllib.request.rst:1294 @@ -1660,8 +1659,8 @@ msgstr "" #: ../../library/urllib.request.rst:1298 msgid "" -"proxy_handler = urllib.request.ProxyHandler({'http': 'http://" -"www.example.com:3128/'})\n" +"proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example." +"com:3128/'})\n" "proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()\n" "proxy_auth_handler.add_password('realm', 'host', 'username', 'password')\n" "\n" @@ -1670,8 +1669,8 @@ msgid "" "with opener.open('http://www.example.com/login.html') as f:\n" " print(f.read().decode('utf-8'))" msgstr "" -"proxy_handler = urllib.request.ProxyHandler({'http': 'http://" -"www.example.com:3128/'})\n" +"proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example." +"com:3128/'})\n" "proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()\n" "proxy_auth_handler.add_password('realm', 'host', 'username', 'password')\n" "\n" @@ -1728,10 +1727,9 @@ msgstr "" #: ../../library/urllib.request.rst:1329 msgid "" -"Also, remember that a few standard headers (:mailheader:`Content-" -"Length`, :mailheader:`Content-Type` and :mailheader:`Host`) are added when " -"the :class:`Request` is passed to :func:`urlopen` " -"(or :meth:`OpenerDirector.open`)." +"Also, remember that a few standard headers (:mailheader:`Content-Length`, :" +"mailheader:`Content-Type` and :mailheader:`Host`) are added when the :class:" +"`Request` is passed to :func:`urlopen` (or :meth:`OpenerDirector.open`)." msgstr "" #: ../../library/urllib.request.rst:1336 @@ -1843,9 +1841,9 @@ msgid "" "Copy a network object denoted by a URL to a local file. If the URL points to " "a local file, the object will not be copied unless filename is supplied. " "Return a tuple ``(filename, headers)`` where *filename* is the local file " -"name under which the object can be found, and *headers* is whatever " -"the :meth:`!info` method of the object returned by :func:`urlopen` returned " -"(for a remote object). Exceptions are the same as for :func:`urlopen`." +"name under which the object can be found, and *headers* is whatever the :" +"meth:`!info` method of the object returned by :func:`urlopen` returned (for " +"a remote object). Exceptions are the same as for :func:`urlopen`." msgstr "" #: ../../library/urllib.request.rst:1393 @@ -1867,14 +1865,14 @@ msgstr "" #: ../../library/urllib.request.rst:1404 msgid "" ">>> import urllib.request\n" -">>> local_filename, headers = urllib.request.urlretrieve('http://" -"python.org/')\n" +">>> local_filename, headers = urllib.request.urlretrieve('http://python." +"org/')\n" ">>> html = open(local_filename)\n" ">>> html.close()" msgstr "" ">>> import urllib.request\n" -">>> local_filename, headers = urllib.request.urlretrieve('http://" -"python.org/')\n" +">>> local_filename, headers = urllib.request.urlretrieve('http://python." +"org/')\n" ">>> html = open(local_filename)\n" ">>> html.close()" @@ -1882,9 +1880,9 @@ msgstr "" msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " -"type is ``GET``). The *data* argument must be a bytes object in " -"standard :mimetype:`application/x-www-form-urlencoded` format; see " -"the :func:`urllib.parse.urlencode` function." +"type is ``GET``). The *data* argument must be a bytes object in standard :" +"mimetype:`application/x-www-form-urlencoded` format; see the :func:`urllib." +"parse.urlencode` function." msgstr "" #: ../../library/urllib.request.rst:1415 @@ -1924,8 +1922,8 @@ msgstr "" #: ../../library/urllib.request.rst:1440 msgid "" "Base class for opening and reading URLs. Unless you need to support opening " -"objects using schemes other than :file:`http:`, :file:`ftp:`, " -"or :file:`file:`, you probably want to use :class:`FancyURLopener`." +"objects using schemes other than :file:`http:`, :file:`ftp:`, or :file:`file:" +"`, you probably want to use :class:`FancyURLopener`." msgstr "" #: ../../library/urllib.request.rst:1444 @@ -1965,8 +1963,8 @@ msgid "" "Open *fullurl* using the appropriate protocol. This method sets up cache " "and proxy information, then calls the appropriate open method with its input " "arguments. If the scheme is not recognized, :meth:`open_unknown` is called. " -"The *data* argument has the same meaning as the *data* argument " -"of :func:`urlopen`." +"The *data* argument has the same meaning as the *data* argument of :func:" +"`urlopen`." msgstr "" #: ../../library/urllib.request.rst:1471 @@ -1980,35 +1978,35 @@ msgstr "" #: ../../library/urllib.request.rst:1480 msgid "" "Retrieves the contents of *url* and places it in *filename*. The return " -"value is a tuple consisting of a local filename and either " -"an :class:`email.message.Message` object containing the response headers " -"(for remote URLs) or ``None`` (for local URLs). The caller must then open " -"and read the contents of *filename*. If *filename* is not given and the URL " -"refers to a local file, the input filename is returned. If the URL is non-" -"local and *filename* is not given, the filename is the output " -"of :func:`tempfile.mktemp` with a suffix that matches the suffix of the last " -"path component of the input URL. If *reporthook* is given, it must be a " -"function accepting three numeric parameters: A chunk number, the maximum " -"size chunks are read in and the total size of the download (-1 if unknown). " -"It will be called once at the start and after each chunk of data is read " -"from the network. *reporthook* is ignored for local URLs." +"value is a tuple consisting of a local filename and either an :class:`email." +"message.Message` object containing the response headers (for remote URLs) or " +"``None`` (for local URLs). The caller must then open and read the contents " +"of *filename*. If *filename* is not given and the URL refers to a local " +"file, the input filename is returned. If the URL is non-local and " +"*filename* is not given, the filename is the output of :func:`tempfile." +"mktemp` with a suffix that matches the suffix of the last path component of " +"the input URL. If *reporthook* is given, it must be a function accepting " +"three numeric parameters: A chunk number, the maximum size chunks are read " +"in and the total size of the download (-1 if unknown). It will be called " +"once at the start and after each chunk of data is read from the network. " +"*reporthook* is ignored for local URLs." msgstr "" #: ../../library/urllib.request.rst:1493 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " -"type is ``GET``). The *data* argument must in " -"standard :mimetype:`application/x-www-form-urlencoded` format; see " -"the :func:`urllib.parse.urlencode` function." +"type is ``GET``). The *data* argument must in standard :mimetype:" +"`application/x-www-form-urlencoded` format; see the :func:`urllib.parse." +"urlencode` function." msgstr "" #: ../../library/urllib.request.rst:1502 msgid "" -"Variable that specifies the user agent of the opener object. To " -"get :mod:`urllib` to tell servers that it is a particular user agent, set " -"this in a subclass as a class variable or in the constructor before calling " -"the base constructor." +"Variable that specifies the user agent of the opener object. To get :mod:" +"`urllib` to tell servers that it is a particular user agent, set this in a " +"subclass as a class variable or in the constructor before calling the base " +"constructor." msgstr "" #: ../../library/urllib.request.rst:1512 @@ -2024,9 +2022,9 @@ msgstr "" #: ../../library/urllib.request.rst:1519 msgid "" -"For all other response codes, the " -"method :meth:`~BaseHandler.http_error_default` is called which you can " -"override in subclasses to handle the error appropriately." +"For all other response codes, the method :meth:`~BaseHandler." +"http_error_default` is called which you can override in subclasses to handle " +"the error appropriately." msgstr "" #: ../../library/urllib.request.rst:1524 @@ -2040,8 +2038,8 @@ msgstr "" #: ../../library/urllib.request.rst:1529 msgid "" -"The parameters to the constructor are the same as those " -"for :class:`URLopener`." +"The parameters to the constructor are the same as those for :class:" +"`URLopener`." msgstr "" #: ../../library/urllib.request.rst:1533 @@ -2118,9 +2116,9 @@ msgid "" "The data returned by :func:`urlopen` or :func:`urlretrieve` is the raw data " "returned by the server. This may be binary data (such as an image), plain " "text or (for example) HTML. The HTTP protocol provides type information in " -"the reply header, which can be inspected by looking at " -"the :mailheader:`Content-Type` header. If the returned data is HTML, you " -"can use the module :mod:`html.parser` to parse it." +"the reply header, which can be inspected by looking at the :mailheader:" +"`Content-Type` header. If the returned data is HTML, you can use the " +"module :mod:`html.parser` to parse it." msgstr "" #: ../../library/urllib.request.rst:1591 @@ -2149,9 +2147,9 @@ msgstr "" msgid "" "The :mod:`urllib.response` module defines functions and classes which define " "a minimal file-like interface, including ``read()`` and ``readline()``. " -"Functions defined by this module are used internally by " -"the :mod:`urllib.request` module. The typical response object is " -"a :class:`urllib.response.addinfourl` instance:" +"Functions defined by this module are used internally by the :mod:`urllib." +"request` module. The typical response object is a :class:`urllib.response." +"addinfourl` instance:" msgstr "" #: ../../library/urllib.request.rst:1622 @@ -2162,8 +2160,8 @@ msgstr "" #: ../../library/urllib.request.rst:1626 msgid "" -"Returns the headers of the response in the form of " -"an :class:`~email.message.EmailMessage` instance." +"Returns the headers of the response in the form of an :class:`~email.message." +"EmailMessage` instance." msgstr "" #: ../../library/urllib.request.rst:1632 @@ -2204,8 +2202,8 @@ msgstr "HTML" #~ "... print(f.read(300))\n" #~ "...\n" #~ "b'\\n\\n\\n\\n\\n\\n\\n\\n\\n\n" #~ "\\n\\n\\n\\n\\n\\n\\n\\n\\n\n" #~ " Date: Wed, 14 May 2025 00:16:38 +0000 Subject: [PATCH 03/14] sync with cpython 78a04b33 --- c-api/unicode.po | 371 ++++++++++++++++++++++++----------------------- 1 file changed, 190 insertions(+), 181 deletions(-) diff --git a/c-api/unicode.po b/c-api/unicode.po index f29bafb0e6..ac345f6a7c 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-30 00:15+0000\n" +"POT-Creation-Date: 2025-05-14 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -866,25 +866,34 @@ msgstr "" #: ../../c-api/unicode.rst:626 msgid "" +"Return a mapping suitable for decoding a custom single-byte encoding. Given " +"a Unicode string *string* of up to 256 characters representing an encoding " +"table, returns either a compact internal mapping object or a dictionary " +"mapping character ordinals to byte values. Raises a :exc:`TypeError` and " +"return ``NULL`` on invalid input. .. versionadded:: 3.2" +msgstr "" + +#: ../../c-api/unicode.rst:636 +msgid "" "Return the name of the default string encoding, ``\"utf-8\"``. See :func:" "`sys.getdefaultencoding`." msgstr "" -#: ../../c-api/unicode.rst:629 +#: ../../c-api/unicode.rst:639 msgid "" "The returned string does not need to be freed, and is valid until " "interpreter shutdown." msgstr "" -#: ../../c-api/unicode.rst:635 +#: ../../c-api/unicode.rst:645 msgid "Return the length of the Unicode object, in code points." msgstr "" -#: ../../c-api/unicode.rst:637 +#: ../../c-api/unicode.rst:647 msgid "On error, set an exception and return ``-1``." msgstr "發生錯誤時,設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:648 +#: ../../c-api/unicode.rst:658 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:`!" @@ -892,61 +901,61 @@ msgid "" "otherwise returns the number of copied characters." msgstr "" -#: ../../c-api/unicode.rst:659 +#: ../../c-api/unicode.rst:669 msgid "" "Fill a string with a character: write *fill_char* into ``unicode[start:" "start+length]``." msgstr "" -#: ../../c-api/unicode.rst:662 +#: ../../c-api/unicode.rst:672 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" -#: ../../c-api/unicode.rst:665 +#: ../../c-api/unicode.rst:675 msgid "" "Return the number of written character, or return ``-1`` and raise an " "exception on error." msgstr "" -#: ../../c-api/unicode.rst:674 +#: ../../c-api/unicode.rst:684 msgid "" "Write a character to a string. The string must have been created through :c:" "func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " "the string must not be shared, or have been hashed yet." msgstr "" -#: ../../c-api/unicode.rst:678 +#: ../../c-api/unicode.rst:688 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " "not out of bounds, and that the object can be modified safely (i.e. that it " "its reference count is one)." msgstr "" -#: ../../c-api/unicode.rst:682 +#: ../../c-api/unicode.rst:692 msgid "Return ``0`` on success, ``-1`` on error with an exception set." msgstr "成功時回傳 ``0``,發生錯誤時設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:689 +#: ../../c-api/unicode.rst:699 msgid "" "Read a character from a string. This function checks that *unicode* is a " "Unicode object and the index is not out of bounds, in contrast to :c:func:" "`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" -#: ../../c-api/unicode.rst:693 +#: ../../c-api/unicode.rst:703 msgid "Return character on success, ``-1`` on error with an exception set." msgstr "成功時回傳字元,發生錯誤時設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:701 +#: ../../c-api/unicode.rst:711 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " "character index *end* (excluded). Negative indices are not supported. On " "error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:711 +#: ../../c-api/unicode.rst:721 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " @@ -954,7 +963,7 @@ msgid "" "*unicode*). *buffer* is returned on success." msgstr "" -#: ../../c-api/unicode.rst:721 +#: ../../c-api/unicode.rst:731 msgid "" "Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" "func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" @@ -962,17 +971,17 @@ msgid "" "appended." msgstr "" -#: ../../c-api/unicode.rst:730 +#: ../../c-api/unicode.rst:740 msgid "Locale Encoding" msgstr "" -#: ../../c-api/unicode.rst:732 +#: ../../c-api/unicode.rst:742 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" -#: ../../c-api/unicode.rst:739 +#: ../../c-api/unicode.rst:749 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " @@ -981,21 +990,21 @@ msgid "" "null character but cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:746 +#: ../../c-api/unicode.rst:756 msgid "" "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" "term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:749 ../../c-api/unicode.rst:784 +#: ../../c-api/unicode.rst:759 ../../c-api/unicode.rst:794 msgid "This function ignores the :ref:`Python UTF-8 Mode `." msgstr "此函式會忽略 :ref:`Python UTF-8 模式 `。" -#: ../../c-api/unicode.rst:753 ../../c-api/unicode.rst:869 +#: ../../c-api/unicode.rst:763 ../../c-api/unicode.rst:879 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 函式。" -#: ../../c-api/unicode.rst:757 +#: ../../c-api/unicode.rst:767 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -1003,7 +1012,7 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:766 +#: ../../c-api/unicode.rst:776 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." @@ -1011,7 +1020,7 @@ msgstr "" "類似於 :c:func:`PyUnicode_DecodeLocaleAndSize`,但使用 :c:func:`!strlen` 計算" "字串長度。" -#: ../../c-api/unicode.rst:774 +#: ../../c-api/unicode.rst:784 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " @@ -1020,17 +1029,17 @@ msgid "" "`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:781 +#: ../../c-api/unicode.rst:791 msgid "" "Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" "`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:788 ../../c-api/unicode.rst:900 +#: ../../c-api/unicode.rst:798 ../../c-api/unicode.rst:910 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 函式。" -#: ../../c-api/unicode.rst:792 +#: ../../c-api/unicode.rst:802 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -1038,24 +1047,24 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:801 +#: ../../c-api/unicode.rst:811 msgid "File System Encoding" msgstr "檔案系統編碼" -#: ../../c-api/unicode.rst:803 +#: ../../c-api/unicode.rst:813 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" -#: ../../c-api/unicode.rst:806 +#: ../../c-api/unicode.rst:816 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " "``\"O&\"`` converter should be used, passing :c:func:`!" "PyUnicode_FSConverter` as the conversion function:" msgstr "" -#: ../../c-api/unicode.rst:812 +#: ../../c-api/unicode.rst:822 msgid "" ":ref:`PyArg_Parse\\* converter `: encode :class:`str` objects " "-- obtained directly or through the :class:`os.PathLike` interface -- to :" @@ -1068,24 +1077,24 @@ msgid "" "not allowed in the result. On failure, return ``0`` with an exception set." msgstr "" -#: ../../c-api/unicode.rst:824 +#: ../../c-api/unicode.rst:834 msgid "" "If *obj* is ``NULL``, the function releases a strong reference stored in the " "variable referred by *result* and returns ``1``." msgstr "" -#: ../../c-api/unicode.rst:829 ../../c-api/unicode.rst:856 +#: ../../c-api/unicode.rst:839 ../../c-api/unicode.rst:866 msgid "Accepts a :term:`path-like object`." msgstr "接受一個 :term:`path-like object`。" -#: ../../c-api/unicode.rst:832 +#: ../../c-api/unicode.rst:842 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " "converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: ../../c-api/unicode.rst:838 +#: ../../c-api/unicode.rst:848 msgid "" ":ref:`PyArg_Parse\\* converter `: decode :class:`bytes` objects " "-- obtained either directly or indirectly through the :class:`os.PathLike` " @@ -1099,63 +1108,63 @@ msgid "" "result. On failure, return ``0`` with an exception set." msgstr "" -#: ../../c-api/unicode.rst:851 +#: ../../c-api/unicode.rst:861 msgid "" "If *obj* is ``NULL``, release the strong reference to the object referred to " "by *result* and return ``1``." msgstr "" -#: ../../c-api/unicode.rst:862 +#: ../../c-api/unicode.rst:872 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:864 +#: ../../c-api/unicode.rst:874 msgid "" "If you need to decode a string from the current locale encoding, use :c:func:" "`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: ../../c-api/unicode.rst:871 ../../c-api/unicode.rst:884 -#: ../../c-api/unicode.rst:904 +#: ../../c-api/unicode.rst:881 ../../c-api/unicode.rst:894 +#: ../../c-api/unicode.rst:914 msgid "" "The :term:`filesystem error handler ` " "is now used." msgstr "" -#: ../../c-api/unicode.rst:878 +#: ../../c-api/unicode.rst:888 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: ../../c-api/unicode.rst:881 +#: ../../c-api/unicode.rst:891 msgid "" "If the string length is known, use :c:func:" "`PyUnicode_DecodeFSDefaultAndSize`." msgstr "如果字串長度已知,請使用 :c:func:`PyUnicode_DecodeFSDefaultAndSize`。" -#: ../../c-api/unicode.rst:891 +#: ../../c-api/unicode.rst:901 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" -#: ../../c-api/unicode.rst:895 +#: ../../c-api/unicode.rst:905 msgid "" "If you need to encode a string to the current locale encoding, use :c:func:" "`PyUnicode_EncodeLocale`." msgstr "" -#: ../../c-api/unicode.rst:909 +#: ../../c-api/unicode.rst:919 msgid "wchar_t Support" msgstr "wchar_t 支援" -#: ../../c-api/unicode.rst:911 +#: ../../c-api/unicode.rst:921 msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr "對支援 :c:type:`wchar_t` 的平台提供支援:" -#: ../../c-api/unicode.rst:915 +#: ../../c-api/unicode.rst:925 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " @@ -1163,7 +1172,7 @@ msgid "" "failure." msgstr "" -#: ../../c-api/unicode.rst:923 +#: ../../c-api/unicode.rst:933 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " @@ -1171,13 +1180,13 @@ msgid "" "`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -#: ../../c-api/unicode.rst:928 +#: ../../c-api/unicode.rst:938 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" -#: ../../c-api/unicode.rst:931 +#: ../../c-api/unicode.rst:941 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" "terminated. It is the responsibility of the caller to make sure that the :c:" @@ -1187,7 +1196,7 @@ msgid "" "most C functions." msgstr "" -#: ../../c-api/unicode.rst:941 +#: ../../c-api/unicode.rst:951 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " @@ -1198,37 +1207,37 @@ msgid "" "`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/unicode.rst:949 +#: ../../c-api/unicode.rst:959 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -#: ../../c-api/unicode.rst:956 +#: ../../c-api/unicode.rst:966 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: ../../c-api/unicode.rst:964 +#: ../../c-api/unicode.rst:974 msgid "Built-in Codecs" msgstr "內建編解碼器" -#: ../../c-api/unicode.rst:966 +#: ../../c-api/unicode.rst:976 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: ../../c-api/unicode.rst:969 +#: ../../c-api/unicode.rst:979 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: ../../c-api/unicode.rst:973 +#: ../../c-api/unicode.rst:983 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1236,28 +1245,28 @@ msgid "" "handler` internally." msgstr "" -#: ../../c-api/unicode.rst:978 +#: ../../c-api/unicode.rst:988 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: ../../c-api/unicode.rst:982 +#: ../../c-api/unicode.rst:992 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: ../../c-api/unicode.rst:987 +#: ../../c-api/unicode.rst:997 msgid "Generic Codecs" msgstr "泛用編解碼器" -#: ../../c-api/unicode.rst:989 +#: ../../c-api/unicode.rst:999 msgid "These are the generic codec APIs:" msgstr "這些是泛用編解碼器的 API:" -#: ../../c-api/unicode.rst:995 +#: ../../c-api/unicode.rst:1005 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1266,7 +1275,7 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1005 +#: ../../c-api/unicode.rst:1015 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1275,21 +1284,21 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1013 +#: ../../c-api/unicode.rst:1023 msgid "UTF-8 Codecs" msgstr "UTF-8 編解碼器" -#: ../../c-api/unicode.rst:1015 +#: ../../c-api/unicode.rst:1025 msgid "These are the UTF-8 codec APIs:" msgstr "這些是 UTF-8 編解碼器的 API:" -#: ../../c-api/unicode.rst:1020 +#: ../../c-api/unicode.rst:1030 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1027 +#: ../../c-api/unicode.rst:1037 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1297,20 +1306,20 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1035 +#: ../../c-api/unicode.rst:1045 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1039 ../../c-api/unicode.rst:1054 +#: ../../c-api/unicode.rst:1049 ../../c-api/unicode.rst:1064 msgid "" "The function fails if the string contains surrogate code points (``U+D800`` " "- ``U+DFFF``)." msgstr "" -#: ../../c-api/unicode.rst:1045 +#: ../../c-api/unicode.rst:1055 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1319,7 +1328,7 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: ../../c-api/unicode.rst:1051 +#: ../../c-api/unicode.rst:1061 msgid "" "On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " "return ``NULL``." @@ -1327,7 +1336,7 @@ msgstr "" "發生錯誤時,設定例外並將 *size* 設為 ``-1``\\ (如果不是 NULL),並回傳 " "``NULL``。" -#: ../../c-api/unicode.rst:1057 +#: ../../c-api/unicode.rst:1067 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1336,19 +1345,19 @@ msgid "" "collected." msgstr "" -#: ../../c-api/unicode.rst:1064 ../../c-api/unicode.rst:1086 +#: ../../c-api/unicode.rst:1074 ../../c-api/unicode.rst:1096 msgid "The return type is now ``const char *`` rather of ``char *``." msgstr "回傳型別現在是 ``const char *`` 而不是 ``char *``。" -#: ../../c-api/unicode.rst:1067 +#: ../../c-api/unicode.rst:1077 msgid "This function is a part of the :ref:`limited API `." msgstr "" -#: ../../c-api/unicode.rst:1073 +#: ../../c-api/unicode.rst:1083 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "與 :c:func:`PyUnicode_AsUTF8AndSize` 類似,但不儲存大小。" -#: ../../c-api/unicode.rst:1077 +#: ../../c-api/unicode.rst:1087 msgid "" "This function does not have any special behavior for `null characters " "`_ embedded within *unicode*. " @@ -1358,35 +1367,35 @@ msgid "" "c:func:`PyUnicode_AsUTF8AndSize` instead." msgstr "" -#: ../../c-api/unicode.rst:1091 +#: ../../c-api/unicode.rst:1101 msgid "UTF-32 Codecs" msgstr "UTF-32 編解碼器" -#: ../../c-api/unicode.rst:1093 +#: ../../c-api/unicode.rst:1103 msgid "These are the UTF-32 codec APIs:" msgstr "這些是 UTF-32 編解碼器的 API:" -#: ../../c-api/unicode.rst:1099 +#: ../../c-api/unicode.rst:1109 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1103 ../../c-api/unicode.rst:1153 +#: ../../c-api/unicode.rst:1113 ../../c-api/unicode.rst:1163 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: ../../c-api/unicode.rst:1106 ../../c-api/unicode.rst:1156 +#: ../../c-api/unicode.rst:1116 ../../c-api/unicode.rst:1166 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" -#: ../../c-api/unicode.rst:1110 +#: ../../c-api/unicode.rst:1120 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1394,21 +1403,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: ../../c-api/unicode.rst:1115 +#: ../../c-api/unicode.rst:1125 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1118 ../../c-api/unicode.rst:1169 +#: ../../c-api/unicode.rst:1128 ../../c-api/unicode.rst:1179 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: ../../c-api/unicode.rst:1120 ../../c-api/unicode.rst:1171 +#: ../../c-api/unicode.rst:1130 ../../c-api/unicode.rst:1181 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "如果編解碼器引發例外則回傳 ``NULL``。" -#: ../../c-api/unicode.rst:1126 +#: ../../c-api/unicode.rst:1136 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1417,29 +1426,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1135 +#: ../../c-api/unicode.rst:1145 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1141 +#: ../../c-api/unicode.rst:1151 msgid "UTF-16 Codecs" msgstr "UTF-16 編解碼器" -#: ../../c-api/unicode.rst:1143 +#: ../../c-api/unicode.rst:1153 msgid "These are the UTF-16 codec APIs:" msgstr "這些是 UTF-16 編解碼器的 API:" -#: ../../c-api/unicode.rst:1149 +#: ../../c-api/unicode.rst:1159 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1160 +#: ../../c-api/unicode.rst:1170 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1448,13 +1457,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: ../../c-api/unicode.rst:1166 +#: ../../c-api/unicode.rst:1176 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1177 +#: ../../c-api/unicode.rst:1187 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1464,28 +1473,28 @@ msgid "" "*consumed*." msgstr "" -#: ../../c-api/unicode.rst:1186 +#: ../../c-api/unicode.rst:1196 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1192 +#: ../../c-api/unicode.rst:1202 msgid "UTF-7 Codecs" msgstr "UTF-7 編解碼器" -#: ../../c-api/unicode.rst:1194 +#: ../../c-api/unicode.rst:1204 msgid "These are the UTF-7 codec APIs:" msgstr "這些是 UTF-7 編解碼器的 API:" -#: ../../c-api/unicode.rst:1199 +#: ../../c-api/unicode.rst:1209 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1206 +#: ../../c-api/unicode.rst:1216 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1493,101 +1502,101 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1213 +#: ../../c-api/unicode.rst:1223 msgid "Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1215 +#: ../../c-api/unicode.rst:1225 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1221 +#: ../../c-api/unicode.rst:1231 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1227 +#: ../../c-api/unicode.rst:1237 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1233 +#: ../../c-api/unicode.rst:1243 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1235 +#: ../../c-api/unicode.rst:1245 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1241 +#: ../../c-api/unicode.rst:1251 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1247 +#: ../../c-api/unicode.rst:1257 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1253 +#: ../../c-api/unicode.rst:1263 msgid "Latin-1 Codecs" msgstr "Latin-1 編解碼器" -#: ../../c-api/unicode.rst:1255 +#: ../../c-api/unicode.rst:1265 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: ../../c-api/unicode.rst:1261 +#: ../../c-api/unicode.rst:1271 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1267 +#: ../../c-api/unicode.rst:1277 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1273 +#: ../../c-api/unicode.rst:1283 msgid "ASCII Codecs" msgstr "ASCII 編解碼器" -#: ../../c-api/unicode.rst:1275 +#: ../../c-api/unicode.rst:1285 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: ../../c-api/unicode.rst:1281 +#: ../../c-api/unicode.rst:1291 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1287 +#: ../../c-api/unicode.rst:1297 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1293 +#: ../../c-api/unicode.rst:1303 msgid "Character Map Codecs" msgstr "" -#: ../../c-api/unicode.rst:1295 +#: ../../c-api/unicode.rst:1305 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1597,18 +1606,18 @@ msgid "" "sequences work well." msgstr "" -#: ../../c-api/unicode.rst:1301 +#: ../../c-api/unicode.rst:1311 msgid "These are the mapping codec APIs:" msgstr "這些是對映編解碼器的 API:" -#: ../../c-api/unicode.rst:1306 +#: ../../c-api/unicode.rst:1316 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1310 +#: ../../c-api/unicode.rst:1320 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1618,14 +1627,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1321 +#: ../../c-api/unicode.rst:1331 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1325 +#: ../../c-api/unicode.rst:1335 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1633,41 +1642,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1331 +#: ../../c-api/unicode.rst:1341 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: ../../c-api/unicode.rst:1335 +#: ../../c-api/unicode.rst:1345 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: ../../c-api/unicode.rst:1339 +#: ../../c-api/unicode.rst:1349 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: ../../c-api/unicode.rst:1342 +#: ../../c-api/unicode.rst:1352 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: ../../c-api/unicode.rst:1346 +#: ../../c-api/unicode.rst:1356 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: ../../c-api/unicode.rst:1351 +#: ../../c-api/unicode.rst:1361 msgid "MBCS codecs for Windows" msgstr "Windows 的 MBCS 編解碼器" -#: ../../c-api/unicode.rst:1353 +#: ../../c-api/unicode.rst:1363 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1675,13 +1684,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: ../../c-api/unicode.rst:1360 +#: ../../c-api/unicode.rst:1370 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1367 +#: ../../c-api/unicode.rst:1377 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1689,50 +1698,50 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1376 +#: ../../c-api/unicode.rst:1386 msgid "" "Similar to :c:func:`PyUnicode_DecodeMBCSStateful`, except uses the code page " "specified by *code_page*." msgstr "" -#: ../../c-api/unicode.rst:1382 +#: ../../c-api/unicode.rst:1392 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1389 +#: ../../c-api/unicode.rst:1399 msgid "" "Encode the Unicode object using the specified code page and return a Python " "bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" "c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" -#: ../../c-api/unicode.rst:1397 +#: ../../c-api/unicode.rst:1407 msgid "Methods & Slots" msgstr "" -#: ../../c-api/unicode.rst:1403 +#: ../../c-api/unicode.rst:1413 msgid "Methods and Slot Functions" msgstr "" -#: ../../c-api/unicode.rst:1405 +#: ../../c-api/unicode.rst:1415 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: ../../c-api/unicode.rst:1409 +#: ../../c-api/unicode.rst:1419 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." msgstr "如果發生例外,則回傳 ``NULL`` 或 ``-1``。" -#: ../../c-api/unicode.rst:1414 +#: ../../c-api/unicode.rst:1424 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1419 +#: ../../c-api/unicode.rst:1429 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1741,33 +1750,33 @@ msgid "" "list." msgstr "" -#: ../../c-api/unicode.rst:1424 ../../c-api/unicode.rst:1434 -#: ../../c-api/unicode.rst:1455 ../../c-api/unicode.rst:1468 +#: ../../c-api/unicode.rst:1434 ../../c-api/unicode.rst:1444 +#: ../../c-api/unicode.rst:1465 ../../c-api/unicode.rst:1478 msgid "On error, return ``NULL`` with an exception set." msgstr "於錯誤發生時回傳 ``NULL`` 並設定例外。" -#: ../../c-api/unicode.rst:1426 +#: ../../c-api/unicode.rst:1436 msgid "Equivalent to :py:meth:`str.split`." msgstr "等價於 :py:meth:`str.split`。" -#: ../../c-api/unicode.rst:1431 +#: ../../c-api/unicode.rst:1441 msgid "" "Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning " "at the end of the string." msgstr "" -#: ../../c-api/unicode.rst:1436 +#: ../../c-api/unicode.rst:1446 msgid "Equivalent to :py:meth:`str.rsplit`." msgstr "等價於 :py:meth:`str.rsplit`。" -#: ../../c-api/unicode.rst:1441 +#: ../../c-api/unicode.rst:1451 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" -#: ../../c-api/unicode.rst:1448 +#: ../../c-api/unicode.rst:1458 msgid "" "Split a Unicode string at the first occurrence of *sep*, and return a 3-" "tuple containing the part before the separator, the separator itself, and " @@ -1775,39 +1784,39 @@ msgid "" "tuple containing the string itself, followed by two empty strings." msgstr "" -#: ../../c-api/unicode.rst:1453 ../../c-api/unicode.rst:1466 +#: ../../c-api/unicode.rst:1463 ../../c-api/unicode.rst:1476 msgid "*sep* must not be empty." msgstr "*sep* 不得為空。" -#: ../../c-api/unicode.rst:1457 +#: ../../c-api/unicode.rst:1467 msgid "Equivalent to :py:meth:`str.partition`." msgstr "等價於 :py:meth:`str.partition`。" -#: ../../c-api/unicode.rst:1462 +#: ../../c-api/unicode.rst:1472 msgid "" "Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the " "last occurrence of *sep*. If the separator is not found, return a 3-tuple " "containing two empty strings, followed by the string itself." msgstr "" -#: ../../c-api/unicode.rst:1470 +#: ../../c-api/unicode.rst:1480 msgid "Equivalent to :py:meth:`str.rpartition`." msgstr "等價於 :py:meth:`str.rpartition`。" -#: ../../c-api/unicode.rst:1475 +#: ../../c-api/unicode.rst:1485 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1482 +#: ../../c-api/unicode.rst:1492 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1490 +#: ../../c-api/unicode.rst:1500 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1816,7 +1825,7 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1500 +#: ../../c-api/unicode.rst:1510 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " @@ -1826,37 +1835,37 @@ msgid "" "set." msgstr "" -#: ../../c-api/unicode.rst:1508 +#: ../../c-api/unicode.rst:1518 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -#: ../../c-api/unicode.rst:1515 +#: ../../c-api/unicode.rst:1525 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1522 +#: ../../c-api/unicode.rst:1532 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" -#: ../../c-api/unicode.rst:1529 +#: ../../c-api/unicode.rst:1539 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: ../../c-api/unicode.rst:1532 +#: ../../c-api/unicode.rst:1542 msgid "" "This function returns ``-1`` upon failure, so one should call :c:func:" "`PyErr_Occurred` to check for errors." msgstr "" -#: ../../c-api/unicode.rst:1538 +#: ../../c-api/unicode.rst:1548 msgid "" "Compare a Unicode object with a char buffer which is interpreted as being " "UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " @@ -1865,18 +1874,18 @@ msgid "" "is returned." msgstr "" -#: ../../c-api/unicode.rst:1545 ../../c-api/unicode.rst:1566 +#: ../../c-api/unicode.rst:1555 ../../c-api/unicode.rst:1576 msgid "This function does not raise exceptions." msgstr "此函式不會引發例外。" -#: ../../c-api/unicode.rst:1552 +#: ../../c-api/unicode.rst:1562 msgid "" "Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " "length using :c:func:`!strlen`. If the Unicode object contains null " "characters, false (``0``) is returned." msgstr "" -#: ../../c-api/unicode.rst:1561 +#: ../../c-api/unicode.rst:1571 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1884,47 +1893,47 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: ../../c-api/unicode.rst:1571 +#: ../../c-api/unicode.rst:1581 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: ../../c-api/unicode.rst:1573 +#: ../../c-api/unicode.rst:1583 msgid "``NULL`` in case an exception was raised" msgstr "" -#: ../../c-api/unicode.rst:1574 +#: ../../c-api/unicode.rst:1584 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" -#: ../../c-api/unicode.rst:1575 +#: ../../c-api/unicode.rst:1585 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: ../../c-api/unicode.rst:1577 +#: ../../c-api/unicode.rst:1587 msgid "" "Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" "`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" -#: ../../c-api/unicode.rst:1583 +#: ../../c-api/unicode.rst:1593 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: ../../c-api/unicode.rst:1589 +#: ../../c-api/unicode.rst:1599 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" -#: ../../c-api/unicode.rst:1592 +#: ../../c-api/unicode.rst:1602 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: ../../c-api/unicode.rst:1598 +#: ../../c-api/unicode.rst:1608 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " @@ -1935,7 +1944,7 @@ msgid "" "interns it." msgstr "" -#: ../../c-api/unicode.rst:1605 +#: ../../c-api/unicode.rst:1615 msgid "" "(Clarification: even though there is a lot of talk about references, think " "of this function as reference-neutral. You must own the object you pass in; " @@ -1943,39 +1952,39 @@ msgid "" "the result.)" msgstr "" -#: ../../c-api/unicode.rst:1610 +#: ../../c-api/unicode.rst:1620 msgid "" "This function never raises an exception. On error, it leaves its argument " "unchanged without interning it." msgstr "" -#: ../../c-api/unicode.rst:1613 +#: ../../c-api/unicode.rst:1623 msgid "" "Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" "expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " "as with any other error -- the argument is left unchanged." msgstr "" -#: ../../c-api/unicode.rst:1617 +#: ../../c-api/unicode.rst:1627 msgid "" "Note that interned strings are not “immortal”. You must keep a reference to " "the result to benefit from interning." msgstr "" -#: ../../c-api/unicode.rst:1623 +#: ../../c-api/unicode.rst:1633 msgid "" "A combination of :c:func:`PyUnicode_FromString` and :c:func:" "`PyUnicode_InternInPlace`, meant for statically allocated strings." msgstr "" -#: ../../c-api/unicode.rst:1626 +#: ../../c-api/unicode.rst:1636 msgid "" "Return a new (\"owned\") reference to either a new Unicode string object " "that has been interned, or an earlier interned string object with the same " "value." msgstr "" -#: ../../c-api/unicode.rst:1630 +#: ../../c-api/unicode.rst:1640 msgid "" "Python may keep a reference to the result, or make it :term:`immortal`, " "preventing it from being garbage-collected promptly. For interning an " @@ -1984,6 +1993,6 @@ msgid "" "`PyUnicode_InternInPlace` directly." msgstr "" -#: ../../c-api/unicode.rst:1638 +#: ../../c-api/unicode.rst:1648 msgid "Strings interned this way are made :term:`immortal`." msgstr "" From 32c33ca7fac3b9348287e476338e303c0bebb7e3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 14 May 2025 22:42:02 +0000 Subject: [PATCH 04/14] sync with cpython f474264b --- reference/grammar.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/reference/grammar.po b/reference/grammar.po index 24d3eb9b2c..e828dc5b77 100644 --- a/reference/grammar.po +++ b/reference/grammar.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-11 00:14+0000\n" +"POT-Creation-Date: 2025-05-14 22:40+0000\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -134,7 +134,7 @@ msgid "" "# ~\n" "# Commit to the current alternative, even if it fails to parse.\n" "# &&e\n" -"# Eager parse e. The parser will not backtrack and will immediately \n" +"# Eager parse e. The parser will not backtrack and will immediately\n" "# fail with SyntaxError if e cannot be parsed.\n" "#\n" "\n" @@ -780,7 +780,7 @@ msgid "" "# Type parameter declaration\n" "# --------------------------\n" "\n" -"type_params[asdl_type_param_seq*]: \n" +"type_params[asdl_type_param_seq*]:\n" " | invalid_type_params\n" " | '[' t=type_param_seq ']' {\n" " CHECK_VERSION(asdl_type_param_seq *, 12, \"Type parameter lists " @@ -1607,7 +1607,7 @@ msgid "" " | a='import' ','.dotted_name+ 'from' dotted_name {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"Did you mean to use 'from ... " "import ...' instead?\") }\n" -" | 'import' token=NEWLINE { \n" +" | 'import' token=NEWLINE {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(token, \"Expected one or more names " "after 'import'\") }\n" "\n" @@ -1615,7 +1615,7 @@ msgid "" " | import_from_as_names ',' NEWLINE {\n" " RAISE_SYNTAX_ERROR(\"trailing comma not allowed without surrounding " "parentheses\") }\n" -" | token=NEWLINE { \n" +" | token=NEWLINE {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(token, \"Expected one or more names " "after 'import'\") }\n" "\n" @@ -1805,6 +1805,6 @@ msgid "" "invalid_type_params:\n" " | '[' token=']' {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(\n" -" token, \n" +" token,\n" " \"Type parameter list cannot be empty\")}\n" msgstr "" From bdb7a532342364f6dc5be53ab4e066a9e8a30be3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 16 May 2025 00:17:10 +0000 Subject: [PATCH 05/14] sync with cpython bc1a6ecf --- library/stdtypes.po | 2634 +++++++++++++++++++++---------------------- 1 file changed, 1315 insertions(+), 1319 deletions(-) diff --git a/library/stdtypes.po b/library/stdtypes.po index 760f2937ed..388ffc8bc0 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-10 00:14+0000\n" +"POT-Creation-Date: 2025-05-16 00:15+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-" @@ -65,24 +65,22 @@ msgstr "真值檢測" #: ../../library/stdtypes.rst:41 msgid "" -"Any object can be tested for truth value, for use in an :keyword:`if` " -"or :keyword:`while` condition or as operand of the Boolean operations below." +"Any object can be tested for truth value, for use in an :keyword:`if` or :" +"keyword:`while` condition or as operand of the Boolean operations below." msgstr "" -"任何物件都可以進行檢測以判斷是否為真值,以便在 :keyword:`if` " -"或 :keyword:`while` 條件中使用,或是作為如下所述 boolean(布林)運算之運算元" -"所用。" +"任何物件都可以進行檢測以判斷是否為真值,以便在 :keyword:`if` 或 :keyword:" +"`while` 條件中使用,或是作為如下所述 boolean(布林)運算之運算元所用。" #: ../../library/stdtypes.rst:46 msgid "" -"By default, an object is considered true unless its class defines either " -"a :meth:`~object.__bool__` method that returns ``False`` or " -"a :meth:`~object.__len__` method that returns zero, when called with the " -"object. [1]_ Here are most of the built-in objects considered false:" +"By default, an object is considered true unless its class defines either a :" +"meth:`~object.__bool__` method that returns ``False`` or a :meth:`~object." +"__len__` method that returns zero, when called with the object. [1]_ Here " +"are most of the built-in objects considered false:" msgstr "" -"預設情況下,一個物件會被視為真值,除非它的 class 定義了會回傳 ``False`` " -"的 :meth:`~object.__bool__` method 或是定義了會回傳零" -"的 :meth:`~object.__len__` method。[1]_ 以下列出了大部分會被視為 false 的內建" -"物件:" +"預設情況下,一個物件會被視為真值,除非它的 class 定義了會回傳 ``False`` 的 :" +"meth:`~object.__bool__` method 或是定義了會回傳零的 :meth:`~object.__len__` " +"method。[1]_ 以下列出了大部分會被視為 false 的內建物件:" #: ../../library/stdtypes.rst:56 msgid "constants defined to be false: ``None`` and ``False``" @@ -137,8 +135,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276 #: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965 -#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2578 -#: ../../library/stdtypes.rst:3797 +#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2590 +#: ../../library/stdtypes.rst:3809 msgid "Notes" msgstr "註解" @@ -152,7 +150,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:967 #: ../../library/stdtypes.rst:970 ../../library/stdtypes.rst:1181 -#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3803 +#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:3815 msgid "\\(1)" msgstr "\\(1)" @@ -166,8 +164,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:289 #: ../../library/stdtypes.rst:309 ../../library/stdtypes.rst:1209 -#: ../../library/stdtypes.rst:2588 ../../library/stdtypes.rst:2590 -#: ../../library/stdtypes.rst:3807 ../../library/stdtypes.rst:3809 +#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:2602 +#: ../../library/stdtypes.rst:3819 ../../library/stdtypes.rst:3821 msgid "\\(2)" msgstr "\\(2)" @@ -180,18 +178,18 @@ msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" #: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:979 -#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2592 -#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:2596 -#: ../../library/stdtypes.rst:2598 ../../library/stdtypes.rst:3811 -#: ../../library/stdtypes.rst:3813 ../../library/stdtypes.rst:3815 -#: ../../library/stdtypes.rst:3817 +#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2604 +#: ../../library/stdtypes.rst:2606 ../../library/stdtypes.rst:2608 +#: ../../library/stdtypes.rst:2610 ../../library/stdtypes.rst:3823 +#: ../../library/stdtypes.rst:3825 ../../library/stdtypes.rst:3827 +#: ../../library/stdtypes.rst:3829 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:320 #: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:1016 -#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2624 -#: ../../library/stdtypes.rst:3847 +#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2636 +#: ../../library/stdtypes.rst:3859 msgid "Notes:" msgstr "註解:" @@ -238,9 +236,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2410 -#: ../../library/stdtypes.rst:2555 ../../library/stdtypes.rst:2578 -#: ../../library/stdtypes.rst:3774 ../../library/stdtypes.rst:3797 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2422 +#: ../../library/stdtypes.rst:2567 ../../library/stdtypes.rst:2590 +#: ../../library/stdtypes.rst:3786 ../../library/stdtypes.rst:3809 msgid "Meaning" msgstr "含義" @@ -327,24 +325,23 @@ msgid "" "Non-identical instances of a class normally compare as non-equal unless the " "class defines the :meth:`~object.__eq__` method." msgstr "" -"一個 class 的非相同實例通常會比較為不相等,除非 class 有定" -"義 :meth:`~object.__eq__` method。" +"一個 class 的非相同實例通常會比較為不相等,除非 class 有定義 :meth:`~object." +"__eq__` method。" #: ../../library/stdtypes.rst:184 msgid "" "Instances of a class cannot be ordered with respect to other instances of " "the same class, or other types of object, unless the class defines enough of " -"the " -"methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " -"and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` " -"and :meth:`~object.__eq__` are sufficient, if you want the conventional " -"meanings of the comparison operators)." +"the methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object." +"__gt__`, and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` and :" +"meth:`~object.__eq__` are sufficient, if you want the conventional meanings " +"of the comparison operators)." msgstr "" "一個 class 的實例不可以與其他相同 class 的實例或其他物件型別進行排序,除非 " -"class 定義足夠的 method ,包" -"含 :meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object.__gt__` " -"及 :meth:`~object.__ge__`\\ (一般來說,使用 :meth:`~object.__lt__` " -"及 :meth:`~object.__eq__` 就可以滿足常規意義上的比較運算子)。" +"class 定義足夠的 method ,包含 :meth:`~object.__lt__`、:meth:`~object." +"__le__`、:meth:`~object.__gt__` 及 :meth:`~object.__ge__`\\ (一般來說,使" +"用 :meth:`~object.__lt__` 及 :meth:`~object.__eq__` 就可以滿足常規意義上的比" +"較運算子)。" #: ../../library/stdtypes.rst:191 msgid "" @@ -357,8 +354,8 @@ msgstr "" #: ../../library/stdtypes.rst:199 msgid "" -"Two more operations with the same syntactic priority, :keyword:`in` " -"and :keyword:`not in`, are supported by types that are :term:`iterable` or " +"Two more operations with the same syntactic priority, :keyword:`in` and :" +"keyword:`not in`, are supported by types that are :term:`iterable` or " "implement the :meth:`~object.__contains__` method." msgstr "" "此外,擁有相同的語法優先序的 :keyword:`in` 及 :keyword:`not in` 兩種運算皆被" @@ -376,21 +373,20 @@ msgid "" "subtype of integers. Integers have unlimited precision. Floating-point " "numbers are usually implemented using :c:expr:`double` in C; information " "about the precision and internal representation of floating-point numbers " -"for the machine on which your program is running is available " -"in :data:`sys.float_info`. Complex numbers have a real and imaginary part, " -"which are each a floating-point number. To extract these parts from a " -"complex number *z*, use ``z.real`` and ``z.imag``. (The standard library " -"includes the additional numeric types :mod:`fractions.Fraction`, for " -"rationals, and :mod:`decimal.Decimal`, for floating-point numbers with user-" -"definable precision.)" +"for the machine on which your program is running is available in :data:`sys." +"float_info`. Complex numbers have a real and imaginary part, which are each " +"a floating-point number. To extract these parts from a complex number *z*, " +"use ``z.real`` and ``z.imag``. (The standard library includes the additional " +"numeric types :mod:`fractions.Fraction`, for rationals, and :mod:`decimal." +"Decimal`, for floating-point numbers with user-definable precision.)" msgstr "" "數值型別共有三種::dfn:`整數`、:dfn:`浮點數` 及 :dfn:`複數`。此外,Boolean 為" -"整數中的一個子型別。整數有無限的精度。浮點數通常使用 C 裡面" -"的 :c:expr:`double` 實作。關於在你程式所運作的機器上之浮點數的精度及內部表示" -"法可以在 :data:`sys.float_info` 進行查找。複數包含實數及虛數的部分,這兩部分" -"各自是一個浮點數。若要從一個複數 *z* 提取這兩部分,需使用 ``z.real`` 及 " -"``z.imag``。(標準函式庫包含額外的數值型別,像是 :mod:`fractions.Fraction` 表" -"示有理數,而 :mod:`decimal.Decimal` 表示可由使用者制定精度的浮點數。)" +"整數中的一個子型別。整數有無限的精度。浮點數通常使用 C 裡面的 :c:expr:" +"`double` 實作。關於在你程式所運作的機器上之浮點數的精度及內部表示法可以在 :" +"data:`sys.float_info` 進行查找。複數包含實數及虛數的部分,這兩部分各自是一個" +"浮點數。若要從一個複數 *z* 提取這兩部分,需使用 ``z.real`` 及 ``z.imag``。" +"(標準函式庫包含額外的數值型別,像是 :mod:`fractions.Fraction` 表示有理數," +"而 :mod:`decimal.Decimal` 表示可由使用者制定精度的浮點數。)" #: ../../library/stdtypes.rst:238 msgid "" @@ -433,8 +429,8 @@ msgid "" "All numeric types (except complex) support the following operations (for " "priorities of the operations, see :ref:`operator-summary`):" msgstr "" -"所有數值型別(除複數外)皆支援以下的運算(有關運算的先後順序,詳" -"見 :ref:`operator-summary`):" +"所有數值型別(除複數外)皆支援以下的運算(有關運算的先後順序,詳見 :ref:" +"`operator-summary`):" #: ../../library/stdtypes.rst:276 msgid "Full documentation" @@ -563,7 +559,7 @@ msgid "" msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" #: ../../library/stdtypes.rst:302 ../../library/stdtypes.rst:1202 -#: ../../library/stdtypes.rst:2586 ../../library/stdtypes.rst:3834 +#: ../../library/stdtypes.rst:2598 ../../library/stdtypes.rst:3846 msgid "\\(6)" msgstr "\\(6)" @@ -601,9 +597,9 @@ msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313 #: ../../library/stdtypes.rst:1191 ../../library/stdtypes.rst:1194 -#: ../../library/stdtypes.rst:2611 ../../library/stdtypes.rst:2614 -#: ../../library/stdtypes.rst:2617 ../../library/stdtypes.rst:3830 -#: ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:2623 ../../library/stdtypes.rst:2626 +#: ../../library/stdtypes.rst:2629 ../../library/stdtypes.rst:3842 +#: ../../library/stdtypes.rst:3849 msgid "\\(5)" msgstr "\\(5)" @@ -624,11 +620,11 @@ msgid "" "always rounded towards minus infinity: ``1//2`` is ``0``, ``(-1)//2`` is " "``-1``, ``1//(-2)`` is ``-1``, and ``(-1)//(-2)`` is ``0``." msgstr "" -"也被稱為整數除法。對於型別為 :class:`int` 的運算元來說,結果之型別會" -"是 :class:`int`。對於型別為 :class:`float` 的運算元來說,結果之型別會" -"是 :class:`float`。一般來說,結果會是一個整數,但其型別不一定會" -"是 :class:`int`。結果總是會往負無窮大的方向取整數值: ``1//2`` 為 ``0``、" -"``(-1)//2`` 為 ``-1``、``1//(-2)`` 為 ``-1`` 及 ``(-1)//(-2)`` 為 ``0``。" +"也被稱為整數除法。對於型別為 :class:`int` 的運算元來說,結果之型別會是 :" +"class:`int`。對於型別為 :class:`float` 的運算元來說,結果之型別會是 :class:" +"`float`。一般來說,結果會是一個整數,但其型別不一定會是 :class:`int`。結果總" +"是會往負無窮大的方向取整數值: ``1//2`` 為 ``0``、``(-1)//2`` 為 ``-1``、" +"``1//(-2)`` 為 ``-1`` 及 ``(-1)//(-2)`` 為 ``0``。" #: ../../library/stdtypes.rst:331 msgid "" @@ -642,8 +638,8 @@ msgid "" "fractional part. See functions :func:`math.floor` and :func:`math.ceil` for " "alternative conversions." msgstr "" -"從 :class:`float` 轉換為 :class:`int` 會導致截斷並排除小數部分。詳" -"見 :func:`math.floor` 及 :func:`math.ceil` 以了解更多轉換方式。" +"從 :class:`float` 轉換為 :class:`int` 會導致截斷並排除小數部分。詳見 :func:" +"`math.floor` 及 :func:`math.ceil` 以了解更多轉換方式。" #: ../../library/stdtypes.rst:347 msgid "" @@ -762,8 +758,8 @@ msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:418 ../../library/stdtypes.rst:421 #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:2604 -#: ../../library/stdtypes.rst:3819 ../../library/stdtypes.rst:3823 +#: ../../library/stdtypes.rst:2612 ../../library/stdtypes.rst:2616 +#: ../../library/stdtypes.rst:3831 ../../library/stdtypes.rst:3835 msgid "\\(4)" msgstr "\\(4)" @@ -833,13 +829,13 @@ msgstr "向右移動 *n* 個位元等同於向下除法除以 ``pow(2, n)``。" #: ../../library/stdtypes.rst:446 msgid "" "Performing these calculations with at least one extra sign extension bit in " -"a finite two's complement representation (a working bit-width of ``1 + " -"max(x.bit_length(), y.bit_length())`` or more) is sufficient to get the same " +"a finite two's complement representation (a working bit-width of ``1 + max(x." +"bit_length(), y.bit_length())`` or more) is sufficient to get the same " "result as if there were an infinite number of sign bits." msgstr "" -"在有限的二的補數表示法中執行這些計算(一個有效位元寬度為 ``1 + " -"max(x.bit_length(), y.bit_length())`` 或以上)並至少有一個額外的符號擴展位" -"元,便足以得到與無窮多個符號位元相同的結果。" +"在有限的二的補數表示法中執行這些計算(一個有效位元寬度為 ``1 + max(x." +"bit_length(), y.bit_length())`` 或以上)並至少有一個額外的符號擴展位元,便足" +"以得到與無窮多個符號位元相同的結果。" #: ../../library/stdtypes.rst:453 msgid "Additional Methods on Integer Types" @@ -878,13 +874,13 @@ msgid "" "More precisely, if ``x`` is nonzero, then ``x.bit_length()`` is the unique " "positive integer ``k`` such that ``2**(k-1) <= abs(x) < 2**k``. " "Equivalently, when ``abs(x)`` is small enough to have a correctly rounded " -"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then " -"``x.bit_length()`` returns ``0``." +"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then ``x." +"bit_length()`` returns ``0``." msgstr "" "更準確來說,若 ``x`` 非為零,則 ``x.bit_length()`` 會得出滿足 ``2**(k-1) <= " "abs(x) < 2**k`` 的單一正整數 ``k``。同樣地,當 ``abs(x)`` 足夠小到能正確地取" -"得捨入的對數,則 ``k = 1 + int(log(abs(x), 2))``。若 ``x`` 為零,則 " -"``x.bit_length()`` 會回傳 ``0``。" +"得捨入的對數,則 ``k = 1 + int(log(abs(x), 2))``。若 ``x`` 為零,則 ``x." +"bit_length()`` 會回傳 ``0``。" #: ../../library/stdtypes.rst:475 ../../library/stdtypes.rst:498 #: ../../library/stdtypes.rst:543 ../../library/stdtypes.rst:587 @@ -937,9 +933,9 @@ msgstr "回傳表示一個整數的一列位元組。" #: ../../library/stdtypes.rst:519 msgid "" -"The integer is represented using *length* bytes, and defaults to 1. " -"An :exc:`OverflowError` is raised if the integer is not representable with " -"the given number of bytes." +"The integer is represented using *length* bytes, and defaults to 1. An :exc:" +"`OverflowError` is raised if the integer is not representable with the given " +"number of bytes." msgstr "" "此整數會使用 *length* 位元組表示,並且預設為 1。如果該整數無法用給定的位元組" "數來表示,則會引發 :exc:`OverflowError`。" @@ -985,8 +981,8 @@ msgid "" "However, when using the default arguments, don't try to convert a value " "greater than 255 or you'll get an :exc:`OverflowError`." msgstr "" -"然而,使用預設引數時,不要嘗試轉換大於 255 的值,否則你將會得到一" -"個 :exc:`OverflowError`。" +"然而,使用預設引數時,不要嘗試轉換大於 255 的值,否則你將會得到一個 :exc:" +"`OverflowError`。" #: ../../library/stdtypes.rst:545 msgid "" @@ -1032,8 +1028,8 @@ msgid "" "integer, and defaults to ``\"big\"``. If *byteorder* is ``\"big\"``, the " "most significant byte is at the beginning of the byte array. If *byteorder* " "is ``\"little\"``, the most significant byte is at the end of the byte " -"array. To request the native byte order of the host system, " -"use :data:`sys.byteorder` as the byte order value." +"array. To request the native byte order of the host system, use :data:`sys." +"byteorder` as the byte order value." msgstr "" "*byteorder* 引數決定了用來表示整數的位元組順序並且預設為 ``\"big\"``。如果 " "*byteorder* 是 ``\"big\"``,最重要的位元組位於位元組陣列的開頭。如果 " @@ -1091,8 +1087,8 @@ msgstr "" #: ../../library/stdtypes.rst:618 msgid "" -"Returns ``True``. Exists for duck type compatibility " -"with :meth:`float.is_integer`." +"Returns ``True``. Exists for duck type compatibility with :meth:`float." +"is_integer`." msgstr "回傳 ``True``。為了與 :meth:`float.is_integer` 的鴨子型別相容而存在。" #: ../../library/stdtypes.rst:623 @@ -1110,8 +1106,8 @@ msgstr "" #: ../../library/stdtypes.rst:630 msgid "" "Return a pair of integers whose ratio is exactly equal to the original " -"float. The ratio is in lowest terms and has a positive denominator. " -"Raises :exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." +"float. The ratio is in lowest terms and has a positive denominator. Raises :" +"exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." msgstr "" "回傳一對整數,其比率完全等於原始浮點數。比率是在最低條件下並且有一個正分母。" "在無窮大時引發 :exc:`OverflowError`,在 NaN 時引發 :exc:`ValueError`。" @@ -1168,8 +1164,8 @@ msgstr "" #: ../../library/stdtypes.rst:669 msgid "" -"Note that :meth:`float.hex` is an instance method, " -"while :meth:`float.fromhex` is a class method." +"Note that :meth:`float.hex` is an instance method, while :meth:`float." +"fromhex` is a class method." msgstr "" "請注意 :meth:`float.hex` 是一個實例 method,而 :meth:`float.fromhex` 是一個 " "class method。" @@ -1198,10 +1194,10 @@ msgstr "" "其中可選的 ``sign`` 可以是 ``+`` 或 ``-``,``integer`` 和 ``fraction`` 是十六" "進位數字的字串,而 ``exponent`` 是一個十進位整數並且有一個可選的前導符號。大" "小寫不重要,並且整數或小數部分至少有一個十六進位數字。這個語法與 C99 標準的" -"第 6.4.4.2 節指定的語法相似,也與 Java 1.5 以後的語法相似。特別" -"是 :meth:`float.hex` 的輸出可用作 C 或 Java 程式碼中的十六進位浮點數文字,並" -"且 C 的 ``%a`` 格式字元或 Java 的 ``Double.toHexString`` 產生的十六進位字串可" -"被 :meth:`float.fromhex` 接受。" +"第 6.4.4.2 節指定的語法相似,也與 Java 1.5 以後的語法相似。特別是 :meth:" +"`float.hex` 的輸出可用作 C 或 Java 程式碼中的十六進位浮點數文字,並且 C 的 " +"``%a`` 格式字元或 Java 的 ``Double.toHexString`` 產生的十六進位字串可被 :" +"meth:`float.fromhex` 接受。" #: ../../library/stdtypes.rst:689 msgid "" @@ -1244,29 +1240,27 @@ msgstr "數值型別的雜湊" #: ../../library/stdtypes.rst:711 msgid "" "For numbers ``x`` and ``y``, possibly of different types, it's a requirement " -"that ``hash(x) == hash(y)`` whenever ``x == y`` (see " -"the :meth:`~object.__hash__` method documentation for more details). For " -"ease of implementation and efficiency across a variety of numeric types " -"(including :class:`int`, :class:`float`, :class:`decimal.Decimal` " -"and :class:`fractions.Fraction`) Python's hash for numeric types is based on " -"a single mathematical function that's defined for any rational number, and " -"hence applies to all instances of :class:`int` " -"and :class:`fractions.Fraction`, and all finite instances of :class:`float` " -"and :class:`decimal.Decimal`. Essentially, this function is given by " -"reduction modulo ``P`` for a fixed prime ``P``. The value of ``P`` is made " -"available to Python as the :attr:`~sys.hash_info.modulus` attribute " -"of :data:`sys.hash_info`." +"that ``hash(x) == hash(y)`` whenever ``x == y`` (see the :meth:`~object." +"__hash__` method documentation for more details). For ease of " +"implementation and efficiency across a variety of numeric types (including :" +"class:`int`, :class:`float`, :class:`decimal.Decimal` and :class:`fractions." +"Fraction`) Python's hash for numeric types is based on a single mathematical " +"function that's defined for any rational number, and hence applies to all " +"instances of :class:`int` and :class:`fractions.Fraction`, and all finite " +"instances of :class:`float` and :class:`decimal.Decimal`. Essentially, this " +"function is given by reduction modulo ``P`` for a fixed prime ``P``. The " +"value of ``P`` is made available to Python as the :attr:`~sys.hash_info." +"modulus` attribute of :data:`sys.hash_info`." msgstr "" "對於數字 ``x`` 和 ``y``,可能是不同型別,當 ``x == y`` 時,``hash(x) == " "hash(y)`` 是一個要求( 詳見 :meth:`~object.__hash__` method 的文件以獲得更多" -"細節)。為了實作的便利性和效率跨越各種數值型別(包" -"括 :class:`int`、:class:`float`、:class:`decimal.Decimal` " -"和 :class:`fractions.Fraction`)Python 的數值型別的雜湊是基於一個數學函式,它" -"對於任何有理數都是定義的,因此適用於所有 :class:`int` " -"和 :class:`fractions.Fraction` 的實例,以及所有有限的 :class:`float` " -"和 :class:`decimal.Decimal` 的實例。基本上,這個函式是由簡化的 modulo(模" -"數) ``P`` 給出的一個固定的質數 ``P``。``P`` 的值作為 :data:`sys.hash_info` " -"的 :attr:`~sys.hash_info.modulus` 屬性提供給 Python。" +"細節)。為了實作的便利性和效率跨越各種數值型別(包括 :class:`int`、:class:" +"`float`、:class:`decimal.Decimal` 和 :class:`fractions.Fraction`)Python 的數" +"值型別的雜湊是基於一個數學函式,它對於任何有理數都是定義的,因此適用於所有 :" +"class:`int` 和 :class:`fractions.Fraction` 的實例,以及所有有限的 :class:" +"`float` 和 :class:`decimal.Decimal` 的實例。基本上,這個函式是由簡化的 modulo" +"(模數) ``P`` 給出的一個固定的質數 ``P``。``P`` 的值作為 :data:`sys." +"hash_info` 的 :attr:`~sys.hash_info.modulus` 屬性提供給 Python。" #: ../../library/stdtypes.rst:726 msgid "" @@ -1321,23 +1315,21 @@ msgstr "" #: ../../library/stdtypes.rst:748 msgid "" "For a :class:`complex` number ``z``, the hash values of the real and " -"imaginary parts are combined by computing ``hash(z.real) + " -"sys.hash_info.imag * hash(z.imag)``, reduced modulo " -"``2**sys.hash_info.width`` so that it lies in " -"``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - 1))``. " -"Again, if the result is ``-1``, it's replaced with ``-2``." +"imaginary parts are combined by computing ``hash(z.real) + sys.hash_info." +"imag * hash(z.imag)``, reduced modulo ``2**sys.hash_info.width`` so that it " +"lies in ``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - " +"1))``. Again, if the result is ``-1``, it's replaced with ``-2``." msgstr "" "對於一個 :class:`complex` 值 ``z``,實部和虛部的雜湊值藉由 ``hash(z.real) + " -"sys.hash_info.imag * hash(z.imag)`` 的計算進行組合,對 " -"``2**sys.hash_info.width`` 取模數使其介於 ``range(-2**(sys.hash_info.width - " -"1), 2**(sys.hash_info.width - 1))``。同樣地,如果結果是 ``-1``,則將其替換為 " -"``-2``。" +"sys.hash_info.imag * hash(z.imag)`` 的計算進行組合,對 ``2**sys.hash_info." +"width`` 取模數使其介於 ``range(-2**(sys.hash_info.width - 1), 2**(sys." +"hash_info.width - 1))``。同樣地,如果結果是 ``-1``,則將其替換為 ``-2``。" #: ../../library/stdtypes.rst:756 msgid "" "To clarify the above rules, here's some example Python code, equivalent to " -"the built-in hash, for computing the hash of a rational " -"number, :class:`float`, or :class:`complex`::" +"the built-in hash, for computing the hash of a rational number, :class:" +"`float`, or :class:`complex`::" msgstr "" "為了闡明上述規則,這裡有一些 Python 程式碼範例,等同於內建的雜湊,用於計算有" "理數、:class:`float` 或 :class:`complex` 的雜湊: ::" @@ -1384,8 +1376,8 @@ msgid "" "def hash_complex(z):\n" " \"\"\"Compute the hash of a complex number z.\"\"\"\n" "\n" -" hash_value = hash_float(z.real) + sys.hash_info.imag * " -"hash_float(z.imag)\n" +" hash_value = hash_float(z.real) + sys.hash_info.imag * hash_float(z." +"imag)\n" " # do a signed reduction modulo 2**sys.hash_info.width\n" " M = 2**(sys.hash_info.width - 1)\n" " hash_value = (hash_value & (M - 1)) - (hash_value & M)\n" @@ -1461,8 +1453,8 @@ msgstr "" #: ../../library/stdtypes.rst:858 msgid "" -"One method needs to be defined for container objects to " -"provide :term:`iterable` support:" +"One method needs to be defined for container objects to provide :term:" +"`iterable` support:" msgstr "" "需要為容器物件定義一個 method 來提供\\ :term:`可疊代物件 `\\ 支援:" @@ -1473,15 +1465,15 @@ msgid "" "of iteration, additional methods can be provided to specifically request " "iterators for those iteration types. (An example of an object supporting " "multiple forms of iteration would be a tree structure which supports both " -"breadth-first and depth-first traversal.) This method corresponds to " -"the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python " -"objects in the Python/C API." +"breadth-first and depth-first traversal.) This method corresponds to the :c:" +"member:`~PyTypeObject.tp_iter` slot of the type structure for Python objects " +"in the Python/C API." msgstr "" "回傳一個\\ :term:`疊代器 `\\ 物件。該物件需要支援下述的疊代器協定。" "如果一個容器支援不同型別的疊代,則可以提供額外的 methods 來專門請求這些疊代型" "別的疊代器。(支援多種形式疊代的物件的一個例子是支援廣度優先和深度優先遍歷的" -"樹結構。)此 method 對應 Python/C API 中 Python 物件的型別結構" -"的 :c:member:`~PyTypeObject.tp_iter` 插槽。" +"樹結構。)此 method 對應 Python/C API 中 Python 物件的型別結構的 :c:member:" +"`~PyTypeObject.tp_iter` 插槽。" #: ../../library/stdtypes.rst:874 msgid "" @@ -1493,10 +1485,9 @@ msgstr "" #: ../../library/stdtypes.rst:880 msgid "" "Return the :term:`iterator` object itself. This is required to allow both " -"containers and iterators to be used with the :keyword:`for` " -"and :keyword:`in` statements. This method corresponds to " -"the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python " -"objects in the Python/C API." +"containers and iterators to be used with the :keyword:`for` and :keyword:" +"`in` statements. This method corresponds to the :c:member:`~PyTypeObject." +"tp_iter` slot of the type structure for Python objects in the Python/C API." msgstr "" "回傳\\ :term:`疊代器 `\\ 物件本身。這是為了允許容器和疊代器都可以" "與 :keyword:`for` 和 :keyword:`in` 在陳述式中使用。此 method 對應於 Python/C " @@ -1509,9 +1500,9 @@ msgid "" "the :c:member:`~PyTypeObject.tp_iternext` slot of the type structure for " "Python objects in the Python/C API." msgstr "" -"從\\ :term:`疊代器 `\\ 回傳下一個項目。如果沒有更多項目,則引" -"發 :exc:`StopIteration` 例外。此 method 對應於 Python/C API 中Python 物件的型" -"別結構的 :c:member:`~PyTypeObject.tp_iternext` 插槽。" +"從\\ :term:`疊代器 `\\ 回傳下一個項目。如果沒有更多項目,則引發 :" +"exc:`StopIteration` 例外。此 method 對應於 Python/C API 中Python 物件的型別結" +"構的 :c:member:`~PyTypeObject.tp_iternext` 插槽。" #: ../../library/stdtypes.rst:894 msgid "" @@ -1525,8 +1516,8 @@ msgstr "" #: ../../library/stdtypes.rst:899 msgid "" -"Once an iterator's :meth:`~iterator.__next__` method " -"raises :exc:`StopIteration`, it must continue to do so on subsequent calls. " +"Once an iterator's :meth:`~iterator.__next__` method raises :exc:" +"`StopIteration`, it must continue to do so on subsequent calls. " "Implementations that do not obey this property are deemed broken." msgstr "" "一旦疊代器的 :meth:`~iterator.__next__` method 引發 :exc:`StopIteration`,則" @@ -1541,10 +1532,10 @@ msgid "" "Python's :term:`generator`\\s provide a convenient way to implement the " "iterator protocol. If a container object's :meth:`~object.__iter__` method " "is implemented as a generator, it will automatically return an iterator " -"object (technically, a generator object) supplying " -"the :meth:`~iterator.__iter__` and :meth:`~generator.__next__` methods. More " -"information about generators can be found in :ref:`the documentation for the " -"yield expression `." +"object (technically, a generator object) supplying the :meth:`~iterator." +"__iter__` and :meth:`~generator.__next__` methods. More information about " +"generators can be found in :ref:`the documentation for the yield expression " +"`." msgstr "" #: ../../library/stdtypes.rst:921 @@ -1693,7 +1684,7 @@ msgid "" "before index *j*)" msgstr "" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3805 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3817 msgid "\\(8)" msgstr "\\(8)" @@ -1718,9 +1709,9 @@ msgstr "" msgid "" "Forward and reversed iterators over mutable sequences access values using an " "index. That index will continue to march forward (or backward) even if the " -"underlying sequence is mutated. The iterator terminates only when " -"an :exc:`IndexError` or a :exc:`StopIteration` is encountered (or when the " -"index drops below zero)." +"underlying sequence is mutated. The iterator terminates only when an :exc:" +"`IndexError` or a :exc:`StopIteration` is encountered (or when the index " +"drops below zero)." msgstr "" #: ../../library/stdtypes.rst:1019 @@ -1832,17 +1823,17 @@ msgstr "" #: ../../library/stdtypes.rst:1084 msgid "" -"if concatenating :class:`str` objects, you can build a list and " -"use :meth:`str.join` at the end or else write to an :class:`io.StringIO` " -"instance and retrieve its value when complete" +"if concatenating :class:`str` objects, you can build a list and use :meth:" +"`str.join` at the end or else write to an :class:`io.StringIO` instance and " +"retrieve its value when complete" msgstr "" #: ../../library/stdtypes.rst:1088 msgid "" -"if concatenating :class:`bytes` objects, you can similarly " -"use :meth:`bytes.join` or :class:`io.BytesIO`, or you can do in-place " -"concatenation with a :class:`bytearray` object. :class:`bytearray` objects " -"are mutable and have an efficient overallocation mechanism" +"if concatenating :class:`bytes` objects, you can similarly use :meth:`bytes." +"join` or :class:`io.BytesIO`, or you can do in-place concatenation with a :" +"class:`bytearray` object. :class:`bytearray` objects are mutable and have " +"an efficient overallocation mechanism" msgstr "" #: ../../library/stdtypes.rst:1093 @@ -1877,15 +1868,15 @@ msgstr "" #: ../../library/stdtypes.rst:1122 msgid "" "The only operation that immutable sequence types generally implement that is " -"not also implemented by mutable sequence types is support for " -"the :func:`hash` built-in." +"not also implemented by mutable sequence types is support for the :func:" +"`hash` built-in." msgstr "" #: ../../library/stdtypes.rst:1126 msgid "" "This support allows immutable sequences, such as :class:`tuple` instances, " -"to be used as :class:`dict` keys and stored in :class:`set` " -"and :class:`frozenset` instances." +"to be used as :class:`dict` keys and stored in :class:`set` and :class:" +"`frozenset` instances." msgstr "" #: ../../library/stdtypes.rst:1130 @@ -2057,9 +2048,9 @@ msgstr "" msgid "" ":meth:`clear` and :meth:`!copy` are included for consistency with the " "interfaces of mutable containers that don't support slicing operations (such " -"as :class:`dict` and :class:`set`). :meth:`!copy` is not part of " -"the :class:`collections.abc.MutableSequence` ABC, but most concrete mutable " -"sequence classes provide it." +"as :class:`dict` and :class:`set`). :meth:`!copy` is not part of the :class:" +"`collections.abc.MutableSequence` ABC, but most concrete mutable sequence " +"classes provide it." msgstr "" #: ../../library/stdtypes.rst:1245 @@ -2068,11 +2059,10 @@ msgstr "" #: ../../library/stdtypes.rst:1249 msgid "" -"The value *n* is an integer, or an object " -"implementing :meth:`~object.__index__`. Zero and negative values of *n* " -"clear the sequence. Items in the sequence are not copied; they are " -"referenced multiple times, as explained for ``s * n`` under :ref:`typesseq-" -"common`." +"The value *n* is an integer, or an object implementing :meth:`~object." +"__index__`. Zero and negative values of *n* clear the sequence. Items in " +"the sequence are not copied; they are referenced multiple times, as " +"explained for ``s * n`` under :ref:`typesseq-common`." msgstr "" #: ../../library/stdtypes.rst:1258 @@ -2141,8 +2131,8 @@ msgstr "" #: ../../library/stdtypes.rst:1298 msgid "" -":meth:`sort` accepts two arguments that can only be passed by keyword " -"(:ref:`keyword-only arguments `):" +":meth:`sort` accepts two arguments that can only be passed by keyword (:ref:" +"`keyword-only arguments `):" msgstr "" #: ../../library/stdtypes.rst:1301 @@ -2204,8 +2194,8 @@ msgid "" "Tuples are immutable sequences, typically used to store collections of " "heterogeneous data (such as the 2-tuples produced by the :func:`enumerate` " "built-in). Tuples are also used for cases where an immutable sequence of " -"homogeneous data is needed (such as allowing storage in a :class:`set` " -"or :class:`dict` instance)." +"homogeneous data is needed (such as allowing storage in a :class:`set` or :" +"class:`dict` instance)." msgstr "" #: ../../library/stdtypes.rst:1349 @@ -2273,8 +2263,8 @@ msgstr "" #: ../../library/stdtypes.rst:1392 msgid "" -"The arguments to the range constructor must be integers (either built-" -"in :class:`int` or any object that implements the :meth:`~object.__index__` " +"The arguments to the range constructor must be integers (either built-in :" +"class:`int` or any object that implements the :meth:`~object.__index__` " "special method). If the *step* argument is omitted, it defaults to ``1``. " "If the *start* argument is omitted, it defaults to ``0``. If *step* is " "zero, :exc:`ValueError` is raised." @@ -2303,8 +2293,8 @@ msgstr "" #: ../../library/stdtypes.rst:1411 msgid "" "Ranges containing absolute values larger than :data:`sys.maxsize` are " -"permitted but some features (such as :func:`len`) may " -"raise :exc:`OverflowError`." +"permitted but some features (such as :func:`len`) may raise :exc:" +"`OverflowError`." msgstr "" #: ../../library/stdtypes.rst:1415 @@ -2369,8 +2359,8 @@ msgstr "" #: ../../library/stdtypes.rst:1451 msgid "" -"The advantage of the :class:`range` type over a regular :class:`list` " -"or :class:`tuple` is that a :class:`range` object will always take the same " +"The advantage of the :class:`range` type over a regular :class:`list` or :" +"class:`tuple` is that a :class:`range` object will always take the same " "(small) amount of memory, no matter the size of the range it represents (as " "it only stores the ``start``, ``stop`` and ``step`` values, calculating " "individual items and subranges as needed)." @@ -2395,9 +2385,9 @@ msgstr "" #: ../../library/stdtypes.rst:1484 msgid "" -"Implement the Sequence ABC. Support slicing and negative indices. " -"Test :class:`int` objects for membership in constant time instead of " -"iterating through all items." +"Implement the Sequence ABC. Support slicing and negative indices. Test :" +"class:`int` objects for membership in constant time instead of iterating " +"through all items." msgstr "" #: ../../library/stdtypes.rst:1490 @@ -2425,9 +2415,9 @@ msgstr "" #: ../../library/stdtypes.rst:1514 msgid "" -"Textual data in Python is handled with :class:`str` objects, " -"or :dfn:`strings`. Strings are immutable :ref:`sequences ` of " -"Unicode code points. String literals are written in a variety of ways:" +"Textual data in Python is handled with :class:`str` objects, or :dfn:" +"`strings`. Strings are immutable :ref:`sequences ` of Unicode code " +"points. String literals are written in a variety of ways:" msgstr "" #: ../../library/stdtypes.rst:1519 @@ -2478,9 +2468,9 @@ msgstr "" #: ../../library/stdtypes.rst:1543 msgid "" -"There is also no mutable string type, but :meth:`str.join` " -"or :class:`io.StringIO` can be used to efficiently construct strings from " -"multiple fragments." +"There is also no mutable string type, but :meth:`str.join` or :class:`io." +"StringIO` can be used to efficiently construct strings from multiple " +"fragments." msgstr "" #: ../../library/stdtypes.rst:1547 @@ -2499,24 +2489,24 @@ msgstr "" #: ../../library/stdtypes.rst:1563 msgid "" -"If neither *encoding* nor *errors* is given, ``str(object)`` " -"returns :meth:`type(object).__str__(object) `, which is the " -"\"informal\" or nicely printable string representation of *object*. For " -"string objects, this is the string itself. If *object* does not have " -"a :meth:`~object.__str__` method, then :func:`str` falls back to " -"returning :func:`repr(object) `." +"If neither *encoding* nor *errors* is given, ``str(object)`` returns :meth:" +"`type(object).__str__(object) `, which is the \"informal\" " +"or nicely printable string representation of *object*. For string objects, " +"this is the string itself. If *object* does not have a :meth:`~object." +"__str__` method, then :func:`str` falls back to returning :func:" +"`repr(object) `." msgstr "" #: ../../library/stdtypes.rst:1575 msgid "" -"If at least one of *encoding* or *errors* is given, *object* should be " -"a :term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " +"If at least one of *encoding* or *errors* is given, *object* should be a :" +"term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " "this case, if *object* is a :class:`bytes` (or :class:`bytearray`) object, " -"then ``str(bytes, encoding, errors)`` is equivalent " -"to :meth:`bytes.decode(encoding, errors) `. Otherwise, the " -"bytes object underlying the buffer object is obtained before " -"calling :meth:`bytes.decode`. See :ref:`binaryseq` and :ref:`bufferobjects` " -"for information on buffer objects." +"then ``str(bytes, encoding, errors)`` is equivalent to :meth:`bytes." +"decode(encoding, errors) `. Otherwise, the bytes object " +"underlying the buffer object is obtained before calling :meth:`bytes." +"decode`. See :ref:`binaryseq` and :ref:`bufferobjects` for information on " +"buffer objects." msgstr "" #: ../../library/stdtypes.rst:1584 @@ -2537,10 +2527,10 @@ msgstr "" #: ../../library/stdtypes.rst:1592 msgid "" -"For more information on the ``str`` class and its methods, " -"see :ref:`textseq` and the :ref:`string-methods` section below. To output " -"formatted strings, see the :ref:`f-strings` and :ref:`formatstrings` " -"sections. In addition, see the :ref:`stringservices` section." +"For more information on the ``str`` class and its methods, see :ref:" +"`textseq` and the :ref:`string-methods` section below. To output formatted " +"strings, see the :ref:`f-strings` and :ref:`formatstrings` sections. In " +"addition, see the :ref:`stringservices` section." msgstr "" #: ../../library/stdtypes.rst:1604 @@ -2556,11 +2546,11 @@ msgstr "" #: ../../library/stdtypes.rst:1612 msgid "" "Strings also support two styles of string formatting, one providing a large " -"degree of flexibility and customization " -"(see :meth:`str.format`, :ref:`formatstrings` and :ref:`string-formatting`) " -"and the other based on C ``printf`` style formatting that handles a narrower " -"range of types and is slightly harder to use correctly, but is often faster " -"for the cases it can handle (:ref:`old-string-formatting`)." +"degree of flexibility and customization (see :meth:`str.format`, :ref:" +"`formatstrings` and :ref:`string-formatting`) and the other based on C " +"``printf`` style formatting that handles a narrower range of types and is " +"slightly harder to use correctly, but is often faster for the cases it can " +"handle (:ref:`old-string-formatting`)." msgstr "" #: ../../library/stdtypes.rst:1619 @@ -2594,8 +2584,8 @@ msgid "" "Casefolding is similar to lowercasing but more aggressive because it is " "intended to remove all case distinctions in a string. For example, the " "German lowercase letter ``'ß'`` is equivalent to ``\"ss\"``. Since it is " -"already lowercase, :meth:`lower` would do nothing to " -"``'ß'``; :meth:`casefold` converts it to ``\"ss\"``." +"already lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:" +"`casefold` converts it to ``\"ss\"``." msgstr "" #: ../../library/stdtypes.rst:1644 @@ -2629,7 +2619,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2970 +#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2982 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -2640,25 +2630,25 @@ msgid "" "*errors* controls how encoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " "are ``'ignore'``, ``'replace'``, ``'xmlcharrefreplace'``, " -"``'backslashreplace'`` and any other name registered " -"via :func:`codecs.register_error`. See :ref:`error-handlers` for details." +"``'backslashreplace'`` and any other name registered via :func:`codecs." +"register_error`. See :ref:`error-handlers` for details." msgstr "" #: ../../library/stdtypes.rst:1683 msgid "" "For performance reasons, the value of *errors* is not checked for validity " -"unless an encoding error actually occurs, :ref:`devmode` is enabled or " -"a :ref:`debug build ` is used." +"unless an encoding error actually occurs, :ref:`devmode` is enabled or a :" +"ref:`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:2989 +#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:3001 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:2992 +#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:3004 msgid "" -"The value of the *errors* argument is now checked in :ref:`devmode` and " -"in :ref:`debug mode `." +"The value of the *errors* argument is now checked in :ref:`devmode` and in :" +"ref:`debug mode `." msgstr "" #: ../../library/stdtypes.rst:1698 @@ -2695,8 +2685,8 @@ msgstr "" #: ../../library/stdtypes.rst:1733 msgid "" "The :meth:`~str.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::" +"position of *sub*. To check if *sub* is a substring or not, use the :" +"keyword:`in` operator::" msgstr "" #: ../../library/stdtypes.rst:1737 @@ -2725,14 +2715,13 @@ msgstr "" #: ../../library/stdtypes.rst:1757 msgid "" -"When formatting a number " -"(:class:`int`, :class:`float`, :class:`complex`, :class:`decimal.Decimal` " -"and subclasses) with the ``n`` type (ex: ``'{:n}'.format(1234)``), the " -"function temporarily sets the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` " -"locale to decode ``decimal_point`` and ``thousands_sep`` fields " -"of :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, and the " -"``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. This " -"temporary change affects other threads." +"When formatting a number (:class:`int`, :class:`float`, :class:`complex`, :" +"class:`decimal.Decimal` and subclasses) with the ``n`` type (ex: ``'{:n}'." +"format(1234)``), the function temporarily sets the ``LC_CTYPE`` locale to " +"the ``LC_NUMERIC`` locale to decode ``decimal_point`` and ``thousands_sep`` " +"fields of :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, " +"and the ``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. " +"This temporary change affects other threads." msgstr "" #: ../../library/stdtypes.rst:1766 @@ -2758,20 +2747,20 @@ msgstr "" msgid "" "Return ``True`` if all characters in the string are alphanumeric and there " "is at least one character, ``False`` otherwise. A character ``c`` is " -"alphanumeric if one of the following returns ``True``: ``c.isalpha()``, " -"``c.isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." +"alphanumeric if one of the following returns ``True``: ``c.isalpha()``, ``c." +"isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." msgstr "" #: ../../library/stdtypes.rst:1804 msgid "" "Return ``True`` if all characters in the string are alphabetic and there is " "at least one character, ``False`` otherwise. Alphabetic characters are " -"those characters defined in the Unicode character database as \"Letter\", " -"i.e., those with general category property being one of \"Lm\", \"Lt\", " +"those characters defined in the Unicode character database as \"Letter\", i." +"e., those with general category property being one of \"Lm\", \"Lt\", " "\"Lu\", \"Ll\", or \"Lo\". Note that this is different from the `Alphabetic " "property defined in the section 4.10 'Letters, Alphabetic, and Ideographic' " -"of the Unicode Standard `_." +"of the Unicode Standard `_." msgstr "" #: ../../library/stdtypes.rst:1815 @@ -2879,10 +2868,9 @@ msgstr "" #: ../../library/stdtypes.rst:1899 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``." +"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:1907 @@ -2901,8 +2889,8 @@ msgstr "" #: ../../library/stdtypes.rst:1932 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 " +"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 " "*iterable*, including :class:`bytes` objects. The separator between " "elements is the string providing this method." msgstr "" @@ -2968,8 +2956,8 @@ msgstr "" #: ../../library/stdtypes.rst:1978 msgid "" -"This static method returns a translation table usable " -"for :meth:`str.translate`." +"This static method returns a translation table usable for :meth:`str." +"translate`." msgstr "" #: ../../library/stdtypes.rst:1980 @@ -3135,21 +3123,21 @@ msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " "``['1', '', '2']``). The *sep* argument may consist of multiple characters " -"as a single delimiter (to split with multiple delimiters, " -"use :func:`re.split`). Splitting an empty string with a specified separator " -"returns ``['']``." +"as a single delimiter (to split with multiple delimiters, use :func:`re." +"split`). Splitting an empty string with a specified separator returns " +"``['']``." msgstr "" #: ../../library/stdtypes.rst:2109 ../../library/stdtypes.rst:2127 -#: ../../library/stdtypes.rst:2179 ../../library/stdtypes.rst:2247 -#: ../../library/stdtypes.rst:2315 ../../library/stdtypes.rst:3307 -#: ../../library/stdtypes.rst:3325 ../../library/stdtypes.rst:3416 -#: ../../library/stdtypes.rst:3432 ../../library/stdtypes.rst:3457 -#: ../../library/stdtypes.rst:3471 ../../library/stdtypes.rst:3499 -#: ../../library/stdtypes.rst:3513 ../../library/stdtypes.rst:3531 -#: ../../library/stdtypes.rst:3558 ../../library/stdtypes.rst:3581 -#: ../../library/stdtypes.rst:3608 ../../library/stdtypes.rst:3650 -#: ../../library/stdtypes.rst:3674 +#: ../../library/stdtypes.rst:2139 ../../library/stdtypes.rst:2191 +#: ../../library/stdtypes.rst:2259 ../../library/stdtypes.rst:2327 +#: ../../library/stdtypes.rst:3319 ../../library/stdtypes.rst:3337 +#: ../../library/stdtypes.rst:3428 ../../library/stdtypes.rst:3444 +#: ../../library/stdtypes.rst:3469 ../../library/stdtypes.rst:3483 +#: ../../library/stdtypes.rst:3511 ../../library/stdtypes.rst:3525 +#: ../../library/stdtypes.rst:3543 ../../library/stdtypes.rst:3570 +#: ../../library/stdtypes.rst:3593 ../../library/stdtypes.rst:3620 +#: ../../library/stdtypes.rst:3662 ../../library/stdtypes.rst:3686 msgid "For example::" msgstr "舉例來說: ::" @@ -3199,120 +3187,136 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2142 +#: ../../library/stdtypes.rst:2136 +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:2141 +msgid "" +">>> \"\".split(None, 0)\n" +"[]\n" +">>> \" \".split(None, 0)\n" +"[]\n" +">>> \" foo \".split(maxsplit=0)\n" +"['foo ']" +msgstr "" + +#: ../../library/stdtypes.rst:2154 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:2146 +#: ../../library/stdtypes.rst:2158 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2150 +#: ../../library/stdtypes.rst:2162 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2150 +#: ../../library/stdtypes.rst:2162 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2152 +#: ../../library/stdtypes.rst:2164 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2152 +#: ../../library/stdtypes.rst:2164 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2154 +#: ../../library/stdtypes.rst:2166 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2154 +#: ../../library/stdtypes.rst:2166 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2156 +#: ../../library/stdtypes.rst:2168 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2156 +#: ../../library/stdtypes.rst:2168 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2158 +#: ../../library/stdtypes.rst:2170 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2158 +#: ../../library/stdtypes.rst:2170 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2160 +#: ../../library/stdtypes.rst:2172 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2160 +#: ../../library/stdtypes.rst:2172 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2162 +#: ../../library/stdtypes.rst:2174 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2162 +#: ../../library/stdtypes.rst:2174 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2164 +#: ../../library/stdtypes.rst:2176 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2164 +#: ../../library/stdtypes.rst:2176 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2166 +#: ../../library/stdtypes.rst:2178 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2166 +#: ../../library/stdtypes.rst:2178 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2168 +#: ../../library/stdtypes.rst:2180 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2168 +#: ../../library/stdtypes.rst:2180 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2170 +#: ../../library/stdtypes.rst:2182 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2170 +#: ../../library/stdtypes.rst:2182 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2172 +#: ../../library/stdtypes.rst:2184 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2172 +#: ../../library/stdtypes.rst:2184 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2177 +#: ../../library/stdtypes.rst:2189 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2181 +#: ../../library/stdtypes.rst:2193 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -3324,14 +3328,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:2186 +#: ../../library/stdtypes.rst:2198 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:2190 +#: ../../library/stdtypes.rst:2202 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -3343,11 +3347,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2195 +#: ../../library/stdtypes.rst:2207 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2197 +#: ../../library/stdtypes.rst:2209 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -3359,7 +3363,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2205 +#: ../../library/stdtypes.rst:2217 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -3367,7 +3371,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2213 +#: ../../library/stdtypes.rst:2225 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 " @@ -3376,7 +3380,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2219 +#: ../../library/stdtypes.rst:2231 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -3388,7 +3392,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2224 +#: ../../library/stdtypes.rst:2236 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -3396,7 +3400,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2230 +#: ../../library/stdtypes.rst:2242 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -3406,20 +3410,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2237 +#: ../../library/stdtypes.rst:2249 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " -"and vice versa. Note that it is not necessarily true that " -"``s.swapcase().swapcase() == s``." +"and vice versa. Note that it is not necessarily true that ``s.swapcase()." +"swapcase() == s``." msgstr "" -#: ../../library/stdtypes.rst:2244 +#: ../../library/stdtypes.rst:2256 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:2249 +#: ../../library/stdtypes.rst:2261 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -3427,7 +3431,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2252 ../../library/stdtypes.rst:3618 +#: ../../library/stdtypes.rst:2264 ../../library/stdtypes.rst:3630 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 " @@ -3435,7 +3439,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2257 +#: ../../library/stdtypes.rst:2269 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -3443,19 +3447,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2260 +#: ../../library/stdtypes.rst:2272 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2263 +#: ../../library/stdtypes.rst:2275 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2266 +#: ../../library/stdtypes.rst:2278 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -3475,31 +3479,31 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2278 +#: ../../library/stdtypes.rst:2290 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 " -"indexing via :meth:`~object.__getitem__`, typically a :term:`mapping` " -"or :term:`sequence`. When indexed by a Unicode ordinal (an integer), the " -"table object can do any of the following: return a Unicode ordinal or a " -"string, to map the character to one or more other characters; return " -"``None``, to delete the character from the return string; or raise " -"a :exc:`LookupError` exception, to map the character to itself." +"indexing via :meth:`~object.__getitem__`, typically a :term:`mapping` or :" +"term:`sequence`. When indexed by a Unicode ordinal (an integer), the table " +"object can do any of the following: return a Unicode ordinal or a string, to " +"map the character to one or more other characters; return ``None``, to " +"delete the character from the return string; or raise a :exc:`LookupError` " +"exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2287 +#: ../../library/stdtypes.rst:2299 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2290 +#: ../../library/stdtypes.rst:2302 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2296 +#: ../../library/stdtypes.rst:2308 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`` " @@ -3508,14 +3512,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2302 +#: ../../library/stdtypes.rst:2314 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2309 +#: ../../library/stdtypes.rst:2321 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 " @@ -3523,7 +3527,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2317 +#: ../../library/stdtypes.rst:2329 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -3535,27 +3539,27 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2338 +#: ../../library/stdtypes.rst:2350 msgid "Formatted String Literals (f-strings)" msgstr "" -#: ../../library/stdtypes.rst:2341 +#: ../../library/stdtypes.rst:2353 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" -#: ../../library/stdtypes.rst:2344 +#: ../../library/stdtypes.rst:2356 msgid "Added the debugging operator (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2346 +#: ../../library/stdtypes.rst:2358 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../library/stdtypes.rst:2350 +#: ../../library/stdtypes.rst:2362 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 " @@ -3565,7 +3569,7 @@ msgid "" "into regular :class:`str` objects. For example:" msgstr "" -#: ../../library/stdtypes.rst:2358 +#: ../../library/stdtypes.rst:2370 msgid "" ">>> who = 'nobody'\n" ">>> nationality = 'Spanish'\n" @@ -3577,11 +3581,11 @@ msgstr "" ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" "'Nobody expects the Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2365 +#: ../../library/stdtypes.rst:2377 msgid "It is also possible to use a multi line f-string:" msgstr "" -#: ../../library/stdtypes.rst:2367 +#: ../../library/stdtypes.rst:2379 msgid "" ">>> f'''This is a string\n" "... on two lines'''\n" @@ -3591,13 +3595,13 @@ msgstr "" "... on two lines'''\n" "'This is a string\\non two lines'" -#: ../../library/stdtypes.rst:2373 +#: ../../library/stdtypes.rst:2385 msgid "" "A single opening curly bracket, ``'{'``, marks a *replacement field* that " "can contain any Python expression:" msgstr "" -#: ../../library/stdtypes.rst:2376 +#: ../../library/stdtypes.rst:2388 msgid "" ">>> nationality = 'Spanish'\n" ">>> f'The {nationality} Inquisition!'\n" @@ -3607,11 +3611,11 @@ msgstr "" ">>> f'The {nationality} Inquisition!'\n" "'The Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2382 +#: ../../library/stdtypes.rst:2394 msgid "To include a literal ``{`` or ``}``, use a double bracket:" msgstr "" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2396 msgid "" ">>> x = 42\n" ">>> f'{{x}} is {x}'\n" @@ -3621,12 +3625,12 @@ msgstr "" ">>> f'{{x}} is {x}'\n" "'{x} is 42'" -#: ../../library/stdtypes.rst:2390 +#: ../../library/stdtypes.rst:2402 msgid "" "Functions can also be used, and :ref:`format specifiers `:" msgstr "" -#: ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2404 msgid "" ">>> from math import sqrt\n" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" @@ -3636,11 +3640,11 @@ msgstr "" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" "'√2 ≈ 1.41421'" -#: ../../library/stdtypes.rst:2398 +#: ../../library/stdtypes.rst:2410 msgid "Any non-string expression is converted using :func:`str`, by default:" msgstr "" -#: ../../library/stdtypes.rst:2400 +#: ../../library/stdtypes.rst:2412 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)}'\n" @@ -3650,46 +3654,46 @@ msgstr "" ">>> f'{Fraction(1, 3)}'\n" "'1/3'" -#: ../../library/stdtypes.rst:2406 +#: ../../library/stdtypes.rst:2418 msgid "" "To use an explicit conversion, use the ``!`` (exclamation mark) operator, " "followed by any of the valid formats, which are:" msgstr "" -#: ../../library/stdtypes.rst:2410 ../../library/stdtypes.rst:2578 -#: ../../library/stdtypes.rst:3797 +#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:2590 +#: ../../library/stdtypes.rst:3809 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:2412 +#: ../../library/stdtypes.rst:2424 msgid "``!a``" msgstr "``!a``" -#: ../../library/stdtypes.rst:2412 +#: ../../library/stdtypes.rst:2424 msgid ":func:`ascii`" msgstr ":func:`ascii`" -#: ../../library/stdtypes.rst:2413 +#: ../../library/stdtypes.rst:2425 msgid "``!r``" msgstr "``!r``" -#: ../../library/stdtypes.rst:2413 +#: ../../library/stdtypes.rst:2425 msgid ":func:`repr`" msgstr ":func:`repr`" -#: ../../library/stdtypes.rst:2414 +#: ../../library/stdtypes.rst:2426 msgid "``!s``" msgstr "``!s``" -#: ../../library/stdtypes.rst:2414 +#: ../../library/stdtypes.rst:2426 msgid ":func:`str`" msgstr ":func:`str`" -#: ../../library/stdtypes.rst:2417 +#: ../../library/stdtypes.rst:2429 msgid "For example:" msgstr "舉例來說:" -#: ../../library/stdtypes.rst:2419 +#: ../../library/stdtypes.rst:2431 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)!s}'\n" @@ -3709,7 +3713,7 @@ msgstr "" ">>> print(f'{question!a}')\n" "'\\xbfD\\xf3nde est\\xe1 el Presidente?'" -#: ../../library/stdtypes.rst:2430 +#: ../../library/stdtypes.rst:2442 msgid "" "While debugging it may be helpful to see both the expression and its value, " "by using the equals sign (``=``) after the expression. This preserves spaces " @@ -3717,7 +3721,7 @@ msgid "" "debugging operator uses the :func:`repr` (``!r``) conversion. For example:" msgstr "" -#: ../../library/stdtypes.rst:2436 +#: ../../library/stdtypes.rst:2448 msgid "" ">>> from fractions import Fraction\n" ">>> calculation = Fraction(1, 3)\n" @@ -3737,7 +3741,7 @@ msgstr "" ">>> f'{calculation = !s}'\n" "'calculation = 1/3'" -#: ../../library/stdtypes.rst:2447 +#: ../../library/stdtypes.rst:2459 msgid "" "Once the output has been evaluated, it can be formatted using a :ref:`format " "specifier ` following a colon (``':'``). After the expression " @@ -3747,7 +3751,7 @@ msgid "" "used as the final value for the replacement field. For example:" msgstr "" -#: ../../library/stdtypes.rst:2455 +#: ../../library/stdtypes.rst:2467 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 7):.6f}'\n" @@ -3756,11 +3760,11 @@ msgid "" "'___+1/7___'" msgstr "" -#: ../../library/stdtypes.rst:2467 +#: ../../library/stdtypes.rst:2479 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2480 +#: ../../library/stdtypes.rst:2492 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 " @@ -3771,7 +3775,7 @@ msgid "" "or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2488 +#: ../../library/stdtypes.rst:2500 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -3781,13 +3785,13 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:2495 +#: ../../library/stdtypes.rst:2507 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." msgstr "" -#: ../../library/stdtypes.rst:2500 +#: ../../library/stdtypes.rst:2512 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 " @@ -3795,36 +3799,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2510 ../../library/stdtypes.rst:3729 +#: ../../library/stdtypes.rst:2522 ../../library/stdtypes.rst:3741 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2513 ../../library/stdtypes.rst:3732 +#: ../../library/stdtypes.rst:2525 ../../library/stdtypes.rst:3744 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2515 ../../library/stdtypes.rst:3734 +#: ../../library/stdtypes.rst:2527 ../../library/stdtypes.rst:3746 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2518 ../../library/stdtypes.rst:3737 +#: ../../library/stdtypes.rst:2530 ../../library/stdtypes.rst:3749 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2521 ../../library/stdtypes.rst:3740 +#: ../../library/stdtypes.rst:2533 ../../library/stdtypes.rst:3752 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:2525 ../../library/stdtypes.rst:3744 +#: ../../library/stdtypes.rst:2537 ../../library/stdtypes.rst:3756 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -3832,15 +3836,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2530 ../../library/stdtypes.rst:3749 +#: ../../library/stdtypes.rst:2542 ../../library/stdtypes.rst:3761 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2532 ../../library/stdtypes.rst:3751 +#: ../../library/stdtypes.rst:2544 ../../library/stdtypes.rst:3763 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2534 +#: ../../library/stdtypes.rst:2546 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 " @@ -3848,293 +3852,293 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2543 ../../library/stdtypes.rst:3762 +#: ../../library/stdtypes.rst:2555 ../../library/stdtypes.rst:3774 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2546 ../../library/stdtypes.rst:3765 +#: ../../library/stdtypes.rst:2558 ../../library/stdtypes.rst:3777 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2555 ../../library/stdtypes.rst:3774 +#: ../../library/stdtypes.rst:2567 ../../library/stdtypes.rst:3786 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2557 ../../library/stdtypes.rst:3776 +#: ../../library/stdtypes.rst:2569 ../../library/stdtypes.rst:3788 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2557 ../../library/stdtypes.rst:3776 +#: ../../library/stdtypes.rst:2569 ../../library/stdtypes.rst:3788 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2560 ../../library/stdtypes.rst:3779 +#: ../../library/stdtypes.rst:2572 ../../library/stdtypes.rst:3791 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2560 ../../library/stdtypes.rst:3779 +#: ../../library/stdtypes.rst:2572 ../../library/stdtypes.rst:3791 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2562 ../../library/stdtypes.rst:3781 +#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:3793 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2562 ../../library/stdtypes.rst:3781 +#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:3793 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2565 ../../library/stdtypes.rst:3784 +#: ../../library/stdtypes.rst:2577 ../../library/stdtypes.rst:3796 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2565 ../../library/stdtypes.rst:3784 +#: ../../library/stdtypes.rst:2577 ../../library/stdtypes.rst:3796 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2568 ../../library/stdtypes.rst:3787 +#: ../../library/stdtypes.rst:2580 ../../library/stdtypes.rst:3799 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2568 ../../library/stdtypes.rst:3787 +#: ../../library/stdtypes.rst:2580 ../../library/stdtypes.rst:3799 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2572 ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3803 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:2575 ../../library/stdtypes.rst:3794 +#: ../../library/stdtypes.rst:2587 ../../library/stdtypes.rst:3806 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2580 ../../library/stdtypes.rst:3799 +#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:3811 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2580 ../../library/stdtypes.rst:2582 -#: ../../library/stdtypes.rst:3799 ../../library/stdtypes.rst:3801 +#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:2594 +#: ../../library/stdtypes.rst:3811 ../../library/stdtypes.rst:3813 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2582 ../../library/stdtypes.rst:3801 +#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:3813 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3803 +#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:3815 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3803 +#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:3815 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2586 ../../library/stdtypes.rst:3805 +#: ../../library/stdtypes.rst:2598 ../../library/stdtypes.rst:3817 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2586 ../../library/stdtypes.rst:3805 +#: ../../library/stdtypes.rst:2598 ../../library/stdtypes.rst:3817 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2588 ../../library/stdtypes.rst:3807 +#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:3819 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2588 ../../library/stdtypes.rst:3807 +#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:3819 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2590 ../../library/stdtypes.rst:3809 +#: ../../library/stdtypes.rst:2602 ../../library/stdtypes.rst:3821 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2590 ../../library/stdtypes.rst:3809 +#: ../../library/stdtypes.rst:2602 ../../library/stdtypes.rst:3821 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:3811 +#: ../../library/stdtypes.rst:2604 ../../library/stdtypes.rst:3823 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:3811 +#: ../../library/stdtypes.rst:2604 ../../library/stdtypes.rst:3823 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:3813 +#: ../../library/stdtypes.rst:2606 ../../library/stdtypes.rst:3825 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:3813 +#: ../../library/stdtypes.rst:2606 ../../library/stdtypes.rst:3825 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:2608 ../../library/stdtypes.rst:3827 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:2598 -#: ../../library/stdtypes.rst:3815 ../../library/stdtypes.rst:3817 +#: ../../library/stdtypes.rst:2608 ../../library/stdtypes.rst:2610 +#: ../../library/stdtypes.rst:3827 ../../library/stdtypes.rst:3829 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2598 ../../library/stdtypes.rst:3817 +#: ../../library/stdtypes.rst:2610 ../../library/stdtypes.rst:3829 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:3819 +#: ../../library/stdtypes.rst:2612 ../../library/stdtypes.rst:3831 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:3819 +#: ../../library/stdtypes.rst:2612 ../../library/stdtypes.rst:3831 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:2604 ../../library/stdtypes.rst:3823 +#: ../../library/stdtypes.rst:2616 ../../library/stdtypes.rst:3835 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2604 ../../library/stdtypes.rst:3823 +#: ../../library/stdtypes.rst:2616 ../../library/stdtypes.rst:3835 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:2608 ../../library/stdtypes.rst:3827 +#: ../../library/stdtypes.rst:2620 ../../library/stdtypes.rst:3839 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2608 +#: ../../library/stdtypes.rst:2620 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2611 ../../library/stdtypes.rst:3840 +#: ../../library/stdtypes.rst:2623 ../../library/stdtypes.rst:3852 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2611 +#: ../../library/stdtypes.rst:2623 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2614 ../../library/stdtypes.rst:3834 +#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3846 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2614 +#: ../../library/stdtypes.rst:2626 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2617 ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:2629 ../../library/stdtypes.rst:3849 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2617 +#: ../../library/stdtypes.rst:2629 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2620 ../../library/stdtypes.rst:3843 +#: ../../library/stdtypes.rst:2632 ../../library/stdtypes.rst:3855 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2620 ../../library/stdtypes.rst:3843 +#: ../../library/stdtypes.rst:2632 ../../library/stdtypes.rst:3855 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2627 ../../library/stdtypes.rst:3850 +#: ../../library/stdtypes.rst:2639 ../../library/stdtypes.rst:3862 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2631 ../../library/stdtypes.rst:3854 +#: ../../library/stdtypes.rst:2643 ../../library/stdtypes.rst:3866 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:2635 ../../library/stdtypes.rst:3858 +#: ../../library/stdtypes.rst:2647 ../../library/stdtypes.rst:3870 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2638 ../../library/stdtypes.rst:3861 +#: ../../library/stdtypes.rst:2650 ../../library/stdtypes.rst:3873 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2642 ../../library/stdtypes.rst:3865 +#: ../../library/stdtypes.rst:2654 ../../library/stdtypes.rst:3877 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:2645 ../../library/stdtypes.rst:3868 +#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:3880 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:3872 +#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:3884 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:3881 +#: ../../library/stdtypes.rst:2664 ../../library/stdtypes.rst:3893 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2654 +#: ../../library/stdtypes.rst:2666 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:2659 +#: ../../library/stdtypes.rst:2671 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2670 +#: ../../library/stdtypes.rst:2682 msgid "" -"Binary Sequence Types " -"--- :class:`bytes`, :class:`bytearray`, :class:`memoryview`" +"Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" +"`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2678 +#: ../../library/stdtypes.rst:2690 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 :ref:`buffer protocol ` to access the memory of other " -"binary objects without needing to make a copy." +"The core built-in types for manipulating binary data are :class:`bytes` and :" +"class:`bytearray`. They are supported by :class:`memoryview` which uses the :" +"ref:`buffer protocol ` to access the memory of other binary " +"objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2683 +#: ../../library/stdtypes.rst:2695 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:2689 +#: ../../library/stdtypes.rst:2701 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2693 +#: ../../library/stdtypes.rst:2705 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -4142,40 +4146,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2700 +#: ../../library/stdtypes.rst:2712 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:2703 +#: ../../library/stdtypes.rst:2715 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2704 +#: ../../library/stdtypes.rst:2716 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2705 +#: ../../library/stdtypes.rst:2717 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2707 +#: ../../library/stdtypes.rst:2719 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:2711 +#: ../../library/stdtypes.rst:2723 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:2715 +#: ../../library/stdtypes.rst:2727 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -4188,29 +4192,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2725 +#: ../../library/stdtypes.rst:2737 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2728 +#: ../../library/stdtypes.rst:2740 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2729 +#: ../../library/stdtypes.rst:2741 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2730 +#: ../../library/stdtypes.rst:2742 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2732 +#: ../../library/stdtypes.rst:2744 msgid "Also see the :ref:`bytes ` built-in." msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:2734 +#: ../../library/stdtypes.rst:2746 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4218,32 +4222,32 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:2740 +#: ../../library/stdtypes.rst:2752 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:2747 +#: ../../library/stdtypes.rst:2759 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:2751 +#: ../../library/stdtypes.rst:2763 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2756 ../../library/stdtypes.rst:2841 +#: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:2853 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:2762 +#: ../../library/stdtypes.rst:2774 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, " @@ -4252,13 +4256,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:2779 +#: ../../library/stdtypes.rst:2791 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:2783 +#: ../../library/stdtypes.rst:2795 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 " @@ -4266,58 +4270,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2788 +#: ../../library/stdtypes.rst:2800 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:2796 +#: ../../library/stdtypes.rst:2808 msgid "Bytearray Objects" msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:2800 +#: ../../library/stdtypes.rst:2812 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:2805 +#: ../../library/stdtypes.rst:2817 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:2808 +#: ../../library/stdtypes.rst:2820 msgid "Creating an empty instance: ``bytearray()``" msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:2809 +#: ../../library/stdtypes.rst:2821 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:2810 +#: ../../library/stdtypes.rst:2822 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2811 +#: ../../library/stdtypes.rst:2823 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:2813 +#: ../../library/stdtypes.rst:2825 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:2817 +#: ../../library/stdtypes.rst:2829 msgid "Also see the :ref:`bytearray ` built-in." msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:2819 +#: ../../library/stdtypes.rst:2831 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4325,33 +4329,33 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:2825 +#: ../../library/stdtypes.rst:2837 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:2832 +#: ../../library/stdtypes.rst:2844 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:2836 +#: ../../library/stdtypes.rst:2848 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2849 +#: ../../library/stdtypes.rst:2861 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:2854 +#: ../../library/stdtypes.rst:2866 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 " @@ -4359,7 +4363,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2859 +#: ../../library/stdtypes.rst:2871 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -4367,11 +4371,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2868 +#: ../../library/stdtypes.rst:2880 msgid "Bytes and Bytearray Operations" msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:2873 +#: ../../library/stdtypes.rst:2885 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -4380,14 +4384,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:2881 +#: ../../library/stdtypes.rst:2893 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:2885 +#: ../../library/stdtypes.rst:2897 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -4395,11 +4399,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:2888 +#: ../../library/stdtypes.rst:2900 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:2890 +#: ../../library/stdtypes.rst:2902 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -4407,60 +4411,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2905 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:2898 +#: ../../library/stdtypes.rst:2910 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:2901 +#: ../../library/stdtypes.rst:2913 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:2907 +#: ../../library/stdtypes.rst:2919 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:2911 ../../library/stdtypes.rst:3016 -#: ../../library/stdtypes.rst:3038 ../../library/stdtypes.rst:3104 -#: ../../library/stdtypes.rst:3117 +#: ../../library/stdtypes.rst:2923 ../../library/stdtypes.rst:3028 +#: ../../library/stdtypes.rst:3050 ../../library/stdtypes.rst:3116 +#: ../../library/stdtypes.rst:3129 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:2914 +#: ../../library/stdtypes.rst:2926 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:2917 ../../library/stdtypes.rst:3028 -#: ../../library/stdtypes.rst:3041 ../../library/stdtypes.rst:3107 -#: ../../library/stdtypes.rst:3120 +#: ../../library/stdtypes.rst:2929 ../../library/stdtypes.rst:3040 +#: ../../library/stdtypes.rst:3053 ../../library/stdtypes.rst:3119 +#: ../../library/stdtypes.rst:3132 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:2924 +#: ../../library/stdtypes.rst:2936 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:2928 +#: ../../library/stdtypes.rst:2940 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -4472,32 +4476,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:2933 +#: ../../library/stdtypes.rst:2945 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" -#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:2959 -#: ../../library/stdtypes.rst:3092 ../../library/stdtypes.rst:3185 -#: ../../library/stdtypes.rst:3199 ../../library/stdtypes.rst:3230 -#: ../../library/stdtypes.rst:3244 ../../library/stdtypes.rst:3286 -#: ../../library/stdtypes.rst:3357 ../../library/stdtypes.rst:3375 -#: ../../library/stdtypes.rst:3403 ../../library/stdtypes.rst:3542 -#: ../../library/stdtypes.rst:3597 ../../library/stdtypes.rst:3640 -#: ../../library/stdtypes.rst:3661 ../../library/stdtypes.rst:3683 -#: ../../library/stdtypes.rst:3885 +#: ../../library/stdtypes.rst:2949 ../../library/stdtypes.rst:2971 +#: ../../library/stdtypes.rst:3104 ../../library/stdtypes.rst:3197 +#: ../../library/stdtypes.rst:3211 ../../library/stdtypes.rst:3242 +#: ../../library/stdtypes.rst:3256 ../../library/stdtypes.rst:3298 +#: ../../library/stdtypes.rst:3369 ../../library/stdtypes.rst:3387 +#: ../../library/stdtypes.rst:3415 ../../library/stdtypes.rst:3554 +#: ../../library/stdtypes.rst:3609 ../../library/stdtypes.rst:3652 +#: ../../library/stdtypes.rst:3673 ../../library/stdtypes.rst:3695 +#: ../../library/stdtypes.rst:3897 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:2946 +#: ../../library/stdtypes.rst:2958 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:2950 +#: ../../library/stdtypes.rst:2962 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -4509,37 +4513,37 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:2955 +#: ../../library/stdtypes.rst:2967 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2968 +#: ../../library/stdtypes.rst:2980 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:2973 +#: ../../library/stdtypes.rst:2985 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " -"are ``'ignore'``, ``'replace'``, and any other name registered " -"via :func:`codecs.register_error`. See :ref:`error-handlers` for details." +"are ``'ignore'``, ``'replace'``, and any other name registered via :func:" +"`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:2979 +#: ../../library/stdtypes.rst:2991 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." +"unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" +"`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:2985 +#: ../../library/stdtypes.rst:2997 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." +"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:3000 +#: ../../library/stdtypes.rst:3012 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -4547,11 +4551,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3005 +#: ../../library/stdtypes.rst:3017 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3011 +#: ../../library/stdtypes.rst:3023 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 " @@ -4559,14 +4563,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3021 +#: ../../library/stdtypes.rst:3033 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::" +"position of *sub*. To check if *sub* is a substring or not, use the :" +"keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:3025 +#: ../../library/stdtypes.rst:3037 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -4574,13 +4578,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:3035 +#: ../../library/stdtypes.rst:3047 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:3048 +#: ../../library/stdtypes.rst:3060 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 " @@ -4590,15 +4594,15 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:3059 +#: ../../library/stdtypes.rst:3071 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 same position in *to*; *from* and *to* must both " -"be :term:`bytes-like objects ` and have the same length." +"This static method returns a translation table usable for :meth:`bytes." +"translate` that will map each character in *from* into the character at the " +"same position in *to*; *from* and *to* must both be :term:`bytes-like " +"objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:3070 +#: ../../library/stdtypes.rst:3082 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 " @@ -4607,24 +4611,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:3077 ../../library/stdtypes.rst:3134 +#: ../../library/stdtypes.rst:3089 ../../library/stdtypes.rst:3146 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3083 +#: ../../library/stdtypes.rst:3095 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:3087 +#: ../../library/stdtypes.rst:3099 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3099 +#: ../../library/stdtypes.rst:3111 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -4632,13 +4636,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:3114 +#: ../../library/stdtypes.rst:3126 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3127 +#: ../../library/stdtypes.rst:3139 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 " @@ -4647,7 +4651,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:3140 +#: ../../library/stdtypes.rst:3152 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -4655,11 +4659,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3145 +#: ../../library/stdtypes.rst:3157 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3151 +#: ../../library/stdtypes.rst:3163 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 " @@ -4667,18 +4671,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3156 +#: ../../library/stdtypes.rst:3168 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3159 +#: ../../library/stdtypes.rst:3171 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3162 +#: ../../library/stdtypes.rst:3174 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -4686,11 +4690,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3165 +#: ../../library/stdtypes.rst:3177 msgid "*delete* is now supported as a keyword argument." msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3169 +#: ../../library/stdtypes.rst:3181 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 " @@ -4699,7 +4703,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3178 +#: ../../library/stdtypes.rst:3190 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). " @@ -4707,7 +4711,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3192 +#: ../../library/stdtypes.rst:3204 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). " @@ -4715,7 +4719,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3206 +#: ../../library/stdtypes.rst:3218 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4725,7 +4729,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3213 +#: ../../library/stdtypes.rst:3225 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -4737,14 +4741,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3218 +#: ../../library/stdtypes.rst:3230 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:3223 +#: ../../library/stdtypes.rst:3235 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -4756,7 +4760,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3237 +#: ../../library/stdtypes.rst:3249 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). " @@ -4764,7 +4768,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3251 +#: ../../library/stdtypes.rst:3263 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 " @@ -4774,7 +4778,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3262 +#: ../../library/stdtypes.rst:3274 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4784,7 +4788,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3269 +#: ../../library/stdtypes.rst:3281 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -4796,14 +4800,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3274 +#: ../../library/stdtypes.rst:3286 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:3279 +#: ../../library/stdtypes.rst:3291 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -4815,7 +4819,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3293 +#: ../../library/stdtypes.rst:3305 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 " @@ -4824,7 +4828,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3299 +#: ../../library/stdtypes.rst:3311 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',')`` " @@ -4835,7 +4839,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3309 +#: ../../library/stdtypes.rst:3321 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -4855,7 +4859,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3318 +#: ../../library/stdtypes.rst:3330 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 " @@ -4865,7 +4869,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3328 +#: ../../library/stdtypes.rst:3340 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -4881,7 +4885,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3339 +#: ../../library/stdtypes.rst:3351 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *chars* argument is a binary sequence specifying the set of " @@ -4891,7 +4895,7 @@ msgid "" "a prefix or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3347 +#: ../../library/stdtypes.rst:3359 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -4903,13 +4907,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3352 +#: ../../library/stdtypes.rst:3364 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3361 +#: ../../library/stdtypes.rst:3373 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 " @@ -4917,14 +4921,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3369 +#: ../../library/stdtypes.rst:3381 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:3382 +#: ../../library/stdtypes.rst:3394 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 " @@ -4940,7 +4944,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3396 +#: ../../library/stdtypes.rst:3408 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -4952,7 +4956,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3410 +#: ../../library/stdtypes.rst:3422 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -4961,7 +4965,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3418 +#: ../../library/stdtypes.rst:3430 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -4973,7 +4977,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3427 +#: ../../library/stdtypes.rst:3439 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -4981,7 +4985,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3434 +#: ../../library/stdtypes.rst:3446 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -4993,20 +4997,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3443 +#: ../../library/stdtypes.rst:3455 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:3453 +#: ../../library/stdtypes.rst:3465 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:3459 +#: ../../library/stdtypes.rst:3471 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -5018,13 +5022,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3468 +#: ../../library/stdtypes.rst:3480 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:3473 +#: ../../library/stdtypes.rst:3485 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -5036,16 +5040,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3478 ../../library/stdtypes.rst:3520 -#: ../../library/stdtypes.rst:3536 ../../library/stdtypes.rst:3586 -#: ../../library/stdtypes.rst:3655 +#: ../../library/stdtypes.rst:3490 ../../library/stdtypes.rst:3532 +#: ../../library/stdtypes.rst:3548 ../../library/stdtypes.rst:3598 +#: ../../library/stdtypes.rst:3667 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:3486 +#: ../../library/stdtypes.rst:3498 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -5053,14 +5057,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3495 +#: ../../library/stdtypes.rst:3507 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:3501 +#: ../../library/stdtypes.rst:3513 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -5072,14 +5076,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3510 +#: ../../library/stdtypes.rst:3522 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:3515 +#: ../../library/stdtypes.rst:3527 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -5091,13 +5095,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3528 +#: ../../library/stdtypes.rst:3540 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3533 +#: ../../library/stdtypes.rst:3545 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -5105,7 +5109,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3553 +#: ../../library/stdtypes.rst:3565 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 " @@ -5113,7 +5117,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3560 +#: ../../library/stdtypes.rst:3572 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -5125,14 +5129,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:3565 +#: ../../library/stdtypes.rst:3577 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:3569 +#: ../../library/stdtypes.rst:3581 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -5144,13 +5148,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:3590 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:3583 +#: ../../library/stdtypes.rst:3595 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -5158,22 +5162,22 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3590 +#: ../../library/stdtypes.rst:3602 msgid "" -"Unlike :func:`str.swapcase`, it is always the case that " -"``bin.swapcase().swapcase() == bin`` for the binary versions. Case " -"conversions are symmetrical in ASCII, even though that is not generally true " -"for arbitrary Unicode code points." +"Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." +"swapcase() == bin`` for the binary versions. Case conversions are " +"symmetrical in ASCII, even though that is not generally true for arbitrary " +"Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3604 +#: ../../library/stdtypes.rst:3616 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:3610 +#: ../../library/stdtypes.rst:3622 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -5181,7 +5185,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3613 +#: ../../library/stdtypes.rst:3625 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -5189,7 +5193,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3623 +#: ../../library/stdtypes.rst:3635 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -5197,12 +5201,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:3626 +#: ../../library/stdtypes.rst:3638 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3628 +#: ../../library/stdtypes.rst:3640 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -5224,13 +5228,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:3647 +#: ../../library/stdtypes.rst:3659 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3652 +#: ../../library/stdtypes.rst:3664 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -5238,7 +5242,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3668 +#: ../../library/stdtypes.rst:3680 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 " @@ -5247,7 +5251,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3676 +#: ../../library/stdtypes.rst:3688 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5259,11 +5263,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:3690 +#: ../../library/stdtypes.rst:3702 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:3707 +#: ../../library/stdtypes.rst:3719 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 " @@ -5271,17 +5275,17 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:3712 +#: ../../library/stdtypes.rst:3724 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " "*interpolation* operator. Given ``format % values`` (where *format* is a " "bytes object), ``%`` conversion specifications in *format* are replaced with " -"zero or more elements of *values*. The effect is similar to using " -"the :c:func:`sprintf` in the C language." +"zero or more elements of *values*. The effect is similar to using the :c:" +"func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:3719 +#: ../../library/stdtypes.rst:3731 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 " @@ -5289,7 +5293,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3753 +#: ../../library/stdtypes.rst:3765 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 " @@ -5297,73 +5301,73 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3827 +#: ../../library/stdtypes.rst:3839 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:3830 +#: ../../library/stdtypes.rst:3842 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:3830 +#: ../../library/stdtypes.rst:3842 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:3834 +#: ../../library/stdtypes.rst:3846 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:3849 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:3840 +#: ../../library/stdtypes.rst:3852 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3840 +#: ../../library/stdtypes.rst:3852 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:3875 +#: ../../library/stdtypes.rst:3887 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3878 +#: ../../library/stdtypes.rst:3890 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3890 +#: ../../library/stdtypes.rst:3902 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:3897 +#: ../../library/stdtypes.rst:3909 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:3899 +#: ../../library/stdtypes.rst:3911 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:3905 +#: ../../library/stdtypes.rst:3917 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:3909 +#: ../../library/stdtypes.rst:3921 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 " @@ -5371,32 +5375,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:3914 +#: ../../library/stdtypes.rst:3926 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:3918 +#: ../../library/stdtypes.rst:3930 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:3921 +#: ../../library/stdtypes.rst:3933 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:3924 +#: ../../library/stdtypes.rst:3936 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:3927 +#: ../../library/stdtypes.rst:3939 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -5418,7 +5422,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:3937 +#: ../../library/stdtypes.rst:3949 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 " @@ -5429,11 +5433,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:3946 +#: ../../library/stdtypes.rst:3958 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:3948 +#: ../../library/stdtypes.rst:3960 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -5455,13 +5459,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:3958 +#: ../../library/stdtypes.rst:3970 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:3961 +#: ../../library/stdtypes.rst:3973 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -5501,14 +5505,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:3979 +#: ../../library/stdtypes.rst:3991 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:3983 +#: ../../library/stdtypes.rst:3995 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -5526,41 +5530,40 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:3991 +#: ../../library/stdtypes.rst:4003 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:3995 +#: ../../library/stdtypes.rst:4007 msgid "" -"memoryview is now registered automatically " -"with :class:`collections.abc.Sequence`" +"memoryview is now registered automatically with :class:`collections.abc." +"Sequence`" msgstr "" -#: ../../library/stdtypes.rst:3999 +#: ../../library/stdtypes.rst:4011 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:4002 +#: ../../library/stdtypes.rst:4014 msgid ":class:`memoryview` has several methods:" msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:4006 +#: ../../library/stdtypes.rst:4018 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:4010 +#: ../../library/stdtypes.rst:4022 msgid "" -"For the subset of :mod:`struct` format strings currently supported " -"by :meth:`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == " -"w.tolist()``::" +"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:4013 +#: ../../library/stdtypes.rst:4025 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -5594,14 +5597,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:4029 +#: ../../library/stdtypes.rst:4041 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:4033 +#: ../../library/stdtypes.rst:4045 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -5627,25 +5630,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:4045 +#: ../../library/stdtypes.rst:4057 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:4048 +#: ../../library/stdtypes.rst:4060 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:4054 +#: ../../library/stdtypes.rst:4066 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:4057 +#: ../../library/stdtypes.rst:4069 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -5659,7 +5662,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:4063 +#: ../../library/stdtypes.rst:4075 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -5667,7 +5670,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:4068 +#: ../../library/stdtypes.rst:4080 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' " @@ -5676,13 +5679,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:4077 +#: ../../library/stdtypes.rst:4089 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:4080 +#: ../../library/stdtypes.rst:4092 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -5692,18 +5695,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:4086 +#: ../../library/stdtypes.rst:4098 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:4093 +#: ../../library/stdtypes.rst:4105 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:4095 +#: ../../library/stdtypes.rst:4107 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -5721,19 +5724,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:4103 +#: ../../library/stdtypes.rst:4115 msgid "" -":meth:`tolist` now supports all single character native formats " -"in :mod:`struct` module syntax as well as multi-dimensional representations." +":meth:`tolist` now supports all single character native formats in :mod:" +"`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:4110 +#: ../../library/stdtypes.rst:4122 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:4125 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -5759,23 +5762,23 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:4129 +#: ../../library/stdtypes.rst:4141 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 :class:`bytearray` would temporarily forbid resizing); therefore, calling " +"objects take special actions when a view is held on them (for example, a :" +"class:`bytearray` would temporarily forbid resizing); therefore, calling " "release() is handy to remove these restrictions (and free any dangling " "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:4135 +#: ../../library/stdtypes.rst:4147 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:4139 +#: ../../library/stdtypes.rst:4151 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -5791,13 +5794,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4146 +#: ../../library/stdtypes.rst:4158 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4149 +#: ../../library/stdtypes.rst:4161 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -5817,7 +5820,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4162 +#: ../../library/stdtypes.rst:4174 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 " @@ -5826,19 +5829,19 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4168 +#: ../../library/stdtypes.rst:4180 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 'c'). The byte length of the result must be the same as the original " -"length. Note that all byte lengths may depend on the operating system." +"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 " +"'c'). The byte length of the result must be the same as the original length. " +"Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4174 +#: ../../library/stdtypes.rst:4186 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4176 +#: ../../library/stdtypes.rst:4188 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -5882,11 +5885,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4197 +#: ../../library/stdtypes.rst:4209 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4199 +#: ../../library/stdtypes.rst:4211 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -5910,11 +5913,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4210 +#: ../../library/stdtypes.rst:4222 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4212 +#: ../../library/stdtypes.rst:4224 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -5964,11 +5967,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4236 +#: ../../library/stdtypes.rst:4248 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4238 +#: ../../library/stdtypes.rst:4250 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -5990,19 +5993,19 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4250 +#: ../../library/stdtypes.rst:4262 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4253 +#: ../../library/stdtypes.rst:4265 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4257 +#: ../../library/stdtypes.rst:4269 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4259 +#: ../../library/stdtypes.rst:4271 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -6014,14 +6017,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4268 +#: ../../library/stdtypes.rst:4280 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:4272 +#: ../../library/stdtypes.rst:4284 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -6053,11 +6056,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4287 +#: ../../library/stdtypes.rst:4299 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4289 +#: ../../library/stdtypes.rst:4301 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -6081,11 +6084,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4304 +#: ../../library/stdtypes.rst:4316 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4308 +#: ../../library/stdtypes.rst:4320 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 " @@ -6093,17 +6096,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4313 +#: ../../library/stdtypes.rst:4325 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:4319 +#: ../../library/stdtypes.rst:4331 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4321 +#: ../../library/stdtypes.rst:4333 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -6123,59 +6126,59 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4332 +#: ../../library/stdtypes.rst:4344 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4337 +#: ../../library/stdtypes.rst:4349 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:4340 ../../library/stdtypes.rst:4348 +#: ../../library/stdtypes.rst:4352 ../../library/stdtypes.rst:4360 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4345 +#: ../../library/stdtypes.rst:4357 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:4353 +#: ../../library/stdtypes.rst:4365 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4357 +#: ../../library/stdtypes.rst:4369 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4363 +#: ../../library/stdtypes.rst:4375 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:4381 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4377 +#: ../../library/stdtypes.rst:4389 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4381 +#: ../../library/stdtypes.rst:4393 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " "sequence, and computing mathematical operations such as intersection, union, " "difference, and symmetric difference. (For other containers see the built-" -"in :class:`dict`, :class:`list`, and :class:`tuple` classes, and " -"the :mod:`collections` module.)" +"in :class:`dict`, :class:`list`, and :class:`tuple` classes, and the :mod:" +"`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4388 +#: ../../library/stdtypes.rst:4400 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 " @@ -6183,30 +6186,30 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4393 +#: ../../library/stdtypes.rst:4405 msgid "" -"There are currently two built-in set types, :class:`set` " -"and :class:`frozenset`. The :class:`set` type is mutable --- the contents " -"can be changed using methods like :meth:`~set.add` and :meth:`~set.remove`. " -"Since it is mutable, it has no hash value and cannot be used as either a " +"There are currently two built-in set types, :class:`set` and :class:" +"`frozenset`. The :class:`set` type is mutable --- the contents can be " +"changed using methods like :meth:`~set.add` and :meth:`~set.remove`. Since " +"it is mutable, it has no hash value and cannot be used as either a " "dictionary key or as an element of another set. The :class:`frozenset` type " "is immutable and :term:`hashable` --- its contents cannot be altered after " "it is created; it can therefore be used as a dictionary key or as an element " "of another set." msgstr "" -#: ../../library/stdtypes.rst:4401 +#: ../../library/stdtypes.rst:4413 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:4405 +#: ../../library/stdtypes.rst:4417 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4410 +#: ../../library/stdtypes.rst:4422 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 " @@ -6214,102 +6217,102 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4416 +#: ../../library/stdtypes.rst:4428 msgid "Sets can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4418 +#: ../../library/stdtypes.rst:4430 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4419 +#: ../../library/stdtypes.rst:4431 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4420 +#: ../../library/stdtypes.rst:4432 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4422 +#: ../../library/stdtypes.rst:4434 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4427 +#: ../../library/stdtypes.rst:4439 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4431 +#: ../../library/stdtypes.rst:4443 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4447 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4439 +#: ../../library/stdtypes.rst:4451 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:4445 +#: ../../library/stdtypes.rst:4457 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4449 +#: ../../library/stdtypes.rst:4461 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4455 +#: ../../library/stdtypes.rst:4467 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4459 +#: ../../library/stdtypes.rst:4471 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4465 +#: ../../library/stdtypes.rst:4477 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4470 +#: ../../library/stdtypes.rst:4482 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4475 +#: ../../library/stdtypes.rst:4487 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4480 +#: ../../library/stdtypes.rst:4492 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4484 +#: ../../library/stdtypes.rst:4496 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4487 +#: ../../library/stdtypes.rst:4499 msgid "" -"Note, the non-operator versions " -"of :meth:`union`, :meth:`intersection`, :meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, " -"and :meth:`issuperset` methods will accept any iterable as an argument. In " -"contrast, their operator based counterparts require their arguments to be " -"sets. This precludes error-prone constructions like ``set('abc') & 'cbs'`` " -"in favor of the more readable ``set('abc').intersection('cbs')``." +"Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" +"meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" +"`issuperset` methods will accept any iterable as an argument. In contrast, " +"their operator based counterparts require their arguments to be sets. This " +"precludes error-prone constructions like ``set('abc') & 'cbs'`` in favor of " +"the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4494 +#: ../../library/stdtypes.rst:4506 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 " @@ -6319,14 +6322,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4501 +#: ../../library/stdtypes.rst:4513 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:4505 +#: ../../library/stdtypes.rst:4517 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 " @@ -6334,136 +6337,134 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4510 +#: ../../library/stdtypes.rst:4522 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:4513 +#: ../../library/stdtypes.rst:4525 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4515 +#: ../../library/stdtypes.rst:4527 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:4519 +#: ../../library/stdtypes.rst:4531 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4525 +#: ../../library/stdtypes.rst:4537 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4530 +#: ../../library/stdtypes.rst:4542 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4535 +#: ../../library/stdtypes.rst:4547 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4540 +#: ../../library/stdtypes.rst:4552 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4544 +#: ../../library/stdtypes.rst:4556 msgid "Add element *elem* to the set." msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:4548 +#: ../../library/stdtypes.rst:4560 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4553 +#: ../../library/stdtypes.rst:4565 msgid "Remove element *elem* from the set if it is present." msgstr "如果 *elem* 存在於集合中則將其移除。" -#: ../../library/stdtypes.rst:4557 +#: ../../library/stdtypes.rst:4569 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4562 +#: ../../library/stdtypes.rst:4574 msgid "Remove all elements from the set." msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:4565 +#: ../../library/stdtypes.rst:4577 msgid "" -"Note, the non-operator versions of " -"the :meth:`update`, :meth:`intersection_update`, :meth:`difference_update`, " -"and :meth:`symmetric_difference_update` methods will accept any iterable as " -"an argument." +"Note, the non-operator versions of the :meth:`update`, :meth:" +"`intersection_update`, :meth:`difference_update`, and :meth:" +"`symmetric_difference_update` methods will accept any iterable as an " +"argument." msgstr "" -#: ../../library/stdtypes.rst:4570 +#: ../../library/stdtypes.rst:4582 msgid "" -"Note, the *elem* argument to " -"the :meth:`~object.__contains__`, :meth:`remove`, and :meth:`discard` " -"methods may be a set. To support searching for an equivalent frozenset, a " -"temporary one is created from *elem*." +"Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" +"`remove`, and :meth:`discard` methods may be a set. To support searching " +"for an equivalent frozenset, a temporary one is created from *elem*." msgstr "" -#: ../../library/stdtypes.rst:4579 +#: ../../library/stdtypes.rst:4591 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4589 +#: ../../library/stdtypes.rst:4601 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " -"type, the :dfn:`dictionary`. (For other containers see the built-" -"in :class:`list`, :class:`set`, and :class:`tuple` classes, and " -"the :mod:`collections` module.)" +"type, the :dfn:`dictionary`. (For other containers see the built-in :class:" +"`list`, :class:`set`, and :class:`tuple` classes, and the :mod:`collections` " +"module.)" msgstr "" -#: ../../library/stdtypes.rst:4595 +#: ../../library/stdtypes.rst:4607 msgid "" -"A dictionary's keys are *almost* arbitrary values. Values that are " -"not :term:`hashable`, that is, values containing lists, dictionaries or " -"other mutable types (that are compared by value rather than by object " -"identity) may not be used as keys. Values that compare equal (such as ``1``, " -"``1.0``, and ``True``) can be used interchangeably to index the same " -"dictionary entry." +"A dictionary's keys are *almost* arbitrary values. Values that are not :" +"term:`hashable`, that is, values containing lists, dictionaries or other " +"mutable types (that are compared by value rather than by object identity) " +"may not be used as keys. Values that compare equal (such as ``1``, ``1.0``, " +"and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4606 +#: ../../library/stdtypes.rst:4618 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4609 +#: ../../library/stdtypes.rst:4621 msgid "Dictionaries can be created by several means:" msgstr "字典可以用數種方式建立:" -#: ../../library/stdtypes.rst:4611 +#: ../../library/stdtypes.rst:4623 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:4613 +#: ../../library/stdtypes.rst:4625 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4614 +#: ../../library/stdtypes.rst:4626 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4617 +#: ../../library/stdtypes.rst:4629 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 " @@ -6476,7 +6477,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4627 +#: ../../library/stdtypes.rst:4639 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 " @@ -6484,13 +6485,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4632 ../../library/stdtypes.rst:4650 +#: ../../library/stdtypes.rst:4644 ../../library/stdtypes.rst:4662 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:4635 +#: ../../library/stdtypes.rst:4647 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -6499,7 +6500,7 @@ msgid "" "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4641 +#: ../../library/stdtypes.rst:4653 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -6519,13 +6520,13 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:4665 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:4656 +#: ../../library/stdtypes.rst:4668 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6557,44 +6558,44 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4671 +#: ../../library/stdtypes.rst:4683 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4675 +#: ../../library/stdtypes.rst:4687 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4680 +#: ../../library/stdtypes.rst:4692 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4684 +#: ../../library/stdtypes.rst:4696 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4688 +#: ../../library/stdtypes.rst:4700 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4693 +#: ../../library/stdtypes.rst:4705 msgid "" "If a subclass of dict defines a method :meth:`__missing__` and *key* is not " "present, the ``d[key]`` operation calls that method with the key *key* as " "argument. The ``d[key]`` operation then returns or raises whatever is " "returned or raised by the ``__missing__(key)`` call. No other operations or " -"methods invoke :meth:`__missing__`. If :meth:`__missing__` is not " -"defined, :exc:`KeyError` is raised. :meth:`__missing__` must be a method; it " -"cannot be an instance variable::" +"methods invoke :meth:`__missing__`. If :meth:`__missing__` is not defined, :" +"exc:`KeyError` is raised. :meth:`__missing__` must be a method; it cannot be " +"an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4701 +#: ../../library/stdtypes.rst:4713 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -6618,51 +6619,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:4712 +#: ../../library/stdtypes.rst:4724 msgid "" -"The example above shows part of the implementation " -"of :class:`collections.Counter`. A different ``__missing__`` method is used " -"by :class:`collections.defaultdict`." +"The example above shows part of the implementation of :class:`collections." +"Counter`. A different ``__missing__`` method is used by :class:`collections." +"defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:4718 +#: ../../library/stdtypes.rst:4730 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:4722 +#: ../../library/stdtypes.rst:4734 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:4727 +#: ../../library/stdtypes.rst:4739 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:4731 +#: ../../library/stdtypes.rst:4743 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:4735 +#: ../../library/stdtypes.rst:4747 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4740 +#: ../../library/stdtypes.rst:4752 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:4744 +#: ../../library/stdtypes.rst:4756 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4748 +#: ../../library/stdtypes.rst:4760 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4750 +#: ../../library/stdtypes.rst:4762 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 " @@ -6671,70 +6672,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4758 +#: ../../library/stdtypes.rst:4770 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:4764 +#: ../../library/stdtypes.rst:4776 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4769 +#: ../../library/stdtypes.rst:4781 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4774 +#: ../../library/stdtypes.rst:4786 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." +"*default*. If *default* is not given and *key* is not in the dictionary, a :" +"exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:4780 +#: ../../library/stdtypes.rst:4792 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:4783 +#: ../../library/stdtypes.rst:4795 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`." +"often used in set algorithms. If the dictionary is empty, calling :meth:" +"`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4787 +#: ../../library/stdtypes.rst:4799 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4793 +#: ../../library/stdtypes.rst:4805 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4800 +#: ../../library/stdtypes.rst:4812 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:4806 +#: ../../library/stdtypes.rst:4818 msgid "" "Update the dictionary with the key/value pairs from *other*, overwriting " "existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4809 +#: ../../library/stdtypes.rst:4821 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -6743,20 +6744,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4817 +#: ../../library/stdtypes.rst:4829 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4820 +#: ../../library/stdtypes.rst:4832 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:4824 +#: ../../library/stdtypes.rst:4836 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -6766,25 +6767,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:4830 +#: ../../library/stdtypes.rst:4842 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:4838 +#: ../../library/stdtypes.rst:4850 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:4844 +#: ../../library/stdtypes.rst:4856 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4846 +#: ../../library/stdtypes.rst:4858 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6806,85 +6807,85 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:4856 +#: ../../library/stdtypes.rst:4868 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4861 +#: ../../library/stdtypes.rst:4873 msgid "" -":class:`types.MappingProxyType` can be used to create a read-only view of " -"a :class:`dict`." +":class:`types.MappingProxyType` can be used to create a read-only view of a :" +"class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4868 +#: ../../library/stdtypes.rst:4880 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4870 +#: ../../library/stdtypes.rst:4882 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 dictionary's entries, which means that when the dictionary changes, the " -"view reflects these changes." +"The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" +"`dict.items` are *view objects*. They provide a dynamic view on the " +"dictionary's entries, which means that when the dictionary changes, the view " +"reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4875 +#: ../../library/stdtypes.rst:4887 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4880 +#: ../../library/stdtypes.rst:4892 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4884 +#: ../../library/stdtypes.rst:4896 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4887 +#: ../../library/stdtypes.rst:4899 msgid "" "Keys and values are iterated over in insertion order. This allows the " -"creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = " -"zip(d.values(), d.keys())``. Another way to create the same list is ``pairs " -"= [(v, k) for (k, v) in d.items()]``." +"creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." +"values(), d.keys())``. Another way to create the same list is ``pairs = " +"[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4892 +#: ../../library/stdtypes.rst:4904 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:4895 +#: ../../library/stdtypes.rst:4907 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4900 +#: ../../library/stdtypes.rst:4912 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:4905 +#: ../../library/stdtypes.rst:4917 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:4908 +#: ../../library/stdtypes.rst:4920 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4913 +#: ../../library/stdtypes.rst:4925 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4918 +#: ../../library/stdtypes.rst:4930 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 " @@ -6898,11 +6899,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:4930 +#: ../../library/stdtypes.rst:4942 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4932 +#: ../../library/stdtypes.rst:4944 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -6943,11 +6944,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:4974 +#: ../../library/stdtypes.rst:4986 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:4981 +#: ../../library/stdtypes.rst:4993 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 " @@ -6958,7 +6959,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:4989 +#: ../../library/stdtypes.rst:5001 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 " @@ -6969,17 +6970,16 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:4994 +#: ../../library/stdtypes.rst:5006 msgid "" "An example of a context manager that returns itself is a :term:`file " -"object`. File objects return themselves from __enter__() to " -"allow :func:`open` to be used as the context expression in a :keyword:`with` " -"statement." +"object`. File objects return themselves from __enter__() to allow :func:" +"`open` to be used as the context expression in a :keyword:`with` statement." msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:4998 +#: ../../library/stdtypes.rst:5010 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 " @@ -6993,7 +6993,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5008 +#: ../../library/stdtypes.rst:5020 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -7001,11 +7001,11 @@ msgid "" "the exception type, value and traceback information. Otherwise, all three " "arguments are ``None``." msgstr "" -"退出 runtime 情境並回傳布林旗標以表示是否應抑制曾發生的任何例外。如果在執" -"行 :keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " +"退出 runtime 情境並回傳布林旗標以表示是否應抑制曾發生的任何例外。如果在執行 :" +"keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5013 +#: ../../library/stdtypes.rst:5025 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -7015,24 +7015,24 @@ msgid "" "replace any exception that occurred in the body of the :keyword:`!with` " "statement." msgstr "" -"從此方法回傳 true 值將導致 :keyword:`with` 陳述式抑制例外並繼續執行緊接" -"著 :keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續" -"傳播 (propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體" -"中發生的任何例外。" +"從此方法回傳 true 值將導致 :keyword:`with` 陳述式抑制例外並繼續執行緊接著 :" +"keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續傳播 " +"(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" +"的任何例外。" -#: ../../library/stdtypes.rst:5020 +#: ../../library/stdtypes.rst:5032 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " "successfully and does not want to suppress the raised exception. This allows " -"context management code to easily detect whether or not " -"an :meth:`~object.__exit__` method has actually failed." +"context management code to easily detect whether or not an :meth:`~object." +"__exit__` method has actually failed." msgstr "" "傳入的例外不應明確重新引發 - 取而代之的是,此方法應回傳 false 值以指示該方法" -"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢" -"測 :meth:`__exit__` 方法是否曾實際失敗過。" +"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" +"`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5026 +#: ../../library/stdtypes.rst:5038 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -7044,23 +7044,22 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5032 +#: ../../library/stdtypes.rst:5044 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " "generator function is decorated with the :class:`contextlib.contextmanager` " -"decorator, it will return a context manager implementing the " -"necessary :meth:`~contextmanager.__enter__` " -"and :meth:`~contextmanager.__exit__` methods, rather than the iterator " -"produced by an undecorated generator function." +"decorator, it will return a context manager implementing the necessary :meth:" +"`~contextmanager.__enter__` and :meth:`~contextmanager.__exit__` methods, " +"rather than the iterator produced by an undecorated generator function." msgstr "" "Python 的 :term:`generator` 和 :class:`contextlib.contextmanager` 裝飾器提供" -"了一種便捷的方法來實作這些協定。如果產生器函式" -"以 :class:`contextlib.contextmanager` 裝飾器裝飾,它將回傳一個有實作出需要" -"的 :meth:`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法" -"的情境管理器,而不是由未裝飾產生器函式產生的疊代器。" +"了一種便捷的方法來實作這些協定。如果產生器函式以 :class:`contextlib." +"contextmanager` 裝飾器裝飾,它將回傳一個有實作出需要的 :meth:" +"`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" +"理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5039 +#: ../../library/stdtypes.rst:5051 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 " @@ -7072,27 +7071,27 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5047 +#: ../../library/stdtypes.rst:5059 msgid "" -"Type Annotation Types --- :ref:`Generic Alias `, :ref:`Union `" +"Type Annotation Types --- :ref:`Generic Alias `, :ref:" +"`Union `" msgstr "" -"型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:ref:`聯合 (Union) `" +"型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" +"ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5052 +#: ../../library/stdtypes.rst:5064 msgid "" -"The core built-in types for :term:`type annotations ` " -"are :ref:`Generic Alias ` and :ref:`Union `." +"The core built-in types for :term:`type annotations ` are :ref:" +"`Generic Alias ` and :ref:`Union `." msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5059 +#: ../../library/stdtypes.rst:5071 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5077 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -7108,7 +7107,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5075 +#: ../../library/stdtypes.rst:5087 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -7116,7 +7115,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5078 +#: ../../library/stdtypes.rst:5090 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -7124,19 +7123,19 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5081 +#: ../../library/stdtypes.rst:5093 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 " "object contains. For example, ``set[bytes]`` can be used in type annotations " -"to signify a :class:`set` in which all the elements are of " -"type :class:`bytes`." +"to signify a :class:`set` in which all the elements are of type :class:" +"`bytes`." msgstr "" "對於一個容器類別,提供給該類別的\\ :ref:`下標 `\\ 引數可以代表" -"物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一" -"個 :class:`set`,其中所有元素的型別都是 :class:`bytes`。" +"物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" +"`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5087 +#: ../../library/stdtypes.rst:5099 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 " @@ -7148,7 +7147,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5093 +#: ../../library/stdtypes.rst:5105 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 " @@ -7160,11 +7159,11 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5099 +#: ../../library/stdtypes.rst:5111 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.group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type " +"``y`` will also be an instance of ``re.Match``, but the return values of ``y." +"group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type " "annotations, we would represent this variety of :ref:`re.Match ` objects with ``re.Match[bytes]``." msgstr "" @@ -7173,26 +7172,26 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5105 +#: ../../library/stdtypes.rst:5117 msgid "" -"``GenericAlias`` objects are instances of the " -"class :class:`types.GenericAlias`, which can also be used to create " -"``GenericAlias`` objects directly." +"``GenericAlias`` objects are instances of the class :class:`types." +"GenericAlias`, which can also be used to create ``GenericAlias`` objects " +"directly." msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:5111 +#: ../../library/stdtypes.rst:5123 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " "expecting a :class:`list` containing :class:`float` elements::" msgstr "" "建立一個 ``GenericAlias`` 來表示一個型別 ``T``,其以型別 *X*、*Y* 等(取決於" -"所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素" -"的 :class:`list`: ::" +"所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" +"class:`list`: ::" -#: ../../library/stdtypes.rst:5116 +#: ../../library/stdtypes.rst:5128 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -7200,7 +7199,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5119 +#: ../../library/stdtypes.rst:5131 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 " @@ -7211,7 +7210,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5124 +#: ../../library/stdtypes.rst:5136 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -7219,7 +7218,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5127 +#: ../../library/stdtypes.rst:5139 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -7227,7 +7226,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5130 +#: ../../library/stdtypes.rst:5142 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -7239,7 +7238,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5135 +#: ../../library/stdtypes.rst:5147 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7251,7 +7250,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5141 +#: ../../library/stdtypes.rst:5153 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7261,13 +7260,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5145 +#: ../../library/stdtypes.rst:5157 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5148 +#: ../../library/stdtypes.rst:5160 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7285,13 +7284,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5156 +#: ../../library/stdtypes.rst:5168 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5158 +#: ../../library/stdtypes.rst:5170 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7305,15 +7304,15 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5164 +#: ../../library/stdtypes.rst:5176 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" msgstr "" -"為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器" -"的 :meth:`~object.__getitem__` 方法會在這種情況下引發例外: ::" +"為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." +"__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5167 +#: ../../library/stdtypes.rst:5179 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7325,17 +7324,17 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5172 +#: ../../library/stdtypes.rst:5184 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " "items in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::" msgstr "" "然而當使用\\ :ref:`型別變數 (type variable) ` 時,此類運算式是有效" -"的。索引的元素數量必須與 ``GenericAlias`` 物件" -"的 :attr:`~genericalias.__args__` 中的型別變數項目一樣多: ::" +"的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." +"__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5176 +#: ../../library/stdtypes.rst:5188 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7347,253 +7346,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5183 +#: ../../library/stdtypes.rst:5195 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5185 +#: ../../library/stdtypes.rst:5197 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5188 +#: ../../library/stdtypes.rst:5200 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5189 +#: ../../library/stdtypes.rst:5201 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5190 +#: ../../library/stdtypes.rst:5202 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5191 +#: ../../library/stdtypes.rst:5203 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5192 +#: ../../library/stdtypes.rst:5204 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5193 +#: ../../library/stdtypes.rst:5205 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5194 +#: ../../library/stdtypes.rst:5206 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5195 +#: ../../library/stdtypes.rst:5207 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5196 +#: ../../library/stdtypes.rst:5208 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5197 +#: ../../library/stdtypes.rst:5209 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5198 +#: ../../library/stdtypes.rst:5210 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5199 +#: ../../library/stdtypes.rst:5211 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5200 +#: ../../library/stdtypes.rst:5212 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5201 +#: ../../library/stdtypes.rst:5213 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5202 +#: ../../library/stdtypes.rst:5214 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5203 +#: ../../library/stdtypes.rst:5215 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5204 +#: ../../library/stdtypes.rst:5216 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5205 +#: ../../library/stdtypes.rst:5217 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5206 +#: ../../library/stdtypes.rst:5218 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5207 +#: ../../library/stdtypes.rst:5219 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5220 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5209 +#: ../../library/stdtypes.rst:5221 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5210 +#: ../../library/stdtypes.rst:5222 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5211 +#: ../../library/stdtypes.rst:5223 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5212 +#: ../../library/stdtypes.rst:5224 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5213 +#: ../../library/stdtypes.rst:5225 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5214 +#: ../../library/stdtypes.rst:5226 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5215 +#: ../../library/stdtypes.rst:5227 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5216 +#: ../../library/stdtypes.rst:5228 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5217 +#: ../../library/stdtypes.rst:5229 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5218 +#: ../../library/stdtypes.rst:5230 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5219 +#: ../../library/stdtypes.rst:5231 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5220 +#: ../../library/stdtypes.rst:5232 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5221 +#: ../../library/stdtypes.rst:5233 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5222 +#: ../../library/stdtypes.rst:5234 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5223 +#: ../../library/stdtypes.rst:5235 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5224 +#: ../../library/stdtypes.rst:5236 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5225 +#: ../../library/stdtypes.rst:5237 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5226 +#: ../../library/stdtypes.rst:5238 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5227 +#: ../../library/stdtypes.rst:5239 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5228 +#: ../../library/stdtypes.rst:5240 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5229 +#: ../../library/stdtypes.rst:5241 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5230 +#: ../../library/stdtypes.rst:5242 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5231 +#: ../../library/stdtypes.rst:5243 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5232 +#: ../../library/stdtypes.rst:5244 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5233 +#: ../../library/stdtypes.rst:5245 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5234 +#: ../../library/stdtypes.rst:5246 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5235 +#: ../../library/stdtypes.rst:5247 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5236 +#: ../../library/stdtypes.rst:5248 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5237 +#: ../../library/stdtypes.rst:5249 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5238 +#: ../../library/stdtypes.rst:5250 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5239 +#: ../../library/stdtypes.rst:5251 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5240 +#: ../../library/stdtypes.rst:5252 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5241 +#: ../../library/stdtypes.rst:5253 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5242 +#: ../../library/stdtypes.rst:5254 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5243 +#: ../../library/stdtypes.rst:5255 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5248 +#: ../../library/stdtypes.rst:5260 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5250 +#: ../../library/stdtypes.rst:5262 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5254 +#: ../../library/stdtypes.rst:5266 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5256 +#: ../../library/stdtypes.rst:5268 msgid "" ">>> list[int].__origin__\n" "" @@ -7601,16 +7600,16 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5262 +#: ../../library/stdtypes.rst:5274 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 " "class::" msgstr "" -"此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型" -"別 :class:`tuple`\\ (長度可以為 1): ::" +"此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" +"class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5266 +#: ../../library/stdtypes.rst:5278 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -7618,7 +7617,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5272 +#: ../../library/stdtypes.rst:5284 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -7626,7 +7625,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5275 +#: ../../library/stdtypes.rst:5287 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -7640,90 +7639,89 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5283 +#: ../../library/stdtypes.rst:5295 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " -"have correct ``__parameters__`` after substitution " -"because :class:`typing.ParamSpec` is intended primarily for static type " -"checking." +"have correct ``__parameters__`` after substitution because :class:`typing." +"ParamSpec` is intended primarily for static type checking." msgstr "" "具有 :class:`typing.ParamSpec` 參數的一個 ``GenericAlias`` 物件在替換後可能沒" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5290 +#: ../../library/stdtypes.rst:5302 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." msgstr "" -"如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參" -"閱 :data:`~typing.TypeVarTuple`\\ )。" +"如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" +"`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5298 +#: ../../library/stdtypes.rst:5310 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5299 +#: ../../library/stdtypes.rst:5311 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5301 +#: ../../library/stdtypes.rst:5313 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5302 +#: ../../library/stdtypes.rst:5314 msgid "" "Introducing the ability to natively parameterize standard-library classes, " -"provided they implement the special class " -"method :meth:`~object.__class_getitem__`." +"provided they implement the special class method :meth:`~object." +"__class_getitem__`." msgstr "" -"引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方" -"法 :meth:`~object.__class_getitem__`。" +"引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" +"`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5306 +#: ../../library/stdtypes.rst:5318 msgid "" -":ref:`Generics`, :ref:`user-defined generics ` " -"and :class:`typing.Generic`" +":ref:`Generics`, :ref:`user-defined generics ` and :" +"class:`typing.Generic`" msgstr "" -":ref:`Generics`、:ref:`使用者定義泛型 `\\ " -"和 :class:`typing.Generic`" +":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" +"`typing.Generic`" -#: ../../library/stdtypes.rst:5307 +#: ../../library/stdtypes.rst:5319 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:5316 +#: ../../library/stdtypes.rst:5328 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5322 +#: ../../library/stdtypes.rst:5334 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " "primarily for :term:`type annotations `. The union type " -"expression enables cleaner type hinting syntax compared " -"to :data:`typing.Union`." +"expression enables cleaner type hinting syntax compared to :data:`typing." +"Union`." msgstr "" "一個聯合物件可以保存多個\\ :ref:`型別物件 (type object) `\\ 之 ``|``\\ (位元 or)運算的值。這些型別主要用於\\ :term:`型別註" "釋 (type annotation) `。與 :data:`typing.Union` 相比,聯合型別運" "算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5329 +#: ../../library/stdtypes.rst:5341 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 " -"example, the following function expects an argument of type :class:`int` " -"or :class:`float`::" +"example, the following function expects an argument of type :class:`int` or :" +"class:`float`::" msgstr "" "定義一個包含 *X*、*Y* 等型別的聯合物件。``X | Y`` 表示 X 或 Y。它相當於 " -"``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` " -"或 :class:`float` 的引數: ::" +"``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" +"class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5334 +#: ../../library/stdtypes.rst:5346 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -7731,7 +7729,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5339 +#: ../../library/stdtypes.rst:5351 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 " @@ -7744,58 +7742,58 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5347 +#: ../../library/stdtypes.rst:5359 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5349 +#: ../../library/stdtypes.rst:5361 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5351 +#: ../../library/stdtypes.rst:5363 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5353 +#: ../../library/stdtypes.rst:5365 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5355 +#: ../../library/stdtypes.rst:5367 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5357 +#: ../../library/stdtypes.rst:5369 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5359 +#: ../../library/stdtypes.rst:5371 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5361 +#: ../../library/stdtypes.rst:5373 msgid "It is compatible with :data:`typing.Union`::" msgstr "它與 :data:`typing.Union` 相容: ::" -#: ../../library/stdtypes.rst:5363 +#: ../../library/stdtypes.rst:5375 msgid "int | str == typing.Union[int, str]" msgstr "int | str == typing.Union[int, str]" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5377 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5367 +#: ../../library/stdtypes.rst:5379 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5372 +#: ../../library/stdtypes.rst:5384 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5375 +#: ../../library/stdtypes.rst:5387 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -7803,14 +7801,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5378 +#: ../../library/stdtypes.rst:5390 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5381 +#: ../../library/stdtypes.rst:5393 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -7820,17 +7818,16 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5388 +#: ../../library/stdtypes.rst:5400 msgid "" -"The user-exposed type for the union object can be accessed " -"from :data:`types.UnionType` and used for :func:`isinstance` checks. An " -"object cannot be instantiated from the type::" +"The user-exposed type for the union object can be accessed from :data:`types." +"UnionType` and used for :func:`isinstance` checks. An object cannot be " +"instantiated from the type::" msgstr "" -"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透" -"過 :data:`types.UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別" -"來實例化: ::" +"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." +"UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別來實例化: ::" -#: ../../library/stdtypes.rst:5392 +#: ../../library/stdtypes.rst:5404 msgid "" ">>> import types\n" ">>> isinstance(int | str, types.UnionType)\n" @@ -7848,7 +7845,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'types.UnionType' instances" -#: ../../library/stdtypes.rst:5401 +#: ../../library/stdtypes.rst:5413 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 " @@ -7857,7 +7854,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5405 +#: ../../library/stdtypes.rst:5417 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -7883,72 +7880,72 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5421 +#: ../../library/stdtypes.rst:5433 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5429 +#: ../../library/stdtypes.rst:5441 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:5431 +#: ../../library/stdtypes.rst:5443 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5438 +#: ../../library/stdtypes.rst:5450 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5440 +#: ../../library/stdtypes.rst:5452 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 " -"table. Module attributes can be assigned to. (Note that " -"the :keyword:`import` statement is not, strictly speaking, an operation on a " -"module object; ``import foo`` does not require a module object named *foo* " -"to exist, rather it requires an (external) *definition* for a module named " +"table. Module attributes can be assigned to. (Note that the :keyword:" +"`import` statement is not, strictly speaking, an operation on a module " +"object; ``import foo`` does not require a module object named *foo* to " +"exist, rather it requires an (external) *definition* for a module named " "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5447 +#: ../../library/stdtypes.rst:5459 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " "will actually change the module's symbol table, but direct assignment to " -"the :attr:`~object.__dict__` attribute is not possible (you can write " -"``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't " -"write ``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is " -"not recommended." +"the :attr:`~object.__dict__` attribute is not possible (you can write ``m." +"__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write " +"``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is not " +"recommended." msgstr "" -#: ../../library/stdtypes.rst:5455 +#: ../../library/stdtypes.rst:5467 msgid "" -"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." +"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5463 +#: ../../library/stdtypes.rst:5475 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:5465 +#: ../../library/stdtypes.rst:5477 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:5471 +#: ../../library/stdtypes.rst:5483 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5473 +#: ../../library/stdtypes.rst:5485 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:5476 +#: ../../library/stdtypes.rst:5488 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -7956,36 +7953,36 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5480 +#: ../../library/stdtypes.rst:5492 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5486 +#: ../../library/stdtypes.rst:5498 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:5490 +#: ../../library/stdtypes.rst:5502 msgid "" "Methods are functions that are called using the attribute notation. There " -"are two flavors: :ref:`built-in methods ` (such " -"as :meth:`append` on lists) and :ref:`class instance method `. Built-in methods are described with the types that support them." +"are two flavors: :ref:`built-in methods ` (such as :meth:" +"`append` on lists) and :ref:`class instance method `. " +"Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5495 +#: ../../library/stdtypes.rst:5507 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:`instance method `) object. When called, it " -"will add the ``self`` argument to the argument list. Bound methods have two " -"special read-only attributes: :attr:`m.__self__ ` is the " -"object on which the method operates, and :attr:`m.__func__ " -"` is the function implementing the method. Calling " -"``m(arg-1, arg-2, ..., arg-n)`` is completely equivalent to calling " -"``m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)``." +"instance, you get a special object: a :dfn:`bound method` (also called :ref:" +"`instance method `) object. When called, it will add the " +"``self`` argument to the argument list. Bound methods have two special read-" +"only attributes: :attr:`m.__self__ ` is the object on which " +"the method operates, and :attr:`m.__func__ ` is the " +"function implementing the method. Calling ``m(arg-1, arg-2, ..., arg-n)`` " +"is completely equivalent to calling ``m.__func__(m.__self__, arg-1, " +"arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5506 +#: ../../library/stdtypes.rst:5518 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -7996,7 +7993,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5514 +#: ../../library/stdtypes.rst:5526 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -8024,25 +8021,25 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5529 +#: ../../library/stdtypes.rst:5541 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5537 +#: ../../library/stdtypes.rst:5549 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5543 +#: ../../library/stdtypes.rst:5555 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " "objects because they don't contain a reference to their global execution " "environment. Code objects are returned by the built-in :func:`compile` " -"function and can be extracted from function objects through " -"their :attr:`~function.__code__` attribute. See also the :mod:`code` module." +"function and can be extracted from function objects through their :attr:" +"`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5550 +#: ../../library/stdtypes.rst:5562 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -8051,21 +8048,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5557 +#: ../../library/stdtypes.rst:5569 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:5560 +#: ../../library/stdtypes.rst:5572 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5566 +#: ../../library/stdtypes.rst:5578 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5572 +#: ../../library/stdtypes.rst:5584 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 " @@ -8073,119 +8070,119 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5577 +#: ../../library/stdtypes.rst:5589 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5583 +#: ../../library/stdtypes.rst:5595 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5585 +#: ../../library/stdtypes.rst:5597 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:5589 +#: ../../library/stdtypes.rst:5601 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5596 +#: ../../library/stdtypes.rst:5608 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5598 +#: ../../library/stdtypes.rst:5610 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " -"no special operations. There is exactly one ellipsis object, " -"named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces " -"the :const:`Ellipsis` singleton." +"no special operations. There is exactly one ellipsis object, named :const:" +"`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the :const:" +"`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5603 +#: ../../library/stdtypes.rst:5615 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5609 +#: ../../library/stdtypes.rst:5621 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5611 +#: ../../library/stdtypes.rst:5623 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 " -"more information. There is exactly one :data:`NotImplemented` " -"object. :code:`type(NotImplemented)()` produces the singleton instance." +"more information. There is exactly one :data:`NotImplemented` object. :code:" +"`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5616 +#: ../../library/stdtypes.rst:5628 msgid "It is written as :code:`NotImplemented`." msgstr "" -#: ../../library/stdtypes.rst:5622 +#: ../../library/stdtypes.rst:5634 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:5624 +#: ../../library/stdtypes.rst:5636 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5632 +#: ../../library/stdtypes.rst:5644 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5634 +#: ../../library/stdtypes.rst:5646 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." +"types, where they are relevant. Some of these are not reported by the :func:" +"`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5641 +#: ../../library/stdtypes.rst:5653 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5647 +#: ../../library/stdtypes.rst:5659 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5655 +#: ../../library/stdtypes.rst:5667 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5660 +#: ../../library/stdtypes.rst:5672 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5665 +#: ../../library/stdtypes.rst:5677 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." +"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:5675 +#: ../../library/stdtypes.rst:5687 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5677 +#: ../../library/stdtypes.rst:5689 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 decimal or other non-power-of-two number bases. Hexadecimal, " -"octal, and binary conversions are unlimited. The limit can be configured." +"CPython has a global limit for converting between :class:`int` and :class:" +"`str` to mitigate denial of service attacks. This limit *only* applies to " +"decimal or other non-power-of-two number bases. Hexadecimal, octal, and " +"binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5682 +#: ../../library/stdtypes.rst:5694 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 " @@ -8195,24 +8192,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5689 +#: ../../library/stdtypes.rst:5701 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5703 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:5695 +#: ../../library/stdtypes.rst:5707 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5697 +#: ../../library/stdtypes.rst:5709 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8236,19 +8233,19 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5717 +#: ../../library/stdtypes.rst:5729 msgid "" -"The default limit is 4300 digits as provided " -"in :data:`sys.int_info.default_max_str_digits `. The lowest " -"limit that can be configured is 640 digits as provided " -"in :data:`sys.int_info.str_digits_check_threshold `." +"The default limit is 4300 digits as provided in :data:`sys.int_info." +"default_max_str_digits `. The lowest limit that can be " +"configured is 640 digits as provided in :data:`sys.int_info." +"str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5722 +#: ../../library/stdtypes.rst:5734 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5724 +#: ../../library/stdtypes.rst:5736 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8266,84 +8263,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:5737 +#: ../../library/stdtypes.rst:5749 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5739 +#: ../../library/stdtypes.rst:5751 msgid "" -"The limitation only applies to potentially slow conversions " -"between :class:`int` and :class:`str` or :class:`bytes`:" +"The limitation only applies to potentially slow conversions between :class:" +"`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5742 +#: ../../library/stdtypes.rst:5754 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5743 +#: ../../library/stdtypes.rst:5755 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5744 +#: ../../library/stdtypes.rst:5756 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5745 +#: ../../library/stdtypes.rst:5757 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5746 +#: ../../library/stdtypes.rst:5758 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5749 +#: ../../library/stdtypes.rst:5761 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5751 +#: ../../library/stdtypes.rst:5763 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5752 +#: ../../library/stdtypes.rst:5764 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5753 +#: ../../library/stdtypes.rst:5765 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5754 +#: ../../library/stdtypes.rst:5766 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5755 +#: ../../library/stdtypes.rst:5767 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5756 +#: ../../library/stdtypes.rst:5768 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5759 +#: ../../library/stdtypes.rst:5771 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5761 +#: ../../library/stdtypes.rst:5773 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:5764 +#: ../../library/stdtypes.rst:5776 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:5767 +#: ../../library/stdtypes.rst:5779 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8351,48 +8348,47 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5769 +#: ../../library/stdtypes.rst:5781 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 env var and the ``-X`` option are set, the ``-X`` option takes " -"precedence. A value of *-1* indicates that both were unset, thus a value " -"of :data:`sys.int_info.default_max_str_digits` was used during " -"initialization." +":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" +"`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " +"env var and the ``-X`` option are set, the ``-X`` option takes precedence. A " +"value of *-1* indicates that both were unset, thus a value of :data:`sys." +"int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:5775 +#: ../../library/stdtypes.rst:5787 msgid "" -"From code, you can inspect the current limit and set a new one using " -"these :mod:`sys` APIs:" +"From code, you can inspect the current limit and set a new one using these :" +"mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5778 +#: ../../library/stdtypes.rst:5790 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:5782 +#: ../../library/stdtypes.rst:5794 msgid "" -"Information about the default and minimum can be found " -"in :data:`sys.int_info`:" +"Information about the default and minimum can be found in :data:`sys." +"int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5784 +#: ../../library/stdtypes.rst:5796 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5786 +#: ../../library/stdtypes.rst:5798 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:5793 +#: ../../library/stdtypes.rst:5805 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 " @@ -8404,7 +8400,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5802 +#: ../../library/stdtypes.rst:5814 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 " @@ -8412,11 +8408,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5808 +#: ../../library/stdtypes.rst:5820 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5810 +#: ../../library/stdtypes.rst:5822 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 " @@ -8424,11 +8420,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5815 +#: ../../library/stdtypes.rst:5827 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5817 +#: ../../library/stdtypes.rst:5829 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8450,38 +8446,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:5827 +#: ../../library/stdtypes.rst:5839 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5831 +#: ../../library/stdtypes.rst:5843 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5832 +#: ../../library/stdtypes.rst:5844 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5835 +#: ../../library/stdtypes.rst:5847 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5838 +#: ../../library/stdtypes.rst:5850 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5840 +#: ../../library/stdtypes.rst:5852 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:5843 +#: ../../library/stdtypes.rst:5855 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -8494,13 +8490,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:316 #: ../../library/stdtypes.rst:393 ../../library/stdtypes.rst:950 #: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:1139 -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4581 -#: ../../library/stdtypes.rst:5568 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4593 +#: ../../library/stdtypes.rst:5580 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:4593 msgid "statement" msgstr "statement(陳述式)" @@ -8622,11 +8618,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:1260 #: ../../library/stdtypes.rst:1339 ../../library/stdtypes.rst:1383 #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1540 -#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:2691 -#: ../../library/stdtypes.rst:2798 ../../library/stdtypes.rst:4379 -#: ../../library/stdtypes.rst:4581 ../../library/stdtypes.rst:5061 -#: ../../library/stdtypes.rst:5318 ../../library/stdtypes.rst:5488 -#: ../../library/stdtypes.rst:5532 +#: ../../library/stdtypes.rst:2684 ../../library/stdtypes.rst:2703 +#: ../../library/stdtypes.rst:2810 ../../library/stdtypes.rst:4391 +#: ../../library/stdtypes.rst:4593 ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5330 ../../library/stdtypes.rst:5500 +#: ../../library/stdtypes.rst:5544 msgid "object" msgstr "object(物件)" @@ -8718,9 +8714,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:950 -#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4581 -#: ../../library/stdtypes.rst:5539 ../../library/stdtypes.rst:5553 -#: ../../library/stdtypes.rst:5568 +#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4593 +#: ../../library/stdtypes.rst:5551 ../../library/stdtypes.rst:5565 +#: ../../library/stdtypes.rst:5580 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -8736,8 +8732,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2548 -#: ../../library/stdtypes.rst:3767 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2560 +#: ../../library/stdtypes.rst:3779 msgid "+ (plus)" msgstr "+ (加號)" @@ -8749,13 +8745,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2548 -#: ../../library/stdtypes.rst:3767 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2560 +#: ../../library/stdtypes.rst:3779 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2505 -#: ../../library/stdtypes.rst:3724 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2517 +#: ../../library/stdtypes.rst:3736 msgid "* (asterisk)" msgstr "* (星號)" @@ -8767,8 +8763,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2469 -#: ../../library/stdtypes.rst:3692 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2481 +#: ../../library/stdtypes.rst:3704 msgid "% (percent)" msgstr "% (百分號)" @@ -8778,7 +8774,7 @@ msgstr "**" #: ../../library/stdtypes.rst:316 ../../library/stdtypes.rst:393 #: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:4593 msgid "operations on" msgstr "operations on(操作於)" @@ -8787,7 +8783,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1606 -#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:5568 +#: ../../library/stdtypes.rst:2684 ../../library/stdtypes.rst:5580 msgid "module" msgstr "模組" @@ -8855,7 +8851,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4976 +#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4988 msgid "protocol" msgstr "protocol(協定)" @@ -8881,7 +8877,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4593 msgid "len" msgstr "len" @@ -8958,14 +8954,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2672 -#: ../../library/stdtypes.rst:2798 ../../library/stdtypes.rst:2870 -#: ../../library/stdtypes.rst:3692 +#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2684 +#: ../../library/stdtypes.rst:2810 ../../library/stdtypes.rst:2882 +#: ../../library/stdtypes.rst:3704 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4581 -#: ../../library/stdtypes.rst:5318 ../../library/stdtypes.rst:5568 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4593 +#: ../../library/stdtypes.rst:5330 ../../library/stdtypes.rst:5580 msgid "type" msgstr "type(型別)" @@ -8973,7 +8969,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4593 msgid "del" msgstr "del" @@ -9014,8 +9010,8 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1553 -#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2323 -#: ../../library/stdtypes.rst:2469 +#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2481 msgid "string" msgstr "string(字串)" @@ -9036,17 +9032,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2664 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2676 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2672 -#: ../../library/stdtypes.rst:2691 ../../library/stdtypes.rst:2870 -#: ../../library/stdtypes.rst:3692 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2684 +#: ../../library/stdtypes.rst:2703 ../../library/stdtypes.rst:2882 +#: ../../library/stdtypes.rst:3704 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2870 +#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2882 msgid "methods" msgstr "methods(方法)" @@ -9054,239 +9050,239 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2137 ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:2149 ../../library/stdtypes.rst:3558 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2137 +#: ../../library/stdtypes.rst:2149 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "! formatted string literal" msgstr "! formatted string literals(! 格式化字串常數)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "formatted string literals" msgstr "formatted string literals(格式化字串常數)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "! f-string" msgstr "! f-string(! f 字串)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "! (exclamation mark)" msgstr "! (驚嘆號)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "= (equals)" msgstr "= (等號)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2335 msgid "for help in debugging using string literals" msgstr "" -#: ../../library/stdtypes.rst:2469 +#: ../../library/stdtypes.rst:2481 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2469 +#: ../../library/stdtypes.rst:2481 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2469 +#: ../../library/stdtypes.rst:2481 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2469 +#: ../../library/stdtypes.rst:2481 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2469 ../../library/stdtypes.rst:3692 +#: ../../library/stdtypes.rst:2481 ../../library/stdtypes.rst:3704 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2469 ../../library/stdtypes.rst:3692 +#: ../../library/stdtypes.rst:2481 ../../library/stdtypes.rst:3704 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2505 ../../library/stdtypes.rst:3724 +#: ../../library/stdtypes.rst:2517 ../../library/stdtypes.rst:3736 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2505 ../../library/stdtypes.rst:2548 -#: ../../library/stdtypes.rst:3724 ../../library/stdtypes.rst:3767 +#: ../../library/stdtypes.rst:2517 ../../library/stdtypes.rst:2560 +#: ../../library/stdtypes.rst:3736 ../../library/stdtypes.rst:3779 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2505 ../../library/stdtypes.rst:3724 +#: ../../library/stdtypes.rst:2517 ../../library/stdtypes.rst:3736 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2548 ../../library/stdtypes.rst:3767 +#: ../../library/stdtypes.rst:2560 ../../library/stdtypes.rst:3779 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2548 ../../library/stdtypes.rst:3767 +#: ../../library/stdtypes.rst:2560 ../../library/stdtypes.rst:3779 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2664 +#: ../../library/stdtypes.rst:2676 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2672 +#: ../../library/stdtypes.rst:2684 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2672 +#: ../../library/stdtypes.rst:2684 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3558 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3558 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3692 +#: ../../library/stdtypes.rst:3704 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3692 +#: ../../library/stdtypes.rst:3704 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3692 +#: ../../library/stdtypes.rst:3704 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3692 +#: ../../library/stdtypes.rst:3704 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:4391 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:4593 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:4593 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:4691 +#: ../../library/stdtypes.rst:4703 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:4976 +#: ../../library/stdtypes.rst:4988 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:4976 +#: ../../library/stdtypes.rst:4988 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:4976 +#: ../../library/stdtypes.rst:4988 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5049 +#: ../../library/stdtypes.rst:5061 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5049 +#: ../../library/stdtypes.rst:5061 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5073 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5073 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5073 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5318 +#: ../../library/stdtypes.rst:5330 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5318 +#: ../../library/stdtypes.rst:5330 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5488 +#: ../../library/stdtypes.rst:5500 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5532 +#: ../../library/stdtypes.rst:5544 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5532 +#: ../../library/stdtypes.rst:5544 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5539 +#: ../../library/stdtypes.rst:5551 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5539 +#: ../../library/stdtypes.rst:5551 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5553 +#: ../../library/stdtypes.rst:5565 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5553 +#: ../../library/stdtypes.rst:5565 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5592 +#: ../../library/stdtypes.rst:5604 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5592 +#: ../../library/stdtypes.rst:5604 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" From 7942c0eaee85f95b4831e5291b61bae8807cf9a6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 17 May 2025 00:19:33 +0000 Subject: [PATCH 06/14] sync with cpython 510e28ec --- library/asyncio-dev.po | 96 ++--- library/http.server.po | 163 ++++--- library/pathlib.po | 525 ++++++++++++----------- library/threading.po | 943 ++++++++++++++++++++++------------------- 4 files changed, 910 insertions(+), 817 deletions(-) diff --git a/library/asyncio-dev.po b/library/asyncio-dev.po index ad5c2a8c28..e4638f597a 100644 --- a/library/asyncio-dev.po +++ b/library/asyncio-dev.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-05-17 00:18+0000\n" "PO-Revision-Date: 2023-02-18 14:17+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -101,15 +101,6 @@ msgstr "啟用除錯模式時:" #: ../../library/asyncio-dev.rst:49 msgid "" -"asyncio checks for :ref:`coroutines that were not awaited ` and logs them; this mitigates the \"forgotten await\" " -"pitfall." -msgstr "" -"asyncio 會檢查\\ :ref:`未被等待的協程 `\\ 並" -"記錄他們;這會減輕\"被遺忘的等待 (forgotten await)\" 問題。" - -#: ../../library/asyncio-dev.rst:53 -msgid "" "Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` and :meth:" "`loop.call_at` methods) raise an exception if they are called from a wrong " "thread." @@ -118,7 +109,7 @@ msgstr "" "call_soon` 和 :meth:`loop.call_at` 方法),如果從錯誤的執行緒呼叫就會引發例" "外。" -#: ../../library/asyncio-dev.rst:57 +#: ../../library/asyncio-dev.rst:53 msgid "" "The execution time of the I/O selector is logged if it takes too long to " "perform an I/O operation." @@ -126,7 +117,7 @@ msgstr "" "如果執行一個 I/O 操作花費的時間太長,則將 I/O 選擇器 (selector) 的執行時間記" "錄到日誌中。" -#: ../../library/asyncio-dev.rst:60 +#: ../../library/asyncio-dev.rst:56 msgid "" "Callbacks taking longer than 100 milliseconds are logged. The :attr:`loop." "slow_callback_duration` attribute can be used to set the minimum execution " @@ -136,11 +127,11 @@ msgstr "" "slow_callback_duration` 可用於設定以秒為單位的最小執行持續時間,超過這個值執" "行時間就會被視為\"緩慢\"。" -#: ../../library/asyncio-dev.rst:68 +#: ../../library/asyncio-dev.rst:64 msgid "Concurrency and Multithreading" msgstr "並行性和多執行緒 (Concurrency and Multithreading)" -#: ../../library/asyncio-dev.rst:70 +#: ../../library/asyncio-dev.rst:66 msgid "" "An event loop runs in a thread (typically the main thread) and executes all " "callbacks and Tasks in its thread. While a Task is running in the event " @@ -153,7 +144,7 @@ msgstr "" "運行。當一個 Task 執行一個 ``await`` 運算式時,正在執行的 Task 會被暫停,而事" "件迴圈會執行下一個 Task。" -#: ../../library/asyncio-dev.rst:76 +#: ../../library/asyncio-dev.rst:72 msgid "" "To schedule a :term:`callback` from another OS thread, the :meth:`loop." "call_soon_threadsafe` method should be used. Example::" @@ -161,11 +152,11 @@ msgstr "" "要從不同的 OS 執行緒為一個 :term:`callback` 排程,應該使用 :meth:`loop." "call_soon_threadsafe` 方法。例如: ::" -#: ../../library/asyncio-dev.rst:79 +#: ../../library/asyncio-dev.rst:75 msgid "loop.call_soon_threadsafe(callback, *args)" msgstr "loop.call_soon_threadsafe(callback, *args)" -#: ../../library/asyncio-dev.rst:81 +#: ../../library/asyncio-dev.rst:77 msgid "" "Almost all asyncio objects are not thread safe, which is typically not a " "problem unless there is code that works with them from outside of a Task or " @@ -176,11 +167,11 @@ msgstr "" "在 Task 或回呼函式之外有程式需要和它們一起運作。如果需要這樣的程式來呼叫低階 " "asyncio API,應該使用 :meth:`loop.call_soon_threadsafe` 方法,例如: ::" -#: ../../library/asyncio-dev.rst:87 +#: ../../library/asyncio-dev.rst:83 msgid "loop.call_soon_threadsafe(fut.cancel)" msgstr "loop.call_soon_threadsafe(fut.cancel)" -#: ../../library/asyncio-dev.rst:89 +#: ../../library/asyncio-dev.rst:85 msgid "" "To schedule a coroutine object from a different OS thread, the :func:" "`run_coroutine_threadsafe` function should be used. It returns a :class:" @@ -190,7 +181,7 @@ msgstr "" "`run_coroutine_threadsafe` 函式。它會回傳一個 :class:`concurrent.futures." "Future` 以存取結果: ::" -#: ../../library/asyncio-dev.rst:93 +#: ../../library/asyncio-dev.rst:89 msgid "" "async def coro_func():\n" " return await asyncio.sleep(1, 42)\n" @@ -202,11 +193,11 @@ msgid "" "result = future.result()" msgstr "" -#: ../../library/asyncio-dev.rst:102 +#: ../../library/asyncio-dev.rst:98 msgid "To handle signals the event loop must be run in the main thread." msgstr "為了能夠處理訊號,事件迴圈必須於主執行緒中運行。" -#: ../../library/asyncio-dev.rst:105 +#: ../../library/asyncio-dev.rst:101 msgid "" "The :meth:`loop.run_in_executor` method can be used with a :class:" "`concurrent.futures.ThreadPoolExecutor` to execute blocking code in a " @@ -217,7 +208,7 @@ msgstr "" "ThreadPoolExecutor` 一起使用,這能夠在作業系統上另一個不同的執行緒中執行阻塞" "程式,且避免阻塞執行事件迴圈的執行緒。" -#: ../../library/asyncio-dev.rst:110 +#: ../../library/asyncio-dev.rst:106 msgid "" "There is currently no way to schedule coroutines or callbacks directly from " "a different process (such as one started with :mod:`multiprocessing`). The :" @@ -237,11 +228,11 @@ msgstr "" "run_in_executor` 方法也可和 :class:`concurrent.futures.ProcessPoolExecutor` " "搭配使用,以在另一個行程中執行程式。" -#: ../../library/asyncio-dev.rst:124 +#: ../../library/asyncio-dev.rst:120 msgid "Running Blocking Code" msgstr "執行阻塞的程式" -#: ../../library/asyncio-dev.rst:126 +#: ../../library/asyncio-dev.rst:122 msgid "" "Blocking (CPU-bound) code should not be called directly. For example, if a " "function performs a CPU-intensive calculation for 1 second, all concurrent " @@ -250,7 +241,7 @@ msgstr "" "不應該直接呼叫阻塞(CPU 密集型)程式。例如一個執行 1 秒 CPU 密集型計算的函" "式,那麼所有並行非同步 Tasks 和 IO 操作都會被延遲 1 秒。" -#: ../../library/asyncio-dev.rst:131 +#: ../../library/asyncio-dev.rst:127 msgid "" "An executor can be used to run a task in a different thread or even in a " "different process to avoid blocking the OS thread with the event loop. See " @@ -260,11 +251,11 @@ msgstr "" "以避免使用事件迴圈阻塞 OS 執行緒。詳情請見 :meth:`loop.run_in_executor` 方" "法。" -#: ../../library/asyncio-dev.rst:140 +#: ../../library/asyncio-dev.rst:136 msgid "Logging" msgstr "日誌記錄" -#: ../../library/asyncio-dev.rst:142 +#: ../../library/asyncio-dev.rst:138 msgid "" "asyncio uses the :mod:`logging` module and all logging is performed via the " "``\"asyncio\"`` logger." @@ -272,17 +263,17 @@ msgstr "" "asyncio 使用 :mod:`logging` 模組,所有日誌記錄都是透過 ``\"asyncio\"`` " "logger 執行的。" -#: ../../library/asyncio-dev.rst:145 +#: ../../library/asyncio-dev.rst:141 msgid "" "The default log level is :py:const:`logging.INFO`, which can be easily " "adjusted::" msgstr "日誌級別被預設為 :py:const:`logging.INFO`,它可以很容易地被調整: ::" -#: ../../library/asyncio-dev.rst:148 +#: ../../library/asyncio-dev.rst:144 msgid "logging.getLogger(\"asyncio\").setLevel(logging.WARNING)" msgstr "logging.getLogger(\"asyncio\").setLevel(logging.WARNING)" -#: ../../library/asyncio-dev.rst:151 +#: ../../library/asyncio-dev.rst:147 msgid "" "Network logging can block the event loop. It is recommended to use a " "separate thread for handling logs or use non-blocking IO. For example, see :" @@ -291,11 +282,11 @@ msgstr "" "網路日誌記錄可能會阻塞事件迴圈。建議使用獨立的執行緒來處理日誌或使用非阻塞 " "IO,範例請參見 :ref:`blocking-handlers`。" -#: ../../library/asyncio-dev.rst:159 +#: ../../library/asyncio-dev.rst:155 msgid "Detect never-awaited coroutines" msgstr "偵測從未被等待的 (never-awaited) 協程" -#: ../../library/asyncio-dev.rst:161 +#: ../../library/asyncio-dev.rst:157 msgid "" "When a coroutine function is called, but not awaited (e.g. ``coro()`` " "instead of ``await coro()``) or the coroutine is not scheduled with :meth:" @@ -305,7 +296,7 @@ msgstr "" "者協程沒有透過 :meth:`asyncio.create_task` 被排程,asyncio 將會發出 :exc:" "`RuntimeWarning`: ::" -#: ../../library/asyncio-dev.rst:166 +#: ../../library/asyncio-dev.rst:162 msgid "" "import asyncio\n" "\n" @@ -318,11 +309,11 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-dev.rst:176 ../../library/asyncio-dev.rst:221 +#: ../../library/asyncio-dev.rst:172 ../../library/asyncio-dev.rst:217 msgid "Output::" msgstr "輸出: ::" -#: ../../library/asyncio-dev.rst:178 +#: ../../library/asyncio-dev.rst:174 msgid "" "test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" " test()" @@ -330,11 +321,11 @@ msgstr "" "test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" " test()" -#: ../../library/asyncio-dev.rst:181 ../../library/asyncio-dev.rst:237 +#: ../../library/asyncio-dev.rst:177 ../../library/asyncio-dev.rst:233 msgid "Output in debug mode::" msgstr "除錯模式中的輸出: ::" -#: ../../library/asyncio-dev.rst:183 +#: ../../library/asyncio-dev.rst:179 msgid "" "test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" "Coroutine created at (most recent call last)\n" @@ -358,14 +349,14 @@ msgstr "" " test()\n" " test()" -#: ../../library/asyncio-dev.rst:194 +#: ../../library/asyncio-dev.rst:190 msgid "" "The usual fix is to either await the coroutine or call the :meth:`asyncio." "create_task` function::" msgstr "" "常用的修復方法是去等待協程或者呼叫 :meth:`asyncio.create_task` 函式: ::" -#: ../../library/asyncio-dev.rst:197 +#: ../../library/asyncio-dev.rst:193 msgid "" "async def main():\n" " await test()" @@ -373,11 +364,11 @@ msgstr "" "async def main():\n" " await test()" -#: ../../library/asyncio-dev.rst:202 +#: ../../library/asyncio-dev.rst:198 msgid "Detect never-retrieved exceptions" msgstr "偵測從未被取得的 (never-retrieved) 例外" -#: ../../library/asyncio-dev.rst:204 +#: ../../library/asyncio-dev.rst:200 msgid "" "If a :meth:`Future.set_exception` is called but the Future object is never " "awaited on, the exception would never be propagated to the user code. In " @@ -388,11 +379,11 @@ msgstr "" "傳播 (propagate) 到使用者程式。在這種情況下,當 Future 物件被垃圾回收 " "(garbage collected) 時,asyncio 將發出一則日誌訊息。" -#: ../../library/asyncio-dev.rst:209 +#: ../../library/asyncio-dev.rst:205 msgid "Example of an unhandled exception::" msgstr "未處理例外的例子: ::" -#: ../../library/asyncio-dev.rst:211 +#: ../../library/asyncio-dev.rst:207 msgid "" "import asyncio\n" "\n" @@ -414,7 +405,7 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-dev.rst:223 +#: ../../library/asyncio-dev.rst:219 msgid "" "Task exception was never retrieved\n" "future: \n" @@ -434,7 +425,7 @@ msgstr "" " raise Exception(\"not consumed\")\n" "Exception: not consumed" -#: ../../library/asyncio-dev.rst:232 +#: ../../library/asyncio-dev.rst:228 msgid "" ":ref:`Enable the debug mode ` to get the traceback where " "the task was created::" @@ -442,11 +433,11 @@ msgstr "" ":ref:`啟用除錯模式 `\\ 以取得任務建立處的追蹤資訊 " "(traceback): ::" -#: ../../library/asyncio-dev.rst:235 +#: ../../library/asyncio-dev.rst:231 msgid "asyncio.run(main(), debug=True)" msgstr "asyncio.run(main(), debug=True)" -#: ../../library/asyncio-dev.rst:239 +#: ../../library/asyncio-dev.rst:235 msgid "" "Task exception was never retrieved\n" "future: \n" @@ -477,3 +468,12 @@ msgstr "" " File \"../t.py\", line 4, in bug\n" " raise Exception(\"not consumed\")\n" "Exception: not consumed" + +#~ msgid "" +#~ "asyncio checks for :ref:`coroutines that were not awaited ` and logs them; this mitigates the \"forgotten " +#~ "await\" pitfall." +#~ msgstr "" +#~ "asyncio 會檢查\\ :ref:`未被等待的協程 `\\ 並記錄他們;這會減輕\"被遺忘的等待 (forgotten await)\" 問" +#~ "題。" diff --git a/library/http.server.po b/library/http.server.po index 73e6238b9b..08a422c470 100644 --- a/library/http.server.po +++ b/library/http.server.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-16 00:15+0000\n" +"POT-Creation-Date: 2025-05-17 00:18+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "此模組定義了用於實作 HTTP 伺服器的類別。" #: ../../library/http.server.rst:22 msgid "" -":mod:`http.server` is not recommended for production. It only " -"implements :ref:`basic security checks `." +":mod:`http.server` is not recommended for production. It only implements :" +"ref:`basic security checks `." msgstr "" #: ../../includes/wasm-notavail.rst:3 @@ -69,9 +69,9 @@ msgstr "" #: ../../library/http.server.rst:39 msgid "" "This class builds on the :class:`~socketserver.TCPServer` class by storing " -"the server address as instance variables named :attr:`server_name` " -"and :attr:`server_port`. The server is accessible by the handler, typically " -"through the handler's :attr:`server` instance variable." +"the server address as instance variables named :attr:`server_name` and :attr:" +"`server_port`. The server is accessible by the handler, typically through " +"the handler's :attr:`server` instance variable." msgstr "" #: ../../library/http.server.rst:46 @@ -93,9 +93,9 @@ msgstr "" msgid "" "This class is used to handle the HTTP requests that arrive at the server. " "By itself, it cannot respond to any actual HTTP requests; it must be " -"subclassed to handle each request method (e.g. GET or " -"POST). :class:`BaseHTTPRequestHandler` provides a number of class and " -"instance variables, and methods for use by subclasses." +"subclassed to handle each request method (e.g. GET or POST). :class:" +"`BaseHTTPRequestHandler` provides a number of class and instance variables, " +"and methods for use by subclasses." msgstr "" #: ../../library/http.server.rst:66 @@ -132,9 +132,9 @@ msgstr "" #: ../../library/http.server.rst:92 msgid "" "Contains the string representation of the HTTP request line. The terminating " -"CRLF is stripped. This attribute should be set " -"by :meth:`handle_one_request`. If no valid request line was processed, it " -"should be set to the empty string." +"CRLF is stripped. This attribute should be set by :meth:" +"`handle_one_request`. If no valid request line was processed, it should be " +"set to the empty string." msgstr "" #: ../../library/http.server.rst:99 @@ -192,9 +192,9 @@ msgstr "" #: ../../library/http.server.rst:144 msgid "" -"Contains the Python system version, in a form usable by " -"the :attr:`version_string` method and the :attr:`server_version` class " -"variable. For example, ``'Python/1.4'``." +"Contains the Python system version, in a form usable by the :attr:" +"`version_string` method and the :attr:`server_version` class variable. For " +"example, ``'Python/1.4'``." msgstr "" #: ../../library/http.server.rst:150 @@ -225,8 +225,8 @@ msgstr "" #: ../../library/http.server.rst:172 msgid "" "Specifies an :class:`email.message.Message`\\ -like class to parse HTTP " -"headers. Typically, this is not overridden, and it defaults " -"to :class:`http.client.HTTPMessage`." +"headers. Typically, this is not overridden, and it defaults to :class:`http." +"client.HTTPMessage`." msgstr "" #: ../../library/http.server.rst:178 @@ -307,8 +307,8 @@ msgid "" "Adds the HTTP header to an internal buffer which will be written to the " "output stream when either :meth:`end_headers` or :meth:`flush_headers` is " "invoked. *keyword* should specify the header keyword, with *value* " -"specifying its value. Note that, after the send_header calls are " -"done, :meth:`end_headers` MUST BE called in order to complete the operation." +"specifying its value. Note that, after the send_header calls are done, :meth:" +"`end_headers` MUST BE called in order to complete the operation." msgstr "" #: ../../library/http.server.rst:250 @@ -357,15 +357,15 @@ msgstr "" msgid "" "Logs an arbitrary message to ``sys.stderr``. This is typically overridden to " "create custom error logging mechanisms. The *format* argument is a standard " -"printf-style format string, where the additional arguments " -"to :meth:`log_message` are applied as inputs to the formatting. The client " -"ip address and current date and time are prefixed to every message logged." +"printf-style format string, where the additional arguments to :meth:" +"`log_message` are applied as inputs to the formatting. The client ip address " +"and current date and time are prefixed to every message logged." msgstr "" #: ../../library/http.server.rst:301 msgid "" -"Returns the server software's version string. This is a combination of " -"the :attr:`server_version` and :attr:`sys_version` attributes." +"Returns the server software's version string. This is a combination of the :" +"attr:`server_version` and :attr:`sys_version` attributes." msgstr "" #: ../../library/http.server.rst:306 @@ -410,15 +410,15 @@ msgstr "" #: ../../library/http.server.rst:337 msgid "" -"A lot of the work, such as parsing the request, is done by the base " -"class :class:`BaseHTTPRequestHandler`. This class implements " -"the :func:`do_GET` and :func:`do_HEAD` functions." +"A lot of the work, such as parsing the request, is done by the base class :" +"class:`BaseHTTPRequestHandler`. This class implements the :func:`do_GET` " +"and :func:`do_HEAD` functions." msgstr "" #: ../../library/http.server.rst:341 msgid "" -"The following are defined as class-level attributes " -"of :class:`SimpleHTTPRequestHandler`:" +"The following are defined as class-level attributes of :class:" +"`SimpleHTTPRequestHandler`:" msgstr "" #: ../../library/http.server.rst:346 @@ -463,9 +463,9 @@ msgid "" "If the request was mapped to a directory, the directory is checked for a " "file named ``index.html`` or ``index.htm`` (in that order). If found, the " "file's contents are returned; otherwise a directory listing is generated by " -"calling the :meth:`list_directory` method. This method " -"uses :func:`os.listdir` to scan the directory, and returns a ``404`` error " -"response if the :func:`~os.listdir` fails." +"calling the :meth:`list_directory` method. This method uses :func:`os." +"listdir` to scan the directory, and returns a ``404`` error response if the :" +"func:`~os.listdir` fails." msgstr "" #: ../../library/http.server.rst:379 @@ -489,28 +489,27 @@ msgstr "" #: ../../library/http.server.rst:391 msgid "" "Then follows a blank line signifying the end of the headers, and then the " -"contents of the file are output. If the file's MIME type starts with ``text/" -"`` the file is opened in text mode; otherwise binary mode is used." +"contents of the file are output." msgstr "" -#: ../../library/http.server.rst:395 +#: ../../library/http.server.rst:394 msgid "" -"For example usage, see the implementation of the ``test`` function " -"in :source:`Lib/http/server.py`." +"For example usage, see the implementation of the ``test`` function in :" +"source:`Lib/http/server.py`." msgstr "" -#: ../../library/http.server.rst:398 +#: ../../library/http.server.rst:397 msgid "Support of the ``'If-Modified-Since'`` header." msgstr "" -#: ../../library/http.server.rst:401 +#: ../../library/http.server.rst:400 msgid "" "The :class:`SimpleHTTPRequestHandler` class can be used in the following " "manner in order to create a very basic webserver serving files relative to " "the current directory::" msgstr "" -#: ../../library/http.server.rst:405 +#: ../../library/http.server.rst:404 msgid "" "import http.server\n" "import socketserver\n" @@ -534,28 +533,28 @@ msgstr "" " print(\"serving at port\", PORT)\n" " httpd.serve_forever()" -#: ../../library/http.server.rst:417 +#: ../../library/http.server.rst:416 msgid "" ":class:`SimpleHTTPRequestHandler` can also be subclassed to enhance " "behavior, such as using different index file names by overriding the class " "attribute :attr:`index_pages`." msgstr "" -#: ../../library/http.server.rst:424 +#: ../../library/http.server.rst:423 msgid "" "This class is used to serve either files or output of CGI scripts from the " "current directory and below. Note that mapping HTTP hierarchic structure to " "local directory structure is exactly as in :class:`SimpleHTTPRequestHandler`." msgstr "" -#: ../../library/http.server.rst:430 +#: ../../library/http.server.rst:429 msgid "" "CGI scripts run by the :class:`CGIHTTPRequestHandler` class cannot execute " "redirects (HTTP code 302), because code 200 (script output follows) is sent " "prior to execution of the CGI script. This pre-empts the status code." msgstr "" -#: ../../library/http.server.rst:435 +#: ../../library/http.server.rst:434 msgid "" "The class will however, run the CGI script, instead of serving it as a file, " "if it guesses it to be a CGI script. Only directory-based CGI are used --- " @@ -563,79 +562,79 @@ msgid "" "denoting CGI scripts." msgstr "" -#: ../../library/http.server.rst:440 +#: ../../library/http.server.rst:439 msgid "" "The :func:`do_GET` and :func:`do_HEAD` functions are modified to run CGI " "scripts and serve the output, instead of serving files, if the request leads " "to somewhere below the ``cgi_directories`` path." msgstr "" -#: ../../library/http.server.rst:444 +#: ../../library/http.server.rst:443 msgid "The :class:`CGIHTTPRequestHandler` defines the following data member:" msgstr "" -#: ../../library/http.server.rst:448 +#: ../../library/http.server.rst:447 msgid "" "This defaults to ``['/cgi-bin', '/htbin']`` and describes directories to " "treat as containing CGI scripts." msgstr "" -#: ../../library/http.server.rst:451 +#: ../../library/http.server.rst:450 msgid "The :class:`CGIHTTPRequestHandler` defines the following method:" msgstr "" -#: ../../library/http.server.rst:455 +#: ../../library/http.server.rst:454 msgid "" "This method serves the ``'POST'`` request type, only allowed for CGI " "scripts. Error 501, \"Can only POST to CGI scripts\", is output when trying " "to POST to a non-CGI url." msgstr "" -#: ../../library/http.server.rst:459 +#: ../../library/http.server.rst:458 msgid "" "Note that CGI scripts will be run with UID of user nobody, for security " "reasons. Problems with the CGI script will be translated to error 403." msgstr "" -#: ../../library/http.server.rst:464 +#: ../../library/http.server.rst:463 msgid "" ":class:`CGIHTTPRequestHandler` is being removed in 3.15. CGI has not been " "considered a good way to do things for well over a decade. This code has " "been unmaintained for a while now and sees very little practical use. " -"Retaining it could lead to further :ref:`security considerations " -"`." +"Retaining it could lead to further :ref:`security considerations `." msgstr "" -#: ../../library/http.server.rst:474 +#: ../../library/http.server.rst:473 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/http.server.rst:476 +#: ../../library/http.server.rst:475 msgid "" ":mod:`http.server` can also be invoked directly using the :option:`-m` " "switch of the interpreter. The following example illustrates how to serve " "files relative to the current directory::" msgstr "" -#: ../../library/http.server.rst:480 +#: ../../library/http.server.rst:479 msgid "python -m http.server [OPTIONS] [port]" msgstr "python -m http.server [OPTIONS] [port]" -#: ../../library/http.server.rst:482 +#: ../../library/http.server.rst:481 msgid "The following options are accepted:" msgstr "可接受以下選項:" -#: ../../library/http.server.rst:488 +#: ../../library/http.server.rst:487 msgid "" "The server listens to port 8000 by default. The default can be overridden by " "passing the desired port number as an argument::" msgstr "" -#: ../../library/http.server.rst:491 +#: ../../library/http.server.rst:490 msgid "python -m http.server 9000" msgstr "python -m http.server 9000" -#: ../../library/http.server.rst:495 +#: ../../library/http.server.rst:494 msgid "" "Specifies a specific address to which it should bind. Both IPv4 and IPv6 " "addresses are supported. By default, the server binds itself to all " @@ -643,80 +642,80 @@ msgid "" "localhost only::" msgstr "" -#: ../../library/http.server.rst:500 +#: ../../library/http.server.rst:499 msgid "python -m http.server --bind 127.0.0.1" msgstr "python -m http.server --bind 127.0.0.1" -#: ../../library/http.server.rst:504 +#: ../../library/http.server.rst:503 msgid "Support IPv6 in the ``--bind`` option." msgstr "於 ``--bind`` 選項中支援 IPv6。" -#: ../../library/http.server.rst:509 +#: ../../library/http.server.rst:508 msgid "" "Specifies a directory to which it should serve the files. By default, the " "server uses the current directory. For example, the following command uses a " "specific directory::" msgstr "" -#: ../../library/http.server.rst:513 +#: ../../library/http.server.rst:512 msgid "python -m http.server --directory /tmp/" msgstr "python -m http.server --directory /tmp/" -#: ../../library/http.server.rst:519 +#: ../../library/http.server.rst:518 msgid "" "Specifies the HTTP version to which the server is conformant. By default, " "the server is conformant to HTTP/1.0. For example, the following command " "runs an HTTP/1.1 conformant server::" msgstr "" -#: ../../library/http.server.rst:523 +#: ../../library/http.server.rst:522 msgid "python -m http.server --protocol HTTP/1.1" msgstr "python -m http.server --protocol HTTP/1.1" -#: ../../library/http.server.rst:529 +#: ../../library/http.server.rst:528 msgid "" ":class:`CGIHTTPRequestHandler` can be enabled in the command line by passing " "the ``--cgi`` option::" msgstr "" -#: ../../library/http.server.rst:532 +#: ../../library/http.server.rst:531 msgid "python -m http.server --cgi" msgstr "python -m http.server --cgi" -#: ../../library/http.server.rst:536 +#: ../../library/http.server.rst:535 msgid "" -":mod:`http.server` command line ``--cgi`` support is being removed " -"because :class:`CGIHTTPRequestHandler` is being removed." +":mod:`http.server` command line ``--cgi`` support is being removed because :" +"class:`CGIHTTPRequestHandler` is being removed." msgstr "" -#: ../../library/http.server.rst:541 +#: ../../library/http.server.rst:540 msgid "" ":class:`CGIHTTPRequestHandler` and the ``--cgi`` command-line option are not " "intended for use by untrusted clients and may be vulnerable to exploitation. " "Always use within a secure environment." msgstr "" -#: ../../library/http.server.rst:549 +#: ../../library/http.server.rst:548 msgid "Security considerations" msgstr "安全性注意事項" -#: ../../library/http.server.rst:553 +#: ../../library/http.server.rst:552 msgid "" ":class:`SimpleHTTPRequestHandler` will follow symbolic links when handling " "requests, this makes it possible for files outside of the specified " "directory to be served." msgstr "" -#: ../../library/http.server.rst:557 +#: ../../library/http.server.rst:556 msgid "" "Earlier versions of Python did not scrub control characters from the log " -"messages emitted to stderr from ``python -m http.server`` or the " -"default :class:`BaseHTTPRequestHandler` ``.log_message`` implementation. " -"This could allow remote clients connecting to your server to send nefarious " -"control codes to your terminal." +"messages emitted to stderr from ``python -m http.server`` or the default :" +"class:`BaseHTTPRequestHandler` ``.log_message`` implementation. This could " +"allow remote clients connecting to your server to send nefarious control " +"codes to your terminal." msgstr "" -#: ../../library/http.server.rst:563 +#: ../../library/http.server.rst:562 msgid "Control characters are scrubbed in stderr logs." msgstr "" @@ -744,11 +743,11 @@ msgstr "URL(統一資源定位器)" msgid "httpd" msgstr "httpd" -#: ../../library/http.server.rst:551 +#: ../../library/http.server.rst:550 msgid "http.server" msgstr "http.server" -#: ../../library/http.server.rst:551 +#: ../../library/http.server.rst:550 msgid "security" msgstr "security(安全)" diff --git a/library/pathlib.po b/library/pathlib.po index 86e5df8c15..e57c602086 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-05-17 00:18+0000\n" "PO-Revision-Date: 2024-12-23 19:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -76,8 +76,8 @@ msgid "" "You cannot instantiate a :class:`WindowsPath` when running on Unix, but you " "can instantiate :class:`PureWindowsPath`." msgstr "" -"如果你想在 Unix 機器上處理 Windows 路徑(或反過來),你無法在 Unix 上實例" -"化 :class:`WindowsPath`,但你可以實例化 :class:`PureWindowsPath`。" +"如果你想在 Unix 機器上處理 Windows 路徑(或反過來),你無法在 Unix 上實例化 :" +"class:`WindowsPath`,但你可以實例化 :class:`PureWindowsPath`。" #: ../../library/pathlib.rst:40 msgid "" @@ -94,8 +94,8 @@ msgstr ":pep:`428`:pathlib 模組 -- 物件導向檔案系統路徑。" #: ../../library/pathlib.rst:48 msgid "" -"For low-level path manipulation on strings, you can also use " -"the :mod:`os.path` module." +"For low-level path manipulation on strings, you can also use the :mod:`os." +"path` module." msgstr "針對字串上的底層路徑操作,你也可以使用 :mod:`os.path` 模組。" #: ../../library/pathlib.rst:53 @@ -222,8 +222,8 @@ msgid "" "A generic class that represents the system's path flavour (instantiating it " "creates either a :class:`PurePosixPath` or a :class:`PureWindowsPath`)::" msgstr "" -"一個通用的類別,表示系統的路徑類型(實例化時會建立一" -"個 :class:`PurePosixPath` 或 :class:`PureWindowsPath`): ::" +"一個通用的類別,表示系統的路徑類型(實例化時會建立一個 :class:" +"`PurePosixPath` 或 :class:`PureWindowsPath`): ::" #: ../../library/pathlib.rst:121 msgid "" @@ -241,8 +241,8 @@ msgid "" "path object::" msgstr "" "*pathsegments* 中的每個元素可以是以下的其中一種:一個表示路徑片段的字串,或一" -"個物件,它實作了 :class:`os.PathLike` 介面且其中" -"的 :meth:`~os.PathLike.__fspath__` 方法會回傳字串,就像是另一個路徑物件: ::" +"個物件,它實作了 :class:`os.PathLike` 介面且其中的 :meth:`~os.PathLike." +"__fspath__` 方法會回傳字串,就像是另一個路徑物件: ::" #: ../../library/pathlib.rst:129 msgid "" @@ -270,11 +270,11 @@ msgstr "" #: ../../library/pathlib.rst:139 msgid "" -"If a segment is an absolute path, all previous segments are ignored " -"(like :func:`os.path.join`)::" +"If a segment is an absolute path, all previous segments are ignored (like :" +"func:`os.path.join`)::" msgstr "" -"如果一個片段是絕對路徑,則所有之前的片段會被忽略(類" -"似 :func:`os.path.join`): ::" +"如果一個片段是絕對路徑,則所有之前的片段會被忽略(類似 :func:`os.path." +"join`): ::" #: ../../library/pathlib.rst:142 msgid "" @@ -290,8 +290,8 @@ msgstr "" #: ../../library/pathlib.rst:147 msgid "" -"On Windows, the drive is not reset when a rooted relative path segment " -"(e.g., ``r'\\foo'``) is encountered::" +"On Windows, the drive is not reset when a rooted relative path segment (e." +"g., ``r'\\foo'``) is encountered::" msgstr "" "在 Windows 系統上,當遇到具有根目錄的相對路徑片段(例如 ``r'\\foo'``)時,磁" "碟機 (drive) 部分不會被重置: ::" @@ -504,8 +504,8 @@ msgstr "" #: ../../library/pathlib.rst:251 msgid "" -"A path object can be used anywhere an object " -"implementing :class:`os.PathLike` is accepted::" +"A path object can be used anywhere an object implementing :class:`os." +"PathLike` is accepted::" msgstr "" "路徑物件可以被用在任何可以接受實作 :class:`os.PathLike` 的物件的地方: ::" @@ -690,8 +690,8 @@ msgstr "" #: ../../library/pathlib.rst:350 msgid "" -"If the path starts with more than two successive " -"slashes, :class:`~pathlib.PurePosixPath` collapses them::" +"If the path starts with more than two successive slashes, :class:`~pathlib." +"PurePosixPath` collapses them::" msgstr "" "如果路徑以超過兩個連續的斜線開頭,:class:`~pathlib.PurePosixPath` 會合併它" "們: ::" @@ -715,12 +715,12 @@ msgstr "" #: ../../library/pathlib.rst:362 msgid "" "This behavior conforms to *The Open Group Base Specifications Issue 6*, " -"paragraph `4.11 Pathname Resolution `_:" +"paragraph `4.11 Pathname Resolution `_:" msgstr "" "此行為符合 *The Open Group Base Specifications Issue 6*,章節 `4.11 路徑名稱" -"解析 `_:" +"解析 `_:" #: ../../library/pathlib.rst:366 msgid "" @@ -1132,9 +1132,9 @@ msgid "" "\"``**``\" isn't supported (it acts like non-recursive \"``*``\"), and if a " "relative pattern is provided, then matching is done from the right::" msgstr "" -"此方法類似於 :meth:`~PurePath.full_match`,但不允許空白模式(會引" -"發 :exc:`ValueError`)、不支援遞迴萬用字元 \"``**``\"(它會像非遞迴的 " -"\"``*``\" 一樣),且如果提供相對模式,則會從右邊進行比對: ::" +"此方法類似於 :meth:`~PurePath.full_match`,但不允許空白模式(會引發 :exc:" +"`ValueError`)、不支援遞迴萬用字元 \"``**``\"(它會像非遞迴的 \"``*``\" 一" +"樣),且如果提供相對模式,則會從右邊進行比對: ::" #: ../../library/pathlib.rst:605 msgid "" @@ -1167,8 +1167,8 @@ msgid "" "Compute a version of this path relative to the path represented by *other*. " "If it's impossible, :exc:`ValueError` is raised::" msgstr "" -"計算這個路徑相對於 *other* 所表示路徑的版本。如果做不到會引" -"發 :exc:`ValueError`: ::" +"計算這個路徑相對於 *other* 所表示路徑的版本。如果做不到會引發 :exc:" +"`ValueError`: ::" #: ../../library/pathlib.rst:624 msgid "" @@ -1202,8 +1202,8 @@ msgstr "" msgid "" "When *walk_up* is false (the default), the path must start with *other*. " "When the argument is true, ``..`` entries may be added to form the relative " -"path. In all other cases, such as the paths referencing different " -"drives, :exc:`ValueError` is raised.::" +"path. In all other cases, such as the paths referencing different drives, :" +"exc:`ValueError` is raised.::" msgstr "" "當 *walk_up* 是 False(預設值),路徑必須以 *other* 為開始。當此引數是 True," "可能會加入 ``..`` 以組成相對路徑。在其他情況下,例如路徑參考到不同的磁碟機," @@ -1454,11 +1454,11 @@ msgstr "" #: ../../library/pathlib.rst:778 msgid "" -"Raises :exc:`UnsupportedOperation` on Windows. In previous " -"versions, :exc:`NotImplementedError` was raised instead." +"Raises :exc:`UnsupportedOperation` on Windows. In previous versions, :exc:" +"`NotImplementedError` was raised instead." msgstr "" -"在 Windows 上會引發 :exc:`UnsupportedOperation`。在先前版本中,則是引" -"發 :exc:`NotImplementedError`。" +"在 Windows 上會引發 :exc:`UnsupportedOperation`。在先前版本中,則是引發 :exc:" +"`NotImplementedError`。" #: ../../library/pathlib.rst:785 msgid "" @@ -1607,8 +1607,8 @@ msgid "" ":exc:`ValueError` is raised if the URI does not start with ``file:``, or the " "parsed path isn't absolute." msgstr "" -"如果 URI 不是 ``file:`` 開頭,或是剖析後的路徑不是絕對路徑,則會引" -"發 :exc:`ValueError`。" +"如果 URI 不是 ``file:`` 開頭,或是剖析後的路徑不是絕對路徑,則會引發 :exc:" +"`ValueError`。" #: ../../library/pathlib.rst:864 msgid "" @@ -1638,8 +1638,8 @@ msgid "" "For historical reasons, this method is also available from :class:`PurePath` " "objects. However, its use of :func:`os.fsencode` makes it strictly impure." msgstr "" -"因為歷史上的原因,此方法也可以從 :class:`PurePath` 物件上使用。然而,它使" -"用 :func:`os.fsencode` 而讓它完全不純粹。" +"因為歷史上的原因,此方法也可以從 :class:`PurePath` 物件上使用。然而,它使用 :" +"func:`os.fsencode` 而讓它完全不純粹。" #: ../../library/pathlib.rst:882 msgid "Expanding and resolving paths" @@ -1651,9 +1651,8 @@ msgid "" "by :func:`os.path.expanduser` with ``~`` construct). If the home directory " "can't be resolved, :exc:`RuntimeError` is raised." msgstr "" -"回傳一個代表使用者家目錄的新的路徑物件(像以 ``~`` 構成" -"的 :func:`os.path.expanduser` 的回傳一樣)。如果無法解析家目錄,會引" -"發 :exc:`RuntimeError`。" +"回傳一個代表使用者家目錄的新的路徑物件(像以 ``~`` 構成的 :func:`os.path." +"expanduser` 的回傳一樣)。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" #: ../../library/pathlib.rst:892 msgid "" @@ -1666,8 +1665,8 @@ msgstr "" #: ../../library/pathlib.rst:900 msgid "" "Return a new path with expanded ``~`` and ``~user`` constructs, as returned " -"by :meth:`os.path.expanduser`. If a home directory can't be " -"resolved, :exc:`RuntimeError` is raised." +"by :meth:`os.path.expanduser`. If a home directory can't be resolved, :exc:" +"`RuntimeError` is raised." msgstr "" "回傳一個展開 ``~`` 和 ``~user`` 構成的新路徑,像 :meth:`os.path.expanduser` " "回傳的一樣。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" @@ -1684,8 +1683,8 @@ msgstr "" #: ../../library/pathlib.rst:915 msgid "" -"Return a new path object representing the current directory (as returned " -"by :func:`os.getcwd`)::" +"Return a new path object representing the current directory (as returned by :" +"func:`os.getcwd`)::" msgstr "" "回傳一個代表目前目錄的新的路徑物件(像 :func:`os.getcwd` 回傳的一樣): ::" @@ -1761,9 +1760,9 @@ msgid "" "resolved as far as possible and any remainder is appended without checking " "whether it exists." msgstr "" -"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引" -"發 :exc:`OSError`。如果 *strict* 為 ``False``,則將盡可能解析該路徑,並將任何" -"剩餘部分追加到路徑中,而不檢查其是否存在。" +"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引發 :exc:" +"`OSError`。如果 *strict* 為 ``False``,則將盡可能解析該路徑,並將任何剩餘部分" +"追加到路徑中,而不檢查其是否存在。" #: ../../library/pathlib.rst:956 msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." @@ -1781,8 +1780,8 @@ msgstr "" #: ../../library/pathlib.rst:967 msgid "" -"Return the path to which the symbolic link points (as returned " -"by :func:`os.readlink`)::" +"Return the path to which the symbolic link points (as returned by :func:`os." +"readlink`)::" msgstr "回傳符號連結指向的路徑(如 :func:`os.readlink` 的回傳值): ::" #: ../../library/pathlib.rst:970 @@ -1811,11 +1810,15 @@ msgstr "查詢檔案類型和狀態" #: ../../library/pathlib.rst:987 msgid "" -":meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`, :meth:`~Path.is_mount`, :meth:`~Path.is_symlink`, :meth:`~Path.is_block_device`, :meth:`~Path.is_char_device`, :meth:`~Path.is_fifo`, :meth:`~Path.is_socket` " +":meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`, :meth:" +"`~Path.is_mount`, :meth:`~Path.is_symlink`, :meth:`~Path.is_block_device`, :" +"meth:`~Path.is_char_device`, :meth:`~Path.is_fifo`, :meth:`~Path.is_socket` " "now return ``False`` instead of raising an exception for paths that contain " "characters unrepresentable at the OS level." msgstr "" -":meth:`~Path.exists`、:meth:`~Path.is_dir`、:meth:`~Path.is_file`、:meth:`~Path.is_mount`、:meth:`~Path.is_symlink`、:meth:`~Path.is_block_device`、:meth:`~Path.is_char_device`、:meth:`~Path.is_fifo`、:meth:`~Path.is_socket` " +":meth:`~Path.exists`、:meth:`~Path.is_dir`、:meth:`~Path.is_file`、:meth:" +"`~Path.is_mount`、:meth:`~Path.is_symlink`、:meth:`~Path.is_block_device`、:" +"meth:`~Path.is_char_device`、:meth:`~Path.is_fifo`、:meth:`~Path.is_socket` " "遇到路徑包含 OS 層無法表示的字元時現在會回傳 ``False`` 而不是引發例外。" #: ../../library/pathlib.rst:997 @@ -2016,12 +2019,12 @@ msgstr "" #: ../../library/pathlib.rst:1144 msgid "" "Return whether this path points to the same file as *other_path*, which can " -"be either a Path object, or a string. The semantics are similar " -"to :func:`os.path.samefile` and :func:`os.path.samestat`." +"be either a Path object, or a string. The semantics are similar to :func:" +"`os.path.samefile` and :func:`os.path.samestat`." msgstr "" "回傳此路徑是否指向與 *other_path* 相同的檔案,*other_path* 可以是路徑 (Path) " -"物件或字串。其語義類似於 :func:`os.path.samefile` " -"和 :func:`os.path.samestat`。" +"物件或字串。其語義類似於 :func:`os.path.samefile` 和 :func:`os.path." +"samestat`。" #: ../../library/pathlib.rst:1148 msgid "" @@ -2200,8 +2203,8 @@ msgstr "" #: ../../library/pathlib.rst:1279 msgid "" ">>> sorted(Path('.').glob('*.py'))\n" -"[PosixPath('pathlib.py'), PosixPath('setup.py'), " -"PosixPath('test_pathlib.py')]\n" +"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." +"py')]\n" ">>> sorted(Path('.').glob('*/*.py'))\n" "[PosixPath('docs/conf.py')]\n" ">>> sorted(Path('.').glob('**/*.py'))\n" @@ -2212,8 +2215,8 @@ msgid "" " PosixPath('test_pathlib.py')]" msgstr "" ">>> sorted(Path('.').glob('*.py'))\n" -"[PosixPath('pathlib.py'), PosixPath('setup.py'), " -"PosixPath('test_pathlib.py')]\n" +"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." +"py')]\n" ">>> sorted(Path('.').glob('*/*.py'))\n" "[PosixPath('docs/conf.py')]\n" ">>> sorted(Path('.').glob('**/*.py'))\n" @@ -2268,8 +2271,8 @@ msgstr "" #: ../../library/pathlib.rst:1321 msgid "" -"Glob the given relative *pattern* recursively. This is like " -"calling :func:`Path.glob` with \"``**/``\" added in front of the *pattern*." +"Glob the given relative *pattern* recursively. This is like calling :func:" +"`Path.glob` with \"``**/``\" added in front of the *pattern*." msgstr "" "遞迴地 glob 給定的相對 *pattern*。這相當於在給定的相對 *pattern* 前面加上 " "\"``**/``\" 並呼叫 :func:`Path.glob`。" @@ -2335,15 +2338,14 @@ msgstr "" #: ../../library/pathlib.rst:1364 msgid "" "When *top_down* is true, the caller can modify the *dirnames* list in-place " -"(for example, using :keyword:`del` or slice assignment), " -"and :meth:`Path.walk` will only recurse into the subdirectories whose names " -"remain in *dirnames*. This can be used to prune the search, or to impose a " -"specific order of visiting, or even to inform :meth:`Path.walk` about " -"directories the caller creates or renames before it " -"resumes :meth:`Path.walk` again. Modifying *dirnames* when *top_down* is " -"false has no effect on the behavior of :meth:`Path.walk` since the " -"directories in *dirnames* have already been generated by the time *dirnames* " -"is yielded to the caller." +"(for example, using :keyword:`del` or slice assignment), and :meth:`Path." +"walk` will only recurse into the subdirectories whose names remain in " +"*dirnames*. This can be used to prune the search, or to impose a specific " +"order of visiting, or even to inform :meth:`Path.walk` about directories the " +"caller creates or renames before it resumes :meth:`Path.walk` again. " +"Modifying *dirnames* when *top_down* is false has no effect on the behavior " +"of :meth:`Path.walk` since the directories in *dirnames* have already been " +"generated by the time *dirnames* is yielded to the caller." msgstr "" "當 *top_down* 是 true,呼叫者可以原地 (in-place) 修改 *dirnames* 串列(例如使" "用 :keyword:`del` 或切片賦值 (slice assignment)),且 :meth:`Path.walk` 只會" @@ -2382,9 +2384,8 @@ msgstr "" #: ../../library/pathlib.rst:1387 msgid "" "Be aware that setting *follow_symlinks* to true can lead to infinite " -"recursion if a link points to a parent directory of " -"itself. :meth:`Path.walk` does not keep track of the directories it has " -"already visited." +"recursion if a link points to a parent directory of itself. :meth:`Path." +"walk` does not keep track of the directories it has already visited." msgstr "" "需要注意的是如果符號連結指向一個其本身的父目錄,則將 *follow_symlinks* 設定" "為 true 會導致無窮的遞迴。:meth:`Path.walk` 不會紀錄其已經瀏覽過的目錄。" @@ -2398,17 +2399,17 @@ msgid "" "*dirnames* as appropriate." msgstr "" ":meth:`Path.walk` 假設其走訪的目錄在執行過程中不會被修改。舉例來說,如果在 " -"*dirnames* 裡的目錄已經被一個符號連結取代,且 *follow_symlinks* 是 " -"false,:meth:`Path.walk` 依然會試著往下進入它。為了防止這樣的行為,可以從 " -"*dirnames* 適當地移除目錄。" +"*dirnames* 裡的目錄已經被一個符號連結取代,且 *follow_symlinks* 是 false,:" +"meth:`Path.walk` 依然會試著往下進入它。為了防止這樣的行為,可以從 *dirnames* " +"適當地移除目錄。" #: ../../library/pathlib.rst:1400 msgid "" "Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in " "*filenames* if *follow_symlinks* is false." msgstr "" -"如果 *follow_symlinks* 是 false,和 :func:`os.walk` 行為不同的" -"是 :meth:`Path.walk` 會將指向目錄的符號連結放在 *filenames* 串列。" +"如果 *follow_symlinks* 是 false,和 :func:`os.walk` 行為不同的是 :meth:`Path." +"walk` 會將指向目錄的符號連結放在 *filenames* 串列。" #: ../../library/pathlib.rst:1403 msgid "" @@ -2421,8 +2422,8 @@ msgstr "" #: ../../library/pathlib.rst:1406 msgid "" "from pathlib import Path\n" -"for root, dirs, files in Path(\"cpython/Lib/" -"concurrent\").walk(on_error=print):\n" +"for root, dirs, files in Path(\"cpython/Lib/concurrent\")." +"walk(on_error=print):\n" " print(\n" " root,\n" " \"consumes\",\n" @@ -2435,8 +2436,8 @@ msgid "" " dirs.remove('__pycache__')" msgstr "" "from pathlib import Path\n" -"for root, dirs, files in Path(\"cpython/Lib/" -"concurrent\").walk(on_error=print):\n" +"for root, dirs, files in Path(\"cpython/Lib/concurrent\")." +"walk(on_error=print):\n" " print(\n" " root,\n" " \"consumes\",\n" @@ -2486,8 +2487,8 @@ msgid "" "Create a file at this given path. If *mode* is given, it is combined with " "the process's ``umask`` value to determine the file mode and access flags. " "If the file already exists, the function succeeds when *exist_ok* is true " -"(and its modification time is updated to the current time), " -"otherwise :exc:`FileExistsError` is raised." +"(and its modification time is updated to the current time), otherwise :exc:" +"`FileExistsError` is raised." msgstr "" "根據給定路徑來建立一個檔案。如果 *mode* 有給定,它會與行程的 ``umask`` 值結" "合,以確定檔案模式和存取旗標。當檔案已經存在時,若 *exist_ok* 為 true 則函式" @@ -2495,8 +2496,8 @@ msgstr "" #: ../../library/pathlib.rst:1447 msgid "" -"The :meth:`~Path.open`, :meth:`~Path.write_text` " -"and :meth:`~Path.write_bytes` methods are often used to create files." +"The :meth:`~Path.open`, :meth:`~Path.write_text` and :meth:`~Path." +"write_bytes` methods are often used to create files." msgstr "" ":meth:`~Path.open`、:meth:`~Path.write_text` 和 :meth:`~Path.write_bytes` 方" "法通常用於建立檔案。" @@ -2522,19 +2523,19 @@ msgstr "" #: ../../library/pathlib.rst:1462 msgid "" -"If *parents* is false (the default), a missing parent " -"raises :exc:`FileNotFoundError`." +"If *parents* is false (the default), a missing parent raises :exc:" +"`FileNotFoundError`." msgstr "" -"如果 *parents* 是 false(預設值),缺少的父路徑會引" -"發 :exc:`FileNotFoundError`。" +"如果 *parents* 是 false(預設值),缺少的父路徑會引發 :exc:" +"`FileNotFoundError`。" #: ../../library/pathlib.rst:1465 msgid "" "If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if " "the target directory already exists." msgstr "" -"如果 *exist_ok* 是 false(預設值),則當目標目錄已經存在的話會引" -"發 :exc:`FileExistsError`。" +"如果 *exist_ok* 是 false(預設值),則當目標目錄已經存在的話會引發 :exc:" +"`FileExistsError`。" #: ../../library/pathlib.rst:1468 msgid "" @@ -2542,9 +2543,8 @@ msgid "" "given path already exists in the file system and is not a directory (same " "behavior as the POSIX ``mkdir -p`` command)." msgstr "" -"如果 *exist_ok* 是 true,只有當最後的路徑組成不是一個已存在的非目錄檔" -"案,:exc:`FileExistsError` 例外會被忽略(與 POSIX 的 ``mkdir -p`` 指令行為相" -"同)。" +"如果 *exist_ok* 是 true,只有當最後的路徑組成不是一個已存在的非目錄檔案,:" +"exc:`FileExistsError` 例外會被忽略(與 POSIX 的 ``mkdir -p`` 指令行為相同)。" #: ../../library/pathlib.rst:1472 msgid "The *exist_ok* parameter was added." @@ -2623,11 +2623,11 @@ msgstr "重新命名和刪除" #: ../../library/pathlib.rst:1526 msgid "" -"Rename this file or directory to the given *target*, and return a " -"new :class:`!Path` instance pointing to *target*. On Unix, if *target* " -"exists and is a file, it will be replaced silently if the user has " -"permission. On Windows, if *target* exists, :exc:`FileExistsError` will be " -"raised. *target* can be either a string or another path object::" +"Rename this file or directory to the given *target*, and return a new :class:" +"`!Path` instance pointing to *target*. On Unix, if *target* exists and is a " +"file, it will be replaced silently if the user has permission. On Windows, " +"if *target* exists, :exc:`FileExistsError` will be raised. *target* can be " +"either a string or another path object::" msgstr "" "將此檔案或目錄重新命名為給定的 *target* ,並回傳一個新的 :class:`!Path` 實例" "指向該 *target*。在 Unix 系統上,若 *target* 存在且為一個檔案,若使用者有權" @@ -2657,8 +2657,8 @@ msgstr "" #: ../../library/pathlib.rst:1541 ../../library/pathlib.rst:1557 msgid "" "The target path may be absolute or relative. Relative paths are interpreted " -"relative to the current working directory, *not* the directory of " -"the :class:`!Path` object." +"relative to the current working directory, *not* the directory of the :class:" +"`!Path` object." msgstr "" "目標路徑可以是絕對路徑或相對路徑。相對路徑會相對於目前的工作目錄進行解釋,*而" "不是*\\ 相對於 :class:`!Path` 物件所在的目錄。" @@ -2675,18 +2675,17 @@ msgstr "新增了回傳值,回傳新的 :class:`!Path` 實例。" #: ../../library/pathlib.rst:1553 msgid "" -"Rename this file or directory to the given *target*, and return a " -"new :class:`!Path` instance pointing to *target*. If *target* points to an " -"existing file or empty directory, it will be unconditionally replaced." +"Rename this file or directory to the given *target*, and return a new :class:" +"`!Path` instance pointing to *target*. If *target* points to an existing " +"file or empty directory, it will be unconditionally replaced." msgstr "" -"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的" -"新 :class:`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條" -"件地取代。" +"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的新 :class:" +"`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條件地取代。" #: ../../library/pathlib.rst:1567 msgid "" -"Remove this file or symbolic link. If the path points to a directory, " -"use :func:`Path.rmdir` instead." +"Remove this file or symbolic link. If the path points to a directory, use :" +"func:`Path.rmdir` instead." msgstr "移除這個檔案或符號連結。如果路徑指向目錄,請改用 :func:`Path.rmdir`。" #: ../../library/pathlib.rst:1570 @@ -2808,11 +2807,11 @@ msgstr "模式語言 (pattern language)" #: ../../library/pathlib.rst:1652 msgid "" -"The following wildcards are supported in patterns " -"for :meth:`~PurePath.full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" +"The following wildcards are supported in patterns for :meth:`~PurePath." +"full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" msgstr "" -"以下的萬用字元在 :meth:`~PurePath.full_match`、:meth:`~Path.glob` " -"和 :meth:`~Path.rglob` 的模式中被支援:" +"以下的萬用字元在 :meth:`~PurePath.full_match`、:meth:`~Path.glob` 和 :meth:" +"`~Path.rglob` 的模式中被支援:" #: ../../library/pathlib.rst:1655 msgid "``**`` (entire segment)" @@ -2851,18 +2850,25 @@ msgid "``[seq]``" msgstr "``[seq]``" #: ../../library/pathlib.rst:1664 -msgid "Matches one character in *seq*." -msgstr "匹配一個在 *seq* 中的字元。" +msgid "" +"Matches one character in *seq*, where *seq* is a sequence of characters. " +"Range expressions are supported; for example, ``[a-z]`` matches any " +"lowercase ASCII letter. Multiple ranges can be combined: ``[a-zA-Z0-9_]`` " +"matches any ASCII letter, digit, or underscore." +msgstr "" -#: ../../library/pathlib.rst:1665 +#: ../../library/pathlib.rst:1668 msgid "``[!seq]``" msgstr "``[!seq]``" -#: ../../library/pathlib.rst:1666 -msgid "Matches one character not in *seq*." +#: ../../library/pathlib.rst:1669 +#, fuzzy +msgid "" +"Matches one character not in *seq*, where *seq* follows the same rules as " +"above." msgstr "匹配一個不在 *seq* 中的字元。" -#: ../../library/pathlib.rst:1668 +#: ../../library/pathlib.rst:1671 msgid "" "For a literal match, wrap the meta-characters in brackets. For example, " "``\"[?]\"`` matches the character ``\"?\"``." @@ -2870,52 +2876,52 @@ msgstr "" "對於文本 (literal) 匹配,可以用方括號包裝元字元 (meta-characters)。例如," "``\"[?]\"`` 會匹配字元 ``\"?\"``。" -#: ../../library/pathlib.rst:1671 +#: ../../library/pathlib.rst:1674 msgid "The \"``**``\" wildcard enables recursive globbing. A few examples:" msgstr "\"``**``\" 萬用字元讓它可以做遞迴 glob。例如:" -#: ../../library/pathlib.rst:1674 +#: ../../library/pathlib.rst:1677 msgid "Pattern" msgstr "模式" -#: ../../library/pathlib.rst:1674 +#: ../../library/pathlib.rst:1677 msgid "Meaning" msgstr "意涵" -#: ../../library/pathlib.rst:1676 +#: ../../library/pathlib.rst:1679 msgid "\"``**/*``\"" msgstr "\"``**/*``\"" -#: ../../library/pathlib.rst:1676 +#: ../../library/pathlib.rst:1679 msgid "Any path with at least one segment." msgstr "至少有一個片段的路徑。" -#: ../../library/pathlib.rst:1677 +#: ../../library/pathlib.rst:1680 msgid "\"``**/*.py``\"" msgstr "\"``**/*.py``\"" -#: ../../library/pathlib.rst:1677 +#: ../../library/pathlib.rst:1680 msgid "Any path with a final segment ending \"``.py``\"." msgstr "最後一個片段以 \"``.py``\" 結尾的任何路徑。" -#: ../../library/pathlib.rst:1678 +#: ../../library/pathlib.rst:1681 msgid "\"``assets/**``\"" msgstr "\"``assets/**``\"" -#: ../../library/pathlib.rst:1678 +#: ../../library/pathlib.rst:1681 msgid "Any path starting with \"``assets/``\"." msgstr "任何以 \"``assets/``\" 開頭的路徑。" -#: ../../library/pathlib.rst:1679 +#: ../../library/pathlib.rst:1682 msgid "\"``assets/**/*``\"" msgstr "\"``assets/**/*``\"" -#: ../../library/pathlib.rst:1679 +#: ../../library/pathlib.rst:1682 msgid "" "Any path starting with \"``assets/``\", excluding \"``assets/``\" itself." msgstr "任何以 \"``assets/``\" 開頭的路徑,不包括 \"``assets/``\" 本身。" -#: ../../library/pathlib.rst:1683 +#: ../../library/pathlib.rst:1686 msgid "" "Globbing with the \"``**``\" wildcard visits every directory in the tree. " "Large directory trees may take a long time to search." @@ -2923,7 +2929,7 @@ msgstr "" "Glob 使用 ``**`` 萬用字元會訪問目錄樹中的每個目錄。對於大型的目錄樹,搜尋可能" "需要花費很長的時間。" -#: ../../library/pathlib.rst:1686 +#: ../../library/pathlib.rst:1689 msgid "" "Globbing with a pattern that ends with \"``**``\" returns both files and " "directories. In previous versions, only directories were returned." @@ -2931,7 +2937,7 @@ msgstr "" "Glob 使用結尾為 ``**`` 的模式會同時回傳檔案和目錄。在先前版本中,只會回傳目" "錄。" -#: ../../library/pathlib.rst:1690 +#: ../../library/pathlib.rst:1693 msgid "" "In :meth:`Path.glob` and :meth:`~Path.rglob`, a trailing slash may be added " "to the pattern to match only directories." @@ -2939,43 +2945,43 @@ msgstr "" "在 :meth:`Path.glob` 和 :meth:`~Path.rglob` 中,可以在模式後面加上斜線以只匹" "配目錄。" -#: ../../library/pathlib.rst:1693 +#: ../../library/pathlib.rst:1696 msgid "" -"Globbing with a pattern that ends with a pathname components separator " -"(:data:`~os.sep` or :data:`~os.altsep`) returns only directories." +"Globbing with a pattern that ends with a pathname components separator (:" +"data:`~os.sep` or :data:`~os.altsep`) returns only directories." msgstr "" "Glob 使用以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os.altsep`)作" "結尾的模式則只會回傳目錄。" -#: ../../library/pathlib.rst:1699 +#: ../../library/pathlib.rst:1702 msgid "Comparison to the :mod:`glob` module" msgstr "與 :mod:`glob` 模組的比較" -#: ../../library/pathlib.rst:1701 +#: ../../library/pathlib.rst:1704 msgid "" -"The patterns accepted and results generated by :meth:`Path.glob` " -"and :meth:`Path.rglob` differ slightly from those by the :mod:`glob` module:" +"The patterns accepted and results generated by :meth:`Path.glob` and :meth:" +"`Path.rglob` differ slightly from those by the :mod:`glob` module:" msgstr "" ":meth:`Path.glob` 和 :meth:`Path.rglob` 接受的模式和產生的結果與 :mod:`glob` " "模組略有不同:" -#: ../../library/pathlib.rst:1704 +#: ../../library/pathlib.rst:1707 msgid "" "Files beginning with a dot are not special in pathlib. This is like passing " "``include_hidden=True`` to :func:`glob.glob`." msgstr "" -"pathlib 中以點開頭的檔案並不特別。這和將 ``include_hidden=True`` 傳遞" -"給 :func:`glob.glob` 相同。" +"pathlib 中以點開頭的檔案並不特別。這和將 ``include_hidden=True`` 傳遞給 :" +"func:`glob.glob` 相同。" -#: ../../library/pathlib.rst:1706 +#: ../../library/pathlib.rst:1709 msgid "" "\"``**``\" pattern components are always recursive in pathlib. This is like " "passing ``recursive=True`` to :func:`glob.glob`." msgstr "" -"``**`` 模式組成在 pathlib 中總是遞迴的。這與將 ``recursive=True`` 傳遞" -"給 :func:`glob.glob` 相同。" +"``**`` 模式組成在 pathlib 中總是遞迴的。這與將 ``recursive=True`` 傳遞給 :" +"func:`glob.glob` 相同。" -#: ../../library/pathlib.rst:1708 +#: ../../library/pathlib.rst:1711 msgid "" "\"``**``\" pattern components do not follow symlinks by default in pathlib. " "This behaviour has no equivalent in :func:`glob.glob`, but you can pass " @@ -2985,24 +2991,24 @@ msgstr "" "有等效的行為,但你可以將 ``recurse_symlinks=True`` 傳遞給 :meth:`Path.glob` " "以獲得相容的行為。" -#: ../../library/pathlib.rst:1711 +#: ../../library/pathlib.rst:1714 msgid "" "Like all :class:`PurePath` and :class:`Path` objects, the values returned " "from :meth:`Path.glob` and :meth:`Path.rglob` don't include trailing slashes." msgstr "" -"與所有 :class:`PurePath` 和 :class:`Path` 物件一樣,從 :meth:`Path.glob` " -"和 :meth:`Path.rglob` 回傳的值不包含結尾斜線。" +"與所有 :class:`PurePath` 和 :class:`Path` 物件一樣,從 :meth:`Path.glob` 和 :" +"meth:`Path.rglob` 回傳的值不包含結尾斜線。" -#: ../../library/pathlib.rst:1714 +#: ../../library/pathlib.rst:1717 msgid "" "The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` " -"include the *path* as a prefix, unlike the results of " -"``glob.glob(root_dir=path)``." +"include the *path* as a prefix, unlike the results of ``glob." +"glob(root_dir=path)``." msgstr "" "pathlib 的 ``path.glob()`` 和 ``path.rglob()`` 回傳的值包含了 *path* 作為前" "綴,而 ``glob.glob(root_dir=path)`` 的結果則不會如此。" -#: ../../library/pathlib.rst:1717 +#: ../../library/pathlib.rst:1720 msgid "" "The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` may " "include *path* itself, for example when globbing \"``**``\", whereas the " @@ -3013,15 +3019,15 @@ msgstr "" "例如當使用 \"``**``\" 做 glob 的時候,然而 ``glob.glob(root_dir=path)`` 的結" "果則永遠不會包含一個對應到 *path* 的空字串。" -#: ../../library/pathlib.rst:1724 +#: ../../library/pathlib.rst:1727 msgid "Comparison to the :mod:`os` and :mod:`os.path` modules" msgstr "與 :mod:`os` 和 :mod:`os.path` 模組的比較" -#: ../../library/pathlib.rst:1726 +#: ../../library/pathlib.rst:1729 msgid "" "pathlib implements path operations using :class:`PurePath` and :class:`Path` " -"objects, and so it's said to be *object-oriented*. On the other hand, " -"the :mod:`os` and :mod:`os.path` modules supply functions that work with low-" +"objects, and so it's said to be *object-oriented*. On the other hand, the :" +"mod:`os` and :mod:`os.path` modules supply functions that work with low-" "level ``str`` and ``bytes`` objects, which is a more *procedural* approach. " "Some users consider the object-oriented style to be more readable." msgstr "" @@ -3030,27 +3036,27 @@ msgstr "" "與底層 ``str`` 和 ``bytes`` 物件互動的函式,這是一種更\\ *程序式*\\ 的方法。" "有些使用者認為物件導向的風格更易讀。" -#: ../../library/pathlib.rst:1732 +#: ../../library/pathlib.rst:1735 msgid "" -"Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths " -"and :ref:`paths relative to directory descriptors `. These features " +"Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and :" +"ref:`paths relative to directory descriptors `. These features " "aren't available in pathlib." msgstr "" ":mod:`os` 和 :mod:`os.path` 中的許多函式支援 ``bytes`` 路徑和\\ :ref:`相對路" "徑的目錄描述器 (paths relative to directory descriptors) `。這些功能" "在 pathlib 中不可用。" -#: ../../library/pathlib.rst:1736 +#: ../../library/pathlib.rst:1739 msgid "" -"Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` " -"and :mod:`os.path` modules, are written in C and are very speedy. pathlib is " -"written in pure Python and is often slower, but rarely slow enough to matter." +"Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` and :mod:" +"`os.path` modules, are written in C and are very speedy. pathlib is written " +"in pure Python and is often slower, but rarely slow enough to matter." msgstr "" "Python 的 ``str`` 和 ``bytes`` 型別,以及 :mod:`os` 和 :mod:`os.path` 模組的" "一些部分,是用 C 寫的且非常快速。pathlib 是用純 Python 寫的且通常比較慢,但很" "少會慢到足以產生影響。" -#: ../../library/pathlib.rst:1740 +#: ../../library/pathlib.rst:1743 msgid "" "pathlib's path normalization is slightly more opinionated and consistent " "than :mod:`os.path`. For example, whereas :func:`os.path.abspath` eliminates " @@ -3058,16 +3064,16 @@ msgid "" "are involved, :meth:`Path.absolute` preserves these segments for greater " "safety." msgstr "" -"pathlib 的路徑正規化略比 :mod:`os.path` 更武斷和一致。例如,儘" -"管 :func:`os.path.abspath` 會從路徑中移除 \"``..``\" 片段,如果包含符號連結的" -"話這可能會改變其意義,而 :meth:`Path.absolute` 則會保留這些片段以增加安全性。" +"pathlib 的路徑正規化略比 :mod:`os.path` 更武斷和一致。例如,儘管 :func:`os." +"path.abspath` 會從路徑中移除 \"``..``\" 片段,如果包含符號連結的話這可能會改" +"變其意義,而 :meth:`Path.absolute` 則會保留這些片段以增加安全性。" -#: ../../library/pathlib.rst:1745 +#: ../../library/pathlib.rst:1748 msgid "" "pathlib's path normalization may render it unsuitable for some applications:" msgstr "pathlib 的路徑正規化可能會使它不適合某些應用程式:" -#: ../../library/pathlib.rst:1747 +#: ../../library/pathlib.rst:1750 msgid "" "pathlib normalizes ``Path(\"my_folder/\")`` to ``Path(\"my_folder\")``, " "which changes a path's meaning when supplied to various operating system " @@ -3079,7 +3085,7 @@ msgstr "" "提供給各種操作系統 API 和命令列工具時改變路徑的意義。具體來說,缺少結尾分隔符" "號可能會允許該路徑被解析為檔案或目錄,而不只是目錄。" -#: ../../library/pathlib.rst:1752 +#: ../../library/pathlib.rst:1755 msgid "" "pathlib normalizes ``Path(\"./my_program\")`` to ``Path(\"my_program\")``, " "which changes a path's meaning when used as an executable search path, such " @@ -3092,285 +3098,285 @@ msgstr "" "程時。具體來說,在路徑中缺少分隔符號可能會使其強制在 :envvar:`PATH` 中尋找," "而不是目前目錄。" -#: ../../library/pathlib.rst:1758 +#: ../../library/pathlib.rst:1761 msgid "" "As a consequence of these differences, pathlib is not a drop-in replacement " "for :mod:`os.path`." msgstr "因為這些差異,pathlib 不是 :mod:`os.path` 的直接替代品。" -#: ../../library/pathlib.rst:1763 +#: ../../library/pathlib.rst:1766 msgid "Corresponding tools" msgstr "對應工具" -#: ../../library/pathlib.rst:1765 +#: ../../library/pathlib.rst:1768 msgid "" -"Below is a table mapping various :mod:`os` functions to their " -"corresponding :class:`PurePath`/:class:`Path` equivalent." +"Below is a table mapping various :mod:`os` functions to their corresponding :" +"class:`PurePath`/:class:`Path` equivalent." msgstr "" -"以下是一張表格,對應許多 :mod:`os` 函式及其相符" -"於 :class:`PurePath`/:class:`Path` 的項目。" +"以下是一張表格,對應許多 :mod:`os` 函式及其相符於 :class:`PurePath`/:class:" +"`Path` 的項目。" -#: ../../library/pathlib.rst:1769 +#: ../../library/pathlib.rst:1772 msgid ":mod:`os` and :mod:`os.path`" msgstr ":mod:`os` 和 :mod:`os.path`" -#: ../../library/pathlib.rst:1769 +#: ../../library/pathlib.rst:1772 msgid ":mod:`pathlib`" msgstr ":mod:`pathlib`" -#: ../../library/pathlib.rst:1771 +#: ../../library/pathlib.rst:1774 msgid ":func:`os.path.dirname`" msgstr ":func:`os.path.dirname`" -#: ../../library/pathlib.rst:1771 +#: ../../library/pathlib.rst:1774 msgid ":attr:`PurePath.parent`" msgstr ":attr:`PurePath.parent`" -#: ../../library/pathlib.rst:1772 +#: ../../library/pathlib.rst:1775 msgid ":func:`os.path.basename`" msgstr ":func:`os.path.basename`" -#: ../../library/pathlib.rst:1772 +#: ../../library/pathlib.rst:1775 msgid ":attr:`PurePath.name`" msgstr ":attr:`PurePath.name`" -#: ../../library/pathlib.rst:1773 +#: ../../library/pathlib.rst:1776 msgid ":func:`os.path.splitext`" msgstr ":func:`os.path.splitext`" -#: ../../library/pathlib.rst:1773 +#: ../../library/pathlib.rst:1776 msgid ":attr:`PurePath.stem`, :attr:`PurePath.suffix`" msgstr ":attr:`PurePath.stem` 和 :attr:`PurePath.suffix`" -#: ../../library/pathlib.rst:1774 +#: ../../library/pathlib.rst:1777 msgid ":func:`os.path.join`" msgstr ":func:`os.path.join`" -#: ../../library/pathlib.rst:1774 +#: ../../library/pathlib.rst:1777 msgid ":meth:`PurePath.joinpath`" msgstr ":meth:`PurePath.joinpath`" -#: ../../library/pathlib.rst:1775 +#: ../../library/pathlib.rst:1778 msgid ":func:`os.path.isabs`" msgstr ":func:`os.path.isabs`" -#: ../../library/pathlib.rst:1775 +#: ../../library/pathlib.rst:1778 msgid ":meth:`PurePath.is_absolute`" msgstr ":meth:`PurePath.is_absolute`" -#: ../../library/pathlib.rst:1776 +#: ../../library/pathlib.rst:1779 msgid ":func:`os.path.relpath`" msgstr ":func:`os.path.relpath`" -#: ../../library/pathlib.rst:1776 +#: ../../library/pathlib.rst:1779 msgid ":meth:`PurePath.relative_to` [1]_" msgstr ":meth:`PurePath.relative_to` [1]_" -#: ../../library/pathlib.rst:1777 +#: ../../library/pathlib.rst:1780 msgid ":func:`os.path.expanduser`" msgstr ":func:`os.path.expanduser`" -#: ../../library/pathlib.rst:1777 +#: ../../library/pathlib.rst:1780 msgid ":meth:`Path.expanduser` [2]_" msgstr ":meth:`Path.expanduser` [2]_" -#: ../../library/pathlib.rst:1778 +#: ../../library/pathlib.rst:1781 msgid ":func:`os.path.realpath`" msgstr ":func:`os.path.realpath`" -#: ../../library/pathlib.rst:1778 +#: ../../library/pathlib.rst:1781 msgid ":meth:`Path.resolve`" msgstr ":meth:`Path.resolve`" -#: ../../library/pathlib.rst:1779 +#: ../../library/pathlib.rst:1782 msgid ":func:`os.path.abspath`" msgstr ":func:`os.path.abspath`" -#: ../../library/pathlib.rst:1779 +#: ../../library/pathlib.rst:1782 msgid ":meth:`Path.absolute` [3]_" msgstr ":meth:`Path.absolute` [3]_" -#: ../../library/pathlib.rst:1780 +#: ../../library/pathlib.rst:1783 msgid ":func:`os.path.exists`" msgstr ":func:`os.path.exists`" -#: ../../library/pathlib.rst:1780 +#: ../../library/pathlib.rst:1783 msgid ":meth:`Path.exists`" msgstr ":meth:`Path.exists`" -#: ../../library/pathlib.rst:1781 +#: ../../library/pathlib.rst:1784 msgid ":func:`os.path.isfile`" msgstr ":func:`os.path.isfile`" -#: ../../library/pathlib.rst:1781 +#: ../../library/pathlib.rst:1784 msgid ":meth:`Path.is_file`" msgstr ":meth:`Path.is_file`" -#: ../../library/pathlib.rst:1782 +#: ../../library/pathlib.rst:1785 msgid ":func:`os.path.isdir`" msgstr ":func:`os.path.isdir`" -#: ../../library/pathlib.rst:1782 +#: ../../library/pathlib.rst:1785 msgid ":meth:`Path.is_dir`" msgstr ":meth:`Path.is_dir`" -#: ../../library/pathlib.rst:1783 +#: ../../library/pathlib.rst:1786 msgid ":func:`os.path.islink`" msgstr ":func:`os.path.islink`" -#: ../../library/pathlib.rst:1783 +#: ../../library/pathlib.rst:1786 msgid ":meth:`Path.is_symlink`" msgstr ":meth:`Path.is_symlink`" -#: ../../library/pathlib.rst:1784 +#: ../../library/pathlib.rst:1787 msgid ":func:`os.path.isjunction`" msgstr ":func:`os.path.isjunction`" -#: ../../library/pathlib.rst:1784 +#: ../../library/pathlib.rst:1787 msgid ":meth:`Path.is_junction`" msgstr ":meth:`Path.is_junction`" -#: ../../library/pathlib.rst:1785 +#: ../../library/pathlib.rst:1788 msgid ":func:`os.path.ismount`" msgstr ":func:`os.path.ismount`" -#: ../../library/pathlib.rst:1785 +#: ../../library/pathlib.rst:1788 msgid ":meth:`Path.is_mount`" msgstr ":meth:`Path.is_mount`" -#: ../../library/pathlib.rst:1786 +#: ../../library/pathlib.rst:1789 msgid ":func:`os.path.samefile`" msgstr ":func:`os.path.samefile`" -#: ../../library/pathlib.rst:1786 +#: ../../library/pathlib.rst:1789 msgid ":meth:`Path.samefile`" msgstr ":meth:`Path.samefile`" -#: ../../library/pathlib.rst:1787 +#: ../../library/pathlib.rst:1790 msgid ":func:`os.getcwd`" msgstr ":func:`os.getcwd`" -#: ../../library/pathlib.rst:1787 +#: ../../library/pathlib.rst:1790 msgid ":meth:`Path.cwd`" msgstr ":meth:`Path.cwd`" -#: ../../library/pathlib.rst:1788 +#: ../../library/pathlib.rst:1791 msgid ":func:`os.stat`" msgstr ":func:`os.stat`" -#: ../../library/pathlib.rst:1788 +#: ../../library/pathlib.rst:1791 msgid ":meth:`Path.stat`" msgstr ":meth:`Path.stat`" -#: ../../library/pathlib.rst:1789 +#: ../../library/pathlib.rst:1792 msgid ":func:`os.lstat`" msgstr ":func:`os.lstat`" -#: ../../library/pathlib.rst:1789 +#: ../../library/pathlib.rst:1792 msgid ":meth:`Path.lstat`" msgstr ":meth:`Path.lstat`" -#: ../../library/pathlib.rst:1790 +#: ../../library/pathlib.rst:1793 msgid ":func:`os.listdir`" msgstr ":func:`os.listdir`" -#: ../../library/pathlib.rst:1790 +#: ../../library/pathlib.rst:1793 msgid ":meth:`Path.iterdir`" msgstr ":meth:`Path.iterdir`" -#: ../../library/pathlib.rst:1791 +#: ../../library/pathlib.rst:1794 msgid ":func:`os.walk`" msgstr ":func:`os.walk`" -#: ../../library/pathlib.rst:1791 +#: ../../library/pathlib.rst:1794 msgid ":meth:`Path.walk` [4]_" msgstr ":meth:`Path.walk` [4]_" -#: ../../library/pathlib.rst:1792 +#: ../../library/pathlib.rst:1795 msgid ":func:`os.mkdir`, :func:`os.makedirs`" msgstr ":func:`os.mkdir`、:func:`os.makedirs`" -#: ../../library/pathlib.rst:1792 +#: ../../library/pathlib.rst:1795 msgid ":meth:`Path.mkdir`" msgstr ":meth:`Path.mkdir`" -#: ../../library/pathlib.rst:1793 +#: ../../library/pathlib.rst:1796 msgid ":func:`os.link`" msgstr ":func:`os.link`" -#: ../../library/pathlib.rst:1793 +#: ../../library/pathlib.rst:1796 msgid ":meth:`Path.hardlink_to`" msgstr ":meth:`Path.hardlink_to`" -#: ../../library/pathlib.rst:1794 +#: ../../library/pathlib.rst:1797 msgid ":func:`os.symlink`" msgstr ":func:`os.symlink`" -#: ../../library/pathlib.rst:1794 +#: ../../library/pathlib.rst:1797 msgid ":meth:`Path.symlink_to`" msgstr ":meth:`Path.symlink_to`" -#: ../../library/pathlib.rst:1795 +#: ../../library/pathlib.rst:1798 msgid ":func:`os.readlink`" msgstr ":func:`os.readlink`" -#: ../../library/pathlib.rst:1795 +#: ../../library/pathlib.rst:1798 msgid ":meth:`Path.readlink`" msgstr ":meth:`Path.readlink`" -#: ../../library/pathlib.rst:1796 +#: ../../library/pathlib.rst:1799 msgid ":func:`os.rename`" msgstr ":func:`os.rename`" -#: ../../library/pathlib.rst:1796 +#: ../../library/pathlib.rst:1799 msgid ":meth:`Path.rename`" msgstr ":meth:`Path.rename`" -#: ../../library/pathlib.rst:1797 +#: ../../library/pathlib.rst:1800 msgid ":func:`os.replace`" msgstr ":func:`os.replace`" -#: ../../library/pathlib.rst:1797 +#: ../../library/pathlib.rst:1800 msgid ":meth:`Path.replace`" msgstr ":meth:`Path.replace`" -#: ../../library/pathlib.rst:1798 +#: ../../library/pathlib.rst:1801 msgid ":func:`os.remove`, :func:`os.unlink`" msgstr ":func:`os.remove`、:func:`os.unlink`" -#: ../../library/pathlib.rst:1798 +#: ../../library/pathlib.rst:1801 msgid ":meth:`Path.unlink`" msgstr ":meth:`Path.unlink`" -#: ../../library/pathlib.rst:1799 +#: ../../library/pathlib.rst:1802 msgid ":func:`os.rmdir`" msgstr ":func:`os.rmdir`" -#: ../../library/pathlib.rst:1799 +#: ../../library/pathlib.rst:1802 msgid ":meth:`Path.rmdir`" msgstr ":meth:`Path.rmdir`" -#: ../../library/pathlib.rst:1800 +#: ../../library/pathlib.rst:1803 msgid ":func:`os.chmod`" msgstr ":func:`os.chmod`" -#: ../../library/pathlib.rst:1800 +#: ../../library/pathlib.rst:1803 msgid ":meth:`Path.chmod`" msgstr ":meth:`Path.chmod`" -#: ../../library/pathlib.rst:1801 +#: ../../library/pathlib.rst:1804 msgid ":func:`os.lchmod`" msgstr ":func:`os.lchmod`" -#: ../../library/pathlib.rst:1801 +#: ../../library/pathlib.rst:1804 msgid ":meth:`Path.lchmod`" msgstr ":meth:`Path.lchmod`" -#: ../../library/pathlib.rst:1805 +#: ../../library/pathlib.rst:1808 msgid "Footnotes" msgstr "註腳" -#: ../../library/pathlib.rst:1806 +#: ../../library/pathlib.rst:1809 msgid "" ":func:`os.path.relpath` calls :func:`~os.path.abspath` to make paths " "absolute and remove \"``..``\" parts, whereas :meth:`PurePath.relative_to` " @@ -3379,28 +3385,28 @@ msgid "" msgstr "" ":func:`os.path.relpath` 會呼叫 :func:`~os.path.abspath` 來將路徑變成絕對路徑" "並移除 \"``..``\" 部分,而 :meth:`PurePath.relative_to` 是一個文本上的操作," -"當它輸入的錨點不同時(例如一個是絕對路徑,另一個則是相對路徑)會引" -"發 :exc:`ValueError`。" +"當它輸入的錨點不同時(例如一個是絕對路徑,另一個則是相對路徑)會引發 :exc:" +"`ValueError`。" -#: ../../library/pathlib.rst:1810 +#: ../../library/pathlib.rst:1813 msgid "" ":func:`os.path.expanduser` returns the path unchanged if the home directory " -"can't be resolved, whereas :meth:`Path.expanduser` " -"raises :exc:`RuntimeError`." +"can't be resolved, whereas :meth:`Path.expanduser` raises :exc:" +"`RuntimeError`." msgstr "" -":func:`os.path.expanduser` 會在無法解析家目錄時回傳原始路徑," -"而 :meth:`Path.expanduser` 則會引發 :exc:`RuntimeError`。" +":func:`os.path.expanduser` 會在無法解析家目錄時回傳原始路徑,而 :meth:`Path." +"expanduser` 則會引發 :exc:`RuntimeError`。" -#: ../../library/pathlib.rst:1813 +#: ../../library/pathlib.rst:1816 msgid "" ":func:`os.path.abspath` removes \"``..``\" components without resolving " -"symlinks, which may change the meaning of the path, " -"whereas :meth:`Path.absolute` leaves any \"``..``\" components in the path." +"symlinks, which may change the meaning of the path, whereas :meth:`Path." +"absolute` leaves any \"``..``\" components in the path." msgstr "" ":func:`os.path.abspath` 將 \"``..``\" 組成移除而不解析符號連結,這可能會改變" "路徑的意義,而 :meth:`Path.absolute` 則會保留路徑中任何 \"``..``\" 組成。" -#: ../../library/pathlib.rst:1816 +#: ../../library/pathlib.rst:1819 msgid "" ":func:`os.walk` always follows symlinks when categorizing paths into " "*dirnames* and *filenames*, whereas :meth:`Path.walk` categorizes all " @@ -3417,3 +3423,6 @@ msgstr "path(路徑)" #: ../../library/pathlib.rst:11 msgid "operations" msgstr "operations(操作)" + +#~ msgid "Matches one character in *seq*." +#~ msgstr "匹配一個在 *seq* 中的字元。" diff --git a/library/threading.po b/library/threading.po index 17431fee17..3da8aa6efb 100644 --- a/library/threading.po +++ b/library/threading.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-06 00:15+0000\n" +"POT-Creation-Date: 2025-05-17 00:18+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,156 +31,236 @@ msgid "" "level :mod:`_thread` module." msgstr "" -#: ../../library/threading.rst:14 -msgid "This module used to be optional, it is now always available." +#: ../../library/threading.rst:194 ../../library/threading.rst:293 +#: ../../library/threading.rst:641 ../../includes/wasm-notavail.rst:3 +msgid "Availability" +msgstr "" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." +msgstr "" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" + +#: ../../library/threading.rst:17 +msgid "Introduction" msgstr "" #: ../../library/threading.rst:19 msgid "" +"The :mod:`!threading` module provides a way to run multiple `threads " +"`_ (smaller units of a " +"process) concurrently within a single process. It allows for the creation " +"and management of threads, making it possible to execute tasks in parallel, " +"sharing memory space. Threads are particularly useful when tasks are I/O " +"bound, such as file operations or making network requests, where much of the " +"time is spent waiting for external resources." +msgstr "" + +#: ../../library/threading.rst:27 +msgid "" +"A typical use case for :mod:`!threading` includes managing a pool of worker " +"threads that can process multiple tasks concurrently. Here's a basic " +"example of creating and starting threads using :class:`~threading.Thread`::" +msgstr "" + +#: ../../library/threading.rst:31 +msgid "" +"import threading\n" +"import time\n" +"\n" +"def crawl(link, delay=3):\n" +" print(f\"crawl started for {link}\")\n" +" time.sleep(delay) # Blocking I/O (simulating a network request)\n" +" print(f\"crawl ended for {link}\")\n" +"\n" +"links = [\n" +" \"https://python.org\",\n" +" \"https://docs.python.org\",\n" +" \"https://peps.python.org\",\n" +"]\n" +"\n" +"# Start threads for each link\n" +"threads = []\n" +"for link in links:\n" +" # Using `args` to pass positional arguments and `kwargs` for keyword " +"arguments\n" +" t = threading.Thread(target=crawl, args=(link,), kwargs={\"delay\": 2})\n" +" threads.append(t)\n" +"\n" +"# Start each thread\n" +"for t in threads:\n" +" t.start()\n" +"\n" +"# Wait for all threads to finish\n" +"for t in threads:\n" +" t.join()" +msgstr "" + +#: ../../library/threading.rst:60 +msgid "This module used to be optional, it is now always available." +msgstr "" + +#: ../../library/threading.rst:65 +msgid "" ":class:`concurrent.futures.ThreadPoolExecutor` offers a higher level " "interface to push tasks to a background thread without blocking execution of " "the calling thread, while still being able to retrieve their results when " "needed." msgstr "" -#: ../../library/threading.rst:23 +#: ../../library/threading.rst:69 msgid "" ":mod:`queue` provides a thread-safe interface for exchanging data between " "running threads." msgstr "" -#: ../../library/threading.rst:26 +#: ../../library/threading.rst:72 msgid "" ":mod:`asyncio` offers an alternative approach to achieving task level " "concurrency without requiring the use of multiple operating system threads." msgstr "" -#: ../../library/threading.rst:31 +#: ../../library/threading.rst:77 msgid "" "In the Python 2.x series, this module contained ``camelCase`` names for some " "methods and functions. These are deprecated as of Python 3.10, but they are " "still supported for compatibility with Python 2.5 and lower." msgstr "" -#: ../../library/threading.rst:38 +#: ../../library/threading.rst:84 msgid "" "In CPython, due to the :term:`Global Interpreter Lock `, only one thread can execute Python code at once (even though certain " "performance-oriented libraries might overcome this limitation). If you want " "your application to make better use of the computational resources of multi-" -"core machines, you are advised to use :mod:`multiprocessing` " -"or :class:`concurrent.futures.ProcessPoolExecutor`. However, threading is " -"still an appropriate model if you want to run multiple I/O-bound tasks " -"simultaneously." +"core machines, you are advised to use :mod:`multiprocessing` or :class:" +"`concurrent.futures.ProcessPoolExecutor`. However, threading is still an " +"appropriate model if you want to run multiple I/O-bound tasks simultaneously." msgstr "" -#: ../../library/threading.rst:130 ../../library/threading.rst:229 -#: ../../library/threading.rst:577 ../../includes/wasm-notavail.rst:3 -msgid "Availability" +#: ../../library/threading.rst:95 +msgid "GIL and performance considerations" msgstr "" -#: ../../includes/wasm-notavail.rst:5 +#: ../../library/threading.rst:97 msgid "" -"This module does not work or is not available on WebAssembly. See :ref:`wasm-" -"availability` for more information." +"Unlike the :mod:`multiprocessing` module, which uses separate processes to " +"bypass the :term:`global interpreter lock` (GIL), the threading module " +"operates within a single process, meaning that all threads share the same " +"memory space. However, the GIL limits the performance gains of threading " +"when it comes to CPU-bound tasks, as only one thread can execute Python " +"bytecode at a time. Despite this, threads remain a useful tool for achieving " +"concurrency in many scenarios." msgstr "" -"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" -"availability`。" -#: ../../library/threading.rst:50 +#: ../../library/threading.rst:105 +msgid "" +"As of Python 3.13, experimental :term:`free-threaded ` " +"builds can disable the GIL, enabling true parallel execution of threads, but " +"this feature is not available by default (see :pep:`703`)." +msgstr "" + +#: ../../library/threading.rst:112 +msgid "Reference" +msgstr "" + +#: ../../library/threading.rst:114 msgid "This module defines the following functions:" msgstr "此模組定義了以下函式:" -#: ../../library/threading.rst:55 +#: ../../library/threading.rst:119 msgid "" "Return the number of :class:`Thread` objects currently alive. The returned " "count is equal to the length of the list returned by :func:`.enumerate`." msgstr "" -#: ../../library/threading.rst:58 +#: ../../library/threading.rst:122 msgid "The function ``activeCount`` is a deprecated alias for this function." msgstr "" -#: ../../library/threading.rst:63 +#: ../../library/threading.rst:127 msgid "" "Return the current :class:`Thread` object, corresponding to the caller's " "thread of control. If the caller's thread of control was not created " -"through the :mod:`threading` module, a dummy thread object with limited " +"through the :mod:`!threading` module, a dummy thread object with limited " "functionality is returned." msgstr "" -#: ../../library/threading.rst:68 +#: ../../library/threading.rst:132 msgid "The function ``currentThread`` is a deprecated alias for this function." msgstr "``currentThread`` 函式是此函式的已棄用別名。" -#: ../../library/threading.rst:73 +#: ../../library/threading.rst:137 msgid "Handle uncaught exception raised by :func:`Thread.run`." msgstr "處理由 :func:`Thread.run` 引發且未被捕捉到的例外。" -#: ../../library/threading.rst:75 +#: ../../library/threading.rst:139 msgid "The *args* argument has the following attributes:" msgstr "*args* 引數有下列屬性:" -#: ../../library/threading.rst:77 +#: ../../library/threading.rst:141 msgid "*exc_type*: Exception type." msgstr "*exc_type*:例外型別。" -#: ../../library/threading.rst:78 +#: ../../library/threading.rst:142 msgid "*exc_value*: Exception value, can be ``None``." msgstr "" -#: ../../library/threading.rst:79 +#: ../../library/threading.rst:143 msgid "*exc_traceback*: Exception traceback, can be ``None``." msgstr "" -#: ../../library/threading.rst:80 +#: ../../library/threading.rst:144 msgid "*thread*: Thread which raised the exception, can be ``None``." msgstr "*thread*:引發例外的執行緒,可以是 ``None``。" -#: ../../library/threading.rst:82 +#: ../../library/threading.rst:146 msgid "" "If *exc_type* is :exc:`SystemExit`, the exception is silently ignored. " "Otherwise, the exception is printed out on :data:`sys.stderr`." msgstr "" -#: ../../library/threading.rst:85 +#: ../../library/threading.rst:149 msgid "" "If this function raises an exception, :func:`sys.excepthook` is called to " "handle it." msgstr "如果這個函式引發例外,則會呼叫 :func:`sys.excepthook` 來處理它。" -#: ../../library/threading.rst:88 +#: ../../library/threading.rst:152 msgid "" ":func:`threading.excepthook` can be overridden to control how uncaught " "exceptions raised by :func:`Thread.run` are handled." msgstr "" -#: ../../library/threading.rst:91 +#: ../../library/threading.rst:155 msgid "" "Storing *exc_value* using a custom hook can create a reference cycle. It " "should be cleared explicitly to break the reference cycle when the exception " "is no longer needed." msgstr "" -#: ../../library/threading.rst:95 +#: ../../library/threading.rst:159 msgid "" "Storing *thread* using a custom hook can resurrect it if it is set to an " "object which is being finalized. Avoid storing *thread* after the custom " "hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/threading.rst:100 +#: ../../library/threading.rst:164 msgid ":func:`sys.excepthook` handles uncaught exceptions." msgstr ":func:`sys.excepthook` 處理未被捕捉到的例外。" -#: ../../library/threading.rst:106 +#: ../../library/threading.rst:170 msgid "" "Holds the original value of :func:`threading.excepthook`. It is saved so " "that the original value can be restored in case they happen to get replaced " "with broken or alternative objects." msgstr "" -#: ../../library/threading.rst:114 +#: ../../library/threading.rst:178 msgid "" "Return the 'thread identifier' of the current thread. This is a nonzero " "integer. Its value has no direct meaning; it is intended as a magic cookie " @@ -189,7 +269,7 @@ msgid "" "created." msgstr "" -#: ../../library/threading.rst:125 +#: ../../library/threading.rst:189 msgid "" "Return the native integral Thread ID of the current thread assigned by the " "kernel. This is a non-negative integer. Its value may be used to uniquely " @@ -197,80 +277,80 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: ../../library/threading.rst:134 +#: ../../library/threading.rst:198 msgid "Added support for GNU/kFreeBSD." msgstr "新增對 GNU/kFreeBSD 的支援。" -#: ../../library/threading.rst:140 +#: ../../library/threading.rst:204 msgid "" "Return a list of all :class:`Thread` objects currently active. The list " -"includes daemonic threads and dummy thread objects created " -"by :func:`current_thread`. It excludes terminated threads and threads that " -"have not yet been started. However, the main thread is always part of the " -"result, even when terminated." +"includes daemonic threads and dummy thread objects created by :func:" +"`current_thread`. It excludes terminated threads and threads that have not " +"yet been started. However, the main thread is always part of the result, " +"even when terminated." msgstr "" -#: ../../library/threading.rst:149 +#: ../../library/threading.rst:213 msgid "" "Return the main :class:`Thread` object. In normal conditions, the main " "thread is the thread from which the Python interpreter was started." msgstr "" -#: ../../library/threading.rst:160 +#: ../../library/threading.rst:224 msgid "" -"Set a trace function for all threads started from the :mod:`threading` " +"Set a trace function for all threads started from the :mod:`!threading` " "module. The *func* will be passed to :func:`sys.settrace` for each thread, " "before its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:166 +#: ../../library/threading.rst:230 msgid "" -"Set a trace function for all threads started from the :mod:`threading` " +"Set a trace function for all threads started from the :mod:`!threading` " "module and all Python threads that are currently executing." msgstr "" -#: ../../library/threading.rst:169 +#: ../../library/threading.rst:233 msgid "" "The *func* will be passed to :func:`sys.settrace` for each thread, before " "its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:180 +#: ../../library/threading.rst:244 msgid "Get the trace function as set by :func:`settrace`." msgstr "" -#: ../../library/threading.rst:189 +#: ../../library/threading.rst:253 msgid "" -"Set a profile function for all threads started from the :mod:`threading` " +"Set a profile function for all threads started from the :mod:`!threading` " "module. The *func* will be passed to :func:`sys.setprofile` for each " "thread, before its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:195 +#: ../../library/threading.rst:259 msgid "" -"Set a profile function for all threads started from the :mod:`threading` " +"Set a profile function for all threads started from the :mod:`!threading` " "module and all Python threads that are currently executing." msgstr "" -#: ../../library/threading.rst:198 +#: ../../library/threading.rst:262 msgid "" "The *func* will be passed to :func:`sys.setprofile` for each thread, before " "its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:207 +#: ../../library/threading.rst:271 msgid "Get the profiler function as set by :func:`setprofile`." msgstr "" -#: ../../library/threading.rst:214 +#: ../../library/threading.rst:278 msgid "" "Return the thread stack size used when creating new threads. The optional " "*size* argument specifies the stack size to be used for subsequently created " "threads, and must be 0 (use platform or configured default) or a positive " "integer value of at least 32,768 (32 KiB). If *size* is not specified, 0 is " -"used. If changing the thread stack size is unsupported, " -"a :exc:`RuntimeError` is raised. If the specified stack size is invalid, " -"a :exc:`ValueError` is raised and the stack size is unmodified. 32 KiB is " +"used. If changing the thread stack size is unsupported, a :exc:" +"`RuntimeError` is raised. If the specified stack size is invalid, a :exc:" +"`ValueError` is raised and the stack size is unmodified. 32 KiB is " "currently the minimum supported stack size value to guarantee sufficient " "stack space for the interpreter itself. Note that some platforms may have " "particular restrictions on values for the stack size, such as requiring a " @@ -281,29 +361,29 @@ msgid "" "information)." msgstr "" -#: ../../library/threading.rst:231 +#: ../../library/threading.rst:295 msgid "Unix platforms with POSIX threads support." msgstr "" -#: ../../library/threading.rst:234 +#: ../../library/threading.rst:298 msgid "This module also defines the following constant:" msgstr "" -#: ../../library/threading.rst:238 +#: ../../library/threading.rst:302 msgid "" "The maximum value allowed for the *timeout* parameter of blocking functions " "(:meth:`Lock.acquire`, :meth:`RLock.acquire`, :meth:`Condition.wait`, etc.). " -"Specifying a timeout greater than this value will raise " -"an :exc:`OverflowError`." +"Specifying a timeout greater than this value will raise an :exc:" +"`OverflowError`." msgstr "" -#: ../../library/threading.rst:246 +#: ../../library/threading.rst:310 msgid "" "This module defines a number of classes, which are detailed in the sections " "below." msgstr "" -#: ../../library/threading.rst:249 +#: ../../library/threading.rst:313 msgid "" "The design of this module is loosely based on Java's threading model. " "However, where Java makes locks and condition variables basic behavior of " @@ -314,22 +394,22 @@ msgid "" "Thread class, when implemented, are mapped to module-level functions." msgstr "" -#: ../../library/threading.rst:257 +#: ../../library/threading.rst:321 msgid "All of the methods described below are executed atomically." msgstr "" -#: ../../library/threading.rst:261 -msgid "Thread-Local Data" +#: ../../library/threading.rst:325 +msgid "Thread-local data" msgstr "" -#: ../../library/threading.rst:263 +#: ../../library/threading.rst:327 msgid "" "Thread-local data is data whose values are thread specific. If you have data " "that you want to be local to a thread, create a :class:`local` object and " "use its attributes::" msgstr "" -#: ../../library/threading.rst:267 +#: ../../library/threading.rst:331 msgid "" ">>> mydata = local()\n" ">>> mydata.number = 42\n" @@ -341,11 +421,11 @@ msgstr "" ">>> mydata.number\n" "42" -#: ../../library/threading.rst:272 +#: ../../library/threading.rst:336 msgid "You can also access the :class:`local`-object's dictionary::" msgstr "" -#: ../../library/threading.rst:274 +#: ../../library/threading.rst:338 msgid "" ">>> mydata.__dict__\n" "{'number': 42}\n" @@ -361,11 +441,11 @@ msgstr "" ">>> mydata.widgets\n" "[]" -#: ../../library/threading.rst:281 +#: ../../library/threading.rst:345 msgid "If we access the data in a different thread::" msgstr "" -#: ../../library/threading.rst:283 +#: ../../library/threading.rst:347 msgid "" ">>> log = []\n" ">>> def f():\n" @@ -395,13 +475,13 @@ msgstr "" ">>> log\n" "[[], 11]" -#: ../../library/threading.rst:297 +#: ../../library/threading.rst:361 msgid "" "we get different data. Furthermore, changes made in the other thread don't " "affect data seen in this thread::" msgstr "" -#: ../../library/threading.rst:300 +#: ../../library/threading.rst:364 msgid "" ">>> mydata.number\n" "42" @@ -409,22 +489,22 @@ msgstr "" ">>> mydata.number\n" "42" -#: ../../library/threading.rst:303 +#: ../../library/threading.rst:367 msgid "" -"Of course, values you get from a :class:`local` object, including " -"their :attr:`~object.__dict__` attribute, are for whatever thread was " -"current at the time the attribute was read. For that reason, you generally " -"don't want to save these values across threads, as they apply only to the " -"thread they came from." +"Of course, values you get from a :class:`local` object, including their :" +"attr:`~object.__dict__` attribute, are for whatever thread was current at " +"the time the attribute was read. For that reason, you generally don't want " +"to save these values across threads, as they apply only to the thread they " +"came from." msgstr "" -#: ../../library/threading.rst:309 +#: ../../library/threading.rst:373 msgid "" -"You can create custom :class:`local` objects by subclassing " -"the :class:`local` class::" +"You can create custom :class:`local` objects by subclassing the :class:" +"`local` class::" msgstr "" -#: ../../library/threading.rst:312 +#: ../../library/threading.rst:376 msgid "" ">>> class MyLocal(local):\n" "... number = 2\n" @@ -440,7 +520,7 @@ msgstr "" "... def squared(self):\n" "... return self.number ** 2" -#: ../../library/threading.rst:319 +#: ../../library/threading.rst:383 msgid "" "This can be useful to support default values, methods and initialization. " "Note that if you define an :py:meth:`~object.__init__` method, it will be " @@ -448,19 +528,19 @@ msgid "" "This is necessary to initialize each thread's dictionary." msgstr "" -#: ../../library/threading.rst:325 +#: ../../library/threading.rst:389 msgid "Now if we create a :class:`local` object::" msgstr "現在如果我們建立一個 :class:`local` 物件: ::" -#: ../../library/threading.rst:327 +#: ../../library/threading.rst:391 msgid ">>> mydata = MyLocal(color='red')" msgstr ">>> mydata = MyLocal(color='red')" -#: ../../library/threading.rst:329 +#: ../../library/threading.rst:393 msgid "we have a default number::" msgstr "會有一個預設的數字: ::" -#: ../../library/threading.rst:331 +#: ../../library/threading.rst:395 msgid "" ">>> mydata.number\n" "2" @@ -468,11 +548,11 @@ msgstr "" ">>> mydata.number\n" "2" -#: ../../library/threading.rst:334 +#: ../../library/threading.rst:398 msgid "an initial color::" msgstr "和一個初始顏色: ::" -#: ../../library/threading.rst:336 +#: ../../library/threading.rst:400 msgid "" ">>> mydata.color\n" "'red'\n" @@ -482,11 +562,11 @@ msgstr "" "'red'\n" ">>> del mydata.color" -#: ../../library/threading.rst:340 +#: ../../library/threading.rst:404 msgid "And a method that operates on the data::" msgstr "和一個操作資料的方法: ::" -#: ../../library/threading.rst:342 +#: ../../library/threading.rst:406 msgid "" ">>> mydata.squared()\n" "4" @@ -494,11 +574,11 @@ msgstr "" ">>> mydata.squared()\n" "4" -#: ../../library/threading.rst:345 +#: ../../library/threading.rst:409 msgid "As before, we can access the data in a separate thread::" msgstr "" -#: ../../library/threading.rst:347 +#: ../../library/threading.rst:411 msgid "" ">>> log = []\n" ">>> thread = threading.Thread(target=f)\n" @@ -514,11 +594,11 @@ msgstr "" ">>> log\n" "[[('color', 'red')], 11]" -#: ../../library/threading.rst:354 +#: ../../library/threading.rst:418 msgid "without affecting this thread's data::" msgstr "" -#: ../../library/threading.rst:356 +#: ../../library/threading.rst:420 msgid "" ">>> mydata.number\n" "2\n" @@ -534,13 +614,13 @@ msgstr "" "...\n" "AttributeError: 'MyLocal' object has no attribute 'color'" -#: ../../library/threading.rst:363 +#: ../../library/threading.rst:427 msgid "" "Note that subclasses can define :term:`__slots__`, but they are not thread " "local. They are shared across threads::" msgstr "" -#: ../../library/threading.rst:366 +#: ../../library/threading.rst:430 msgid "" ">>> class MyLocal(local):\n" "... __slots__ = 'number'\n" @@ -556,11 +636,11 @@ msgstr "" ">>> mydata.number = 42\n" ">>> mydata.color = 'red'" -#: ../../library/threading.rst:373 +#: ../../library/threading.rst:437 msgid "So, the separate thread::" msgstr "" -#: ../../library/threading.rst:375 +#: ../../library/threading.rst:439 msgid "" ">>> thread = threading.Thread(target=f)\n" ">>> thread.start()\n" @@ -570,11 +650,11 @@ msgstr "" ">>> thread.start()\n" ">>> thread.join()" -#: ../../library/threading.rst:379 +#: ../../library/threading.rst:443 msgid "affects what we see::" msgstr "" -#: ../../library/threading.rst:381 +#: ../../library/threading.rst:445 msgid "" ">>> mydata.number\n" "11" @@ -582,15 +662,16 @@ msgstr "" ">>> mydata.number\n" "11" -#: ../../library/threading.rst:387 +#: ../../library/threading.rst:451 msgid "A class that represents thread-local data." msgstr "" -#: ../../library/threading.rst:393 -msgid "Thread Objects" +#: ../../library/threading.rst:457 +#, fuzzy +msgid "Thread objects" msgstr "Thread 物件" -#: ../../library/threading.rst:395 +#: ../../library/threading.rst:459 msgid "" "The :class:`Thread` class represents an activity that is run in a separate " "thread of control. There are two ways to specify the activity: by passing a " @@ -600,42 +681,42 @@ msgid "" "``__init__()`` and :meth:`~Thread.run` methods of this class." msgstr "" -#: ../../library/threading.rst:402 +#: ../../library/threading.rst:466 msgid "" "Once a thread object is created, its activity must be started by calling the " "thread's :meth:`~Thread.start` method. This invokes the :meth:`~Thread.run` " "method in a separate thread of control." msgstr "" -#: ../../library/threading.rst:406 +#: ../../library/threading.rst:470 msgid "" "Once the thread's activity is started, the thread is considered 'alive'. It " "stops being alive when its :meth:`~Thread.run` method terminates -- either " -"normally, or by raising an unhandled exception. " -"The :meth:`~Thread.is_alive` method tests whether the thread is alive." +"normally, or by raising an unhandled exception. The :meth:`~Thread." +"is_alive` method tests whether the thread is alive." msgstr "" -#: ../../library/threading.rst:411 +#: ../../library/threading.rst:475 msgid "" "Other threads can call a thread's :meth:`~Thread.join` method. This blocks " "the calling thread until the thread whose :meth:`~Thread.join` method is " "called is terminated." msgstr "" -#: ../../library/threading.rst:415 +#: ../../library/threading.rst:479 msgid "" "A thread has a name. The name can be passed to the constructor, and read or " "changed through the :attr:`~Thread.name` attribute." msgstr "" -#: ../../library/threading.rst:418 +#: ../../library/threading.rst:482 msgid "" -"If the :meth:`~Thread.run` method raises an " -"exception, :func:`threading.excepthook` is called to handle it. By " -"default, :func:`threading.excepthook` ignores silently :exc:`SystemExit`." +"If the :meth:`~Thread.run` method raises an exception, :func:`threading." +"excepthook` is called to handle it. By default, :func:`threading.excepthook` " +"ignores silently :exc:`SystemExit`." msgstr "" -#: ../../library/threading.rst:422 +#: ../../library/threading.rst:486 msgid "" "A thread can be flagged as a \"daemon thread\". The significance of this " "flag is that the entire Python program exits when only daemon threads are " @@ -644,7 +725,7 @@ msgid "" "constructor argument." msgstr "" -#: ../../library/threading.rst:429 +#: ../../library/threading.rst:493 msgid "" "Daemon threads are abruptly stopped at shutdown. Their resources (such as " "open files, database transactions, etc.) may not be released properly. If " @@ -652,13 +733,13 @@ msgid "" "suitable signalling mechanism such as an :class:`Event`." msgstr "" -#: ../../library/threading.rst:434 +#: ../../library/threading.rst:498 msgid "" "There is a \"main thread\" object; this corresponds to the initial thread of " "control in the Python program. It is not a daemon thread." msgstr "" -#: ../../library/threading.rst:437 +#: ../../library/threading.rst:501 msgid "" "There is the possibility that \"dummy thread objects\" are created. These " "are thread objects corresponding to \"alien threads\", which are threads of " @@ -669,25 +750,25 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:448 +#: ../../library/threading.rst:512 msgid "" "This constructor should always be called with keyword arguments. Arguments " "are:" msgstr "" -#: ../../library/threading.rst:451 +#: ../../library/threading.rst:515 msgid "" "*group* should be ``None``; reserved for future extension when a :class:`!" "ThreadGroup` class is implemented." msgstr "" -#: ../../library/threading.rst:454 +#: ../../library/threading.rst:518 msgid "" "*target* is the callable object to be invoked by the :meth:`run` method. " "Defaults to ``None``, meaning nothing is called." msgstr "" -#: ../../library/threading.rst:457 +#: ../../library/threading.rst:521 msgid "" "*name* is the thread name. By default, a unique name is constructed of the " "form \"Thread-*N*\" where *N* is a small decimal number, or \"Thread-*N* " @@ -695,62 +776,62 @@ msgid "" "is specified." msgstr "" -#: ../../library/threading.rst:462 +#: ../../library/threading.rst:526 msgid "" "*args* is a list or tuple of arguments for the target invocation. Defaults " "to ``()``." msgstr "" -#: ../../library/threading.rst:464 +#: ../../library/threading.rst:528 msgid "" "*kwargs* is a dictionary of keyword arguments for the target invocation. " "Defaults to ``{}``." msgstr "" -#: ../../library/threading.rst:467 +#: ../../library/threading.rst:531 msgid "" "If not ``None``, *daemon* explicitly sets whether the thread is daemonic. If " "``None`` (the default), the daemonic property is inherited from the current " "thread." msgstr "" -#: ../../library/threading.rst:471 +#: ../../library/threading.rst:535 msgid "" "If the subclass overrides the constructor, it must make sure to invoke the " "base class constructor (``Thread.__init__()``) before doing anything else to " "the thread." msgstr "" -#: ../../library/threading.rst:475 +#: ../../library/threading.rst:539 msgid "Added the *daemon* parameter." msgstr "新增 *daemon* 參數。" -#: ../../library/threading.rst:478 +#: ../../library/threading.rst:542 msgid "Use the *target* name if *name* argument is omitted." msgstr "" -#: ../../library/threading.rst:483 +#: ../../library/threading.rst:547 msgid "Start the thread's activity." msgstr "" -#: ../../library/threading.rst:485 +#: ../../library/threading.rst:549 msgid "" "It must be called at most once per thread object. It arranges for the " "object's :meth:`~Thread.run` method to be invoked in a separate thread of " "control." msgstr "" -#: ../../library/threading.rst:489 +#: ../../library/threading.rst:553 msgid "" "This method will raise a :exc:`RuntimeError` if called more than once on the " "same thread object." msgstr "" -#: ../../library/threading.rst:494 +#: ../../library/threading.rst:558 msgid "Method representing the thread's activity." msgstr "" -#: ../../library/threading.rst:496 +#: ../../library/threading.rst:560 msgid "" "You may override this method in a subclass. The standard :meth:`run` method " "invokes the callable object passed to the object's constructor as the " @@ -758,17 +839,17 @@ msgid "" "the *args* and *kwargs* arguments, respectively." msgstr "" -#: ../../library/threading.rst:501 +#: ../../library/threading.rst:565 msgid "" -"Using list or tuple as the *args* argument which passed to " -"the :class:`Thread` could achieve the same effect." +"Using list or tuple as the *args* argument which passed to the :class:" +"`Thread` could achieve the same effect." msgstr "" -#: ../../library/threading.rst:504 +#: ../../library/threading.rst:568 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/threading.rst:506 +#: ../../library/threading.rst:570 msgid "" ">>> from threading import Thread\n" ">>> t = Thread(target=print, args=[1])\n" @@ -786,7 +867,7 @@ msgstr "" ">>> t.run()\n" "1" -#: ../../library/threading.rst:518 +#: ../../library/threading.rst:582 msgid "" "Wait until the thread terminates. This blocks the calling thread until the " "thread whose :meth:`~Thread.join` method is called terminates -- either " @@ -794,27 +875,27 @@ msgid "" "occurs." msgstr "" -#: ../../library/threading.rst:523 +#: ../../library/threading.rst:587 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds (or " "fractions thereof). As :meth:`~Thread.join` always returns ``None``, you " "must call :meth:`~Thread.is_alive` after :meth:`~Thread.join` to decide " -"whether a timeout happened -- if the thread is still alive, " -"the :meth:`~Thread.join` call timed out." +"whether a timeout happened -- if the thread is still alive, the :meth:" +"`~Thread.join` call timed out." msgstr "" -#: ../../library/threading.rst:530 +#: ../../library/threading.rst:594 msgid "" "When the *timeout* argument is not present or ``None``, the operation will " "block until the thread terminates." msgstr "" -#: ../../library/threading.rst:533 +#: ../../library/threading.rst:597 msgid "A thread can be joined many times." msgstr "" -#: ../../library/threading.rst:535 +#: ../../library/threading.rst:599 msgid "" ":meth:`~Thread.join` raises a :exc:`RuntimeError` if an attempt is made to " "join the current thread as that would cause a deadlock. It is also an error " @@ -822,20 +903,20 @@ msgid "" "do so raise the same exception." msgstr "" -#: ../../library/threading.rst:542 +#: ../../library/threading.rst:606 msgid "" "A string used for identification purposes only. It has no semantics. " "Multiple threads may be given the same name. The initial name is set by the " "constructor." msgstr "" -#: ../../library/threading.rst:549 +#: ../../library/threading.rst:613 msgid "" "Deprecated getter/setter API for :attr:`~Thread.name`; use it directly as a " "property instead." msgstr "" -#: ../../library/threading.rst:556 +#: ../../library/threading.rst:620 msgid "" "The 'thread identifier' of this thread or ``None`` if the thread has not " "been started. This is a nonzero integer. See the :func:`get_ident` " @@ -844,7 +925,7 @@ msgid "" "thread has exited." msgstr "" -#: ../../library/threading.rst:564 +#: ../../library/threading.rst:628 msgid "" "The Thread ID (``TID``) of this thread, as assigned by the OS (kernel). This " "is a non-negative integer, or ``None`` if the thread has not been started. " @@ -853,102 +934,103 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: ../../library/threading.rst:573 +#: ../../library/threading.rst:637 msgid "" "Similar to Process IDs, Thread IDs are only valid (guaranteed unique system-" "wide) from the time the thread is created until the thread has been " "terminated." msgstr "" -#: ../../library/threading.rst:583 +#: ../../library/threading.rst:647 msgid "Return whether the thread is alive." msgstr "" -#: ../../library/threading.rst:585 +#: ../../library/threading.rst:649 msgid "" "This method returns ``True`` just before the :meth:`~Thread.run` method " "starts until just after the :meth:`~Thread.run` method terminates. The " "module function :func:`.enumerate` returns a list of all alive threads." msgstr "" -#: ../../library/threading.rst:591 +#: ../../library/threading.rst:655 msgid "" "A boolean value indicating whether this thread is a daemon thread (``True``) " "or not (``False``). This must be set before :meth:`~Thread.start` is " "called, otherwise :exc:`RuntimeError` is raised. Its initial value is " "inherited from the creating thread; the main thread is not a daemon thread " -"and therefore all threads created in the main thread default " -"to :attr:`~Thread.daemon` = ``False``." +"and therefore all threads created in the main thread default to :attr:" +"`~Thread.daemon` = ``False``." msgstr "" -#: ../../library/threading.rst:598 +#: ../../library/threading.rst:662 msgid "" "The entire Python program exits when no alive non-daemon threads are left." msgstr "" -#: ../../library/threading.rst:603 +#: ../../library/threading.rst:667 msgid "" "Deprecated getter/setter API for :attr:`~Thread.daemon`; use it directly as " "a property instead." msgstr "" -#: ../../library/threading.rst:612 -msgid "Lock Objects" +#: ../../library/threading.rst:676 +#, fuzzy +msgid "Lock objects" msgstr "Lock 物件" -#: ../../library/threading.rst:614 +#: ../../library/threading.rst:678 msgid "" "A primitive lock is a synchronization primitive that is not owned by a " "particular thread when locked. In Python, it is currently the lowest level " -"synchronization primitive available, implemented directly by " -"the :mod:`_thread` extension module." +"synchronization primitive available, implemented directly by the :mod:" +"`_thread` extension module." msgstr "" "原始鎖 (primitive lock) 是一種同步原語 (synchronization primitive),在鎖定時" -"不屬於特定執行緒。在 Python 中,它是目前可用的最低階同步原語,直接" -"由 :mod:`_thread` 擴充模組實作。" +"不屬於特定執行緒。在 Python 中,它是目前可用的最低階同步原語,直接由 :mod:" +"`_thread` 擴充模組實作。" -#: ../../library/threading.rst:619 +#: ../../library/threading.rst:683 msgid "" "A primitive lock is in one of two states, \"locked\" or \"unlocked\". It is " -"created in the unlocked state. It has two basic " -"methods, :meth:`~Lock.acquire` and :meth:`~Lock.release`. When the state is " -"unlocked, :meth:`~Lock.acquire` changes the state to locked and returns " -"immediately. When the state is locked, :meth:`~Lock.acquire` blocks until a " -"call to :meth:`~Lock.release` in another thread changes it to unlocked, then " -"the :meth:`~Lock.acquire` call resets it to locked and returns. " -"The :meth:`~Lock.release` method should only be called in the locked state; " -"it changes the state to unlocked and returns immediately. If an attempt is " -"made to release an unlocked lock, a :exc:`RuntimeError` will be raised." +"created in the unlocked state. It has two basic methods, :meth:`~Lock." +"acquire` and :meth:`~Lock.release`. When the state is unlocked, :meth:" +"`~Lock.acquire` changes the state to locked and returns immediately. When " +"the state is locked, :meth:`~Lock.acquire` blocks until a call to :meth:" +"`~Lock.release` in another thread changes it to unlocked, then the :meth:" +"`~Lock.acquire` call resets it to locked and returns. The :meth:`~Lock." +"release` method should only be called in the locked state; it changes the " +"state to unlocked and returns immediately. If an attempt is made to release " +"an unlocked lock, a :exc:`RuntimeError` will be raised." msgstr "" "原始鎖會處於兩種狀態之一:「鎖定 (locked)」或「未鎖定 (unclocked)」,建立時會" -"處於未鎖定狀態。它有兩個基本方法 :meth:`~Lock.acquire` " -"和 :meth:`~Lock.release`。當狀態為未鎖定時,:meth:`~Lock.acquire` 會將狀態變" -"更為鎖定並立即回傳。當狀態被鎖定時,:meth:`~Lock.acquire` 會阻塞 (block),直" -"到另一個執行緒中對 :meth:`~Lock.release` 的呼叫將其更改為未鎖定狀態,然" -"後 :meth:`~Lock.acquire` 呼叫會將其重置為鎖定並回傳。:meth:`~Lock.release` 方" -"法只能在鎖定狀態下呼叫;它將狀態更改為未鎖定並立即回傳。如果嘗試釋放未鎖定的" -"鎖,則會引發 :exc:`RuntimeError`。" - -#: ../../library/threading.rst:630 +"處於未鎖定狀態。它有兩個基本方法 :meth:`~Lock.acquire` 和 :meth:`~Lock." +"release`。當狀態為未鎖定時,:meth:`~Lock.acquire` 會將狀態變更為鎖定並立即回" +"傳。當狀態被鎖定時,:meth:`~Lock.acquire` 會阻塞 (block),直到另一個執行緒中" +"對 :meth:`~Lock.release` 的呼叫將其更改為未鎖定狀態,然後 :meth:`~Lock." +"acquire` 呼叫會將其重置為鎖定並回傳。:meth:`~Lock.release` 方法只能在鎖定狀態" +"下呼叫;它將狀態更改為未鎖定並立即回傳。如果嘗試釋放未鎖定的鎖,則會引發 :" +"exc:`RuntimeError`。" + +#: ../../library/threading.rst:694 msgid "Locks also support the :ref:`context management protocol `." msgstr "鎖也支援\\ :ref:`情境管理協定 `。" -#: ../../library/threading.rst:632 +#: ../../library/threading.rst:696 msgid "" "When more than one thread is blocked in :meth:`~Lock.acquire` waiting for " -"the state to turn to unlocked, only one thread proceeds when " -"a :meth:`~Lock.release` call resets the state to unlocked; which one of the " -"waiting threads proceeds is not defined, and may vary across implementations." +"the state to turn to unlocked, only one thread proceeds when a :meth:`~Lock." +"release` call resets the state to unlocked; which one of the waiting threads " +"proceeds is not defined, and may vary across implementations." msgstr "" -"當多個執行緒阻塞在 :meth:`~Lock.acquire` 中等待狀態轉變為未鎖定,此時若呼" -"叫 :meth:`~Lock.release` 將狀態重置為未鎖定,則只會有一個執行緒繼續進行;哪一" -"個等待執行緒會繼續進行是未定義的,並且可能因實作而異。" +"當多個執行緒阻塞在 :meth:`~Lock.acquire` 中等待狀態轉變為未鎖定,此時若呼叫 :" +"meth:`~Lock.release` 將狀態重置為未鎖定,則只會有一個執行緒繼續進行;哪一個等" +"待執行緒會繼續進行是未定義的,並且可能因實作而異。" -#: ../../library/threading.rst:637 +#: ../../library/threading.rst:701 msgid "All methods are executed atomically." msgstr "所有方法均以最小不可分割的操作方式 (atomically) 執行。" -#: ../../library/threading.rst:642 +#: ../../library/threading.rst:706 msgid "" "The class implementing primitive lock objects. Once a thread has acquired a " "lock, subsequent attempts to acquire it block, until it is released; any " @@ -957,7 +1039,7 @@ msgstr "" "實作原始鎖物件的類別。一旦執行緒獲得了鎖,後續再嘗試獲得它就會被阻塞,直到鎖" "被釋放;任何執行緒都可以去釋放它。" -#: ../../library/threading.rst:646 +#: ../../library/threading.rst:710 msgid "" "``Lock`` is now a class. In earlier Pythons, ``Lock`` was a factory function " "which returned an instance of the underlying private lock type." @@ -965,11 +1047,11 @@ msgstr "" "``Lock`` 現在是一個類別。在早期的 Python 中,``Lock`` 是一個會回傳底層私有鎖" "型別實例的工廠函式。" -#: ../../library/threading.rst:654 ../../library/threading.rst:745 +#: ../../library/threading.rst:718 ../../library/threading.rst:809 msgid "Acquire a lock, blocking or non-blocking." msgstr "阻塞或非阻塞地取得鎖。" -#: ../../library/threading.rst:656 +#: ../../library/threading.rst:720 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default), " "block until the lock is unlocked, then set it to locked and return ``True``." @@ -977,7 +1059,7 @@ msgstr "" "當以 *blocking* 引數設為 ``True``\\ (預設值)來叫用,將會阻塞直到鎖被解鎖," "然後將其設為鎖定並回傳 ``True``。" -#: ../../library/threading.rst:659 +#: ../../library/threading.rst:723 msgid "" "When invoked with the *blocking* argument set to ``False``, do not block. If " "a call with *blocking* set to ``True`` would block, return ``False`` " @@ -987,7 +1069,7 @@ msgstr "" "``True`` 的呼叫會阻塞,則立即回傳 ``False``;否則將鎖設為鎖定並回傳 " "``True``。" -#: ../../library/threading.rst:663 +#: ../../library/threading.rst:727 msgid "" "When invoked with the floating-point *timeout* argument set to a positive " "value, block for at most the number of seconds specified by *timeout* and as " @@ -999,7 +1081,7 @@ msgstr "" "塞 *timeout* 指定的秒數。``-1`` 的 *timeout* 引數代表指定為不會停止的等待。" "當 *blocking* 為 ``False`` 時禁止指定 *timeout*。" -#: ../../library/threading.rst:669 +#: ../../library/threading.rst:733 msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not (for example if the *timeout* expired)." @@ -1007,24 +1089,24 @@ msgstr "" "如果成功取得鎖,則回傳值為 ``True``,否則回傳值為 ``False``\\ (例如像是 " "*timeout* 已逾期)。" -#: ../../library/threading.rst:672 ../../library/threading.rst:783 -#: ../../library/threading.rst:1030 +#: ../../library/threading.rst:736 ../../library/threading.rst:847 +#: ../../library/threading.rst:1094 msgid "The *timeout* parameter is new." msgstr "新的 *timeout* 參數。" -#: ../../library/threading.rst:675 +#: ../../library/threading.rst:739 msgid "" "Lock acquisition can now be interrupted by signals on POSIX if the " "underlying threading implementation supports it." msgstr "如果底層執行緒實作支援的話,鎖的取得現在可以被 POSIX 上的訊號中斷。" -#: ../../library/threading.rst:682 +#: ../../library/threading.rst:746 msgid "" "Release a lock. This can be called from any thread, not only the thread " "which has acquired the lock." msgstr "釋放鎖。這可以從任何執行緒呼叫,而不是只有獲得鎖的執行緒。" -#: ../../library/threading.rst:685 +#: ../../library/threading.rst:749 msgid "" "When the lock is locked, reset it to unlocked, and return. If any other " "threads are blocked waiting for the lock to become unlocked, allow exactly " @@ -1033,23 +1115,24 @@ msgstr "" "當鎖被鎖定時,將其重置為未鎖定然後回傳。如果任何其他執行緒在等待鎖被解鎖時被" "阻塞,只允許其中一個執行緒繼續進行。" -#: ../../library/threading.rst:689 +#: ../../library/threading.rst:753 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." msgstr "當在未鎖定的鎖上叫用時,會引發 :exc:`RuntimeError`" -#: ../../library/threading.rst:691 ../../library/threading.rst:799 +#: ../../library/threading.rst:755 ../../library/threading.rst:863 msgid "There is no return value." msgstr "沒有回傳值。" -#: ../../library/threading.rst:695 +#: ../../library/threading.rst:759 msgid "Return ``True`` if the lock is acquired." msgstr "如果有取得了鎖,則回傳 ``True``。" -#: ../../library/threading.rst:702 -msgid "RLock Objects" +#: ../../library/threading.rst:766 +#, fuzzy +msgid "RLock objects" msgstr "RLock 物件" -#: ../../library/threading.rst:704 +#: ../../library/threading.rst:768 msgid "" "A reentrant lock is a synchronization primitive that may be acquired " "multiple times by the same thread. Internally, it uses the concepts of " @@ -1062,26 +1145,26 @@ msgstr "" "「遞迴等級 (recursion level)」的概念。在鎖定狀態下,某個執行緒會擁有鎖;在未" "鎖定狀態下則沒有執行緒擁有它。" -#: ../../library/threading.rst:710 +#: ../../library/threading.rst:774 msgid "" -"Threads call a lock's :meth:`~RLock.acquire` method to lock it, and " -"its :meth:`~Lock.release` method to unlock it." +"Threads call a lock's :meth:`~RLock.acquire` method to lock it, and its :" +"meth:`~Lock.release` method to unlock it." msgstr "" -"執行緒呼叫鎖的 :meth:`~RLock.acquire` 方法來鎖定它,並呼叫它" -"的 :meth:`~Lock.release` 方法來解鎖它。" +"執行緒呼叫鎖的 :meth:`~RLock.acquire` 方法來鎖定它,並呼叫它的 :meth:`~Lock." +"release` 方法來解鎖它。" -#: ../../library/threading.rst:715 +#: ../../library/threading.rst:779 msgid "" "Reentrant locks support the :ref:`context management protocol `, " -"so it is recommended to use :keyword:`with` instead of manually " -"calling :meth:`~RLock.acquire` and :meth:`~RLock.release` to handle " -"acquiring and releasing the lock for a block of code." +"so it is recommended to use :keyword:`with` instead of manually calling :" +"meth:`~RLock.acquire` and :meth:`~RLock.release` to handle acquiring and " +"releasing the lock for a block of code." msgstr "" "可重入鎖支援\\ :ref:`情境管理協定`,因此建議使用 :keyword:`with` " "而不是手動呼叫 :meth:`~RLock.acquire` 和 :meth:`~RLock.release` 來對程式碼區" "塊處理鎖的獲得和釋放。" -#: ../../library/threading.rst:720 +#: ../../library/threading.rst:784 msgid "" "RLock's :meth:`~RLock.acquire`/:meth:`~RLock.release` call pairs may be " "nested, unlike Lock's :meth:`~Lock.acquire`/:meth:`~Lock.release`. Only the " @@ -1094,7 +1177,7 @@ msgstr "" "個 :meth:`~RLock.release`\\ (最外面一對的 :meth:`~Lock.release`)會將鎖重置" "為未鎖定狀態,並允許在 :meth:`~RLock.acquire` 中阻塞的另一個執行緒繼續進行。" -#: ../../library/threading.rst:726 +#: ../../library/threading.rst:790 msgid "" ":meth:`~RLock.acquire`/:meth:`~RLock.release` must be used in pairs: each " "acquire must have a release in the thread that has acquired the lock. " @@ -1105,7 +1188,7 @@ msgstr "" "已獲得鎖的執行緒中有一個釋放。如果鎖釋放的次數不能和取得的次數一樣的話,可能" "會導致死鎖 (deadlock)。" -#: ../../library/threading.rst:733 +#: ../../library/threading.rst:797 msgid "" "This class implements reentrant lock objects. A reentrant lock must be " "released by the thread that acquired it. Once a thread has acquired a " @@ -1116,7 +1199,7 @@ msgstr "" "得了可重入鎖,同一個執行緒可以再次獲得它而不會阻塞;執行緒每次獲得它也都必須" "釋放它一次。" -#: ../../library/threading.rst:738 +#: ../../library/threading.rst:802 msgid "" "Note that ``RLock`` is actually a factory function which returns an instance " "of the most efficient version of the concrete RLock class that is supported " @@ -1125,11 +1208,11 @@ msgstr "" "請注意,``RLock`` 實際上是一個工廠函式,它會回傳平台有支援的特定 RLock 類別的" "最高效率版本的實例。" -#: ../../library/threading.rst:749 +#: ../../library/threading.rst:813 msgid ":ref:`Using RLock as a context manager `" msgstr ":ref:`將 RLock 用作為情境管理器 `" -#: ../../library/threading.rst:750 +#: ../../library/threading.rst:814 msgid "" "Recommended over manual :meth:`!acquire` and :meth:`release` calls whenever " "practical." @@ -1137,16 +1220,16 @@ msgstr "" "若是使用場景合理,和手動呼叫 :meth:`!acquire` 和 :meth:`release` 相比,會是更" "為推薦的使用方式。" -#: ../../library/threading.rst:754 +#: ../../library/threading.rst:818 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default):" msgstr "當以 *blocking* 引數設為 ``True``\\ (預設值)來呼叫:" -#: ../../library/threading.rst:756 ../../library/threading.rst:768 +#: ../../library/threading.rst:820 ../../library/threading.rst:832 msgid "If no thread owns the lock, acquire the lock and return immediately." msgstr "如果沒有執行緒擁有鎖,則獲得鎖並立即回傳。" -#: ../../library/threading.rst:758 +#: ../../library/threading.rst:822 msgid "" "If another thread owns the lock, block until we are able to acquire lock, or " "*timeout*, if set to a positive float value." @@ -1154,32 +1237,32 @@ msgstr "" "如果另一個執行緒擁有鎖,則阻塞直到能夠取得鎖,或者達到 *timeout*\\ (如果設定" "為正浮點值)。" -#: ../../library/threading.rst:761 +#: ../../library/threading.rst:825 msgid "" "If the same thread owns the lock, acquire the lock again, and return " "immediately. This is the difference between :class:`Lock` and :class:`!" "RLock`; :class:`Lock` handles this case the same as the previous, blocking " "until the lock can be acquired." msgstr "" -"如果同一個執行緒擁有鎖,則再次取得鎖,並立即回傳。這就是 :class:`Lock` " -"和 :class:`!RLock` 之間的差別;:class:`Lock` 處理方式與上一種情況相同,會阻塞" -"直到能夠取得鎖。" +"如果同一個執行緒擁有鎖,則再次取得鎖,並立即回傳。這就是 :class:`Lock` 和 :" +"class:`!RLock` 之間的差別;:class:`Lock` 處理方式與上一種情況相同,會阻塞直到" +"能夠取得鎖。" -#: ../../library/threading.rst:766 +#: ../../library/threading.rst:830 msgid "When invoked with the *blocking* argument set to ``False``:" msgstr "當以 *blocking* 引數設為 ``False`` 來呼叫:" -#: ../../library/threading.rst:770 +#: ../../library/threading.rst:834 msgid "If another thread owns the lock, return immediately." msgstr "如果另一個執行緒擁有該鎖,則立即回傳。" -#: ../../library/threading.rst:772 +#: ../../library/threading.rst:836 msgid "" "If the same thread owns the lock, acquire the lock again and return " "immediately." msgstr "如果同一個執行緒擁有鎖,則再次取得鎖並立即回傳。" -#: ../../library/threading.rst:775 +#: ../../library/threading.rst:839 msgid "" "In all cases, if the thread was able to acquire the lock, return ``True``. " "If the thread was unable to acquire the lock (i.e. if not blocking or the " @@ -1188,7 +1271,7 @@ msgstr "" "在所有情況下,如果執行緒能夠取得鎖則回傳 ``True``。如果執行緒無法取得鎖(即沒" "有阻塞或已達超時限制)則回傳 ``False``。" -#: ../../library/threading.rst:779 +#: ../../library/threading.rst:843 msgid "" "If called multiple times, failing to call :meth:`~RLock.release` as many " "times may lead to deadlock. Consider using :class:`!RLock` as a context " @@ -1197,7 +1280,7 @@ msgstr "" "如果多次呼叫,又未能呼叫相同次數的 :meth:`~RLock.release`,則可能會導致死鎖。" "考慮將 :class:`!RLock` 作為情境管理器使用,而不是直接呼叫 acquire/release。" -#: ../../library/threading.rst:789 +#: ../../library/threading.rst:853 msgid "" "Release a lock, decrementing the recursion level. If after the decrement it " "is zero, reset the lock to unlocked (not owned by any thread), and if any " @@ -1209,20 +1292,20 @@ msgstr "" "並且如果任何其他執行緒被阻塞以等待鎖變成未鎖定狀態,則僅允許其中一個執行緒繼" "續進行。如果遞減後遞迴等級仍然非零,則鎖會保持鎖定並由呼叫它的執行緒所擁有。" -#: ../../library/threading.rst:795 +#: ../../library/threading.rst:859 msgid "" -"Only call this method when the calling thread owns the lock. " -"A :exc:`RuntimeError` is raised if this method is called when the lock is " -"not acquired." +"Only call this method when the calling thread owns the lock. A :exc:" +"`RuntimeError` is raised if this method is called when the lock is not " +"acquired." msgstr "" -"僅當呼叫的執行緒擁有鎖時才能呼叫此方法。如果在未取得鎖時呼叫此方法則會引" -"發 :exc:`RuntimeError`。" +"僅當呼叫的執行緒擁有鎖時才能呼叫此方法。如果在未取得鎖時呼叫此方法則會引發 :" +"exc:`RuntimeError`。" -#: ../../library/threading.rst:805 -msgid "Condition Objects" +#: ../../library/threading.rst:869 +msgid "Condition objects" msgstr "" -#: ../../library/threading.rst:807 +#: ../../library/threading.rst:871 msgid "" "A condition variable is always associated with some kind of lock; this can " "be passed in or one will be created by default. Passing one in is useful " @@ -1230,33 +1313,32 @@ msgid "" "of the condition object: you don't have to track it separately." msgstr "" -#: ../../library/threading.rst:812 +#: ../../library/threading.rst:876 msgid "" "A condition variable obeys the :ref:`context management protocol `: using the ``with`` statement acquires the associated lock for the " -"duration of the enclosed block. The :meth:`~Condition.acquire` " -"and :meth:`~Condition.release` methods also call the corresponding methods " -"of the associated lock." +"duration of the enclosed block. The :meth:`~Condition.acquire` and :meth:" +"`~Condition.release` methods also call the corresponding methods of the " +"associated lock." msgstr "" -#: ../../library/threading.rst:818 +#: ../../library/threading.rst:882 msgid "" -"Other methods must be called with the associated lock held. " -"The :meth:`~Condition.wait` method releases the lock, and then blocks until " -"another thread awakens it by calling :meth:`~Condition.notify` " -"or :meth:`~Condition.notify_all`. Once awakened, :meth:`~Condition.wait` re-" -"acquires the lock and returns. It is also possible to specify a timeout." +"Other methods must be called with the associated lock held. The :meth:" +"`~Condition.wait` method releases the lock, and then blocks until another " +"thread awakens it by calling :meth:`~Condition.notify` or :meth:`~Condition." +"notify_all`. Once awakened, :meth:`~Condition.wait` re-acquires the lock " +"and returns. It is also possible to specify a timeout." msgstr "" -#: ../../library/threading.rst:824 +#: ../../library/threading.rst:888 msgid "" "The :meth:`~Condition.notify` method wakes up one of the threads waiting for " -"the condition variable, if any are waiting. " -"The :meth:`~Condition.notify_all` method wakes up all threads waiting for " -"the condition variable." +"the condition variable, if any are waiting. The :meth:`~Condition." +"notify_all` method wakes up all threads waiting for the condition variable." msgstr "" -#: ../../library/threading.rst:828 +#: ../../library/threading.rst:892 msgid "" "Note: the :meth:`~Condition.notify` and :meth:`~Condition.notify_all` " "methods don't release the lock; this means that the thread or threads " @@ -1265,19 +1347,19 @@ msgid "" "or :meth:`~Condition.notify_all` finally relinquishes ownership of the lock." msgstr "" -#: ../../library/threading.rst:834 +#: ../../library/threading.rst:898 msgid "" "The typical programming style using condition variables uses the lock to " "synchronize access to some shared state; threads that are interested in a " "particular change of state call :meth:`~Condition.wait` repeatedly until " -"they see the desired state, while threads that modify the state " -"call :meth:`~Condition.notify` or :meth:`~Condition.notify_all` when they " -"change the state in such a way that it could possibly be a desired state for " -"one of the waiters. For example, the following code is a generic producer-" -"consumer situation with unlimited buffer capacity::" +"they see the desired state, while threads that modify the state call :meth:" +"`~Condition.notify` or :meth:`~Condition.notify_all` when they change the " +"state in such a way that it could possibly be a desired state for one of the " +"waiters. For example, the following code is a generic producer-consumer " +"situation with unlimited buffer capacity::" msgstr "" -#: ../../library/threading.rst:843 +#: ../../library/threading.rst:907 msgid "" "# Consume one item\n" "with cv:\n" @@ -1291,17 +1373,17 @@ msgid "" " cv.notify()" msgstr "" -#: ../../library/threading.rst:854 +#: ../../library/threading.rst:918 msgid "" "The ``while`` loop checking for the application's condition is necessary " "because :meth:`~Condition.wait` can return after an arbitrary long time, and " "the condition which prompted the :meth:`~Condition.notify` call may no " -"longer hold true. This is inherent to multi-threaded programming. " -"The :meth:`~Condition.wait_for` method can be used to automate the condition " +"longer hold true. This is inherent to multi-threaded programming. The :" +"meth:`~Condition.wait_for` method can be used to automate the condition " "checking, and eases the computation of timeouts::" msgstr "" -#: ../../library/threading.rst:861 +#: ../../library/threading.rst:925 msgid "" "# Consume an item\n" "with cv:\n" @@ -1309,54 +1391,54 @@ msgid "" " get_an_available_item()" msgstr "" -#: ../../library/threading.rst:866 +#: ../../library/threading.rst:930 msgid "" -"To choose between :meth:`~Condition.notify` " -"and :meth:`~Condition.notify_all`, consider whether one state change can be " -"interesting for only one or several waiting threads. E.g. in a typical " -"producer-consumer situation, adding one item to the buffer only needs to " -"wake up one consumer thread." +"To choose between :meth:`~Condition.notify` and :meth:`~Condition." +"notify_all`, consider whether one state change can be interesting for only " +"one or several waiting threads. E.g. in a typical producer-consumer " +"situation, adding one item to the buffer only needs to wake up one consumer " +"thread." msgstr "" -#: ../../library/threading.rst:874 +#: ../../library/threading.rst:938 msgid "" "This class implements condition variable objects. A condition variable " "allows one or more threads to wait until they are notified by another thread." msgstr "" -#: ../../library/threading.rst:877 +#: ../../library/threading.rst:941 msgid "" "If the *lock* argument is given and not ``None``, it must be a :class:`Lock` " "or :class:`RLock` object, and it is used as the underlying lock. Otherwise, " "a new :class:`RLock` object is created and used as the underlying lock." msgstr "" -#: ../../library/threading.rst:881 ../../library/threading.rst:1005 -#: ../../library/threading.rst:1051 ../../library/threading.rst:1103 -#: ../../library/threading.rst:1171 +#: ../../library/threading.rst:945 ../../library/threading.rst:1069 +#: ../../library/threading.rst:1115 ../../library/threading.rst:1167 +#: ../../library/threading.rst:1235 msgid "changed from a factory function to a class." msgstr "" -#: ../../library/threading.rst:886 +#: ../../library/threading.rst:950 msgid "" "Acquire the underlying lock. This method calls the corresponding method on " "the underlying lock; the return value is whatever that method returns." msgstr "" -#: ../../library/threading.rst:891 +#: ../../library/threading.rst:955 msgid "" "Release the underlying lock. This method calls the corresponding method on " "the underlying lock; there is no return value." msgstr "" -#: ../../library/threading.rst:896 +#: ../../library/threading.rst:960 msgid "" "Wait until notified or until a timeout occurs. If the calling thread has not " "acquired the lock when this method is called, a :exc:`RuntimeError` is " "raised." msgstr "" -#: ../../library/threading.rst:900 +#: ../../library/threading.rst:964 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call for the same " @@ -1364,41 +1446,41 @@ msgid "" "Once awakened or timed out, it re-acquires the lock and returns." msgstr "" -#: ../../library/threading.rst:905 +#: ../../library/threading.rst:969 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds (or " "fractions thereof)." msgstr "" -#: ../../library/threading.rst:909 +#: ../../library/threading.rst:973 msgid "" -"When the underlying lock is an :class:`RLock`, it is not released using " -"its :meth:`release` method, since this may not actually unlock the lock when " -"it was acquired multiple times recursively. Instead, an internal interface " -"of the :class:`RLock` class is used, which really unlocks it even when it " -"has been recursively acquired several times. Another internal interface is " -"then used to restore the recursion level when the lock is reacquired." +"When the underlying lock is an :class:`RLock`, it is not released using its :" +"meth:`release` method, since this may not actually unlock the lock when it " +"was acquired multiple times recursively. Instead, an internal interface of " +"the :class:`RLock` class is used, which really unlocks it even when it has " +"been recursively acquired several times. Another internal interface is then " +"used to restore the recursion level when the lock is reacquired." msgstr "" -#: ../../library/threading.rst:917 +#: ../../library/threading.rst:981 msgid "" "The return value is ``True`` unless a given *timeout* expired, in which case " "it is ``False``." msgstr "" -#: ../../library/threading.rst:920 ../../library/threading.rst:1136 +#: ../../library/threading.rst:984 ../../library/threading.rst:1200 msgid "Previously, the method always returned ``None``." msgstr "" -#: ../../library/threading.rst:925 +#: ../../library/threading.rst:989 msgid "" "Wait until a condition evaluates to true. *predicate* should be a callable " "which result will be interpreted as a boolean value. A *timeout* may be " "provided giving the maximum time to wait." msgstr "" -#: ../../library/threading.rst:929 +#: ../../library/threading.rst:993 msgid "" "This utility method may call :meth:`wait` repeatedly until the predicate is " "satisfied, or until a timeout occurs. The return value is the last return " @@ -1406,13 +1488,13 @@ msgid "" "out." msgstr "" -#: ../../library/threading.rst:934 +#: ../../library/threading.rst:998 msgid "" "Ignoring the timeout feature, calling this method is roughly equivalent to " "writing::" msgstr "" -#: ../../library/threading.rst:937 +#: ../../library/threading.rst:1001 msgid "" "while not predicate():\n" " cv.wait()" @@ -1420,27 +1502,27 @@ msgstr "" "while not predicate():\n" " cv.wait()" -#: ../../library/threading.rst:940 +#: ../../library/threading.rst:1004 msgid "" "Therefore, the same rules apply as with :meth:`wait`: The lock must be held " "when called and is re-acquired on return. The predicate is evaluated with " "the lock held." msgstr "" -#: ../../library/threading.rst:948 +#: ../../library/threading.rst:1012 msgid "" "By default, wake up one thread waiting on this condition, if any. If the " -"calling thread has not acquired the lock when this method is called, " -"a :exc:`RuntimeError` is raised." +"calling thread has not acquired the lock when this method is called, a :exc:" +"`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:952 +#: ../../library/threading.rst:1016 msgid "" "This method wakes up at most *n* of the threads waiting for the condition " "variable; it is a no-op if no threads are waiting." msgstr "" -#: ../../library/threading.rst:955 +#: ../../library/threading.rst:1019 msgid "" "The current implementation wakes up exactly *n* threads, if at least *n* " "threads are waiting. However, it's not safe to rely on this behavior. A " @@ -1448,52 +1530,53 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:960 +#: ../../library/threading.rst:1024 msgid "" "Note: an awakened thread does not actually return from its :meth:`wait` call " "until it can reacquire the lock. Since :meth:`notify` does not release the " "lock, its caller should." msgstr "" -#: ../../library/threading.rst:966 +#: ../../library/threading.rst:1030 msgid "" -"Wake up all threads waiting on this condition. This method acts " -"like :meth:`notify`, but wakes up all waiting threads instead of one. If the " -"calling thread has not acquired the lock when this method is called, " -"a :exc:`RuntimeError` is raised." +"Wake up all threads waiting on this condition. This method acts like :meth:" +"`notify`, but wakes up all waiting threads instead of one. If the calling " +"thread has not acquired the lock when this method is called, a :exc:" +"`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:971 +#: ../../library/threading.rst:1035 msgid "The method ``notifyAll`` is a deprecated alias for this method." msgstr "" -#: ../../library/threading.rst:977 -msgid "Semaphore Objects" -msgstr "" +#: ../../library/threading.rst:1041 +#, fuzzy +msgid "Semaphore objects" +msgstr "Thread 物件" -#: ../../library/threading.rst:979 +#: ../../library/threading.rst:1043 msgid "" "This is one of the oldest synchronization primitives in the history of " "computer science, invented by the early Dutch computer scientist Edsger W. " -"Dijkstra (he used the names ``P()`` and ``V()`` instead " -"of :meth:`~Semaphore.acquire` and :meth:`~Semaphore.release`)." +"Dijkstra (he used the names ``P()`` and ``V()`` instead of :meth:`~Semaphore." +"acquire` and :meth:`~Semaphore.release`)." msgstr "" -#: ../../library/threading.rst:984 +#: ../../library/threading.rst:1048 msgid "" -"A semaphore manages an internal counter which is decremented by " -"each :meth:`~Semaphore.acquire` call and incremented by " -"each :meth:`~Semaphore.release` call. The counter can never go below zero; " -"when :meth:`~Semaphore.acquire` finds that it is zero, it blocks, waiting " -"until some other thread calls :meth:`~Semaphore.release`." +"A semaphore manages an internal counter which is decremented by each :meth:" +"`~Semaphore.acquire` call and incremented by each :meth:`~Semaphore.release` " +"call. The counter can never go below zero; when :meth:`~Semaphore.acquire` " +"finds that it is zero, it blocks, waiting until some other thread calls :" +"meth:`~Semaphore.release`." msgstr "" -#: ../../library/threading.rst:990 +#: ../../library/threading.rst:1054 msgid "" "Semaphores also support the :ref:`context management protocol `." msgstr "" -#: ../../library/threading.rst:995 +#: ../../library/threading.rst:1059 msgid "" "This class implements semaphore objects. A semaphore manages an atomic " "counter representing the number of :meth:`release` calls minus the number " @@ -1502,75 +1585,76 @@ msgid "" "If not given, *value* defaults to 1." msgstr "" -#: ../../library/threading.rst:1001 +#: ../../library/threading.rst:1065 msgid "" "The optional argument gives the initial *value* for the internal counter; it " "defaults to ``1``. If the *value* given is less than 0, :exc:`ValueError` is " "raised." msgstr "" -#: ../../library/threading.rst:1010 +#: ../../library/threading.rst:1074 msgid "Acquire a semaphore." msgstr "" -#: ../../library/threading.rst:1012 +#: ../../library/threading.rst:1076 msgid "When invoked without arguments:" msgstr "" -#: ../../library/threading.rst:1014 +#: ../../library/threading.rst:1078 msgid "" "If the internal counter is larger than zero on entry, decrement it by one " "and return ``True`` immediately." msgstr "" -#: ../../library/threading.rst:1016 +#: ../../library/threading.rst:1080 msgid "" -"If the internal counter is zero on entry, block until awoken by a call " -"to :meth:`~Semaphore.release`. Once awoken (and the counter is greater than " -"0), decrement the counter by 1 and return ``True``. Exactly one thread will " -"be awoken by each call to :meth:`~Semaphore.release`. The order in which " +"If the internal counter is zero on entry, block until awoken by a call to :" +"meth:`~Semaphore.release`. Once awoken (and the counter is greater than 0), " +"decrement the counter by 1 and return ``True``. Exactly one thread will be " +"awoken by each call to :meth:`~Semaphore.release`. The order in which " "threads are awoken should not be relied on." msgstr "" -#: ../../library/threading.rst:1022 +#: ../../library/threading.rst:1086 msgid "" "When invoked with *blocking* set to ``False``, do not block. If a call " "without an argument would block, return ``False`` immediately; otherwise, do " "the same thing as when called without arguments, and return ``True``." msgstr "" -#: ../../library/threading.rst:1026 +#: ../../library/threading.rst:1090 msgid "" "When invoked with a *timeout* other than ``None``, it will block for at most " "*timeout* seconds. If acquire does not complete successfully in that " "interval, return ``False``. Return ``True`` otherwise." msgstr "" -#: ../../library/threading.rst:1035 +#: ../../library/threading.rst:1099 msgid "" "Release a semaphore, incrementing the internal counter by *n*. When it was " "zero on entry and other threads are waiting for it to become larger than " "zero again, wake up *n* of those threads." msgstr "" -#: ../../library/threading.rst:1039 +#: ../../library/threading.rst:1103 msgid "Added the *n* parameter to release multiple waiting threads at once." msgstr "" -#: ../../library/threading.rst:1045 +#: ../../library/threading.rst:1109 msgid "" "Class implementing bounded semaphore objects. A bounded semaphore checks to " -"make sure its current value doesn't exceed its initial value. If it " -"does, :exc:`ValueError` is raised. In most situations semaphores are used to " -"guard resources with limited capacity. If the semaphore is released too " -"many times it's a sign of a bug. If not given, *value* defaults to 1." +"make sure its current value doesn't exceed its initial value. If it does, :" +"exc:`ValueError` is raised. In most situations semaphores are used to guard " +"resources with limited capacity. If the semaphore is released too many " +"times it's a sign of a bug. If not given, *value* defaults to 1." msgstr "" -#: ../../library/threading.rst:1058 -msgid ":class:`Semaphore` Example" +#: ../../library/threading.rst:1122 +#, fuzzy +msgid ":class:`Semaphore` example" msgstr ":class:`Semaphore` 範例" -#: ../../library/threading.rst:1060 +#: ../../library/threading.rst:1124 msgid "" "Semaphores are often used to guard resources with limited capacity, for " "example, a database server. In any situation where the size of the resource " @@ -1578,7 +1662,7 @@ msgid "" "threads, your main thread would initialize the semaphore::" msgstr "" -#: ../../library/threading.rst:1065 +#: ../../library/threading.rst:1129 msgid "" "maxconnections = 5\n" "# ...\n" @@ -1588,13 +1672,13 @@ msgstr "" "# ...\n" "pool_sema = BoundedSemaphore(value=maxconnections)" -#: ../../library/threading.rst:1069 +#: ../../library/threading.rst:1133 msgid "" "Once spawned, worker threads call the semaphore's acquire and release " "methods when they need to connect to the server::" msgstr "" -#: ../../library/threading.rst:1072 +#: ../../library/threading.rst:1136 msgid "" "with pool_sema:\n" " conn = connectdb()\n" @@ -1610,62 +1694,61 @@ msgstr "" " finally:\n" " conn.close()" -#: ../../library/threading.rst:1079 +#: ../../library/threading.rst:1143 msgid "" "The use of a bounded semaphore reduces the chance that a programming error " "which causes the semaphore to be released more than it's acquired will go " "undetected." msgstr "" -#: ../../library/threading.rst:1086 -msgid "Event Objects" +#: ../../library/threading.rst:1150 +msgid "Event objects" msgstr "" -#: ../../library/threading.rst:1088 +#: ../../library/threading.rst:1152 msgid "" "This is one of the simplest mechanisms for communication between threads: " "one thread signals an event and other threads wait for it." msgstr "" -#: ../../library/threading.rst:1091 +#: ../../library/threading.rst:1155 msgid "" -"An event object manages an internal flag that can be set to true with " -"the :meth:`~Event.set` method and reset to false with " -"the :meth:`~Event.clear` method. The :meth:`~Event.wait` method blocks " -"until the flag is true." +"An event object manages an internal flag that can be set to true with the :" +"meth:`~Event.set` method and reset to false with the :meth:`~Event.clear` " +"method. The :meth:`~Event.wait` method blocks until the flag is true." msgstr "" -#: ../../library/threading.rst:1098 +#: ../../library/threading.rst:1162 msgid "" "Class implementing event objects. An event manages a flag that can be set " -"to true with the :meth:`~Event.set` method and reset to false with " -"the :meth:`clear` method. The :meth:`wait` method blocks until the flag is " -"true. The flag is initially false." +"to true with the :meth:`~Event.set` method and reset to false with the :meth:" +"`clear` method. The :meth:`wait` method blocks until the flag is true. The " +"flag is initially false." msgstr "" -#: ../../library/threading.rst:1108 +#: ../../library/threading.rst:1172 msgid "Return ``True`` if and only if the internal flag is true." msgstr "" -#: ../../library/threading.rst:1110 +#: ../../library/threading.rst:1174 msgid "The method ``isSet`` is a deprecated alias for this method." msgstr "" -#: ../../library/threading.rst:1114 +#: ../../library/threading.rst:1178 msgid "" "Set the internal flag to true. All threads waiting for it to become true are " "awakened. Threads that call :meth:`wait` once the flag is true will not " "block at all." msgstr "" -#: ../../library/threading.rst:1120 +#: ../../library/threading.rst:1184 msgid "" "Reset the internal flag to false. Subsequently, threads calling :meth:`wait` " "will block until :meth:`.set` is called to set the internal flag to true " "again." msgstr "" -#: ../../library/threading.rst:1126 +#: ../../library/threading.rst:1190 msgid "" "Block as long as the internal flag is false and the timeout, if given, has " "not expired. The return value represents the reason that this blocking " @@ -1674,26 +1757,27 @@ msgid "" "become true within the given wait time." msgstr "" -#: ../../library/threading.rst:1132 +#: ../../library/threading.rst:1196 msgid "" "When the timeout argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds, or " "fractions thereof." msgstr "" -#: ../../library/threading.rst:1143 -msgid "Timer Objects" -msgstr "" +#: ../../library/threading.rst:1207 +#, fuzzy +msgid "Timer objects" +msgstr "Thread 物件" -#: ../../library/threading.rst:1145 +#: ../../library/threading.rst:1209 msgid "" "This class represents an action that should be run only after a certain " -"amount of time has passed --- a timer. :class:`Timer` is a subclass " -"of :class:`Thread` and as such also functions as an example of creating " -"custom threads." +"amount of time has passed --- a timer. :class:`Timer` is a subclass of :" +"class:`Thread` and as such also functions as an example of creating custom " +"threads." msgstr "" -#: ../../library/threading.rst:1149 +#: ../../library/threading.rst:1213 msgid "" "Timers are started, as with threads, by calling their :meth:`Timer.start " "` method. The timer can be stopped (before its action has " @@ -1702,11 +1786,11 @@ msgid "" "interval specified by the user." msgstr "" -#: ../../library/threading.rst:1155 +#: ../../library/threading.rst:1219 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/threading.rst:1157 +#: ../../library/threading.rst:1221 msgid "" "def hello():\n" " print(\"hello, world\")\n" @@ -1720,7 +1804,7 @@ msgstr "" "t = Timer(30.0, hello)\n" "t.start() # 30 秒後會印出 \"hello, world\"" -#: ../../library/threading.rst:1166 +#: ../../library/threading.rst:1230 msgid "" "Create a timer that will run *function* with arguments *args* and keyword " "arguments *kwargs*, after *interval* seconds have passed. If *args* is " @@ -1728,17 +1812,18 @@ msgid "" "``None`` (the default) then an empty dict will be used." msgstr "" -#: ../../library/threading.rst:1176 +#: ../../library/threading.rst:1240 msgid "" "Stop the timer, and cancel the execution of the timer's action. This will " "only work if the timer is still in its waiting stage." msgstr "" -#: ../../library/threading.rst:1181 -msgid "Barrier Objects" -msgstr "" +#: ../../library/threading.rst:1245 +#, fuzzy +msgid "Barrier objects" +msgstr "Thread 物件" -#: ../../library/threading.rst:1185 +#: ../../library/threading.rst:1249 msgid "" "This class provides a simple synchronization primitive for use by a fixed " "number of threads that need to wait for each other. Each of the threads " @@ -1747,18 +1832,18 @@ msgid "" "calls. At this point, the threads are released simultaneously." msgstr "" -#: ../../library/threading.rst:1191 +#: ../../library/threading.rst:1255 msgid "" "The barrier can be reused any number of times for the same number of threads." msgstr "" -#: ../../library/threading.rst:1193 +#: ../../library/threading.rst:1257 msgid "" "As an example, here is a simple way to synchronize a client and server " "thread::" msgstr "" -#: ../../library/threading.rst:1195 +#: ../../library/threading.rst:1259 msgid "" "b = Barrier(2, timeout=5)\n" "\n" @@ -1790,7 +1875,7 @@ msgstr "" " connection = make_connection()\n" " process_client_connection(connection)" -#: ../../library/threading.rst:1213 +#: ../../library/threading.rst:1277 msgid "" "Create a barrier object for *parties* number of threads. An *action*, when " "provided, is a callable to be called by one of the threads when they are " @@ -1798,7 +1883,7 @@ msgid "" "the :meth:`wait` method." msgstr "" -#: ../../library/threading.rst:1220 +#: ../../library/threading.rst:1284 msgid "" "Pass the barrier. When all the threads party to the barrier have called " "this function, they are all released simultaneously. If a *timeout* is " @@ -1806,14 +1891,14 @@ msgid "" "constructor." msgstr "" -#: ../../library/threading.rst:1225 +#: ../../library/threading.rst:1289 msgid "" "The return value is an integer in the range 0 to *parties* -- 1, different " "for each thread. This can be used to select a thread to do some special " "housekeeping, e.g.::" msgstr "" -#: ../../library/threading.rst:1229 +#: ../../library/threading.rst:1293 msgid "" "i = barrier.wait()\n" "if i == 0:\n" @@ -1825,37 +1910,37 @@ msgstr "" " # 只會有一個執行緒會印出這個\n" " print(\"passed the barrier\")" -#: ../../library/threading.rst:1234 +#: ../../library/threading.rst:1298 msgid "" "If an *action* was provided to the constructor, one of the threads will have " "called it prior to being released. Should this call raise an error, the " "barrier is put into the broken state." msgstr "" -#: ../../library/threading.rst:1238 +#: ../../library/threading.rst:1302 msgid "If the call times out, the barrier is put into the broken state." msgstr "" -#: ../../library/threading.rst:1240 +#: ../../library/threading.rst:1304 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a thread is waiting." msgstr "" -#: ../../library/threading.rst:1245 +#: ../../library/threading.rst:1309 msgid "" "Return the barrier to the default, empty state. Any threads waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: ../../library/threading.rst:1248 +#: ../../library/threading.rst:1312 msgid "" "Note that using this function may require some external synchronization if " "there are other threads whose state is unknown. If a barrier is broken it " "may be better to just leave it and create a new one." msgstr "" -#: ../../library/threading.rst:1254 +#: ../../library/threading.rst:1318 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for " @@ -1863,36 +1948,36 @@ msgid "" "application." msgstr "" -#: ../../library/threading.rst:1259 +#: ../../library/threading.rst:1323 msgid "" "It may be preferable to simply create the barrier with a sensible *timeout* " "value to automatically guard against one of the threads going awry." msgstr "" -#: ../../library/threading.rst:1265 +#: ../../library/threading.rst:1329 msgid "The number of threads required to pass the barrier." msgstr "" -#: ../../library/threading.rst:1269 +#: ../../library/threading.rst:1333 msgid "The number of threads currently waiting in the barrier." msgstr "" -#: ../../library/threading.rst:1273 +#: ../../library/threading.rst:1337 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: ../../library/threading.rst:1278 +#: ../../library/threading.rst:1342 msgid "" -"This exception, a subclass of :exc:`RuntimeError`, is raised when " -"the :class:`Barrier` object is reset or broken." +"This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" +"`Barrier` object is reset or broken." msgstr "" -#: ../../library/threading.rst:1285 +#: ../../library/threading.rst:1349 msgid "" "Using locks, conditions, and semaphores in the :keyword:`!with` statement" msgstr "" -#: ../../library/threading.rst:1287 +#: ../../library/threading.rst:1351 msgid "" "All of the objects provided by this module that have ``acquire`` and " "``release`` methods can be used as context managers for a :keyword:`with` " @@ -1901,7 +1986,7 @@ msgid "" "following snippet::" msgstr "" -#: ../../library/threading.rst:1293 +#: ../../library/threading.rst:1357 msgid "" "with some_lock:\n" " # do something..." @@ -1909,11 +1994,11 @@ msgstr "" "with some_lock:\n" " # 做某些事情..." -#: ../../library/threading.rst:1296 +#: ../../library/threading.rst:1360 msgid "is equivalent to::" msgstr "" -#: ../../library/threading.rst:1298 +#: ../../library/threading.rst:1362 msgid "" "some_lock.acquire()\n" "try:\n" @@ -1927,22 +2012,22 @@ msgstr "" "finally:\n" " some_lock.release()" -#: ../../library/threading.rst:1304 +#: ../../library/threading.rst:1368 msgid "" -"Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:`Semaphore`, " -"and :class:`BoundedSemaphore` objects may be used as :keyword:`with` " -"statement context managers." +"Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:" +"`Semaphore`, and :class:`BoundedSemaphore` objects may be used as :keyword:" +"`with` statement context managers." msgstr "" -#: ../../library/threading.rst:158 ../../library/threading.rst:176 +#: ../../library/threading.rst:222 ../../library/threading.rst:240 msgid "trace function" msgstr "" -#: ../../library/threading.rst:176 +#: ../../library/threading.rst:240 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/threading.rst:187 ../../library/threading.rst:205 +#: ../../library/threading.rst:251 ../../library/threading.rst:269 msgid "profile function" msgstr "" From 0187da99e698f7d7434e0826cf99c3e49168799c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 18 May 2025 00:19:18 +0000 Subject: [PATCH 07/14] sync with cpython f6254327 --- library/unittest.po | 5 +- tutorial/controlflow.po | 171 +-- whatsnew/3.10.po | 2338 +++++++++++++++++++-------------------- 3 files changed, 1235 insertions(+), 1279 deletions(-) diff --git a/library/unittest.po b/library/unittest.po index 80fe6553c4..2f2865a0b2 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-23 00:15+0000\n" +"POT-Creation-Date: 2025-05-18 00:18+0000\n" "PO-Revision-Date: 2022-10-16 06:03+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -227,8 +227,9 @@ msgid "" msgstr "" #: ../../library/unittest.rst:113 +#, fuzzy msgid "" -"A testcase is created by subclassing :class:`unittest.TestCase`. The three " +"A test case is created by subclassing :class:`unittest.TestCase`. The three " "individual tests are defined with methods whose names start with the letters " "``test``. This naming convention informs the test runner about which " "methods represent tests." diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index a33b54fa3a..6d5b5bfe33 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-31 00:13+0000\n" +"POT-Creation-Date: 2025-05-18 00:18+0000\n" "PO-Revision-Date: 2022-07-24 14:52+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -64,9 +64,9 @@ msgstr "" msgid "" "There can be zero or more :keyword:`elif` parts, and the :keyword:`else` " "part is optional. The keyword ':keyword:`!elif`' is short for 'else if', " -"and is useful to avoid excessive indentation. An :keyword:`!" -"if` ... :keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute " -"for the ``switch`` or ``case`` statements found in other languages." +"and is useful to avoid excessive indentation. An :keyword:`!if` ... :" +"keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute for the " +"``switch`` or ``case`` statements found in other languages." msgstr "" "在陳述式中,可以沒有或有許多個 :keyword:`elif` 敘述,且 :keyword:`else` 敘述" "並不是必要的。關鍵字 :keyword:`!elif` 是「else if」的縮寫,用來避免過多的縮" @@ -91,10 +91,10 @@ msgid "" "The :keyword:`for` statement in Python differs a bit from what you may be " "used to in C or Pascal. Rather than always iterating over an arithmetic " "progression of numbers (like in Pascal), or giving the user the ability to " -"define both the iteration step and halting condition (as C), " -"Python's :keyword:`!for` statement iterates over the items of any sequence " -"(a list or a string), in the order that they appear in the sequence. For " -"example (no pun intended):" +"define both the iteration step and halting condition (as C), Python's :" +"keyword:`!for` statement iterates over the items of any sequence (a list or " +"a string), in the order that they appear in the sequence. For example (no " +"pun intended):" msgstr "" "在 Python 中的 :keyword:`for` 陳述式有點不同於在 C 或 Pascal 中的慣用方式。相" "較於只能疊代 (iterate) 一個等差數列(如 Pascal),或給予使用者定義疊代步驟與" @@ -145,9 +145,8 @@ msgstr ":func:`range` 函式" #: ../../tutorial/controlflow.rst:96 msgid "" -"If you do need to iterate over a sequence of numbers, the built-in " -"function :func:`range` comes in handy. It generates arithmetic " -"progressions::" +"If you do need to iterate over a sequence of numbers, the built-in function :" +"func:`range` comes in handy. It generates arithmetic progressions::" msgstr "" "如果你需要疊代一個數列的話,使用內建 :func:`range` 函式就很方便。它可以生成一" "等差數列: ::" @@ -267,9 +266,9 @@ msgstr "" msgid "" "We say such an object is :term:`iterable`, that is, suitable as a target for " "functions and constructs that expect something from which they can obtain " -"successive items until the supply is exhausted. We have seen that " -"the :keyword:`for` statement is such a construct, while an example of a " -"function that takes an iterable is :func:`sum`::" +"successive items until the supply is exhausted. We have seen that the :" +"keyword:`for` statement is such a construct, while an example of a function " +"that takes an iterable is :func:`sum`::" msgstr "" "我們稱這樣的物件為 :term:`iterable`\\ (可疊代物件),意即能作為函式及架構中" "可以一直取得項目直到取盡的對象。我們已經了解 :keyword:`for` 陳述式就是如此的" @@ -289,8 +288,8 @@ msgid "" "arguments. In chapter :ref:`tut-structures`, we will discuss in more detail " "about :func:`list`." msgstr "" -"待會我們可以看到更多回傳 iterable 和使用 iterable 為引數的函式。在" -"\\ :ref:`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" +"待會我們可以看到更多回傳 iterable 和使用 iterable 為引數的函式。在\\ :ref:" +"`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" #: ../../tutorial/controlflow.rst:164 msgid ":keyword:`!break` and :keyword:`!continue` Statements" @@ -298,11 +297,11 @@ msgstr ":keyword:`!break` 和 :keyword:`!continue` 陳述式" #: ../../tutorial/controlflow.rst:166 msgid "" -"The :keyword:`break` statement breaks out of the innermost " -"enclosing :keyword:`for` or :keyword:`while` loop::" +"The :keyword:`break` statement breaks out of the innermost enclosing :" +"keyword:`for` or :keyword:`while` loop::" msgstr "" -":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` " -"或 :keyword:`while` 迴圈: ::" +":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` 或 :keyword:" +"`while` 迴圈: ::" #: ../../tutorial/controlflow.rst:169 msgid "" @@ -455,11 +454,11 @@ msgid "" "occurs. For more on the ``try`` statement and exceptions, see :ref:`tut-" "handling`." msgstr "" -"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為" -"與 :keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 " -"``else`` 子句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有" -"任何 ``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見" -"\\ :ref:`tut-handling`。" +"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為與 :" +"keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 ``else`` 子" +"句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有任何 " +"``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見\\ :ref:`tut-" +"handling`。" #: ../../tutorial/controlflow.rst:257 msgid ":keyword:`!pass` Statements" @@ -698,8 +697,8 @@ msgid "" "A recommended way to read patterns is to look at them as an extended form of " "what you would put on the left of an assignment, to understand which " "variables would be set to what. Only the standalone names (like ``var`` " -"above) are assigned to by a match statement. Dotted names (like " -"``foo.bar``), attribute names (the ``x=`` and ``y=`` above) or class names " +"above) are assigned to by a match statement. Dotted names (like ``foo." +"bar``), attribute names (the ``x=`` and ``y=`` above) or class names " "(recognized by the \"(...)\" next to them like ``Point`` above) are never " "assigned to." msgstr "" @@ -884,8 +883,8 @@ msgstr "" #: ../../tutorial/controlflow.rst:454 msgid "" -"For a more detailed explanation and additional examples, you can look " -"into :pep:`636` which is written in a tutorial format." +"For a more detailed explanation and additional examples, you can look into :" +"pep:`636` which is written in a tutorial format." msgstr "" "關於更詳細的解釋和其他範例,你可以閱讀 :pep:`636`,它是以教學的格式編寫而成。" @@ -927,12 +926,12 @@ msgstr "" #: ../../tutorial/controlflow.rst:487 msgid "" "The first statement of the function body can optionally be a string literal; " -"this string literal is the function's documentation string, " -"or :dfn:`docstring`. (More about docstrings can be found in the " -"section :ref:`tut-docstrings`.) There are tools which use docstrings to " -"automatically produce online or printed documentation, or to let the user " -"interactively browse through code; it's good practice to include docstrings " -"in code that you write, so make a habit of it." +"this string literal is the function's documentation string, or :dfn:" +"`docstring`. (More about docstrings can be found in the section :ref:`tut-" +"docstrings`.) There are tools which use docstrings to automatically produce " +"online or printed documentation, or to let the user interactively browse " +"through code; it's good practice to include docstrings in code that you " +"write, so make a habit of it." msgstr "" "一個函式的第一個陳述式可以是一個字串文本;該字串文本被視為該函式的說明文件字" "串,即 :dfn:`docstring`。(關於 docstring 的細節請參見\\ :ref:`tut-" @@ -958,8 +957,8 @@ msgstr "" "域符號表。然而,在引用一個變數時,會先從區域符號表開始搜尋,其次為外層函式的" "區域符號表,其次為全域符號表 (global symbol table),最後為所有內建的名稱。因" "此,在函式中,全域變數及外層函式變數雖然可以被引用,但無法被直接賦值(除非全" -"域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數" -"在 :keyword:`nonlocal` 陳述式中被定義)。" +"域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:" +"`nonlocal` 陳述式中被定義)。" #: ../../tutorial/controlflow.rst:505 msgid "" @@ -1007,8 +1006,8 @@ msgid "" "without a :keyword:`return` statement do return a value, albeit a rather " "boring one. This value is called ``None`` (it's a built-in name). Writing " "the value ``None`` is normally suppressed by the interpreter if it would be " -"the only value written. You can see it if you really want to " -"using :func:`print`::" +"the only value written. You can see it if you really want to using :func:" +"`print`::" msgstr "" "如果你是來自別的語言,你可能不同意 ``fib`` 是個函式,而是個程序 (procedure)," "因為它並沒有回傳值。實際上,即使一個函式缺少一個 :keyword:`return` 陳述式,它" @@ -1053,9 +1052,9 @@ msgstr "這個例子一樣示範了一些新的 Python 特性:" #: ../../tutorial/controlflow.rst:552 msgid "" -"The :keyword:`return` statement returns with a value from a " -"function. :keyword:`!return` without an expression argument returns " -"``None``. Falling off the end of a function also returns ``None``." +"The :keyword:`return` statement returns with a value from a function. :" +"keyword:`!return` without an expression argument returns ``None``. Falling " +"off the end of a function also returns ``None``." msgstr "" ":keyword:`return` 陳述式會讓一個函式回傳一個值。單獨使用 :keyword:`!return` " "不外加一個運算式作為引數時會回傳 ``None``。一個函式執行到結束也會回傳 " @@ -1069,8 +1068,8 @@ msgid "" "expression), and ``methodname`` is the name of a method that is defined by " "the object's type. Different types define different methods. Methods of " "different types may have the same name without causing ambiguity. (It is " -"possible to define your own object types and methods, using *classes*, " -"see :ref:`tut-classes`) The method :meth:`!append` shown in the example is " +"possible to define your own object types and methods, using *classes*, see :" +"ref:`tut-classes`) The method :meth:`!append` shown in the example is " "defined for list objects; it adds a new element at the end of the list. In " "this example it is equivalent to ``result = result + [a]``, but more " "efficient." @@ -1360,8 +1359,8 @@ msgid "" "positional arguments beyond the formal parameter list. (``*name`` must " "occur before ``**name``.) For example, if we define a function like this::" msgstr "" -"當最後一個參數為 ``**name`` 形式時,它接收一個 dictionary(字典,詳" -"見 :ref:`typesmapping`\\ ),該字典包含所有可對應形式參數以外的關鍵字引數。" +"當最後一個參數為 ``**name`` 形式時,它接收一個 dictionary(字典,詳見 :ref:" +"`typesmapping`\\ ),該字典包含所有可對應形式參數以外的關鍵字引數。" "``**name`` 可以與 ``*name`` 參數(下一小節介紹)組合使用,``*name`` 接收一" "個 :ref:`tuple `,該 tuple 包含一般參數以外的位置引數(\\ " "``*name`` 必須出現在 ``**name`` 前面)。例如,若我們定義這樣的函式: ::" @@ -1949,14 +1948,16 @@ msgstr "" "43" #: ../../tutorial/controlflow.rst:1000 +#, fuzzy msgid "" "The above example uses a lambda expression to return a function. Another " -"use is to pass a small function as an argument::" +"use is to pass a small function as an argument. For instance, :meth:`list." +"sort` takes a sorting key function *key* which can be a lambda function::" msgstr "" "上面的例子用 lambda 運算式回傳了一個函式。另外的用法是傳遞一個小函式當作引" "數: ::" -#: ../../tutorial/controlflow.rst:1003 +#: ../../tutorial/controlflow.rst:1004 msgid "" ">>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]\n" ">>> pairs.sort(key=lambda pair: pair[1])\n" @@ -1968,17 +1969,17 @@ msgstr "" ">>> pairs\n" "[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]" -#: ../../tutorial/controlflow.rst:1012 +#: ../../tutorial/controlflow.rst:1013 msgid "Documentation Strings" msgstr "說明文件字串 (Documentation Strings)" -#: ../../tutorial/controlflow.rst:1019 +#: ../../tutorial/controlflow.rst:1020 msgid "" "Here are some conventions about the content and formatting of documentation " "strings." msgstr "以下是關於說明文件字串內容和格式的慣例。" -#: ../../tutorial/controlflow.rst:1022 +#: ../../tutorial/controlflow.rst:1023 msgid "" "The first line should always be a short, concise summary of the object's " "purpose. For brevity, it should not explicitly state the object's name or " @@ -1990,7 +1991,7 @@ msgstr "" "的名稱或型別,因為有其他方法可以達到相同目的(除非該名稱剛好是一個描述函式運" "算的動詞)。這一行應以大寫字母開頭,以句號結尾。" -#: ../../tutorial/controlflow.rst:1028 +#: ../../tutorial/controlflow.rst:1029 msgid "" "If there are more lines in the documentation string, the second line should " "be blank, visually separating the summary from the rest of the description. " @@ -2000,7 +2001,7 @@ msgstr "" "文件字串為多行時,第二行應為空白行,在視覺上將摘要與其餘描述分開。後面幾行可" "包含一或多個段落,描述此物件的呼叫慣例、副作用等。" -#: ../../tutorial/controlflow.rst:1033 +#: ../../tutorial/controlflow.rst:1034 msgid "" "The Python parser does not strip indentation from multi-line string literals " "in Python, so tools that process documentation have to strip indentation if " @@ -2022,11 +2023,11 @@ msgstr "" "出現了,這些行的全部前導空白字元都應被去除。展開 tab 鍵後(通常為八個空格)," "應測試空白字元量是否等價。" -#: ../../tutorial/controlflow.rst:1045 +#: ../../tutorial/controlflow.rst:1046 msgid "Here is an example of a multi-line docstring::" msgstr "下面是多行說明字串的一個範例: ::" -#: ../../tutorial/controlflow.rst:1047 +#: ../../tutorial/controlflow.rst:1048 msgid "" ">>> def my_function():\n" "... \"\"\"Do nothing, but document it.\n" @@ -2041,11 +2042,11 @@ msgid "" " No, really, it doesn't do anything." msgstr "" -#: ../../tutorial/controlflow.rst:1063 +#: ../../tutorial/controlflow.rst:1064 msgid "Function Annotations" msgstr "函式註釋 (Function Annotations)" -#: ../../tutorial/controlflow.rst:1071 +#: ../../tutorial/controlflow.rst:1072 msgid "" ":ref:`Function annotations ` are completely optional metadata " "information about the types used by user-defined functions (see :pep:`3107` " @@ -2054,7 +2055,7 @@ msgstr "" ":ref:`函式註釋 `\\ 是選擇性的元資料(metadata)資訊,描述使用者定義" "函式所使用的型別(更多資訊詳見 :pep:`3107` 和 :pep:`484`\\ )。" -#: ../../tutorial/controlflow.rst:1075 +#: ../../tutorial/controlflow.rst:1076 msgid "" ":term:`Annotations ` are stored in the :attr:`!" "__annotations__` attribute of the function as a dictionary and have no " @@ -2072,7 +2073,7 @@ msgstr "" ">`` 文字接著一個運算式。以下範例註釋了一個必要引數、一個選擇性引數,以及回傳" "值: ::" -#: ../../tutorial/controlflow.rst:1084 +#: ../../tutorial/controlflow.rst:1085 msgid "" ">>> def f(ham: str, eggs: str = 'eggs') -> str:\n" "... print(\"Annotations:\", f.__annotations__)\n" @@ -2096,11 +2097,11 @@ msgstr "" "Arguments: spam eggs\n" "'spam and eggs'" -#: ../../tutorial/controlflow.rst:1097 +#: ../../tutorial/controlflow.rst:1098 msgid "Intermezzo: Coding Style" msgstr "間奏曲:程式碼風格 (Coding Style)" -#: ../../tutorial/controlflow.rst:1102 +#: ../../tutorial/controlflow.rst:1103 msgid "" "Now that you are about to write longer, more complex pieces of Python, it is " "a good time to talk about *coding style*. Most languages can be written (or " @@ -2113,7 +2114,7 @@ msgstr "" "式比其他的更具可讀性。能讓其他人輕鬆閱讀你的程式碼永遠是一個好主意,而使用優" "良的編碼樣式對此有極大的幫助。" -#: ../../tutorial/controlflow.rst:1108 +#: ../../tutorial/controlflow.rst:1109 msgid "" "For Python, :pep:`8` has emerged as the style guide that most projects " "adhere to; it promotes a very readable and eye-pleasing coding style. Every " @@ -2123,11 +2124,11 @@ msgstr "" "對於 Python,大多數的專案都遵循 :pep:`8` 的樣式指南;它推行的編碼樣式相當可讀" "且賞心悅目。每個 Python 開發者都應該花點時間研讀;這裡是該指南的核心重點:" -#: ../../tutorial/controlflow.rst:1113 +#: ../../tutorial/controlflow.rst:1114 msgid "Use 4-space indentation, and no tabs." msgstr "用 4 個空格縮排,不要用 tab 鍵。" -#: ../../tutorial/controlflow.rst:1115 +#: ../../tutorial/controlflow.rst:1116 msgid "" "4 spaces are a good compromise between small indentation (allows greater " "nesting depth) and large indentation (easier to read). Tabs introduce " @@ -2136,11 +2137,11 @@ msgstr "" "4 個空格是小縮排(容許更大的巢套深度)和大縮排(較易閱讀)之間的折衷方案。" "Tab 鍵會造成混亂,最好別用。" -#: ../../tutorial/controlflow.rst:1119 +#: ../../tutorial/controlflow.rst:1120 msgid "Wrap lines so that they don't exceed 79 characters." msgstr "換行,使一行不超過 79 個字元。" -#: ../../tutorial/controlflow.rst:1121 +#: ../../tutorial/controlflow.rst:1122 msgid "" "This helps users with small displays and makes it possible to have several " "code files side-by-side on larger displays." @@ -2148,21 +2149,21 @@ msgstr "" "換行能讓使用小顯示器的使用者方便閱讀,也可以在較大顯示器上並排陳列多個程式碼" "檔案。" -#: ../../tutorial/controlflow.rst:1124 +#: ../../tutorial/controlflow.rst:1125 msgid "" "Use blank lines to separate functions and classes, and larger blocks of code " "inside functions." msgstr "用空行分隔函式和 class(類別),及函式內較大塊的程式碼。" -#: ../../tutorial/controlflow.rst:1127 +#: ../../tutorial/controlflow.rst:1128 msgid "When possible, put comments on a line of their own." msgstr "如果可以,把註解放在單獨一行。" -#: ../../tutorial/controlflow.rst:1129 +#: ../../tutorial/controlflow.rst:1130 msgid "Use docstrings." msgstr "使用說明字串。" -#: ../../tutorial/controlflow.rst:1131 +#: ../../tutorial/controlflow.rst:1132 msgid "" "Use spaces around operators and after commas, but not directly inside " "bracketing constructs: ``a = f(1, 2) + g(3, 4)``." @@ -2170,7 +2171,7 @@ msgstr "" "運算子前後、逗號後要加空格,但不要直接放在括號內側:``a = f(1, 2) + g(3, " "4)``。" -#: ../../tutorial/controlflow.rst:1134 +#: ../../tutorial/controlflow.rst:1135 msgid "" "Name your classes and functions consistently; the convention is to use " "``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for " @@ -2182,7 +2183,7 @@ msgstr "" "底線)。永遠用 ``self`` 作為 method 第一個引數的名稱(關於 class 和 method," "詳見 :ref:`tut-firstclasses`\\ )。" -#: ../../tutorial/controlflow.rst:1139 +#: ../../tutorial/controlflow.rst:1140 msgid "" "Don't use fancy encodings if your code is meant to be used in international " "environments. Python's default, UTF-8, or even plain ASCII work best in any " @@ -2191,7 +2192,7 @@ msgstr "" "若程式碼是為了用於國際環境時,不要用花俏的編碼。Python 預設的 UTF-8 或甚至普" "通的 ASCII,就可以勝任各種情況。" -#: ../../tutorial/controlflow.rst:1143 +#: ../../tutorial/controlflow.rst:1144 msgid "" "Likewise, don't use non-ASCII characters in identifiers if there is only the " "slightest chance people speaking a different language will read or maintain " @@ -2200,11 +2201,11 @@ msgstr "" "同樣地,若不同語言使用者閱讀或維護程式碼的可能性微乎其微,就不要在命名時使用" "非 ASCII 字元。" -#: ../../tutorial/controlflow.rst:1149 +#: ../../tutorial/controlflow.rst:1150 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/controlflow.rst:1150 +#: ../../tutorial/controlflow.rst:1151 msgid "" "Actually, *call by object reference* would be a better description, since if " "a mutable object is passed, the caller will see any changes the callee makes " @@ -2222,15 +2223,15 @@ msgstr "statement(陳述式)" msgid "for" msgstr "for" -#: ../../tutorial/controlflow.rst:477 ../../tutorial/controlflow.rst:1014 +#: ../../tutorial/controlflow.rst:477 ../../tutorial/controlflow.rst:1015 msgid "documentation strings" msgstr "ddocumentation strings(說明字串)" -#: ../../tutorial/controlflow.rst:477 ../../tutorial/controlflow.rst:1014 +#: ../../tutorial/controlflow.rst:477 ../../tutorial/controlflow.rst:1015 msgid "docstrings" msgstr "docstrings(說明字串)" -#: ../../tutorial/controlflow.rst:477 ../../tutorial/controlflow.rst:1014 +#: ../../tutorial/controlflow.rst:477 ../../tutorial/controlflow.rst:1015 msgid "strings, documentation" msgstr "strings(字串), documentation(說明文件)" @@ -2246,31 +2247,31 @@ msgstr "於函式呼叫中" msgid "**" msgstr "**" -#: ../../tutorial/controlflow.rst:1066 +#: ../../tutorial/controlflow.rst:1067 msgid "function" msgstr "function(函式)" -#: ../../tutorial/controlflow.rst:1066 +#: ../../tutorial/controlflow.rst:1067 msgid "annotations" msgstr "annotations(註釋)" -#: ../../tutorial/controlflow.rst:1066 +#: ../../tutorial/controlflow.rst:1067 msgid "->" msgstr "->" -#: ../../tutorial/controlflow.rst:1066 +#: ../../tutorial/controlflow.rst:1067 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../tutorial/controlflow.rst:1066 +#: ../../tutorial/controlflow.rst:1067 msgid ": (colon)" msgstr ": (冒號)" -#: ../../tutorial/controlflow.rst:1100 +#: ../../tutorial/controlflow.rst:1101 msgid "coding" msgstr "coding(程式編寫)" -#: ../../tutorial/controlflow.rst:1100 +#: ../../tutorial/controlflow.rst:1101 msgid "style" msgstr "style(風格)" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index 6413962e02..e862c7941b 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-05-18 00:18+0000\n" "PO-Revision-Date: 2023-06-26 03:02+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,8 +32,8 @@ msgstr "Pablo Galindo Salgado" #: ../../whatsnew/3.10.rst:47 msgid "" "This article explains the new features in Python 3.10, compared to 3.9. " -"Python 3.10 was released on October 4, 2021. For full details, see " -"the :ref:`changelog `." +"Python 3.10 was released on October 4, 2021. For full details, see the :ref:" +"`changelog `." msgstr "" "本文介紹了 Python 3.10 與 3.9 相比多了哪些新功能。Python 3.10 已於 2021 年 " "10 月 4 日發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" @@ -125,7 +125,7 @@ msgstr ":pep:`624`,刪除 Py_UNICODE 編碼器 API" msgid ":pep:`597`, Add optional EncodingWarning" msgstr ":pep:`597`,新增可選的 EncodingWarning" -#: ../../whatsnew/3.10.rst:92 ../../whatsnew/3.10.rst:2053 +#: ../../whatsnew/3.10.rst:92 ../../whatsnew/3.10.rst:2054 msgid "New Features" msgstr "新增功能" @@ -216,15 +216,15 @@ msgstr "" #: ../../whatsnew/3.10.rst:142 msgid "" -"This new syntax uses the non LL(1) capacities of the new parser. " -"Check :pep:`617` for more details." +"This new syntax uses the non LL(1) capacities of the new parser. Check :pep:" +"`617` for more details." msgstr "" "此新語法使用新剖析器的非 LL(1) 功能。檢查 :pep:`617` 了解更多詳細資訊。" #: ../../whatsnew/3.10.rst:145 msgid "" -"(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou " -"in :issue:`12782` and :issue:`40334`.)" +"(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou in :" +"issue:`12782` and :issue:`40334`.)" msgstr "" "(由 Guido van Rossum、Pablo Galindo 和 Lysandros Nikolaou 在 :issue:`12782` " "和 :issue:`40334` 中貢獻。)" @@ -309,8 +309,8 @@ msgstr "這些改進是受到 PyPy 直譯器的啟發。" #: ../../whatsnew/3.10.rst:191 msgid "" -"(Contributed by Pablo Galindo in :issue:`42864` and Batuhan Taskaya " -"in :issue:`40176`.)" +"(Contributed by Pablo Galindo in :issue:`42864` and Batuhan Taskaya in :" +"issue:`40176`.)" msgstr "" "(由 Pablo Galindo 在 :issue:`42864` 和 Batuhan Taskaya 在 :issue:`40176` 中" "貢獻。)" @@ -718,12 +718,12 @@ msgstr "影格 (frame) 物件的 :attr:`~frame.f_lineno` 屬性總會包含預 msgid "" "The :attr:`~codeobject.co_lnotab` attribute of :ref:`code objects ` is deprecated and will be removed in 3.12. Code that needs to " -"convert from offset to line number should use the " -"new :meth:`~codeobject.co_lines` method instead." +"convert from offset to line number should use the new :meth:`~codeobject." +"co_lines` method instead." msgstr "" ":ref:`程式碼物件 `\\ 的 :attr:`~codeobject.co_lnotab` 屬性已棄" -"用,並將在 3.12 中刪除。需要從偏移量轉換為列號的程式碼應使用新" -"的 :meth:`~codeobject.co_lines` 方法。" +"用,並將在 3.12 中刪除。需要從偏移量轉換為列號的程式碼應使用新的 :meth:" +"`~codeobject.co_lines` 方法。" #: ../../whatsnew/3.10.rst:412 msgid "PEP 634: Structural Pattern Matching" @@ -987,10 +987,11 @@ msgid "Patterns and classes" msgstr "模式和類別" #: ../../whatsnew/3.10.rst:552 +#, fuzzy msgid "" "If you are using classes to structure your data, you can use as a pattern " "the class name followed by an argument list resembling a constructor. This " -"pattern has the ability to capture class attributes into variables::" +"pattern has the ability to capture instance attributes into variables::" msgstr "" "如果你使用類別來建構資料,則可以用類別名稱與後面的引數列表組合成的建構函式作" "為模式。該模式能夠將類別屬性捕獲到變數中: ::" @@ -998,8 +999,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:556 msgid "" "class Point:\n" -" x: int\n" -" y: int\n" +" def __init__(self, x, y):\n" +" self.x = x\n" +" self.y = y\n" "\n" "def location(point):\n" " match point:\n" @@ -1015,11 +1017,11 @@ msgid "" " print(\"Not a point\")" msgstr "" -#: ../../whatsnew/3.10.rst:574 +#: ../../whatsnew/3.10.rst:575 msgid "Patterns with positional parameters" msgstr "具有位置參數的模式" -#: ../../whatsnew/3.10.rst:576 +#: ../../whatsnew/3.10.rst:577 msgid "" "You can use positional parameters with some builtin classes that provide an " "ordering for their attributes (e.g. dataclasses). You can also define a " @@ -1033,7 +1035,7 @@ msgstr "" "置。如果它被設定為 (\"x\", \"y\"),則以下模式都是等效的(且都將 ``y`` 屬性繫" "結到 ``var`` 變數): ::" -#: ../../whatsnew/3.10.rst:582 +#: ../../whatsnew/3.10.rst:583 msgid "" "Point(1, var)\n" "Point(1, y=var)\n" @@ -1045,11 +1047,11 @@ msgstr "" "Point(x=1, y=var)\n" "Point(y=var, x=1)" -#: ../../whatsnew/3.10.rst:588 +#: ../../whatsnew/3.10.rst:589 msgid "Nested patterns" msgstr "巢狀模式" -#: ../../whatsnew/3.10.rst:590 +#: ../../whatsnew/3.10.rst:591 msgid "" "Patterns can be arbitrarily nested. For example, if our data is a short " "list of points, it could be matched like this::" @@ -1057,7 +1059,7 @@ msgstr "" "模式可以任意巢套。例如,如果我們的資料是一個簡短的座標點列表,則可以這樣匹" "配: ::" -#: ../../whatsnew/3.10.rst:593 +#: ../../whatsnew/3.10.rst:594 msgid "" "match points:\n" " case []:\n" @@ -1072,11 +1074,11 @@ msgid "" " print(\"Something else is found in the list.\")" msgstr "" -#: ../../whatsnew/3.10.rst:606 +#: ../../whatsnew/3.10.rst:607 msgid "Complex patterns and the wildcard" msgstr "複雜模式和萬用字元" -#: ../../whatsnew/3.10.rst:608 +#: ../../whatsnew/3.10.rst:609 msgid "" "To this point, the examples have used ``_`` alone in the last case " "statement. A wildcard can be used in more complex patterns, such as " @@ -1085,7 +1087,7 @@ msgstr "" "到目前為止,範例在最後一個 case 陳述式中單獨使用了 ``_``。萬用字元可以用在更" "複雜的模式中,像是 ``('error', code, _)``。例如: ::" -#: ../../whatsnew/3.10.rst:612 +#: ../../whatsnew/3.10.rst:613 msgid "" "match test_variable:\n" " case ('warning', code, 40):\n" @@ -1094,7 +1096,7 @@ msgid "" " print(f\"An error {code} occurred.\")" msgstr "" -#: ../../whatsnew/3.10.rst:618 +#: ../../whatsnew/3.10.rst:619 msgid "" "In the above case, ``test_variable`` will match for ('error', code, 100) and " "('error', code, 800)." @@ -1102,11 +1104,11 @@ msgstr "" "在上述情況下,值像是 ('error', code, 100) 和 ('error', code, 800) 的 " "``test_variable`` 將會成功匹配。" -#: ../../whatsnew/3.10.rst:622 +#: ../../whatsnew/3.10.rst:623 msgid "Guard" msgstr "Guard" -#: ../../whatsnew/3.10.rst:624 +#: ../../whatsnew/3.10.rst:625 msgid "" "We can add an ``if`` clause to a pattern, known as a \"guard\". If the " "guard is false, ``match`` goes on to try the next case block. Note that " @@ -1116,7 +1118,7 @@ msgstr "" "則 ``match`` 會繼續嘗試下一個 case 區塊。請注意,值的捕獲發生在 guard 的求值 " "(evaluate) 之前: ::" -#: ../../whatsnew/3.10.rst:628 +#: ../../whatsnew/3.10.rst:629 msgid "" "match point:\n" " case Point(x, y) if x == y:\n" @@ -1125,15 +1127,15 @@ msgid "" " print(f\"Point is not on the diagonal.\")" msgstr "" -#: ../../whatsnew/3.10.rst:635 +#: ../../whatsnew/3.10.rst:636 msgid "Other Key Features" msgstr "其他主要功能" -#: ../../whatsnew/3.10.rst:637 +#: ../../whatsnew/3.10.rst:638 msgid "Several other key features:" msgstr "其他幾個主要功能:" -#: ../../whatsnew/3.10.rst:639 +#: ../../whatsnew/3.10.rst:640 msgid "" "Like unpacking assignments, tuple and list patterns have exactly the same " "meaning and actually match arbitrary sequences. Technically, the subject " @@ -1145,7 +1147,7 @@ msgstr "" "列。從技術上來說,主語必須是一個序列。因此,一個重要的例外是模式不會去匹配疊" "代器。另外,為了防止常常出錯,序列模式也不會去匹配字串。" -#: ../../whatsnew/3.10.rst:645 +#: ../../whatsnew/3.10.rst:646 msgid "" "Sequence patterns support wildcards: ``[x, y, *rest]`` and ``(x, y, *rest)`` " "work similar to wildcards in unpacking assignments. The name after ``*`` " @@ -1156,7 +1158,7 @@ msgstr "" "用字元類似。 ``*`` 後面的名稱也可能是 ``_``,因此 ``(x, y, *_)`` 會匹配至少兩" "個項目的序列,且不繫結其餘項目。" -#: ../../whatsnew/3.10.rst:650 +#: ../../whatsnew/3.10.rst:651 msgid "" "Mapping patterns: ``{\"bandwidth\": b, \"latency\": l}`` captures the " "``\"bandwidth\"`` and ``\"latency\"`` values from a dict. Unlike sequence " @@ -1167,15 +1169,15 @@ msgstr "" "``\"bandwidth\"`` 和 ``\"latency\"`` 值。與序列模式不同,額外的鍵將被忽略。也" "支援萬用字元 ``**rest``。(但是 ``**_`` 是多餘的,所以是不允許的。)" -#: ../../whatsnew/3.10.rst:655 +#: ../../whatsnew/3.10.rst:656 msgid "Subpatterns may be captured using the ``as`` keyword::" msgstr "可以使用 ``as`` 關鍵字捕獲子模式: ::" -#: ../../whatsnew/3.10.rst:657 +#: ../../whatsnew/3.10.rst:658 msgid "case (Point(x1, y1), Point(x2, y2) as p2): ..." msgstr "case (Point(x1, y1), Point(x2, y2) as p2): ..." -#: ../../whatsnew/3.10.rst:659 +#: ../../whatsnew/3.10.rst:660 msgid "" "This binds x1, y1, x2, y2 like you would expect without the ``as`` clause, " "and p2 to the entire second item of the subject." @@ -1183,7 +1185,7 @@ msgstr "" "這將繫結 x1、y1、x2、y2,如同沒有 ``as`` 子句的情況下所預期的,並將 p2 繫結到" "主語的整個第二項目。" -#: ../../whatsnew/3.10.rst:662 +#: ../../whatsnew/3.10.rst:663 msgid "" "Most literals are compared by equality. However, the singletons ``True``, " "``False`` and ``None`` are compared by identity." @@ -1191,7 +1193,7 @@ msgstr "" "大多數字面值都是通過相等進行比較的。然而,單例 ``True``、``False`` 和 " "``None`` 是按標識值 (identity) 來進行比較的。" -#: ../../whatsnew/3.10.rst:665 +#: ../../whatsnew/3.10.rst:666 msgid "" "Named constants may be used in patterns. These named constants must be " "dotted names to prevent the constant from being interpreted as a capture " @@ -1200,7 +1202,7 @@ msgstr "" "附名常數 (named constant) 可以在模式中使用。這些附名常數必須有帶有點的名稱 " "(dotted name),以防止常數被直譯為捕獲的變數: ::" -#: ../../whatsnew/3.10.rst:669 +#: ../../whatsnew/3.10.rst:670 msgid "" "from enum import Enum\n" "class Color(Enum):\n" @@ -1218,19 +1220,19 @@ msgid "" " print(\"I'm feeling the blues :(\")" msgstr "" -#: ../../whatsnew/3.10.rst:684 +#: ../../whatsnew/3.10.rst:685 msgid "" -"For the full specification see :pep:`634`. Motivation and rationale are " -"in :pep:`635`, and a longer tutorial is in :pep:`636`." +"For the full specification see :pep:`634`. Motivation and rationale are in :" +"pep:`635`, and a longer tutorial is in :pep:`636`." msgstr "" "有關完整規範,請參閱 :pep:`634`。動機和基本原理位於 :pep:`635` 中,較完整的教" "學位於 :pep:`636` 中。" -#: ../../whatsnew/3.10.rst:691 +#: ../../whatsnew/3.10.rst:692 msgid "Optional ``EncodingWarning`` and ``encoding=\"locale\"`` option" msgstr "可選的 ``EncodingWarning`` 和 ``encoding=\"locale\"`` 選項" -#: ../../whatsnew/3.10.rst:693 +#: ../../whatsnew/3.10.rst:694 msgid "" "The default encoding of :class:`~io.TextIOWrapper` and :func:`open` is " "platform and locale dependent. Since UTF-8 is used on most Unix platforms, " @@ -1241,24 +1243,24 @@ msgstr "" "於大多數 Unix 平台都使用 UTF-8,因此在打開 UTF-8 檔案(例如 JSON、YAML、" "TOML、Markdown)時省略 ``encoding`` 選項是個常見的 bug,例如: ::" -#: ../../whatsnew/3.10.rst:698 +#: ../../whatsnew/3.10.rst:699 msgid "" "# BUG: \"rb\" mode or encoding=\"utf-8\" should be used.\n" "with open(\"data.json\") as f:\n" " data = json.load(f)" msgstr "" -#: ../../whatsnew/3.10.rst:702 +#: ../../whatsnew/3.10.rst:703 msgid "" "To find this type of bug, an optional ``EncodingWarning`` is added. It is " "emitted when :data:`sys.flags.warn_default_encoding ` is true and " "locale-specific default encoding is used." msgstr "" -"為了發現這種錯誤,新增了一個可選的 ``EncodingWarning``。" -"當 :data:`sys.flags.warn_default_encoding ` 為 true 且使用特定於語" -"言環境的預設編碼時,會發出該信號。" +"為了發現這種錯誤,新增了一個可選的 ``EncodingWarning``。當 :data:`sys.flags." +"warn_default_encoding ` 為 true 且使用特定於語言環境的預設編碼時," +"會發出該信號。" -#: ../../whatsnew/3.10.rst:706 +#: ../../whatsnew/3.10.rst:707 msgid "" "``-X warn_default_encoding`` option and :envvar:`PYTHONWARNDEFAULTENCODING` " "are added to enable the warning." @@ -1266,43 +1268,43 @@ msgstr "" "新增 ``-X warn_default_encoding`` 選項和 :envvar:`PYTHONWARNDEFAULTENCODING` " "來啟用警告。" -#: ../../whatsnew/3.10.rst:709 +#: ../../whatsnew/3.10.rst:710 msgid "See :ref:`io-text-encoding` for more information." msgstr "更多資訊請見 :ref:`io-text-encoding`。" -#: ../../whatsnew/3.10.rst:714 +#: ../../whatsnew/3.10.rst:715 msgid "New Features Related to Type Hints" msgstr "與型別提示相關的新功能" -#: ../../whatsnew/3.10.rst:716 +#: ../../whatsnew/3.10.rst:717 msgid "" -"This section covers major changes affecting :pep:`484` type hints and " -"the :mod:`typing` module." +"This section covers major changes affecting :pep:`484` type hints and the :" +"mod:`typing` module." msgstr "本節介紹影響 :pep:`484` 型別提示和 :mod:`typing` 模組的主要更改。" -#: ../../whatsnew/3.10.rst:721 +#: ../../whatsnew/3.10.rst:722 msgid "PEP 604: New Type Union Operator" msgstr "PEP 604:新型聯集運算子" -#: ../../whatsnew/3.10.rst:723 +#: ../../whatsnew/3.10.rst:724 msgid "" "A new type union operator was introduced which enables the syntax ``X | Y``. " "This provides a cleaner way of expressing 'either type X or type Y' instead " "of using :data:`typing.Union`, especially in type hints." msgstr "" "引入了一種新的聯集運算子,該運算子啟用像是 ``X | Y`` 的語法。這提供了一種在型" -"別提示中更清晰的方式來表達「型別 X 或型別 Y」,來取代使" -"用 :data:`typing.Union`。" +"別提示中更清晰的方式來表達「型別 X 或型別 Y」,來取代使用 :data:`typing." +"Union`。" -#: ../../whatsnew/3.10.rst:727 +#: ../../whatsnew/3.10.rst:728 msgid "" "In previous versions of Python, to apply a type hint for functions accepting " "arguments of multiple types, :data:`typing.Union` was used::" msgstr "" -"在以前版本的 Python 中,要使用接受多種型別參數之型別提示的函式,要使" -"用 :data:`typing.Union`: ::" +"在以前版本的 Python 中,要使用接受多種型別參數之型別提示的函式,要使用 :data:" +"`typing.Union`: ::" -#: ../../whatsnew/3.10.rst:730 +#: ../../whatsnew/3.10.rst:731 msgid "" "def square(number: Union[int, float]) -> Union[int, float]:\n" " return number ** 2" @@ -1310,11 +1312,11 @@ msgstr "" "def square(number: Union[int, float]) -> Union[int, float]:\n" " return number ** 2" -#: ../../whatsnew/3.10.rst:734 +#: ../../whatsnew/3.10.rst:735 msgid "Type hints can now be written in a more succinct manner::" msgstr "現在可以用更簡潔的方式編寫型別提示: ::" -#: ../../whatsnew/3.10.rst:736 +#: ../../whatsnew/3.10.rst:737 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -1322,15 +1324,15 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../whatsnew/3.10.rst:740 +#: ../../whatsnew/3.10.rst:741 msgid "" -"This new syntax is also accepted as the second argument " -"to :func:`isinstance` and :func:`issubclass`::" +"This new syntax is also accepted as the second argument to :func:" +"`isinstance` and :func:`issubclass`::" msgstr "" "這種新語法也接受作為 :func:`isinstance` 和 :func:`issubclass` 的第二個引" "數: ::" -#: ../../whatsnew/3.10.rst:743 +#: ../../whatsnew/3.10.rst:744 msgid "" ">>> isinstance(1, int | str)\n" "True" @@ -1338,11 +1340,11 @@ msgstr "" ">>> isinstance(1, int | str)\n" "True" -#: ../../whatsnew/3.10.rst:746 +#: ../../whatsnew/3.10.rst:747 msgid "See :ref:`types-union` and :pep:`604` for more details." msgstr "更多資訊請見 :ref:`types-union` 與 :pep:`604`。" -#: ../../whatsnew/3.10.rst:748 +#: ../../whatsnew/3.10.rst:749 msgid "" "(Contributed by Maggie Moss and Philippe Prados in :issue:`41428`, with " "additions by Yurii Karabas and Serhiy Storchaka in :issue:`44490`.)" @@ -1350,11 +1352,11 @@ msgstr "" "(由 Maggie Moss 和 Philippe Prados 在 :issue:`41428` 中貢獻,由 Yurii " "Karabas 和 Serhiy Storchaka 在 :issue:`44490` 中補充。)" -#: ../../whatsnew/3.10.rst:753 +#: ../../whatsnew/3.10.rst:754 msgid "PEP 612: Parameter Specification Variables" msgstr "PEP 612:參數規範變數" -#: ../../whatsnew/3.10.rst:755 +#: ../../whatsnew/3.10.rst:756 msgid "" "Two new options to improve the information provided to static type checkers " "for :pep:`484`\\ 's ``Callable`` have been added to the :mod:`typing` module." @@ -1362,7 +1364,7 @@ msgstr "" ":mod:`typing` 模組中新增了兩個新選項,用於改進為 :pep:`484` ``Callable`` 的靜" "態型別檢查器 (static type checker) 所提供的資訊。" -#: ../../whatsnew/3.10.rst:758 +#: ../../whatsnew/3.10.rst:759 msgid "" "The first is the parameter specification variable. They are used to forward " "the parameter types of one callable to another callable -- a pattern " @@ -1375,7 +1377,7 @@ msgstr "" "用範例可以在 :class:`typing.ParamSpec` 中找到。在過去是沒有簡單的方法可以如此" "精確地來為參數型別的依賴關係做型別註釋。" -#: ../../whatsnew/3.10.rst:764 +#: ../../whatsnew/3.10.rst:765 msgid "" "The second option is the new ``Concatenate`` operator. It's used in " "conjunction with parameter specification variables to type annotate a higher " @@ -1386,16 +1388,17 @@ msgstr "" "階、會新增或刪除另一個可呼叫物件參數的可呼叫物件進行型別註釋。使用範例可以" "在 :class:`typing.Concatenate` 中找到。" -#: ../../whatsnew/3.10.rst:769 +#: ../../whatsnew/3.10.rst:770 msgid "" -"See :class:`typing.Callable`, :class:`typing.ParamSpec`, :class:`typing.Concatenate`, :class:`typing.ParamSpecArgs`, :class:`typing.ParamSpecKwargs`, " -"and :pep:`612` for more details." +"See :class:`typing.Callable`, :class:`typing.ParamSpec`, :class:`typing." +"Concatenate`, :class:`typing.ParamSpecArgs`, :class:`typing." +"ParamSpecKwargs`, and :pep:`612` for more details." msgstr "" -"請參" -"閱 :class:`typing.Callable`、:class:`typing.ParamSpec`、:class:`typing.Concatenate`、:class:`typing.ParamSpecArgs`、:class:`typing.ParamSpecKwargs` " +"請參閱 :class:`typing.Callable`、:class:`typing.ParamSpec`、:class:`typing." +"Concatenate`、:class:`typing.ParamSpecArgs`、:class:`typing.ParamSpecKwargs` " "和 :pep:`612` 以了解更多詳情。" -#: ../../whatsnew/3.10.rst:773 +#: ../../whatsnew/3.10.rst:774 msgid "" "(Contributed by Ken Jin in :issue:`41559`, with minor enhancements by Jelle " "Zijlstra in :issue:`43783`. PEP written by Mark Mendoza.)" @@ -1403,11 +1406,11 @@ msgstr "" "(由 Ken Jin 在 :issue:`41559` 中貢獻、Jelle Zijlstra 在 :issue:`43783` 中進" "行了小幅改進。PEP 由 Mark Mendoza 編寫。)" -#: ../../whatsnew/3.10.rst:778 +#: ../../whatsnew/3.10.rst:779 msgid "PEP 613: TypeAlias" msgstr "PEP 613:型別別名 (TypeAlias)" -#: ../../whatsnew/3.10.rst:780 +#: ../../whatsnew/3.10.rst:781 msgid "" ":pep:`484` introduced the concept of type aliases, only requiring them to be " "top-level unannotated assignments. This simplicity sometimes made it " @@ -1420,13 +1423,13 @@ msgstr "" "型別別名和普通賦值,尤其是在涉及傳遞參照 (reference) 或無效型別時。比較如" "下: ::" -#: ../../whatsnew/3.10.rst:785 +#: ../../whatsnew/3.10.rst:786 msgid "" "StrCache = 'Cache[str]' # a type alias\n" "LOG_PREFIX = 'LOG[DEBUG]' # a module constant" msgstr "" -#: ../../whatsnew/3.10.rst:788 +#: ../../whatsnew/3.10.rst:789 msgid "" "Now the :mod:`typing` module has a special value :data:`~typing.TypeAlias` " "which lets you declare type aliases more explicitly::" @@ -1434,36 +1437,36 @@ msgstr "" "現在 :mod:`typing` 模組有一個特殊值 :data:`~typing.TypeAlias`,它可以讓你更明" "確地宣告型別別名: ::" -#: ../../whatsnew/3.10.rst:791 +#: ../../whatsnew/3.10.rst:792 msgid "" "StrCache: TypeAlias = 'Cache[str]' # a type alias\n" "LOG_PREFIX = 'LOG[DEBUG]' # a module constant" msgstr "" -#: ../../whatsnew/3.10.rst:794 +#: ../../whatsnew/3.10.rst:795 msgid "See :pep:`613` for more details." msgstr "更多資訊請見 :pep:`613`。" -#: ../../whatsnew/3.10.rst:796 +#: ../../whatsnew/3.10.rst:797 msgid "(Contributed by Mikhail Golubev in :issue:`41923`.)" msgstr "(由 Mikhail Golubev 在 :issue:`41923` 中貢獻。)" -#: ../../whatsnew/3.10.rst:799 +#: ../../whatsnew/3.10.rst:800 msgid "PEP 647: User-Defined Type Guards" msgstr "PEP 647:使用者定義的型別防護" -#: ../../whatsnew/3.10.rst:801 +#: ../../whatsnew/3.10.rst:802 msgid "" ":data:`~typing.TypeGuard` has been added to the :mod:`typing` module to " "annotate type guard functions and improve information provided to static " -"type checkers during type narrowing. For more information, please " -"see :data:`~typing.TypeGuard`\\ 's documentation, and :pep:`647`." +"type checkers during type narrowing. For more information, please see :data:" +"`~typing.TypeGuard`\\ 's documentation, and :pep:`647`." msgstr "" ":data:`~typing.TypeGuard`\\ (型別防護)已新增到 :mod:`typing` 模組中,用以註" "釋型別防護函式並改進在型別窄縮 (type narrowing) 期間提供給靜態型別檢查器的資" "訊。有關更多資訊,請參閱 :data:`~typing.TypeGuard` 的文件和 :pep:`647`。" -#: ../../whatsnew/3.10.rst:806 +#: ../../whatsnew/3.10.rst:807 msgid "" "(Contributed by Ken Jin and Guido van Rossum in :issue:`43766`. PEP written " "by Eric Traut.)" @@ -1471,33 +1474,33 @@ msgstr "" "(由 Ken Jin 和 Guido van Rossum 在 :issue:`43766` 中貢獻。PEP 由 Eric Traut " "編寫。)" -#: ../../whatsnew/3.10.rst:810 +#: ../../whatsnew/3.10.rst:811 msgid "Other Language Changes" msgstr "其他語言更動" -#: ../../whatsnew/3.10.rst:812 +#: ../../whatsnew/3.10.rst:813 msgid "" "The :class:`int` type has a new method :meth:`int.bit_count`, returning the " "number of ones in the binary expansion of a given integer, also known as the " "population count. (Contributed by Niklas Fiekas in :issue:`29882`.)" msgstr "" ":class:`int` 型別有一個新方法 :meth:`int.bit_count`,回傳給定整數的二進位展開" -"式中 1 的數量,也稱為總體計數 (population count)。(由 Niklas Fiekas " -"在 :issue:`29882` 中貢獻。)" +"式中 1 的數量,也稱為總體計數 (population count)。(由 Niklas Fiekas 在 :" +"issue:`29882` 中貢獻。)" -#: ../../whatsnew/3.10.rst:816 +#: ../../whatsnew/3.10.rst:817 msgid "" -"The views returned by :meth:`dict.keys`, :meth:`dict.values` " -"and :meth:`dict.items` now all have a ``mapping`` attribute that gives " -"a :class:`types.MappingProxyType` object wrapping the original dictionary. " -"(Contributed by Dennis Sweeney in :issue:`40890`.)" +"The views returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:`dict." +"items` now all have a ``mapping`` attribute that gives a :class:`types." +"MappingProxyType` object wrapping the original dictionary. (Contributed by " +"Dennis Sweeney in :issue:`40890`.)" msgstr "" ":meth:`dict.keys`、:meth:`dict.values` 和 :meth:`dict.items` 回傳的視圖 " -"(view) 現在都有一個 ``mapping`` 屬性,該屬性提" -"供 :class:`types.MappingProxyType` 包裝原始的字典物件。(由 Dennis Sweeney " -"在 :issue:`40890` 中貢獻。)" +"(view) 現在都有一個 ``mapping`` 屬性,該屬性提供 :class:`types." +"MappingProxyType` 包裝原始的字典物件。(由 Dennis Sweeney 在 :issue:`40890` " +"中貢獻。)" -#: ../../whatsnew/3.10.rst:821 +#: ../../whatsnew/3.10.rst:822 msgid "" ":pep:`618`: The :func:`zip` function now has an optional ``strict`` flag, " "used to require that all the iterables have an equal length." @@ -1505,22 +1508,20 @@ msgstr "" ":pep:`618`::func:`zip` 函式現在有一個可選的 ``strict`` 旗標,用於要求所有可" "疊代物件具有相同的長度。" -#: ../../whatsnew/3.10.rst:824 +#: ../../whatsnew/3.10.rst:825 msgid "" "Builtin and extension functions that take integer arguments no longer " "accept :class:`~decimal.Decimal`\\ s, :class:`~fractions.Fraction`\\ s and " "other objects that can be converted to integers only with a loss (e.g. that " -"have the :meth:`~object.__int__` method but do not have " -"the :meth:`~object.__index__` method). (Contributed by Serhiy Storchaka " -"in :issue:`37999`.)" -msgstr "" -"採用整數引數的內建函式和擴充函式不再接" -"受 :class:`~decimal.Decimal`、:class:`~fractions.Fraction` 以及其他只能在有損" -"失的情況下轉換為整數的物件(例如有 :meth:`~object.__int__` 方法,但沒" -"有 :meth:`~object.__index__` 方法)。(由 Serhiy Storchaka 在 :issue:`37999` " -"中貢獻。)" +"have the :meth:`~object.__int__` method but do not have the :meth:`~object." +"__index__` method). (Contributed by Serhiy Storchaka in :issue:`37999`.)" +msgstr "" +"採用整數引數的內建函式和擴充函式不再接受 :class:`~decimal.Decimal`、:class:" +"`~fractions.Fraction` 以及其他只能在有損失的情況下轉換為整數的物件(例如有 :" +"meth:`~object.__int__` 方法,但沒有 :meth:`~object.__index__` 方法)。(由 " +"Serhiy Storchaka 在 :issue:`37999` 中貢獻。)" -#: ../../whatsnew/3.10.rst:831 +#: ../../whatsnew/3.10.rst:832 msgid "" "If :func:`object.__ipow__` returns :data:`NotImplemented`, the operator will " "correctly fall back to :func:`object.__pow__` and :func:`object.__rpow__` as " @@ -1530,7 +1531,7 @@ msgstr "" "正確回退到 :func:`object.__pow__` 和 :func:`object.__rpow__` 。(由 Alex " "Shkop 在 :issue:`38302` 中貢獻。)" -#: ../../whatsnew/3.10.rst:835 +#: ../../whatsnew/3.10.rst:836 msgid "" "Assignment expressions can now be used unparenthesized within set literals " "and set comprehensions, as well as in sequence indexes (but not slices)." @@ -1538,7 +1539,7 @@ msgstr "" "現在可以在集合字面值 (set literals) 和集合綜合運算 (set comprehensions) 以及" "序列索引(但不能是切片)中使用不帶括號的賦值運算式 (assignment expressions)。" -#: ../../whatsnew/3.10.rst:838 +#: ../../whatsnew/3.10.rst:839 msgid "" "Functions have a new ``__builtins__`` attribute which is used to look for " "builtin symbols when a function is executed, instead of looking into " @@ -1551,44 +1552,44 @@ msgstr "" "存在,則屬性會以此做初始化,否則從目前內建物件 (builtins) 初始化。(由 Mark " "Shannon 在 :issue:`42990` 中貢獻。)" -#: ../../whatsnew/3.10.rst:844 +#: ../../whatsnew/3.10.rst:845 msgid "" "Two new builtin functions -- :func:`aiter` and :func:`anext` have been added " "to provide asynchronous counterparts to :func:`iter` and :func:`next`, " "respectively. (Contributed by Joshua Bronson, Daniel Pope, and Justin Wang " "in :issue:`31861`.)" msgstr "" -"新增兩個內建函式 -- :func:`aiter` 和 :func:`anext`,分別為 :func:`iter` " -"和 :func:`next` 提供非同步的對應函式。(由 Joshua Bronson、Daniel Pope 和 " -"Justin Wang 在 :issue:`31861` 中貢獻。)" +"新增兩個內建函式 -- :func:`aiter` 和 :func:`anext`,分別為 :func:`iter` 和 :" +"func:`next` 提供非同步的對應函式。(由 Joshua Bronson、Daniel Pope 和 Justin " +"Wang 在 :issue:`31861` 中貢獻。)" -#: ../../whatsnew/3.10.rst:849 +#: ../../whatsnew/3.10.rst:850 msgid "" -"Static methods (:func:`@staticmethod `) and class methods " -"(:func:`@classmethod `) now inherit the method attributes " +"Static methods (:func:`@staticmethod `) and class methods (:" +"func:`@classmethod `) now inherit the method attributes " "(``__module__``, ``__name__``, ``__qualname__``, ``__doc__``, " "``__annotations__``) and have a new ``__wrapped__`` attribute. Moreover, " "static methods are now callable as regular functions. (Contributed by Victor " "Stinner in :issue:`43682`.)" msgstr "" -"靜態方法 (:func:`@staticmethod `) 和類別方法 " -"(:func:`@classmethod `) 現在繼承方法屬性 (``__module__``, " +"靜態方法 (:func:`@staticmethod `) 和類別方法 (:func:" +"`@classmethod `) 現在繼承方法屬性 (``__module__``, " "``__name__``, ``__qualname__``, ``__doc__``, ``__annotations__``) 並有一個新" "的 ``__wrapped__`` 屬性。此外,靜態方法現在可以像是常規函式般呼叫。(由 " "Victor Stinner 在 :issue:`43682` 中貢獻。)" -#: ../../whatsnew/3.10.rst:856 +#: ../../whatsnew/3.10.rst:857 msgid "" "Annotations for complex targets (everything beside ``simple name`` targets " "defined by :pep:`526`) no longer cause any runtime effects with ``from " -"__future__ import annotations``. (Contributed by Batuhan Taskaya " -"in :issue:`42737`.)" +"__future__ import annotations``. (Contributed by Batuhan Taskaya in :issue:" +"`42737`.)" msgstr "" "複雜目標(除 :pep:`526` 定義的 ``simple name`` 目標之外的所有內容)的註釋不再" "使用 ``from __future__ import comments`` 造成任何執行環境 (runtime) 影響。" "(由 Batuhan Taskaya 在 :issue:`42737` 中貢獻。)" -#: ../../whatsnew/3.10.rst:860 +#: ../../whatsnew/3.10.rst:861 msgid "" "Class and module objects now lazy-create empty annotations dicts on demand. " "The annotations dicts are stored in the object’s ``__dict__`` for backwards " @@ -1598,21 +1599,21 @@ msgid "" msgstr "" "類別和模組物件現在會根據需求來延遲建立 (lazy-create) 空的註釋字典 " "(annotations dicts)。註釋字典存儲在物件的 ``__dict__`` 中以達成向後相容性。這" -"改進了 ``__annotations__`` 使用方式的最佳實踐方法;有關更多資訊,請參" -"閱 :ref:`annotations-howto`。(由 Larry Hastings 在 :issue:`43901` 中貢獻。)" +"改進了 ``__annotations__`` 使用方式的最佳實踐方法;有關更多資訊,請參閱 :ref:" +"`annotations-howto`。(由 Larry Hastings 在 :issue:`43901` 中貢獻。)" -#: ../../whatsnew/3.10.rst:867 +#: ../../whatsnew/3.10.rst:868 msgid "" "Annotations consist of ``yield``, ``yield from``, ``await`` or named " "expressions are now forbidden under ``from __future__ import annotations`` " -"due to their side effects. (Contributed by Batuhan Taskaya " -"in :issue:`42725`.)" +"due to their side effects. (Contributed by Batuhan Taskaya in :issue:" +"`42725`.)" msgstr "" "附名運算式或由 ``yield``、``yield from``、``await`` 組成的註釋現在在 ``from " "__future__ import comments`` 下被禁止,因為它們有些不預期的行為。(由 " "Batuhan Taskaya 在 :issue:`42725` 中貢獻。)" -#: ../../whatsnew/3.10.rst:872 +#: ../../whatsnew/3.10.rst:873 msgid "" "Usage of unbound variables, ``super()`` and other expressions that might " "alter the processing of symbol table as annotations are now rendered " @@ -1623,14 +1624,14 @@ msgstr "" "(symbol table) 的運算式,現在在 ``from __future__ import comments`` 下變得無" "效。(由 Batuhan Taskaya 在 :issue:`42725` 中貢獻。)" -#: ../../whatsnew/3.10.rst:877 +#: ../../whatsnew/3.10.rst:878 msgid "" -"Hashes of NaN values of both :class:`float` type " -"and :class:`decimal.Decimal` type now depend on object identity. Formerly, " -"they always hashed to ``0`` even though NaN values are not equal to one " -"another. This caused potentially quadratic runtime behavior due to excessive " -"hash collisions when creating dictionaries and sets containing multiple " -"NaNs. (Contributed by Raymond Hettinger in :issue:`43475`.)" +"Hashes of NaN values of both :class:`float` type and :class:`decimal." +"Decimal` type now depend on object identity. Formerly, they always hashed to " +"``0`` even though NaN values are not equal to one another. This caused " +"potentially quadratic runtime behavior due to excessive hash collisions when " +"creating dictionaries and sets containing multiple NaNs. (Contributed by " +"Raymond Hettinger in :issue:`43475`.)" msgstr "" ":class:`float` 型別和 :class:`decimal.Decimal` 型別的 NaN 值的雜湊值現在取決" "於物件的標識值 (identity)。以前即使 NaN 值彼此不相等,它們也總是被雜湊為 " @@ -1638,16 +1639,16 @@ msgstr "" "collision),可能導致潛在的二次方執行環境行為 (quadratic runtime behavior)。" "(由 Raymond Hettinger 在 :issue:`43475` 中貢獻。)" -#: ../../whatsnew/3.10.rst:884 +#: ../../whatsnew/3.10.rst:885 msgid "" "A :exc:`SyntaxError` (instead of a :exc:`NameError`) will be raised when " -"deleting the :const:`__debug__` constant. (Contributed by Donghee Na " -"in :issue:`45000`.)" +"deleting the :const:`__debug__` constant. (Contributed by Donghee Na in :" +"issue:`45000`.)" msgstr "" -"刪除 :const:`__debug__` 常數時將引發 :exc:`SyntaxError` (而不" -"是 :exc:`NameError`)。(由 Donghee Na 在 :issue:`45000` 中貢獻。)" +"刪除 :const:`__debug__` 常數時將引發 :exc:`SyntaxError` (而不是 :exc:" +"`NameError`)。(由 Donghee Na 在 :issue:`45000` 中貢獻。)" -#: ../../whatsnew/3.10.rst:887 +#: ../../whatsnew/3.10.rst:888 msgid "" ":exc:`SyntaxError` exceptions now have ``end_lineno`` and ``end_offset`` " "attributes. They will be ``None`` if not determined. (Contributed by Pablo " @@ -1656,36 +1657,36 @@ msgstr "" ":exc:`SyntaxError` 例外現在具有 ``end_lineno`` 和 ``end_offset`` 屬性。如果未" "被決定,它們將會是 ``None``。(由 Pablo Galindo 在 :issue:`43914` 中貢獻。)" -#: ../../whatsnew/3.10.rst:892 +#: ../../whatsnew/3.10.rst:893 msgid "New Modules" msgstr "新模組" -#: ../../whatsnew/3.10.rst:894 +#: ../../whatsnew/3.10.rst:895 msgid "None." msgstr "無。" -#: ../../whatsnew/3.10.rst:898 +#: ../../whatsnew/3.10.rst:899 msgid "Improved Modules" msgstr "改進的模組" -#: ../../whatsnew/3.10.rst:901 +#: ../../whatsnew/3.10.rst:902 msgid "asyncio" msgstr "asyncio" -#: ../../whatsnew/3.10.rst:903 +#: ../../whatsnew/3.10.rst:904 msgid "" -"Add " -"missing :meth:`~asyncio.events.AbstractEventLoop.connect_accepted_socket` " -"method. (Contributed by Alex Grönholm in :issue:`41332`.)" +"Add missing :meth:`~asyncio.events.AbstractEventLoop." +"connect_accepted_socket` method. (Contributed by Alex Grönholm in :issue:" +"`41332`.)" msgstr "" "新增缺少的 :meth:`~asyncio.events.AbstractEventLoop.connect_accepted_socket` " "方法。(由 Alex Grönholm 在 :issue:`41332` 中貢獻。)" -#: ../../whatsnew/3.10.rst:908 +#: ../../whatsnew/3.10.rst:909 msgid "argparse" msgstr "argparse" -#: ../../whatsnew/3.10.rst:910 +#: ../../whatsnew/3.10.rst:911 msgid "" "Misleading phrase \"optional arguments\" was replaced with \"options\" in " "argparse help. Some tests might require adaptation if they rely on exact " @@ -1695,38 +1696,38 @@ msgstr "" "(options)」。某些依賴於精確輸出匹配的測試可能需要進行調整。(由 Raymond " "Hettinger 在 :issue:`9694` 中貢獻。)" -#: ../../whatsnew/3.10.rst:914 +#: ../../whatsnew/3.10.rst:915 msgid "array" msgstr "array" -#: ../../whatsnew/3.10.rst:916 +#: ../../whatsnew/3.10.rst:917 msgid "" "The :meth:`~array.array.index` method of :class:`array.array` now has " "optional *start* and *stop* parameters. (Contributed by Anders Lorentsen and " "Zackery Spytz in :issue:`31956`.)" msgstr "" ":class:`array.array` 的 :meth:`~array.array.index` 方法現在具有可選的 " -"*start* 和 *stop* 參數。(由 Anders Lorentsen 和 Zackery Spytz " -"在 :issue:`31956` 中貢獻。)" +"*start* 和 *stop* 參數。(由 Anders Lorentsen 和 Zackery Spytz 在 :issue:" +"`31956` 中貢獻。)" -#: ../../whatsnew/3.10.rst:921 +#: ../../whatsnew/3.10.rst:922 msgid "asynchat, asyncore, smtpd" msgstr "asynchat, asyncore, smtpd" -#: ../../whatsnew/3.10.rst:922 +#: ../../whatsnew/3.10.rst:923 msgid "" "These modules have been marked as deprecated in their module documentation " "since Python 3.6. An import-time :class:`DeprecationWarning` has now been " "added to all three of these modules." msgstr "" -"自 Python 3.6 起,這些模組在其文件中被標記為已棄用。引入時" -"的 :class:`DeprecationWarning` 現已新增到這三個模組中。" +"自 Python 3.6 起,這些模組在其文件中被標記為已棄用。引入時的 :class:" +"`DeprecationWarning` 現已新增到這三個模組中。" -#: ../../whatsnew/3.10.rst:927 +#: ../../whatsnew/3.10.rst:928 msgid "base64" msgstr "base64" -#: ../../whatsnew/3.10.rst:929 +#: ../../whatsnew/3.10.rst:930 msgid "" "Add :func:`base64.b32hexencode` and :func:`base64.b32hexdecode` to support " "the Base32 Encoding with Extended Hex Alphabet." @@ -1734,11 +1735,11 @@ msgstr "" "新增 :func:`base64.b32hexencode` 和 :func:`base64.b32hexdecode` 以支援擴充十" "六進位字母的 Base32 編碼 (Base32 Encoding with Extended Hex Alphabet)。" -#: ../../whatsnew/3.10.rst:933 +#: ../../whatsnew/3.10.rst:934 msgid "bdb" msgstr "bdb" -#: ../../whatsnew/3.10.rst:935 +#: ../../whatsnew/3.10.rst:936 msgid "" "Add :meth:`~bdb.Breakpoint.clearBreakpoints` to reset all set breakpoints. " "(Contributed by Irit Katriel in :issue:`24160`.)" @@ -1746,24 +1747,23 @@ msgstr "" "新增 :meth:`~bdb.Breakpoint.clearBreakpoints` 來重置所有設定的斷點。(由 " "Irit Katriel 在 :issue:`24160` 中貢獻。)" -#: ../../whatsnew/3.10.rst:939 +#: ../../whatsnew/3.10.rst:940 msgid "bisect" msgstr "bisect" -#: ../../whatsnew/3.10.rst:941 +#: ../../whatsnew/3.10.rst:942 msgid "" -"Added the possibility of providing a *key* function to the APIs in " -"the :mod:`bisect` module. (Contributed by Raymond Hettinger " -"in :issue:`4356`.)" +"Added the possibility of providing a *key* function to the APIs in the :mod:" +"`bisect` module. (Contributed by Raymond Hettinger in :issue:`4356`.)" msgstr "" "新增向 :mod:`bisect` 模組 API 提供 *key* 函式的可能性。(由 Raymond " "Hettinger 在 :issue:`4356` 中貢獻。)" -#: ../../whatsnew/3.10.rst:945 +#: ../../whatsnew/3.10.rst:946 msgid "codecs" msgstr "codecs" -#: ../../whatsnew/3.10.rst:947 +#: ../../whatsnew/3.10.rst:948 msgid "" "Add a :func:`codecs.unregister` function to unregister a codec search " "function. (Contributed by Hai Shi in :issue:`41842`.)" @@ -1771,42 +1771,41 @@ msgstr "" "新增 :func:`codecs.unregister` 函式來取消註冊 (unregister) 一個編解碼器的搜尋" "功能。(Hai Shi 在 :issue:`41842` 中貢獻。)" -#: ../../whatsnew/3.10.rst:951 +#: ../../whatsnew/3.10.rst:952 msgid "collections.abc" msgstr "collections.abc" -#: ../../whatsnew/3.10.rst:953 +#: ../../whatsnew/3.10.rst:954 msgid "" "The ``__args__`` of the :ref:`parameterized generic ` " -"for :class:`collections.abc.Callable` are now consistent " -"with :data:`typing.Callable`. :class:`collections.abc.Callable` generic now " -"flattens type parameters, similar to what :data:`typing.Callable` currently " -"does. This means that ``collections.abc.Callable[[int, str], str]`` will " -"have ``__args__`` of ``(int, str, str)``; previously this was ``([int, str], " +"for :class:`collections.abc.Callable` are now consistent with :data:`typing." +"Callable`. :class:`collections.abc.Callable` generic now flattens type " +"parameters, similar to what :data:`typing.Callable` currently does. This " +"means that ``collections.abc.Callable[[int, str], str]`` will have " +"``__args__`` of ``(int, str, str)``; previously this was ``([int, str], " "str)``. To allow this change, :class:`types.GenericAlias` can now be " -"subclassed, and a subclass will be returned when subscripting " -"the :class:`collections.abc.Callable` type. Note that a :exc:`TypeError` " -"may be raised for invalid forms of " -"parameterizing :class:`collections.abc.Callable` which may have passed " -"silently in Python 3.9. (Contributed by Ken Jin in :issue:`42195`.)" +"subclassed, and a subclass will be returned when subscripting the :class:" +"`collections.abc.Callable` type. Note that a :exc:`TypeError` may be raised " +"for invalid forms of parameterizing :class:`collections.abc.Callable` which " +"may have passed silently in Python 3.9. (Contributed by Ken Jin in :issue:" +"`42195`.)" msgstr "" ":class:`collections.abc.Callable` 的\\ :ref:`參數化泛型 (parameterized " -"generic) ` 的 ``__args__`` 現在" -"與 :data:`typing.Callable` 一致。:class:`collections.abc.Callable` 泛型現在會" -"將型別參數攤平,類似於 :data:`typing.Callable` 目前的做法。這意味著 " -"``collections.abc.Callable[[int, str], str]`` 將具有 ``(int, str, str)`` 的 " -"``__args__``;在以前這是 ``([int, str], str)``。為了允許此更改,現在可以" -"對 :class:`types.GenericAlias` 進行子類別化,並且在下標 " -"(subscript) :class:`collections.abc.Callable` 型別時將回傳子類別。請注意,對" -"於無效形式的 :class:`collections.abc.Callable` 參數化可能會引" -"發 :exc:`TypeError`,而在 Python 3.9 中該參數可能會無引發例外地傳遞。(由 " -"Ken Jin 在 :issue:`42195` 中貢獻。)" - -#: ../../whatsnew/3.10.rst:966 +"generic) ` 的 ``__args__`` 現在與 :data:`typing." +"Callable` 一致。:class:`collections.abc.Callable` 泛型現在會將型別參數攤平," +"類似於 :data:`typing.Callable` 目前的做法。這意味著 ``collections.abc." +"Callable[[int, str], str]`` 將具有 ``(int, str, str)`` 的 ``__args__``;在以" +"前這是 ``([int, str], str)``。為了允許此更改,現在可以對 :class:`types." +"GenericAlias` 進行子類別化,並且在下標 (subscript) :class:`collections.abc." +"Callable` 型別時將回傳子類別。請注意,對於無效形式的 :class:`collections.abc." +"Callable` 參數化可能會引發 :exc:`TypeError`,而在 Python 3.9 中該參數可能會無" +"引發例外地傳遞。(由 Ken Jin 在 :issue:`42195` 中貢獻。)" + +#: ../../whatsnew/3.10.rst:967 msgid "contextlib" msgstr "contextlib" -#: ../../whatsnew/3.10.rst:968 +#: ../../whatsnew/3.10.rst:969 msgid "" "Add a :func:`contextlib.aclosing` context manager to safely close async " "generators and objects representing asynchronously released resources. " @@ -1816,7 +1815,7 @@ msgstr "" "步釋放資源的物件。(由 Joongi Kim 和 John Belmonte 在 :issue:`41229` 中貢" "獻。)" -#: ../../whatsnew/3.10.rst:972 +#: ../../whatsnew/3.10.rst:973 msgid "" "Add asynchronous context manager support to :func:`contextlib.nullcontext`. " "(Contributed by Tom Gringauz in :issue:`41543`.)" @@ -1824,7 +1823,7 @@ msgstr "" "向 :func:`contextlib.nullcontext` 新增非同步情境管理器支援。(由 Tom " "Gringauz 在 :issue:`41543` 中貢獻。)" -#: ../../whatsnew/3.10.rst:975 +#: ../../whatsnew/3.10.rst:976 msgid "" "Add :class:`~contextlib.AsyncContextDecorator`, for supporting usage of " "async context managers as decorators." @@ -1832,27 +1831,26 @@ msgstr "" "新增 :class:`~contextlib.AsyncContextDecorator`,用於支援將非同步情境管理器作" "為裝飾器使用。" -#: ../../whatsnew/3.10.rst:979 +#: ../../whatsnew/3.10.rst:980 msgid "curses" msgstr "curses" -#: ../../whatsnew/3.10.rst:981 +#: ../../whatsnew/3.10.rst:982 msgid "" "The extended color functions added in ncurses 6.1 will be used transparently " -"by :func:`curses.color_content`, :func:`curses.init_color`, :func:`curses.init_pair`, " -"and :func:`curses.pair_content`. A new " -"function, :func:`curses.has_extended_color_support`, indicates whether " -"extended color support is provided by the underlying ncurses library. " -"(Contributed by Jeffrey Kintscher and Hans Petter Jansson in :issue:`36982`.)" +"by :func:`curses.color_content`, :func:`curses.init_color`, :func:`curses." +"init_pair`, and :func:`curses.pair_content`. A new function, :func:`curses." +"has_extended_color_support`, indicates whether extended color support is " +"provided by the underlying ncurses library. (Contributed by Jeffrey " +"Kintscher and Hans Petter Jansson in :issue:`36982`.)" msgstr "" -"ncurses 6.1 中新增的擴充顏色函式將" -"由 :func:`curses.color_content`、:func:`curses.init_color`、:func:`curses.init_pair` " -"和 :func:`curses.pair_content` 透明地使用。新函" -"式 :func:`curses.has_extended_color_support` 表示了底層的 ncurses 函式庫是否" -"支援擴充顏色。(由 Jeffrey Kintscher 和 Hans Petter Jansson " -"在 :issue:`36982` 中貢獻。)" +"ncurses 6.1 中新增的擴充顏色函式將由 :func:`curses.color_content`、:func:" +"`curses.init_color`、:func:`curses.init_pair` 和 :func:`curses.pair_content` " +"透明地使用。新函式 :func:`curses.has_extended_color_support` 表示了底層的 " +"ncurses 函式庫是否支援擴充顏色。(由 Jeffrey Kintscher 和 Hans Petter " +"Jansson 在 :issue:`36982` 中貢獻。)" -#: ../../whatsnew/3.10.rst:988 +#: ../../whatsnew/3.10.rst:989 msgid "" "The ``BUTTON5_*`` constants are now exposed in the :mod:`curses` module if " "they are provided by the underlying curses library. (Contributed by Zackery " @@ -1861,15 +1859,15 @@ msgstr "" "如果 ``BUTTON5_*`` 常數是由底層 :mod:`curses` 函式庫提供的,那麼它們現在會在 " "curses 模組中公開。(由 Zackery Spytz 在 :issue:`39273` 中貢獻。)" -#: ../../whatsnew/3.10.rst:993 +#: ../../whatsnew/3.10.rst:994 msgid "dataclasses" msgstr "dataclasses" -#: ../../whatsnew/3.10.rst:996 +#: ../../whatsnew/3.10.rst:997 msgid "__slots__" msgstr "__slots__" -#: ../../whatsnew/3.10.rst:998 +#: ../../whatsnew/3.10.rst:999 msgid "" "Added ``slots`` parameter in :func:`dataclasses.dataclass` decorator. " "(Contributed by Yurii Karabas in :issue:`42269`)" @@ -1877,11 +1875,11 @@ msgstr "" "在 :func:`dataclasses.dataclass` 裝飾器中新增了 ``slots`` 參數。(由 Yurii " "Karabas 在 :issue:`42269` 中貢獻)" -#: ../../whatsnew/3.10.rst:1002 +#: ../../whatsnew/3.10.rst:1003 msgid "Keyword-only fields" msgstr "僅限關鍵字欄位 (Keyword-only fields)" -#: ../../whatsnew/3.10.rst:1004 +#: ../../whatsnew/3.10.rst:1005 msgid "" "dataclasses now supports fields that are keyword-only in the generated " "__init__ method. There are a number of ways of specifying keyword-only " @@ -1890,11 +1888,11 @@ msgstr "" "dataclasses 現在支援在產生的 __init__ 方法中包含僅限關鍵字的欄位。有多種方法" "可以指定僅限關鍵字欄位。" -#: ../../whatsnew/3.10.rst:1008 +#: ../../whatsnew/3.10.rst:1009 msgid "You can say that every field is keyword-only:" msgstr "你可以說每個欄位都是關鍵字:" -#: ../../whatsnew/3.10.rst:1010 +#: ../../whatsnew/3.10.rst:1011 msgid "" "from dataclasses import dataclass\n" "\n" @@ -1910,17 +1908,17 @@ msgstr "" " name: str\n" " birthday: datetime.date" -#: ../../whatsnew/3.10.rst:1019 +#: ../../whatsnew/3.10.rst:1020 msgid "" "Both ``name`` and ``birthday`` are keyword-only parameters to the generated " "__init__ method." msgstr "``name`` 和 ``birthday`` 都是產生的 __init__ 方法的僅限關鍵字參數。" -#: ../../whatsnew/3.10.rst:1022 +#: ../../whatsnew/3.10.rst:1023 msgid "You can specify keyword-only on a per-field basis:" msgstr "你可以在每個欄位的基礎上指定僅限關鍵字:" -#: ../../whatsnew/3.10.rst:1024 +#: ../../whatsnew/3.10.rst:1025 msgid "" "from dataclasses import dataclass, field\n" "\n" @@ -1936,7 +1934,7 @@ msgstr "" " name: str\n" " birthday: datetime.date = field(kw_only=True)" -#: ../../whatsnew/3.10.rst:1033 +#: ../../whatsnew/3.10.rst:1034 msgid "" "Here only ``birthday`` is keyword-only. If you set ``kw_only`` on " "individual fields, be aware that there are rules about re-ordering fields " @@ -1947,7 +1945,7 @@ msgstr "" "意,由於僅限關鍵字欄位需要遵循非僅限關鍵字欄位,因此會有欄位重新排序的相關規" "則。詳細資訊請參閱完整的 dataclasses 文件。" -#: ../../whatsnew/3.10.rst:1038 +#: ../../whatsnew/3.10.rst:1039 msgid "" "You can also specify that all fields following a KW_ONLY marker are keyword-" "only. This will probably be the most common usage:" @@ -1955,7 +1953,7 @@ msgstr "" "你還可以指定 KW_ONLY 標記後面的所有欄位均為僅限關鍵字欄位。這可能是最常見的用" "法:" -#: ../../whatsnew/3.10.rst:1041 +#: ../../whatsnew/3.10.rst:1042 msgid "" "from dataclasses import dataclass, KW_ONLY\n" "\n" @@ -1977,7 +1975,7 @@ msgstr "" " z: float = 0.0\n" " t: float = 0.0" -#: ../../whatsnew/3.10.rst:1053 +#: ../../whatsnew/3.10.rst:1054 msgid "" "Here, ``z`` and ``t`` are keyword-only parameters, while ``x`` and ``y`` are " "not. (Contributed by Eric V. Smith in :issue:`43532`.)" @@ -1985,104 +1983,101 @@ msgstr "" "這裡的 ``z`` 和 ``t`` 是僅限關鍵字參數,而 ``x`` 和 ``y`` 則不是。(由 Eric " "V. Smith 在 :issue:`43532` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1060 +#: ../../whatsnew/3.10.rst:1061 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.10.rst:1062 +#: ../../whatsnew/3.10.rst:1063 msgid "" "The entire ``distutils`` package is deprecated, to be removed in Python " "3.12. Its functionality for specifying package builds has already been " "completely replaced by third-party packages ``setuptools`` and " "``packaging``, and most other commonly used APIs are available elsewhere in " -"the standard library (such " -"as :mod:`platform`, :mod:`shutil`, :mod:`subprocess` or :mod:`sysconfig`). " -"There are no plans to migrate any other functionality from ``distutils``, " -"and applications that are using other functions should plan to make private " -"copies of the code. Refer to :pep:`632` for discussion." +"the standard library (such as :mod:`platform`, :mod:`shutil`, :mod:" +"`subprocess` or :mod:`sysconfig`). There are no plans to migrate any other " +"functionality from ``distutils``, and applications that are using other " +"functions should plan to make private copies of the code. Refer to :pep:" +"`632` for discussion." msgstr "" "整個 ``distutils`` 套件已被棄用,將在 Python 3.12 中刪除。它指定套件建置的功" "能已經完全被第三方套件 ``setuptools`` 和 ``packaging`` 所取代,並且大多數其他" -"常用的 API 都可以在標準函式庫的其他地方被找到(例" -"如 :mod:`platform` 、:mod:`shutil`、:mod:`subprocess` 或 :mod:`sysconfig`)。" -"目前沒有將 ``distutils`` 遷移任何其他地方的計畫,且使用其他功能的應用程式應該" -"開始規劃如何取得程式碼的私有副本。請參閱 :pep:`632` 的討論。" +"常用的 API 都可以在標準函式庫的其他地方被找到(例如 :mod:`platform` 、:mod:" +"`shutil`、:mod:`subprocess` 或 :mod:`sysconfig`)。目前沒有將 ``distutils`` " +"遷移任何其他地方的計畫,且使用其他功能的應用程式應該開始規劃如何取得程式碼的" +"私有副本。請參閱 :pep:`632` 的討論。" -#: ../../whatsnew/3.10.rst:1072 +#: ../../whatsnew/3.10.rst:1073 msgid "" "The ``bdist_wininst`` command deprecated in Python 3.8 has been removed. The " "``bdist_wheel`` command is now recommended to distribute binary packages on " "Windows. (Contributed by Victor Stinner in :issue:`42802`.)" msgstr "" "Python 3.8 中不推薦使用的 ``bdist_wininst`` 命令已被刪除。現在建議使用 " -"``bdist_wheel`` 命令來在 Windows 上發布二進位套件。(由 Victor Stinner " -"在 :issue:`42802` 中貢獻。)" +"``bdist_wheel`` 命令來在 Windows 上發布二進位套件。(由 Victor Stinner 在 :" +"issue:`42802` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1078 +#: ../../whatsnew/3.10.rst:1079 msgid "doctest" msgstr "doctest" -#: ../../whatsnew/3.10.rst:1080 ../../whatsnew/3.10.rst:1215 -#: ../../whatsnew/3.10.rst:1242 ../../whatsnew/3.10.rst:1341 +#: ../../whatsnew/3.10.rst:1081 ../../whatsnew/3.10.rst:1216 +#: ../../whatsnew/3.10.rst:1243 ../../whatsnew/3.10.rst:1342 msgid "" -"When a module does not define ``__loader__``, fall back to " -"``__spec__.loader``. (Contributed by Brett Cannon in :issue:`42133`.)" +"When a module does not define ``__loader__``, fall back to ``__spec__." +"loader``. (Contributed by Brett Cannon in :issue:`42133`.)" msgstr "" "當模組未定義 ``__loader__`` 時,回退到 ``__spec__.loader`` 。(由 Brett " "Cannon 在 :issue:`42133` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1084 +#: ../../whatsnew/3.10.rst:1085 msgid "encodings" msgstr "encodings" -#: ../../whatsnew/3.10.rst:1086 +#: ../../whatsnew/3.10.rst:1087 msgid "" ":func:`encodings.normalize_encoding` now ignores non-ASCII characters. " "(Contributed by Hai Shi in :issue:`39337`.)" msgstr "" -":func:`encodings.normalize_encoding` 現在會忽略非 ASCII 字元。(Hai Shi " -"在 :issue:`39337` 中貢獻。)" +":func:`encodings.normalize_encoding` 現在會忽略非 ASCII 字元。(Hai Shi 在 :" +"issue:`39337` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1090 +#: ../../whatsnew/3.10.rst:1091 msgid "enum" msgstr "enum" -#: ../../whatsnew/3.10.rst:1092 +#: ../../whatsnew/3.10.rst:1093 msgid "" -":class:`~enum.Enum` :func:`~object.__repr__` now returns " -"``enum_name.member_name`` and :func:`~object.__str__` now returns " -"``member_name``. Stdlib enums available as module constants have " -"a :func:`repr` of ``module_name.member_name``. (Contributed by Ethan Furman " -"in :issue:`40066`.)" +":class:`~enum.Enum` :func:`~object.__repr__` now returns ``enum_name." +"member_name`` and :func:`~object.__str__` now returns ``member_name``. " +"Stdlib enums available as module constants have a :func:`repr` of " +"``module_name.member_name``. (Contributed by Ethan Furman in :issue:`40066`.)" msgstr "" -":class:`~enum.Enum` :func:`~object.__repr__` 現在會回傳 " -"``enum_name.member_name`` 、:func:`~object.__str__` 現在會回傳 " -"``member_name`` 。可用作模組常數的標準函式庫列舉會有 " -"``module_name.member_name`` 的 :func:`repr`。(由 Ethan Furman " -"在 :issue:`40066` 中貢獻。)" +":class:`~enum.Enum` :func:`~object.__repr__` 現在會回傳 ``enum_name." +"member_name`` 、:func:`~object.__str__` 現在會回傳 ``member_name`` 。可用作模" +"組常數的標準函式庫列舉會有 ``module_name.member_name`` 的 :func:`repr`。(由 " +"Ethan Furman 在 :issue:`40066` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1097 +#: ../../whatsnew/3.10.rst:1098 msgid "" "Add :class:`enum.StrEnum` for enums where all members are strings. " "(Contributed by Ethan Furman in :issue:`41816`.)" msgstr "" -"新增 :class:`enum.StrEnum`,為所有成員都是字串的列舉。(由 Ethan Furman " -"在 :issue:`41816` 中貢獻。)" +"新增 :class:`enum.StrEnum`,為所有成員都是字串的列舉。(由 Ethan Furman 在 :" +"issue:`41816` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1101 +#: ../../whatsnew/3.10.rst:1102 msgid "fileinput" msgstr "fileinput" -#: ../../whatsnew/3.10.rst:1103 +#: ../../whatsnew/3.10.rst:1104 msgid "" -"Add *encoding* and *errors* parameters in :func:`fileinput.input` " -"and :class:`fileinput.FileInput`. (Contributed by Inada Naoki " -"in :issue:`43712`.)" +"Add *encoding* and *errors* parameters in :func:`fileinput.input` and :class:" +"`fileinput.FileInput`. (Contributed by Inada Naoki in :issue:`43712`.)" msgstr "" "在 :func:`fileinput.input` 和 :class:`fileinput.FileInput` 中新增 *encoding* " "和 *errors* 參數。(由 Inada Naoki 在 :issue:`43712` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1107 +#: ../../whatsnew/3.10.rst:1108 msgid "" ":func:`fileinput.hook_compressed` now returns :class:`~io.TextIOWrapper` " "object when *mode* is \"r\" and file is compressed, like uncompressed files. " @@ -2092,59 +2087,58 @@ msgstr "" "會回傳 :class:`~io.TextIOWrapper` 物件(和未壓縮檔案一樣)。(由 Inada Naoki " "在 :issue:`5758` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1112 +#: ../../whatsnew/3.10.rst:1113 msgid "faulthandler" msgstr "faulthandler" -#: ../../whatsnew/3.10.rst:1114 +#: ../../whatsnew/3.10.rst:1115 msgid "" "The :mod:`faulthandler` module now detects if a fatal error occurs during a " -"garbage collector collection. (Contributed by Victor Stinner " -"in :issue:`44466`.)" +"garbage collector collection. (Contributed by Victor Stinner in :issue:" +"`44466`.)" msgstr "" ":mod:`faulthandler` 模組現在可以檢測垃圾收集器 (garbage collector) 在收集期間" "是否發生嚴重錯誤。(由 Victor Stinner 在 :issue:`44466` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1119 +#: ../../whatsnew/3.10.rst:1120 msgid "gc" msgstr "gc" -#: ../../whatsnew/3.10.rst:1121 +#: ../../whatsnew/3.10.rst:1122 msgid "" -"Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` " -"and :func:`gc.get_referents`. (Contributed by Pablo Galindo " -"in :issue:`43439`.)" +"Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` and :" +"func:`gc.get_referents`. (Contributed by Pablo Galindo in :issue:`43439`.)" msgstr "" -"為 :func:`gc.get_objects`、:func:`gc.get_referrers` " -"和 :func:`gc.get_referents` 新增稽核掛鉤 (audit hooks)。(由 Pablo Galindo " -"在 :issue:`43439` 中貢獻。)" +"為 :func:`gc.get_objects`、:func:`gc.get_referrers` 和 :func:`gc." +"get_referents` 新增稽核掛鉤 (audit hooks)。(由 Pablo Galindo 在 :issue:" +"`43439` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1125 +#: ../../whatsnew/3.10.rst:1126 msgid "glob" msgstr "glob" -#: ../../whatsnew/3.10.rst:1127 +#: ../../whatsnew/3.10.rst:1128 msgid "" -"Add the *root_dir* and *dir_fd* parameters in :func:`~glob.glob` " -"and :func:`~glob.iglob` which allow to specify the root directory for " -"searching. (Contributed by Serhiy Storchaka in :issue:`38144`.)" +"Add the *root_dir* and *dir_fd* parameters in :func:`~glob.glob` and :func:" +"`~glob.iglob` which allow to specify the root directory for searching. " +"(Contributed by Serhiy Storchaka in :issue:`38144`.)" msgstr "" "在 :func:`~glob.glob` 和 :func:`~glob.iglob` 中新增 *root_dir* 和 *dir_fd* 參" "數,允許指定搜尋的根目錄。(由 Serhiy Storchaka 在 :issue:`38144` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1132 +#: ../../whatsnew/3.10.rst:1133 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.10.rst:1134 +#: ../../whatsnew/3.10.rst:1135 msgid "" "The hashlib module requires OpenSSL 1.1.1 or newer. (Contributed by " "Christian Heimes in :pep:`644` and :issue:`43669`.)" msgstr "" -"hashlib 模組需要 OpenSSL 1.1.1 或更高版本。(由 Christian Heimes " -"在 :pep:`644` 和 :issue:`43669` 中貢獻。)" +"hashlib 模組需要 OpenSSL 1.1.1 或更高版本。(由 Christian Heimes 在 :pep:" +"`644` 和 :issue:`43669` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1137 +#: ../../whatsnew/3.10.rst:1138 msgid "" "The hashlib module has preliminary support for OpenSSL 3.0.0. (Contributed " "by Christian Heimes in :issue:`38820` and other issues.)" @@ -2152,51 +2146,51 @@ msgstr "" "hashlib 模組初步支援 OpenSSL 3.0.0。(由 Christian Heimes 在 :issue:`38820` " "和其他問題中貢獻。)" -#: ../../whatsnew/3.10.rst:1140 +#: ../../whatsnew/3.10.rst:1141 msgid "" "The pure-Python fallback of :func:`~hashlib.pbkdf2_hmac` is deprecated. In " "the future PBKDF2-HMAC will only be available when Python has been built " "with OpenSSL support. (Contributed by Christian Heimes in :issue:`43880`.)" msgstr "" "純 Python 的 :func:`~hashlib.pbkdf2_hmac` 回退已被棄用。將來只有在有 OpenSSL " -"支援的建置 Python 中才能夠使用 PBKDF2-HMAC。(由 Christian Heimes " -"在 :issue:`43880` 中貢獻。)" +"支援的建置 Python 中才能夠使用 PBKDF2-HMAC。(由 Christian Heimes 在 :issue:" +"`43880` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1146 +#: ../../whatsnew/3.10.rst:1147 msgid "hmac" msgstr "hmac" -#: ../../whatsnew/3.10.rst:1148 +#: ../../whatsnew/3.10.rst:1149 msgid "" "The hmac module now uses OpenSSL's HMAC implementation internally. " "(Contributed by Christian Heimes in :issue:`40645`.)" msgstr "" -"hmac 模組現在在內部使用 OpenSSL 的 HMAC 實作。(由 Christian Heimes " -"在 :issue:`40645` 中貢獻。)" +"hmac 模組現在在內部使用 OpenSSL 的 HMAC 實作。(由 Christian Heimes 在 :" +"issue:`40645` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1152 +#: ../../whatsnew/3.10.rst:1153 msgid "IDLE and idlelib" msgstr "IDLE 和 idlelib" -#: ../../whatsnew/3.10.rst:1154 +#: ../../whatsnew/3.10.rst:1155 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " -"hooks were previously ignored. (Contributed by Ken Hilton " -"in :issue:`43008`.)" +"hooks were previously ignored. (Contributed by Ken Hilton in :issue:" +"`43008`.)" msgstr "" "讓 IDLE 叫用 :func:`sys.excepthook` (在沒有 ``-n`` 的情況下啟動時)。使用者" "掛鉤 (user hooks) 在以前是被忽略的。(由 Ken Hilton 在 :issue:`43008` 中貢" "獻。)" -#: ../../whatsnew/3.10.rst:1158 +#: ../../whatsnew/3.10.rst:1159 msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " "tab. Make space for new options and shorten the dialog. The latter makes " -"the dialog better fit small screens. (Contributed by Terry Jan Reedy " -"in :issue:`40468`.) Move the indent space setting from the Font tab to the " -"new Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy " -"in :issue:`33962`.)" +"the dialog better fit small screens. (Contributed by Terry Jan Reedy in :" +"issue:`40468`.) Move the indent space setting from the Font tab to the new " +"Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" +"`33962`.)" msgstr "" "重新排列設定對話框。將 General 分頁拆分為 Windows 和 Shell/Ed 分頁。將擴充 " "Help 選單的幫助來源移至 Extensions 分頁。為新選項騰出空間並縮短對話框,而後者" @@ -2204,11 +2198,11 @@ msgstr "" "獻。)將縮排空間設定從 Font 分頁移至新的 Windows 分頁。(由 Mark Roseman 和 " "Terry Jan Reedy 在 :issue:`33962` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1166 +#: ../../whatsnew/3.10.rst:1167 msgid "The changes above were backported to a 3.9 maintenance release." msgstr "上述更改已向後移植到 3.9 維護版本。" -#: ../../whatsnew/3.10.rst:1168 +#: ../../whatsnew/3.10.rst:1169 msgid "" "Add a Shell sidebar. Move the primary prompt ('>>>') to the sidebar. Add " "secondary prompts ('...') to the sidebar. Left click and optional drag " @@ -2218,13 +2212,13 @@ msgid "" "the selected text. This option also appears on the context menu for the " "text. (Contributed by Tal Einat in :issue:`37903`.)" msgstr "" -"新增 Shell 側邊欄。將主要提示字元 (``>>>``) 移至側邊欄。將輔助提示字元" -"(``...``)新增到側邊欄。點擊左鍵再拖動能夠選擇一行或多行文字,和編輯器列號側" -"邊欄操作一樣。選擇文字列後點擊右鍵會顯示帶有「一併複製提示字元 (copy with " +"新增 Shell 側邊欄。將主要提示字元 (``>>>``) 移至側邊欄。將輔助提示字元(``..." +"``)新增到側邊欄。點擊左鍵再拖動能夠選擇一行或多行文字,和編輯器列號側邊欄操" +"作一樣。選擇文字列後點擊右鍵會顯示帶有「一併複製提示字元 (copy with " "prompts)」的情境選單,這會將側邊欄中提示字元與所選文字並排,此選項也會出現在" "文字的情境選單上。(由 Tal Einat 在 :issue:`37903` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1177 +#: ../../whatsnew/3.10.rst:1178 msgid "" "Use spaces instead of tabs to indent interactive code. This makes " "interactive code entries 'look right'. Making this feasible was a major " @@ -2235,25 +2229,24 @@ msgstr "" "起來正確」。新增 shell 側邊欄的主要動機是實現這一點。(由 Terry Jan Reedy " "在 :issue:`37892` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1182 +#: ../../whatsnew/3.10.rst:1183 msgid "" -"Highlight the new :ref:`soft keywords ` :keyword:`match`, :keyword:`case `, and :keyword:`_ " -"` in pattern-matching statements. However, this " -"highlighting is not perfect and will be incorrect in some rare cases, " -"including some ``_``-s in ``case`` patterns. (Contributed by Tal Einat " -"in :issue:`44010`.)" +"Highlight the new :ref:`soft keywords ` :keyword:`match`, :" +"keyword:`case `, and :keyword:`_ ` in pattern-" +"matching statements. However, this highlighting is not perfect and will be " +"incorrect in some rare cases, including some ``_``-s in ``case`` patterns. " +"(Contributed by Tal Einat in :issue:`44010`.)" msgstr "" "突顯 (highlight) 模式匹配陳述式中的新\\ :ref:`軟關鍵字 (soft keywords) ` :keyword:`match`、:keyword:`case ` 和 :keyword:`_ " "`。然而這種突顯並不完美,並且在某些罕見的情況下會出錯,包" "括 ``case`` 模式中的一些 ``_``。(由 Tal Einat 在 :issue:`44010` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1188 +#: ../../whatsnew/3.10.rst:1189 msgid "New in 3.10 maintenance releases." msgstr "3.10 維護版本中的新增功能。" -#: ../../whatsnew/3.10.rst:1190 +#: ../../whatsnew/3.10.rst:1191 msgid "" "Apply syntax highlighting to ``.pyi`` files. (Contributed by Alex Waygood " "and Terry Jan Reedy in :issue:`45447`.)" @@ -2261,119 +2254,117 @@ msgstr "" "將語法突顯 (syntax highlighting) 應用於 ``.pyi`` 檔案。(由 Alex Waygood 和 " "Terry Jan Reedy 在 :issue:`45447` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1193 +#: ../../whatsnew/3.10.rst:1194 msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" msgstr "" -"保存帶有輸入和輸出的 Shell 時,會包含提示字元。(由 Terry Jan Reedy " -"在 :gh:`95191` 中貢獻。)" +"保存帶有輸入和輸出的 Shell 時,會包含提示字元。(由 Terry Jan Reedy 在 :gh:" +"`95191` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1197 +#: ../../whatsnew/3.10.rst:1198 msgid "importlib.metadata" msgstr "importlib.metadata" -#: ../../whatsnew/3.10.rst:1199 +#: ../../whatsnew/3.10.rst:1200 msgid "" "Feature parity with ``importlib_metadata`` 4.6 (`history `_)." msgstr "" -"與 ``importlib_metadata`` 4.6 功能相同(`歷史 `_)。" +"與 ``importlib_metadata`` 4.6 功能相同(`歷史 `_)。" -#: ../../whatsnew/3.10.rst:1202 +#: ../../whatsnew/3.10.rst:1203 msgid "" ":ref:`importlib.metadata entry points ` now provide a nicer " -"experience for selecting entry points by group and name through a " -"new :ref:`importlib.metadata.EntryPoints ` class. See the " -"Compatibility Note in the docs for more info on the deprecation and usage." +"experience for selecting entry points by group and name through a new :ref:" +"`importlib.metadata.EntryPoints ` class. See the Compatibility " +"Note in the docs for more info on the deprecation and usage." msgstr "" -":ref:`importlib.metadata 入口點 `\\ 現在透過新" -"的 :ref:`importlib.metadata.EntryPoints ` 類別提供了以群組和名" -"稱選擇入口點的更好體驗。有關棄用與用法的更多資訊,請參閱文件中的相容性說明。" +":ref:`importlib.metadata 入口點 `\\ 現在透過新的 :ref:" +"`importlib.metadata.EntryPoints ` 類別提供了以群組和名稱選擇入" +"口點的更好體驗。有關棄用與用法的更多資訊,請參閱文件中的相容性說明。" -#: ../../whatsnew/3.10.rst:1208 +#: ../../whatsnew/3.10.rst:1209 msgid "" "Added :ref:`importlib.metadata.packages_distributions() ` for resolving top-level Python modules and packages to " "their :ref:`importlib.metadata.Distribution `." msgstr "" "新增了 :ref:`importlib.metadata.packages_distributions() ` 用於將頂階 Python 模組和套件解析" -"出 :ref:`importlib.metadata.Distribution `。" +"distributions>` 用於將頂階 Python 模組和套件解析出 :ref:`importlib.metadata." +"Distribution `。" -#: ../../whatsnew/3.10.rst:1213 +#: ../../whatsnew/3.10.rst:1214 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.10.rst:1218 +#: ../../whatsnew/3.10.rst:1219 msgid "" "Add :func:`inspect.get_annotations`, which safely computes the annotations " "defined on an object. It works around the quirks of accessing the " "annotations on various types of objects, and makes very few assumptions " "about the object it examines. :func:`inspect.get_annotations` can also " -"correctly un-stringize stringized " -"annotations. :func:`inspect.get_annotations` is now considered best " -"practice for accessing the annotations dict defined on any Python object; " -"for more information on best practices for working with annotations, please " -"see :ref:`annotations-howto`. " -"Relatedly, :func:`inspect.signature`, :func:`inspect.Signature.from_callable`, " -"and :func:`!inspect.Signature.from_function` now " -"call :func:`inspect.get_annotations` to retrieve annotations. This " -"means :func:`inspect.signature` and :func:`inspect.Signature.from_callable` " -"can also now un-stringize stringized annotations. (Contributed by Larry " -"Hastings in :issue:`43817`.)" +"correctly un-stringize stringized annotations. :func:`inspect." +"get_annotations` is now considered best practice for accessing the " +"annotations dict defined on any Python object; for more information on best " +"practices for working with annotations, please see :ref:`annotations-howto`. " +"Relatedly, :func:`inspect.signature`, :func:`inspect.Signature." +"from_callable`, and :func:`!inspect.Signature.from_function` now call :func:" +"`inspect.get_annotations` to retrieve annotations. This means :func:`inspect." +"signature` and :func:`inspect.Signature.from_callable` can also now un-" +"stringize stringized annotations. (Contributed by Larry Hastings in :issue:" +"`43817`.)" msgstr "" "新增 :func:`inspect.get_annotations`,它可以安全地計算物件上定義的註釋。它是" "存取各種型別物件註釋的怪作法 (quirks) 的變通解法 (work around),並且對其檢查" "的物件做出很少的假設。 :func:`inspect.get_annotations` 也可以正確地取消字串化" "註釋 (stringized annotations)。 :func:`inspect.get_annotations` 現在被認為是" "存取任何 Python 物件上定義的註釋字典的最佳實踐;有關使用註釋的最佳實踐的更多" -"資訊,請參閱 :ref:`annotations-howto`。相關" -"地,:func:`inspect.signature`、:func:`inspect.Signature.from_callable` " -"和 :func:`!inspect.Signature.from_function` 現在呼" -"叫 :func:`inspect.get_annotations` 來檢索註釋。這意味" +"資訊,請參閱 :ref:`annotations-howto`。相關地,:func:`inspect.signature`、:" +"func:`inspect.Signature.from_callable` 和 :func:`!inspect.Signature." +"from_function` 現在呼叫 :func:`inspect.get_annotations` 來檢索註釋。這意味" "著 :func:`inspect.signature` 和 :func:`inspect.Signature.from_callable` 現在" "也可以取消字串化註釋。(由 Larry Hastings 在 :issue:`43817` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1234 +#: ../../whatsnew/3.10.rst:1235 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.10.rst:1236 +#: ../../whatsnew/3.10.rst:1237 msgid "" -"Add :func:`itertools.pairwise`. (Contributed by Raymond Hettinger " -"in :issue:`38200`.)" +"Add :func:`itertools.pairwise`. (Contributed by Raymond Hettinger in :issue:" +"`38200`.)" msgstr "" "新增 :func:`itertools.pairwise`。(由 Raymond Hettinger 在 :issue:`38200` 中" "貢獻。)" -#: ../../whatsnew/3.10.rst:1240 +#: ../../whatsnew/3.10.rst:1241 msgid "linecache" msgstr "linecache" -#: ../../whatsnew/3.10.rst:1246 +#: ../../whatsnew/3.10.rst:1247 msgid "os" msgstr "os" -#: ../../whatsnew/3.10.rst:1248 +#: ../../whatsnew/3.10.rst:1249 msgid "" "Add :func:`os.cpu_count` support for VxWorks RTOS. (Contributed by Peixing " "Xin in :issue:`41440`.)" msgstr "" -"為 VxWorks RTOS 新增 :func:`os.cpu_count` 支援。(由 Peixing Xin " -"在 :issue:`41440` 中貢獻。)" +"為 VxWorks RTOS 新增 :func:`os.cpu_count` 支援。(由 Peixing Xin 在 :issue:" +"`41440` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1251 +#: ../../whatsnew/3.10.rst:1252 msgid "" "Add a new function :func:`os.eventfd` and related helpers to wrap the " -"``eventfd2`` syscall on Linux. (Contributed by Christian Heimes " -"in :issue:`41001`.)" +"``eventfd2`` syscall on Linux. (Contributed by Christian Heimes in :issue:" +"`41001`.)" msgstr "" "新增函式 :func:`os.eventfd` 和相關幫助程式來包裝 Linux 上的 ``eventfd2`` 系統" "呼叫。(由 Christian Heimes 在 :issue:`41001` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1255 +#: ../../whatsnew/3.10.rst:1256 msgid "" "Add :func:`os.splice` that allows to move data between two file descriptors " "without copying between kernel address space and user address space, where " @@ -2385,35 +2376,35 @@ msgstr "" "address space) 之間進行複製,其中檔案描述器之一必須是個 pipe。(由 Pablo " "Galindo 在 :issue:`41625` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1260 +#: ../../whatsnew/3.10.rst:1261 msgid "" "Add :const:`~os.O_EVTONLY`, :const:`~os.O_FSYNC`, :const:`~os.O_SYMLINK` " -"and :const:`~os.O_NOFOLLOW_ANY` for macOS. (Contributed by Donghee Na " -"in :issue:`43106`.)" +"and :const:`~os.O_NOFOLLOW_ANY` for macOS. (Contributed by Donghee Na in :" +"issue:`43106`.)" msgstr "" -"為 macOS 新" -"增 :const:`~os.O_EVTONLY`、:const:`~os.O_FSYNC`、:const:`~os.O_SYMLINK` " -"和 :const:`~os.O_NOFOLLOW_ANY`。(由 Donghee Na 在 :issue:`43106` 中貢獻。)" +"為 macOS 新增 :const:`~os.O_EVTONLY`、:const:`~os.O_FSYNC`、:const:`~os." +"O_SYMLINK` 和 :const:`~os.O_NOFOLLOW_ANY`。(由 Donghee Na 在 :issue:`43106` " +"中貢獻。)" -#: ../../whatsnew/3.10.rst:1265 +#: ../../whatsnew/3.10.rst:1266 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.10.rst:1267 +#: ../../whatsnew/3.10.rst:1268 msgid "" ":func:`os.path.realpath` now accepts a *strict* keyword-only argument. When " "set to ``True``, :exc:`OSError` is raised if a path doesn't exist or a " "symlink loop is encountered. (Contributed by Barney Gale in :issue:`43757`.)" msgstr "" ":func:`os.path.realpath` 現在接受一個 *strict* 僅限關鍵字引數。當設定為 " -"``True`` 時,如果路徑不存在或遇到符號鏈接循環 (symlink loop),則會引" -"發 :exc:`OSError`。(由 Barney Gale 在 :issue:`43757` 中貢獻。)" +"``True`` 時,如果路徑不存在或遇到符號鏈接循環 (symlink loop),則會引發 :exc:" +"`OSError`。(由 Barney Gale 在 :issue:`43757` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1273 +#: ../../whatsnew/3.10.rst:1274 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.10.rst:1275 +#: ../../whatsnew/3.10.rst:1276 msgid "" "Add slice support to :attr:`PurePath.parents `. " "(Contributed by Joshua Cannon in :issue:`35498`.)" @@ -2421,42 +2412,41 @@ msgstr "" "新增 :attr:`PurePath.parents ` 對於切片的支援。 " "(由 Joshua Cannon 在 :issue:`35498` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1278 +#: ../../whatsnew/3.10.rst:1279 msgid "" -"Add negative indexing support to :attr:`PurePath.parents " -"`. (Contributed by Yaroslav Pankovych " -"in :issue:`21041`.)" +"Add negative indexing support to :attr:`PurePath.parents `. (Contributed by Yaroslav Pankovych in :issue:`21041`.)" msgstr "" "向 :attr:`PurePath.parents ` 新增負索引支援。(由 " "Yaroslav Pankovych 在 :issue:`21041` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1282 +#: ../../whatsnew/3.10.rst:1283 msgid "" "Add :meth:`Path.hardlink_to ` method that " -"supersedes :meth:`!link_to`. The new method has the same argument order " -"as :meth:`~pathlib.Path.symlink_to`. (Contributed by Barney Gale " -"in :issue:`39950`.)" +"supersedes :meth:`!link_to`. The new method has the same argument order as :" +"meth:`~pathlib.Path.symlink_to`. (Contributed by Barney Gale in :issue:" +"`39950`.)" msgstr "" -"新增替代 :meth:`!link_to` 的 :meth:`Path.hardlink_to " -"` 方法。新方法與 :meth:`~pathlib.Path.symlink_to` " -"具有相同的引數順序。(由 Barney Gale 在 :issue:`39950` 中貢獻。)" +"新增替代 :meth:`!link_to` 的 :meth:`Path.hardlink_to ` 方法。新方法與 :meth:`~pathlib.Path.symlink_to` 具有相同的引數" +"順序。(由 Barney Gale 在 :issue:`39950` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1287 +#: ../../whatsnew/3.10.rst:1288 msgid "" ":meth:`pathlib.Path.stat` and :meth:`~pathlib.Path.chmod` now accept a " "*follow_symlinks* keyword-only argument for consistency with corresponding " -"functions in the :mod:`os` module. (Contributed by Barney Gale " -"in :issue:`39906`.)" +"functions in the :mod:`os` module. (Contributed by Barney Gale in :issue:" +"`39906`.)" msgstr "" ":meth:`pathlib.Path.stat` 和 :meth:`~pathlib.Path.chmod` 現在接受 " "*follow_symlinks* 僅限關鍵字引數,以與 :mod:`os` 模組中的相應函式保持一致。" "(由 Barney Gale 在 :issue:`39906` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1293 +#: ../../whatsnew/3.10.rst:1294 msgid "platform" msgstr "platform" -#: ../../whatsnew/3.10.rst:1295 +#: ../../whatsnew/3.10.rst:1296 msgid "" "Add :func:`platform.freedesktop_os_release` to retrieve operation system " "identification from `freedesktop.org os-release ` has a list of deprecated features. " -"(Contributed by Christian Heimes in :issue:`43880`.)" +"Deprecated function and use of deprecated constants now result in a :exc:" +"`DeprecationWarning`. :attr:`ssl.SSLContext.options` has :data:`~ssl." +"OP_NO_SSLv2` and :data:`~ssl.OP_NO_SSLv3` set by default and therefore " +"cannot warn about setting the flag again. The :ref:`deprecation section " +"` has a list of deprecated features. (Contributed by " +"Christian Heimes in :issue:`43880`.)" msgstr "" -"已棄用函式和使用已棄用常數現在會導" -"致 :exc:`DeprecationWarning`。 :attr:`ssl.SSLContext.options` 預設設定" -"有 :data:`~ssl.OP_NO_SSLv2` 和 :data:`~ssl.OP_NO_SSLv3`,因此無法再次發出設定" -"該旗標的警告。:ref:`棄用部分 `\\ 包含已棄用功能的列" -"表。(由 Christian Heimes 在 :issue:`43880` 中貢獻。)" +"已棄用函式和使用已棄用常數現在會導致 :exc:`DeprecationWarning`。 :attr:`ssl." +"SSLContext.options` 預設設定有 :data:`~ssl.OP_NO_SSLv2` 和 :data:`~ssl." +"OP_NO_SSLv3`,因此無法再次發出設定該旗標的警告。:ref:`棄用部分 `\\ 包含已棄用功能的列表。(由 Christian Heimes 在 :issue:`43880` " +"中貢獻。)" -#: ../../whatsnew/3.10.rst:1376 +#: ../../whatsnew/3.10.rst:1377 msgid "" "The ssl module now has more secure default settings. Ciphers without forward " "secrecy or SHA-1 MAC are disabled by default. Security level 2 prohibits " -"weak RSA, DH, and ECC keys with less than 112 bits of " -"security. :class:`~ssl.SSLContext` defaults to minimum protocol version TLS " -"1.2. Settings are based on Hynek Schlawack's research. (Contributed by " -"Christian Heimes in :issue:`43998`.)" +"weak RSA, DH, and ECC keys with less than 112 bits of security. :class:`~ssl." +"SSLContext` defaults to minimum protocol version TLS 1.2. Settings are based " +"on Hynek Schlawack's research. (Contributed by Christian Heimes in :issue:" +"`43998`.)" msgstr "" "ssl 模組現在具有更安全的預設設定。預設情況下禁用沒有前向保密或 SHA-1 MAC 的密" -"碼。安全級別 2 禁止安全性低於 112 位元的弱 RSA、DH 和 ECC 密" -"鑰。 :class:`~ssl.SSLContext` 預設為最低協議版本 TLS 1.2。設定基於 Hynek " -"Schlawack 的研究。(由 Christian Heimes 在 :issue:`43998` 中貢獻。)" +"碼。安全級別 2 禁止安全性低於 112 位元的弱 RSA、DH 和 ECC 密鑰。 :class:" +"`~ssl.SSLContext` 預設為最低協議版本 TLS 1.2。設定基於 Hynek Schlawack 的研" +"究。(由 Christian Heimes 在 :issue:`43998` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1383 +#: ../../whatsnew/3.10.rst:1384 msgid "" "The deprecated protocols SSL 3.0, TLS 1.0, and TLS 1.1 are no longer " "officially supported. Python does not block them actively. However OpenSSL " @@ -2642,7 +2629,7 @@ msgstr "" "們。然而,OpenSSL 建置選項、發行版配置、發行商補丁和密碼套件可能會阻止交握的" "成功。" -#: ../../whatsnew/3.10.rst:1388 +#: ../../whatsnew/3.10.rst:1389 msgid "" "Add a *timeout* parameter to the :func:`ssl.get_server_certificate` " "function. (Contributed by Zackery Spytz in :issue:`31870`.)" @@ -2650,7 +2637,7 @@ msgstr "" "向 :func:`ssl.get_server_certificate` 函式新增 *timeout* 參數。(由 Zackery " "Spytz 在 :issue:`31870` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1391 +#: ../../whatsnew/3.10.rst:1392 msgid "" "The ssl module uses heap-types and multi-phase initialization. (Contributed " "by Christian Heimes in :issue:`42333`.)" @@ -2658,35 +2645,33 @@ msgstr "" "ssl 模組使用堆疊類型 (heap-types) 和多階段初始化 (multi-phase " "initialization)。(由 Christian Heimes 在 :issue:`42333` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1394 +#: ../../whatsnew/3.10.rst:1395 msgid "" "A new verify flag :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN` has been added. " "(Contributed by l0x in :issue:`40849`.)" msgstr "" -"新增驗證旗標 :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN`。(由 l0x " -"在 :issue:`40849` 中貢獻。)" +"新增驗證旗標 :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN`。(由 l0x 在 :issue:" +"`40849` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1398 +#: ../../whatsnew/3.10.rst:1399 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.10.rst:1400 +#: ../../whatsnew/3.10.rst:1401 msgid "" -"Add audit events for :func:`~sqlite3.connect/" -"handle`, :meth:`~sqlite3.Connection.enable_load_extension`, " -"and :meth:`~sqlite3.Connection.load_extension`. (Contributed by Erlend E. " -"Aasland in :issue:`43762`.)" +"Add audit events for :func:`~sqlite3.connect/handle`, :meth:`~sqlite3." +"Connection.enable_load_extension`, and :meth:`~sqlite3.Connection." +"load_extension`. (Contributed by Erlend E. Aasland in :issue:`43762`.)" msgstr "" -"新增 :func:`~sqlite3.connect/" -"handle`、:meth:`~sqlite3.Connection.enable_load_extension` " -"和 :meth:`~sqlite3.Connection.load_extension` 的稽核事件。(由 Erlend E. " -"Aasland 在 :issue:`43762` 中貢獻。)" +"新增 :func:`~sqlite3.connect/handle`、:meth:`~sqlite3.Connection." +"enable_load_extension` 和 :meth:`~sqlite3.Connection.load_extension` 的稽核事" +"件。(由 Erlend E. Aasland 在 :issue:`43762` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1406 +#: ../../whatsnew/3.10.rst:1407 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.10.rst:1408 +#: ../../whatsnew/3.10.rst:1409 msgid "" "Add :data:`sys.orig_argv` attribute: the list of the original command line " "arguments passed to the Python executable. (Contributed by Victor Stinner " @@ -2695,7 +2680,7 @@ msgstr "" "新增 :data:`sys.orig_argv` 屬性:傳遞給 Python 可執行檔案的原始命令列引數列" "表。(由 Victor Stinner 在 :issue:`23427` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1412 +#: ../../whatsnew/3.10.rst:1413 msgid "" "Add :data:`sys.stdlib_module_names`, containing the list of the standard " "library module names. (Contributed by Victor Stinner in :issue:`42955`.)" @@ -2703,11 +2688,11 @@ msgstr "" "新增 :data:`sys.stdlib_module_names`,其中包含標準函式庫模組的名稱列表。 " "(由 Victor Stinner 在 :issue:`42955` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1417 +#: ../../whatsnew/3.10.rst:1418 msgid "_thread" msgstr "_thread" -#: ../../whatsnew/3.10.rst:1419 +#: ../../whatsnew/3.10.rst:1420 msgid "" ":func:`_thread.interrupt_main` now takes an optional signal number to " "simulate (the default is still :const:`signal.SIGINT`). (Contributed by " @@ -2717,88 +2702,87 @@ msgstr "" "然是 :const:`signal.SIGINT`)。(由 Antoine Pitrou 在 :issue:`43356` 中貢" "獻。)" -#: ../../whatsnew/3.10.rst:1424 +#: ../../whatsnew/3.10.rst:1425 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.10.rst:1426 +#: ../../whatsnew/3.10.rst:1427 msgid "" "Add :func:`threading.gettrace` and :func:`threading.getprofile` to retrieve " -"the functions set by :func:`threading.settrace` " -"and :func:`threading.setprofile` respectively. (Contributed by Mario " -"Corchero in :issue:`42251`.)" +"the functions set by :func:`threading.settrace` and :func:`threading." +"setprofile` respectively. (Contributed by Mario Corchero in :issue:`42251`.)" msgstr "" -"新增 :func:`threading.gettrace` 和 :func:`threading.getprofile` 分別取" -"得 :func:`threading.settrace` 和 :func:`threading.setprofile` 設定的函式。" -"(由 Mario Corchero 在 :issue:`42251` 中貢獻。)" +"新增 :func:`threading.gettrace` 和 :func:`threading.getprofile` 分別取得 :" +"func:`threading.settrace` 和 :func:`threading.setprofile` 設定的函式。(由 " +"Mario Corchero 在 :issue:`42251` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1431 +#: ../../whatsnew/3.10.rst:1432 msgid "" "Add :data:`threading.__excepthook__` to allow retrieving the original value " "of :func:`threading.excepthook` in case it is set to a broken or a different " "value. (Contributed by Mario Corchero in :issue:`42308`.)" msgstr "" -"新增 :data:`threading.__excepthook__` 以允許取" -"得 :func:`threading.excepthook` 的原始值,以防它被設定為損壞或不同的值。(由 " -"Mario Corchero 在 :issue:`42308` 中貢獻。)" +"新增 :data:`threading.__excepthook__` 以允許取得 :func:`threading." +"excepthook` 的原始值,以防它被設定為損壞或不同的值。(由 Mario Corchero 在 :" +"issue:`42308` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1437 +#: ../../whatsnew/3.10.rst:1438 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.10.rst:1439 +#: ../../whatsnew/3.10.rst:1440 msgid "" -"The :func:`~traceback.format_exception`, :func:`~traceback.format_exception_only`, " -"and :func:`~traceback.print_exception` functions can now take an exception " -"object as a positional-only argument. (Contributed by Zackery Spytz and " -"Matthias Bussonnier in :issue:`26389`.)" +"The :func:`~traceback.format_exception`, :func:`~traceback." +"format_exception_only`, and :func:`~traceback.print_exception` functions can " +"now take an exception object as a positional-only argument. (Contributed by " +"Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" msgstr "" -":func:`~traceback.format_exception`、:func:`~traceback.format_exception_only` " -"和 :func:`~traceback.print_exception` 函式現在可以將例外物件作為僅限位置引" -"數。(由 Zackery Spytz 和 Matthias Bussonnier 在 :issue:`26389` 中貢獻。)" +":func:`~traceback.format_exception`、:func:`~traceback." +"format_exception_only` 和 :func:`~traceback.print_exception` 函式現在可以將例" +"外物件作為僅限位置引數。(由 Zackery Spytz 和 Matthias Bussonnier 在 :issue:" +"`26389` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1446 +#: ../../whatsnew/3.10.rst:1447 msgid "types" msgstr "types" -#: ../../whatsnew/3.10.rst:1448 +#: ../../whatsnew/3.10.rst:1449 msgid "" -"Reintroduce the :data:`types.EllipsisType`, :data:`types.NoneType` " -"and :data:`types.NotImplementedType` classes, providing a new set of types " -"readily interpretable by type checkers. (Contributed by Bas van Beek " -"in :issue:`41810`.)" +"Reintroduce the :data:`types.EllipsisType`, :data:`types.NoneType` and :data:" +"`types.NotImplementedType` classes, providing a new set of types readily " +"interpretable by type checkers. (Contributed by Bas van Beek in :issue:" +"`41810`.)" msgstr "" -"重新引入 :data:`types.EllipsisType`、:data:`types.NoneType` " -"和 :data:`types.NotImplementedType` 類別,提供一組易於型別檢查器直譯的新型" -"別。(由 Bas van Beek 在 :issue:`41810` 中貢獻。)" +"重新引入 :data:`types.EllipsisType`、:data:`types.NoneType` 和 :data:`types." +"NotImplementedType` 類別,提供一組易於型別檢查器直譯的新型別。(由 Bas van " +"Beek 在 :issue:`41810` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1454 +#: ../../whatsnew/3.10.rst:1455 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.10.rst:1456 +#: ../../whatsnew/3.10.rst:1457 msgid "For major changes, see :ref:`new-feat-related-type-hints`." msgstr "有關重大更改,請參閱\\ :ref:`new-feat-related-type-hints`。" -#: ../../whatsnew/3.10.rst:1458 +#: ../../whatsnew/3.10.rst:1459 msgid "" -"The behavior of :class:`typing.Literal` was changed to conform " -"with :pep:`586` and to match the behavior of static type checkers specified " -"in the PEP." +"The behavior of :class:`typing.Literal` was changed to conform with :pep:" +"`586` and to match the behavior of static type checkers specified in the PEP." msgstr "" ":class:`typing.Literal` 的行為已更改為符合 :pep:`586` 並匹配 PEP 中指定的靜態" "型別檢查器的行為。" -#: ../../whatsnew/3.10.rst:1461 +#: ../../whatsnew/3.10.rst:1462 msgid "``Literal`` now de-duplicates parameters." msgstr "``Literal`` 現在可以刪除重複參數。" -#: ../../whatsnew/3.10.rst:1462 +#: ../../whatsnew/3.10.rst:1463 msgid "" "Equality comparisons between ``Literal`` objects are now order independent." msgstr "``Literal`` 物件之間的相等性比較現在與順序無關。" -#: ../../whatsnew/3.10.rst:1463 +#: ../../whatsnew/3.10.rst:1464 msgid "" "``Literal`` comparisons now respect types. For example, ``Literal[0] == " "Literal[False]`` previously evaluated to ``True``. It is now ``False``. To " @@ -2809,7 +2793,7 @@ msgstr "" "Literal[False]`` 先前之求值為 ``True``,但現在它是 ``False``。為了支援此更" "改,內部使用的型別快取現在支援了型別的辨認。" -#: ../../whatsnew/3.10.rst:1467 +#: ../../whatsnew/3.10.rst:1468 msgid "" "``Literal`` objects will now raise a :exc:`TypeError` exception during " "equality comparisons if any of their parameters are not :term:`hashable`. " @@ -2820,7 +2804,7 @@ msgstr "" "在將在相等性比較期間引發 :exc:`TypeError` 例外。請注意,使用不可雜湊的參數宣" "告 ``Literal`` 不會引發錯誤: ::" -#: ../../whatsnew/3.10.rst:1472 +#: ../../whatsnew/3.10.rst:1473 msgid "" ">>> from typing import Literal\n" ">>> Literal[{0}]\n" @@ -2836,27 +2820,26 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: unhashable type: 'set'" -#: ../../whatsnew/3.10.rst:1479 +#: ../../whatsnew/3.10.rst:1480 msgid "(Contributed by Yurii Karabas in :issue:`42345`.)" msgstr "(由 Yurii Karabas 在 :issue:`42345` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1481 +#: ../../whatsnew/3.10.rst:1482 msgid "" "Add new function :func:`typing.is_typeddict` to introspect if an annotation " -"is a :class:`typing.TypedDict`. (Contributed by Patrick Reader " -"in :issue:`41792`.)" +"is a :class:`typing.TypedDict`. (Contributed by Patrick Reader in :issue:" +"`41792`.)" msgstr "" -"新增函式 :func:`typing.is_typeddict` 來自我審查 (introspect) 註釋是否" -"為 :class:`typing.TypedDict`。(由 Patrick Reader 在 :issue:`41792` 中貢" -"獻。)" +"新增函式 :func:`typing.is_typeddict` 來自我審查 (introspect) 註釋是否為 :" +"class:`typing.TypedDict`。(由 Patrick Reader 在 :issue:`41792` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1485 +#: ../../whatsnew/3.10.rst:1486 msgid "" "Subclasses of ``typing.Protocol`` which only have data variables declared " "will now raise a ``TypeError`` when checked with ``isinstance`` unless they " "are decorated with :func:`~typing.runtime_checkable`. Previously, these " -"checks passed silently. Users should decorate their subclasses with " -"the :func:`!runtime_checkable` decorator if they want runtime protocols. " +"checks passed silently. Users should decorate their subclasses with the :" +"func:`!runtime_checkable` decorator if they want runtime protocols. " "(Contributed by Yurii Karabas in :issue:`38908`.)" msgstr "" "僅宣告了資料變數的 ``typing.Protocol`` 子類別現在在使用 ``isinstance`` 檢查時" @@ -2865,98 +2848,96 @@ msgstr "" "protocol),則應該使用 :func:`!runtime_checkable` 裝飾器來裝飾其子類別。(由 " "Yurii Karabas 在 :issue:`38908` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1493 +#: ../../whatsnew/3.10.rst:1494 msgid "" -"Importing from the ``typing.io`` and ``typing.re`` submodules will now " -"emit :exc:`DeprecationWarning`. These submodules have been deprecated since " +"Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" +"exc:`DeprecationWarning`. These submodules have been deprecated since " "Python 3.8 and will be removed in a future version of Python. Anything " "belonging to those submodules should be imported directly from :mod:`typing` " "instead. (Contributed by Sebastian Rittau in :issue:`38291`.)" msgstr "" -"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發" -"出 :exc:`DeprecationWarning`。這些子模組自 Python 3.8 起已被棄用,並將在未來" -"版本的 Python 中刪除。屬於這些子模組的任何內容都應該直接從 :mod:`typing` 引" -"入。 (由 Sebastian Rittau 在 :issue:`38291` 中貢獻。)" +"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發出 :exc:" +"`DeprecationWarning`。這些子模組自 Python 3.8 起已被棄用,並將在未來版本的 " +"Python 中刪除。屬於這些子模組的任何內容都應該直接從 :mod:`typing` 引入。 " +"(由 Sebastian Rittau 在 :issue:`38291` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1501 +#: ../../whatsnew/3.10.rst:1502 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.10.rst:1503 +#: ../../whatsnew/3.10.rst:1504 msgid "" "Add new method :meth:`~unittest.TestCase.assertNoLogs` to complement the " "existing :meth:`~unittest.TestCase.assertLogs`. (Contributed by Kit Yan Choi " "in :issue:`39385`.)" msgstr "" -"新增方法 :meth:`~unittest.TestCase.assertNoLogs` 以補足現有" -"的 :meth:`~unittest.TestCase.assertLogs`。(由 Kit Yan Choi " -"在 :issue:`39385` 中貢獻。)" +"新增方法 :meth:`~unittest.TestCase.assertNoLogs` 以補足現有的 :meth:" +"`~unittest.TestCase.assertLogs`。(由 Kit Yan Choi 在 :issue:`39385` 中貢" +"獻。)" -#: ../../whatsnew/3.10.rst:1508 +#: ../../whatsnew/3.10.rst:1509 msgid "urllib.parse" msgstr "urllib.parse" -#: ../../whatsnew/3.10.rst:1510 +#: ../../whatsnew/3.10.rst:1511 msgid "" "Python versions earlier than Python 3.10 allowed using both ``;`` and ``&`` " -"as query parameter separators in :func:`urllib.parse.parse_qs` " -"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " -"conform with newer W3C recommendations, this has been changed to allow only " -"a single separator key, with ``&`` as the default. This change also " -"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " -"affected functions internally. For more details, please see their " -"respective documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran " -"and Ken Jin in :issue:`42967`.)" -msgstr "" -"Python 3.10 之前的 Python 版本允許在 :func:`urllib.parse.parse_qs` " -"和 :func:`urllib.parse.parse_qsl` 中使用 ``;`` 和 ``&`` 作為查詢參數 (query " +"as query parameter separators in :func:`urllib.parse.parse_qs` and :func:" +"`urllib.parse.parse_qsl`. Due to security concerns, and to conform with " +"newer W3C recommendations, this has been changed to allow only a single " +"separator key, with ``&`` as the default. This change also affects :func:`!" +"cgi.parse` and :func:`!cgi.parse_multipart` as they use the affected " +"functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" +msgstr "" +"Python 3.10 之前的 Python 版本允許在 :func:`urllib.parse.parse_qs` 和 :func:" +"`urllib.parse.parse_qsl` 中使用 ``;`` 和 ``&`` 作為查詢參數 (query " "parameter) 的分隔符號。出於安全考慮,並且為了符合更新的 W3C 建議,已將其更改" -"為僅允許單個分隔符號鍵,預設為 ``&``。此更改還會影響 :func:`!cgi.parse` " -"和 :func:`!cgi.parse_multipart`,因為它們在內部使用受影響的函式。有關更多詳細" -"資訊,請參閱各自的文件。(由 Adam Goldschmidt、Senthil Kumaran 和 Ken Jin " -"在 :issue:`42967` 中貢獻。)" +"為僅允許單個分隔符號鍵,預設為 ``&``。此更改還會影響 :func:`!cgi.parse` 和 :" +"func:`!cgi.parse_multipart`,因為它們在內部使用受影響的函式。有關更多詳細資" +"訊,請參閱各自的文件。(由 Adam Goldschmidt、Senthil Kumaran 和 Ken Jin 在 :" +"issue:`42967` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1520 +#: ../../whatsnew/3.10.rst:1521 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that " -"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " -"characters are stripped from the URL by the parser in :mod:`urllib.parse` " -"preventing such attacks. The removal characters are controlled by a new " -"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " -"(See :gh:`88048`)" +"forms of attacks. Following the WHATWG specification that updates :rfc:" +"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " +"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " +"attacks. The removal characters are controlled by a new module level " +"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" -#: ../../whatsnew/3.10.rst:1528 +#: ../../whatsnew/3.10.rst:1529 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.10.rst:1530 +#: ../../whatsnew/3.10.rst:1531 msgid "" -"Add a :class:`~xml.sax.handler.LexicalHandler` class to " -"the :mod:`xml.sax.handler` module. (Contributed by Jonathan Gossage and " -"Zackery Spytz in :issue:`35018`.)" +"Add a :class:`~xml.sax.handler.LexicalHandler` class to the :mod:`xml.sax." +"handler` module. (Contributed by Jonathan Gossage and Zackery Spytz in :" +"issue:`35018`.)" msgstr "" "新增 :class:`~xml.sax.handler.LexicalHandler` 類別到 :mod:`xml.sax.handler` " "模組。(由 Jonathan Gossage 和 Zackery Spytz 在 :issue:`35018` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1535 +#: ../../whatsnew/3.10.rst:1536 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.10.rst:1536 +#: ../../whatsnew/3.10.rst:1537 msgid "" -"Add methods related " -"to :pep:`451`: :meth:`~zipimport.zipimporter.find_spec`, :meth:`zipimport.zipimporter.create_module`, " -"and :meth:`zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon " -"in :issue:`42131`.)" +"Add methods related to :pep:`451`: :meth:`~zipimport.zipimporter." +"find_spec`, :meth:`zipimport.zipimporter.create_module`, and :meth:" +"`zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon in :issue:" +"`42131`.)" msgstr "" -"新增與 :pep:`451` 相關的方" -"法::meth:`~zipimport.zipimporter.find_spec`、:meth:`zipimport.zipimporter.create_module` " -"和 :meth:`zipimport.zipimporter.exec_module`。(由 Brett Cannon " -"在 :issue:`42131` 中貢獻。)" +"新增與 :pep:`451` 相關的方法::meth:`~zipimport.zipimporter.find_spec`、:" +"meth:`zipimport.zipimporter.create_module` 和 :meth:`zipimport.zipimporter." +"exec_module`。(由 Brett Cannon 在 :issue:`42131` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1541 +#: ../../whatsnew/3.10.rst:1542 msgid "" "Add :meth:`~zipimport.zipimporter.invalidate_caches` method. (Contributed by " "Desmond Cheong in :issue:`14678`.)" @@ -2964,33 +2945,33 @@ msgstr "" "新增 :meth:`~zipimport.zipimporter.invalidate_caches` 方法。(由 Desmond " "Cheong 在 :issue:`14678` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1546 +#: ../../whatsnew/3.10.rst:1547 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.10.rst:1548 +#: ../../whatsnew/3.10.rst:1549 msgid "" "Constructors :func:`str`, :func:`bytes` and :func:`bytearray` are now faster " -"(around 30--40% for small objects). (Contributed by Serhiy Storchaka " -"in :issue:`41334`.)" +"(around 30--40% for small objects). (Contributed by Serhiy Storchaka in :" +"issue:`41334`.)" msgstr "" "建構函式 :func:`str`、:func:`bytes` 和 :func:`bytearray` 現在更快了(對於小型" "物件大約快了 30--40%)。(由 Serhiy Storchaka 在 :issue:`41334` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1552 +#: ../../whatsnew/3.10.rst:1553 msgid "" "The :mod:`runpy` module now imports fewer modules. The ``python3 -m module-" -"name`` command startup time is 1.4x faster in average. On Linux, ``python3 " -"-I -m module-name`` imports 69 modules on Python 3.9, whereas it only " -"imports 51 modules (-18) on Python 3.10. (Contributed by Victor Stinner " -"in :issue:`41006` and :issue:`41718`.)" +"name`` command startup time is 1.4x faster in average. On Linux, ``python3 -" +"I -m module-name`` imports 69 modules on Python 3.9, whereas it only imports " +"51 modules (-18) on Python 3.10. (Contributed by Victor Stinner in :issue:" +"`41006` and :issue:`41718`.)" msgstr "" ":mod:`runpy` 模組現在引入更少的模組。``python3 -m module-name`` 指令啟動時間" "平均快了 1.4 倍。在 Linux 上,``python3 -I -m module-name`` 在 Python 3.9 上" "引入 69 個模組,而在 Python 3.10 上僅引入 51 個模組 (-18)。(由 Victor " "Stinner 在 :issue:`41006` 和 :issue:`41718` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1558 +#: ../../whatsnew/3.10.rst:1559 msgid "" "The ``LOAD_ATTR`` instruction now uses new \"per opcode cache\" mechanism. " "It is about 36% faster now for regular attributes and 44% faster for slots. " @@ -3003,15 +2984,15 @@ msgstr "" "Yury Selivanov 在 :issue:`42093` 中以及 Guido van Rossum 在 :issue:`42927` 中" "貢獻,基於最初在 PyPy 和 MicroPython 中實作的想法。)" -#: ../../whatsnew/3.10.rst:1564 +#: ../../whatsnew/3.10.rst:1565 msgid "" "When building Python with :option:`--enable-optimizations` now ``-fno-" "semantic-interposition`` is added to both the compile and link line. This " "speeds builds of the Python interpreter created with :option:`--enable-" -"shared` with ``gcc`` by up to 30%. See `this article `_ for more details. (Contributed by Victor " -"Stinner and Pablo Galindo in :issue:`38980`.)" +"shared` with ``gcc`` by up to 30%. See `this article `_ for more details. (Contributed by Victor Stinner " +"and Pablo Galindo in :issue:`38980`.)" msgstr "" "當使用 :option:`--enable-optimizations` 建置 Python 時,現在 ``-fno-semantic-" "interposition`` 被新增到編譯和鏈接列 (link line) 中。這使得使用 :option:`--" @@ -3020,22 +3001,22 @@ msgstr "" "linux-8-2-brings-faster-python-3-8-run-speeds/>`_ 以了解詳情。(由 Victor " "Stinner 和 Pablo Galindo 在 :issue:`38980` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1572 +#: ../../whatsnew/3.10.rst:1573 msgid "" -"Use a new output buffer management code " -"for :mod:`bz2` / :mod:`lzma` / :mod:`zlib` modules, and add ``.readall()`` " -"function to ``_compression.DecompressReader`` class. bz2 decompression is " -"now 1.09x ~ 1.17x faster, lzma decompression 1.20x ~ 1.32x faster, " -"``GzipFile.read(-1)`` 1.11x ~ 1.18x faster. (Contributed by Ma Lin, reviewed " -"by Gregory P. Smith, in :issue:`41486`)" +"Use a new output buffer management code for :mod:`bz2` / :mod:`lzma` / :mod:" +"`zlib` modules, and add ``.readall()`` function to ``_compression." +"DecompressReader`` class. bz2 decompression is now 1.09x ~ 1.17x faster, " +"lzma decompression 1.20x ~ 1.32x faster, ``GzipFile.read(-1)`` 1.11x ~ 1.18x " +"faster. (Contributed by Ma Lin, reviewed by Gregory P. Smith, in :issue:" +"`41486`)" msgstr "" "對 :mod:`bz2` / :mod:`lzma` / :mod:`zlib` 模組使用新的輸出緩衝區管理程式碼," "並將 ``.readall()`` 函式新增到 ``_compression.DecompressReader`` 類別。 bz2 " "解壓縮速度提高了 1.09x ~ 1.17x,lzma 解壓縮速度提高了 1.20x ~ 1.32x," -"``GzipFile.read(-1)`` 速度提高了 1.11x ~ 1.18x。(由 Ma Lin " -"於 :issue:`41486` 貢獻、由 Gregory P. Smith 審閱)" +"``GzipFile.read(-1)`` 速度提高了 1.11x ~ 1.18x。(由 Ma Lin 於 :issue:" +"`41486` 貢獻、由 Gregory P. Smith 審閱)" -#: ../../whatsnew/3.10.rst:1578 +#: ../../whatsnew/3.10.rst:1579 msgid "" "When using stringized annotations, annotations dicts for functions are no " "longer created when the function is created. Instead, they are stored as a " @@ -3049,7 +3030,7 @@ msgstr "" "最佳化將定義帶有註釋的函式所需的 CPU 時間減少了一半。(由 Yurii Karabas 和 " "Inada Naoki 在 :issue:`42202` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1585 +#: ../../whatsnew/3.10.rst:1586 msgid "" "Substring search functions such as ``str1 in str2`` and ``str2.find(str1)`` " "now sometimes use Crochemore & Perrin's \"Two-Way\" string searching " @@ -3060,33 +3041,31 @@ msgstr "" "用 Crochemore & Perrin 的「雙向」字串搜尋演算法來避免作用於長字串上時發生二次" "方行為 (quadratic behavior)。(由 Dennis Sweeney 在 :issue:`41972` 中貢獻)" -#: ../../whatsnew/3.10.rst:1590 +#: ../../whatsnew/3.10.rst:1591 msgid "" "Add micro-optimizations to ``_PyType_Lookup()`` to improve type attribute " "cache lookup performance in the common case of cache hits. This makes the " -"interpreter 1.04 times faster on average. (Contributed by Dino Viehland " -"in :issue:`43452`.)" +"interpreter 1.04 times faster on average. (Contributed by Dino Viehland in :" +"issue:`43452`.)" msgstr "" "向 ``_PyType_Lookup()`` 新增微最佳化以提高快取命中的常見情況下的型別屬性快取" -"查找性能。這使得直譯器平均速度提高了 1.04 倍。(由 Dino Viehland " -"在 :issue:`43452` 中貢獻。)" +"查找性能。這使得直譯器平均速度提高了 1.04 倍。(由 Dino Viehland 在 :issue:" +"`43452` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1594 +#: ../../whatsnew/3.10.rst:1595 msgid "" "The following built-in functions now support the faster :pep:`590` " -"vectorcall calling " -"convention: :func:`map`, :func:`filter`, :func:`reversed`, :func:`bool` " -"and :func:`float`. (Contributed by Donghee Na and Jeroen Demeyer " -"in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:`41873` " -"and :issue:`41870`.)" +"vectorcall calling convention: :func:`map`, :func:`filter`, :func:" +"`reversed`, :func:`bool` and :func:`float`. (Contributed by Donghee Na and " +"Jeroen Demeyer in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:" +"`41873` and :issue:`41870`.)" msgstr "" -"以下內建函式現在支援更快的 :pep:`590` vectorcall 呼叫慣" -"例::func:`map`、:func:`filter`、:func:`reversed`、:func:`bool` " -"和 :func:`float`。(由 Donghee Na 和 Jeroen Demeyer " -"在 :issue:`43575`、:issue:`43287`、:issue:`41922`、:issue:`41873` " -"和 :issue:`41870` 中貢獻。)" +"以下內建函式現在支援更快的 :pep:`590` vectorcall 呼叫慣例::func:`map`、:" +"func:`filter`、:func:`reversed`、:func:`bool` 和 :func:`float`。(由 Donghee " +"Na 和 Jeroen Demeyer 在 :issue:`43575`、:issue:`43287`、:issue:`41922`、:" +"issue:`41873` 和 :issue:`41870` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1598 +#: ../../whatsnew/3.10.rst:1599 msgid "" ":class:`~bz2.BZ2File` performance is improved by removing internal " "``RLock``. This makes :class:`!BZ2File` thread unsafe in the face of " @@ -3094,64 +3073,62 @@ msgid "" "in :mod:`gzip` and :mod:`lzma` have always been. (Contributed by Inada " "Naoki in :issue:`43785`.)" msgstr "" -"通過刪除內部 ``RLock``,:class:`~bz2.BZ2File` 的性能得到了改進。這使" -"得 :class:`!BZ2File` 在面對多個同時的讀取器或寫入器時執行緒不安全,就" -"像 :mod:`gzip` 和 :mod:`lzma` 中的等效類別一樣。(由 Inada Naoki " -"在 :issue:`43785` 中貢獻。)" +"通過刪除內部 ``RLock``,:class:`~bz2.BZ2File` 的性能得到了改進。這使得 :" +"class:`!BZ2File` 在面對多個同時的讀取器或寫入器時執行緒不安全,就像 :mod:" +"`gzip` 和 :mod:`lzma` 中的等效類別一樣。(由 Inada Naoki 在 :issue:`43785` 中" +"貢獻。)" -#: ../../whatsnew/3.10.rst:1606 ../../whatsnew/3.10.rst:2212 +#: ../../whatsnew/3.10.rst:1607 ../../whatsnew/3.10.rst:2213 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.10.rst:1608 +#: ../../whatsnew/3.10.rst:1609 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). Starting in this release, a " "deprecation warning is raised if the numeric literal is immediately followed " -"by one of " -"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " -"and :keyword:`or`. In future releases it will be changed to syntax warning, " -"and finally to syntax error. (Contributed by Serhiy Storchaka " -"in :issue:`43833`.)" +"by one of keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:" +"`if`, :keyword:`in`, :keyword:`is` and :keyword:`or`. In future releases it " +"will be changed to syntax warning, and finally to syntax error. (Contributed " +"by Serhiy Storchaka in :issue:`43833`.)" msgstr "" "目前 Python 接受緊跟關鍵字的數字字面值 (numeric literals),例如 ``0in x``、" "``1or x``、``0if 1else 2``。它允許了令人困惑和不明確的運算式,例如 ``[0x1for " "x in y]`` (可以直譯為 ``[0x1 for x in y]`` 或 ``[0x1f or x in y]`` )。從此" -"版本開始,如果數字字面值後緊跟關鍵" -"字 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " -"與 :keyword:`or` 其中之一,則會引發棄用警告。在未來的版本中,它將被變更為語法" -"警告,最後成為為語法錯誤。(由 Serhiy Storchaka 在 :issue:`43833` 中貢獻。)" +"版本開始,如果數字字面值後緊跟關鍵字 :keyword:`and`、:keyword:`else`、:" +"keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` 與 :keyword:`or` " +"其中之一,則會引發棄用警告。在未來的版本中,它將被變更為語法警告,最後成為為" +"語法錯誤。(由 Serhiy Storchaka 在 :issue:`43833` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1619 +#: ../../whatsnew/3.10.rst:1620 msgid "" "Starting in this release, there will be a concerted effort to begin cleaning " "up old import semantics that were kept for Python 2.7 compatibility. " -"Specifically, :meth:`!find_loader`/:meth:`!find_module` (superseded " -"by :meth:`~importlib.abc.MetaPathFinder.find_spec`), :meth:`~importlib.abc.Loader.load_module` " -"(superseded by :meth:`~importlib.abc.Loader.exec_module`), :meth:`!" -"module_repr` (which the import system takes care of for you), the " +"Specifically, :meth:`!find_loader`/:meth:`!find_module` (superseded by :meth:" +"`~importlib.abc.MetaPathFinder.find_spec`), :meth:`~importlib.abc.Loader." +"load_module` (superseded by :meth:`~importlib.abc.Loader.exec_module`), :" +"meth:`!module_repr` (which the import system takes care of for you), the " "``__package__`` attribute (superseded by ``__spec__.parent``), the " "``__loader__`` attribute (superseded by ``__spec__.loader``), and the " "``__cached__`` attribute (superseded by ``__spec__.cached``) will slowly be " -"removed (as well as other classes and methods " -"in :mod:`importlib`). :exc:`ImportWarning` and/or :exc:`DeprecationWarning` " -"will be raised as appropriate to help identify code which needs updating " -"during this transition." +"removed (as well as other classes and methods in :mod:`importlib`). :exc:" +"`ImportWarning` and/or :exc:`DeprecationWarning` will be raised as " +"appropriate to help identify code which needs updating during this " +"transition." msgstr "" "從這個版本開始,我們將齊心協力開始清理為相容 Python 2.7 而保留的舊引入語義。" -"具體來說, :meth:`!find_loader`/:meth:`!find_module` " -"(被 :meth:`~importlib.abc.MetaPathFinder.find_spec` 取" -"代)、:meth:`~importlib.abc.Loader.load_module` " -"(被 :meth:`~importlib.abc.Loader.exec_module` 取代)、 :meth:`!module_repr` " -"(引入系統負責處理你)、``__package__`` 屬性(由 ``__spec__.parent`` 取" -"代)、 ``__loader__`` 屬性(由 ``__spec__.loader`` 取代)和 ``__cached__`` 屬" -"性(由 ``__spec__.cached`` 取代)將慢慢被刪除(以及 :mod:`importlib` 中的其他" -"類別和方法)。將酌情引發 :exc:`ImportWarning` 和/" -"或 :exc:`DeprecationWarning` 以幫助識別在此轉換期間需要更新的程式碼。" - -#: ../../whatsnew/3.10.rst:1636 +"具體來說, :meth:`!find_loader`/:meth:`!find_module` (被 :meth:`~importlib." +"abc.MetaPathFinder.find_spec` 取代)、:meth:`~importlib.abc.Loader." +"load_module` (被 :meth:`~importlib.abc.Loader.exec_module` 取代)、 :meth:`!" +"module_repr` (引入系統負責處理你)、``__package__`` 屬性(由 ``__spec__." +"parent`` 取代)、 ``__loader__`` 屬性(由 ``__spec__.loader`` 取代)和 " +"``__cached__`` 屬性(由 ``__spec__.cached`` 取代)將慢慢被刪除(以及 :mod:" +"`importlib` 中的其他類別和方法)。將酌情引發 :exc:`ImportWarning` 和/或 :exc:" +"`DeprecationWarning` 以幫助識別在此轉換期間需要更新的程式碼。" + +#: ../../whatsnew/3.10.rst:1637 msgid "" "The entire ``distutils`` namespace is deprecated, to be removed in Python " "3.12. Refer to the :ref:`module changes ` section for " @@ -3160,50 +3137,47 @@ msgstr "" "整個 ``distutils`` 命名空間已棄用,將在 Python 3.12 中刪除。請參閱\\ :ref:`模" "組更改 ` 以取得更多資訊。" -#: ../../whatsnew/3.10.rst:1640 +#: ../../whatsnew/3.10.rst:1641 msgid "" -"Non-integer arguments to :func:`random.randrange` are deprecated. " -"The :exc:`ValueError` is deprecated in favor of a :exc:`TypeError`. " -"(Contributed by Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)" +"Non-integer arguments to :func:`random.randrange` are deprecated. The :exc:" +"`ValueError` is deprecated in favor of a :exc:`TypeError`. (Contributed by " +"Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)" msgstr "" ":func:`random.randrange` 的非整數引數已棄用。:exc:`ValueError` 已被棄用,取而" -"代之的是 :exc:`TypeError`。(由 Serhiy Storchaka 和 Raymond Hettinger " -"在 :issue:`37319` 中貢獻。)" +"代之的是 :exc:`TypeError`。(由 Serhiy Storchaka 和 Raymond Hettinger 在 :" +"issue:`37319` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1644 +#: ../../whatsnew/3.10.rst:1645 msgid "" "The various ``load_module()`` methods of :mod:`importlib` have been " -"documented as deprecated since Python 3.6, but will now also trigger " -"a :exc:`DeprecationWarning`. Use :meth:`~importlib.abc.Loader.exec_module` " -"instead. (Contributed by Brett Cannon in :issue:`26131`.)" +"documented as deprecated since Python 3.6, but will now also trigger a :exc:" +"`DeprecationWarning`. Use :meth:`~importlib.abc.Loader.exec_module` instead. " +"(Contributed by Brett Cannon in :issue:`26131`.)" msgstr "" ":mod:`importlib` 的各種 ``load_module()`` 方法自 Python 3.6 起已被記錄為已棄" -"用,但現在也會觸發 :exc:`DeprecationWarning`。請改" -"用 :meth:`~importlib.abc.Loader.exec_module`。(由 Brett Cannon " -"在 :issue:`26131` 中貢獻。)" +"用,但現在也會觸發 :exc:`DeprecationWarning`。請改用 :meth:`~importlib.abc." +"Loader.exec_module`。(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1650 +#: ../../whatsnew/3.10.rst:1651 msgid "" ":meth:`!zimport.zipimporter.load_module` has been deprecated in preference " "for :meth:`~zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon " "in :issue:`26131`.)" msgstr "" -":meth:`!zimport.zipimporter.load_module` 已被棄用,請" -"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Brett Cannon " -"在 :issue:`26131` 中貢獻。)" +":meth:`!zimport.zipimporter.load_module` 已被棄用,請用 :meth:`~zipimport." +"zipimporter.exec_module`。(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1654 +#: ../../whatsnew/3.10.rst:1655 msgid "" "The use of :meth:`~importlib.abc.Loader.load_module` by the import system " -"now triggers an :exc:`ImportWarning` " -"as :meth:`~importlib.abc.Loader.exec_module` is preferred. (Contributed by " -"Brett Cannon in :issue:`26131`.)" +"now triggers an :exc:`ImportWarning` as :meth:`~importlib.abc.Loader." +"exec_module` is preferred. (Contributed by Brett Cannon in :issue:`26131`.)" msgstr "" -"引入系統使用 :meth:`~importlib.abc.Loader.load_module` 現在會觸" -"發 :exc:`ImportWarning`,因為 :meth:`~importlib.abc.Loader.exec_module` 是目" -"前首選。(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" +"引入系統使用 :meth:`~importlib.abc.Loader.load_module` 現在會觸發 :exc:" +"`ImportWarning`,因為 :meth:`~importlib.abc.Loader.exec_module` 是目前首選。" +"(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1659 +#: ../../whatsnew/3.10.rst:1660 msgid "" "The use of :meth:`!importlib.abc.MetaPathFinder.find_module` and :meth:`!" "importlib.abc.PathEntryFinder.find_module` by the import system now trigger " @@ -3214,88 +3188,80 @@ msgid "" msgstr "" "引入系統使用 :meth:`!importlib.abc.MetaPathFinder.find_module` 和 :meth:`!" "importlib.abc.PathEntryFinder.find_module` 現在會觸發 :exc:`ImportWarning`," -"因為 :meth:`importlib.abc.MetaPathFinder.find_spec` " -"和 :meth:`importlib.abc.PathEntryFinder.find_spec` 分別是替代方案的首選。你可" -"以使用 :func:`importlib.util.spec_from_loader` 來幫助移植。(由 Brett Cannon " -"在 :issue:`42134` 中貢獻。)" +"因為 :meth:`importlib.abc.MetaPathFinder.find_spec` 和 :meth:`importlib.abc." +"PathEntryFinder.find_spec` 分別是替代方案的首選。你可以使用 :func:`importlib." +"util.spec_from_loader` 來幫助移植。(由 Brett Cannon 在 :issue:`42134` 中貢" +"獻。)" -#: ../../whatsnew/3.10.rst:1668 +#: ../../whatsnew/3.10.rst:1669 msgid "" "The use of :meth:`!importlib.abc.PathEntryFinder.find_loader` by the import " -"system now triggers an :exc:`ImportWarning` " -"as :meth:`importlib.abc.PathEntryFinder.find_spec` is preferred. You can " -"use :func:`importlib.util.spec_from_loader` to help in porting. (Contributed " -"by Brett Cannon in :issue:`43672`.)" -msgstr "" -"引入系統使用 :meth:`!importlib.abc.PathEntryFinder.find_loader` 現在會觸" -"發 :exc:`ImportWarning`,因" -"為 :meth:`importlib.abc.PathEntryFinder.find_spec` 是首選。你可以使" -"用 :func:`importlib.util.spec_from_loader` 來幫助移植。(由 Brett Cannon " -"在 :issue:`43672` 中貢獻。)" - -#: ../../whatsnew/3.10.rst:1674 -msgid "" -"The various implementations of :meth:`!" -"importlib.abc.MetaPathFinder.find_module` ( :meth:`!" -"importlib.machinery.BuiltinImporter.find_module`, :meth:`!" -"importlib.machinery.FrozenImporter.find_module`, :meth:`!" -"importlib.machinery.WindowsRegistryFinder.find_module`, :meth:`!" -"importlib.machinery.PathFinder.find_module`, :meth:`!" -"importlib.abc.MetaPathFinder.find_module` ), :meth:`!" -"importlib.abc.PathEntryFinder.find_module` ( :meth:`!" -"importlib.machinery.FileFinder.find_module` ), and :meth:`!" -"importlib.abc.PathEntryFinder.find_loader` ( :meth:`!" -"importlib.machinery.FileFinder.find_loader` ) now " -"raise :exc:`DeprecationWarning` and are slated for removal in Python 3.12 " -"(previously they were documented as deprecated in Python 3.4). (Contributed " -"by Brett Cannon in :issue:`42135`.)" +"system now triggers an :exc:`ImportWarning` as :meth:`importlib.abc." +"PathEntryFinder.find_spec` is preferred. You can use :func:`importlib.util." +"spec_from_loader` to help in porting. (Contributed by Brett Cannon in :issue:" +"`43672`.)" +msgstr "" +"引入系統使用 :meth:`!importlib.abc.PathEntryFinder.find_loader` 現在會觸發 :" +"exc:`ImportWarning`,因為 :meth:`importlib.abc.PathEntryFinder.find_spec` 是" +"首選。你可以使用 :func:`importlib.util.spec_from_loader` 來幫助移植。(由 " +"Brett Cannon 在 :issue:`43672` 中貢獻。)" + +#: ../../whatsnew/3.10.rst:1675 +msgid "" +"The various implementations of :meth:`!importlib.abc.MetaPathFinder." +"find_module` ( :meth:`!importlib.machinery.BuiltinImporter.find_module`, :" +"meth:`!importlib.machinery.FrozenImporter.find_module`, :meth:`!importlib." +"machinery.WindowsRegistryFinder.find_module`, :meth:`!importlib.machinery." +"PathFinder.find_module`, :meth:`!importlib.abc.MetaPathFinder." +"find_module` ), :meth:`!importlib.abc.PathEntryFinder.find_module` ( :meth:`!" +"importlib.machinery.FileFinder.find_module` ), and :meth:`!importlib.abc." +"PathEntryFinder.find_loader` ( :meth:`!importlib.machinery.FileFinder." +"find_loader` ) now raise :exc:`DeprecationWarning` and are slated for " +"removal in Python 3.12 (previously they were documented as deprecated in " +"Python 3.4). (Contributed by Brett Cannon in :issue:`42135`.)" msgstr "" ":meth:`!importlib.abc.MetaPathFinder.find_module` 的各種實作(:meth:`!" -"importlib.machinery.BuiltinImporter.find_module`、:meth:`!" -"importlib.machinery.FrozenImporter.find_module`、:meth:`!" -"importlib.machinery.WindowsRegistryFinder.find_module`、:meth:`!" -"importlib.machinery.PathFinder.find_module`、:meth:`!" -"importlib.abc.MetaPathFinder.find_module` )、:meth:`!" -"importlib.abc.PathEntryFinder.find_module` (:meth:`!" -"importlib.machinery.FileFinder.find_module` ) 和 :meth:`!" -"importlib.abc.PathEntryFinder.find_loader` (:meth:`!" -"importlib.machinery.FileFinder.find_loader` ) 現在引" +"importlib.machinery.BuiltinImporter.find_module`、:meth:`!importlib." +"machinery.FrozenImporter.find_module`、:meth:`!importlib.machinery." +"WindowsRegistryFinder.find_module`、:meth:`!importlib.machinery.PathFinder." +"find_module`、:meth:`!importlib.abc.MetaPathFinder.find_module` )、:meth:`!" +"importlib.abc.PathEntryFinder.find_module` (:meth:`!importlib.machinery." +"FileFinder.find_module` ) 和 :meth:`!importlib.abc.PathEntryFinder." +"find_loader` (:meth:`!importlib.machinery.FileFinder.find_loader` ) 現在引" "發 :exc:`DeprecationWarning` 並計劃在 Python 3.12 中刪除(之前它們已在 " "Python 3.4 中被記錄為已棄用)。(由 Brett Cannon 在 :issue:`42135` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1689 +#: ../../whatsnew/3.10.rst:1690 msgid "" -":class:`!importlib.abc.Finder` is deprecated (including its sole " -"method, :meth:`!find_module`). Both :class:`importlib.abc.MetaPathFinder` " -"and :class:`importlib.abc.PathEntryFinder` no longer inherit from the class. " -"Users should inherit from one of these two classes as appropriate instead. " +":class:`!importlib.abc.Finder` is deprecated (including its sole method, :" +"meth:`!find_module`). Both :class:`importlib.abc.MetaPathFinder` and :class:" +"`importlib.abc.PathEntryFinder` no longer inherit from the class. Users " +"should inherit from one of these two classes as appropriate instead. " "(Contributed by Brett Cannon in :issue:`42135`.)" msgstr "" ":class:`!importlib.abc.Finder` 已被棄用(包括其唯一方法 :meth:`!" -"find_module`)。:class:`importlib.abc.MetaPathFinder` " -"和 :class:`importlib.abc.PathEntryFinder` 都不再從該類別繼承。使用者應該根據" -"需求來選擇其一以繼承。(由 Brett Cannon 在 :issue:`42135` 中貢獻。)" +"find_module`)。:class:`importlib.abc.MetaPathFinder` 和 :class:`importlib." +"abc.PathEntryFinder` 都不再從該類別繼承。使用者應該根據需求來選擇其一以繼承。" +"(由 Brett Cannon 在 :issue:`42135` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1696 +#: ../../whatsnew/3.10.rst:1697 msgid "" "The deprecations of :mod:`!imp`, :func:`!importlib.find_loader`, :func:`!" -"importlib.util.set_package_wrapper`, :func:`!" -"importlib.util.set_loader_wrapper`, :func:`!" -"importlib.util.module_for_loader`, :class:`!pkgutil.ImpImporter`, " -"and :class:`!pkgutil.ImpLoader` have all been updated to list Python 3.12 as " -"the slated version of removal (they began raising :exc:`DeprecationWarning` " -"in previous versions of Python). (Contributed by Brett Cannon " -"in :issue:`43720`.)" -msgstr "" -"棄用 :mod:`!imp`、:func:`!importlib.find_loader`、:func:`!" -"importlib.util.set_package_wrapper`、:func:`!" -"importlib.util.set_loader_wrapper`、:func:`!" +"importlib.util.set_package_wrapper`, :func:`!importlib.util." +"set_loader_wrapper`, :func:`!importlib.util.module_for_loader`, :class:`!" +"pkgutil.ImpImporter`, and :class:`!pkgutil.ImpLoader` have all been updated " +"to list Python 3.12 as the slated version of removal (they began raising :" +"exc:`DeprecationWarning` in previous versions of Python). (Contributed by " +"Brett Cannon in :issue:`43720`.)" +msgstr "" +"棄用 :mod:`!imp`、:func:`!importlib.find_loader`、:func:`!importlib.util." +"set_package_wrapper`、:func:`!importlib.util.set_loader_wrapper`、:func:`!" "importlib.util.module_for_loader`、:class:`!pkgutil.ImpImporter` 和 :class:`!" "pkgutil.ImpLoader` 均已更新,將於 Python 3.12 列為預定的刪除版本(它們開始在" -"過去版本的 Python 中引發 :exc:`DeprecationWarning`) 。(由 Brett Cannon " -"在 :issue:`43720` 中貢獻。)" +"過去版本的 Python 中引發 :exc:`DeprecationWarning`) 。(由 Brett Cannon 在 :" +"issue:`43720` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1706 +#: ../../whatsnew/3.10.rst:1707 msgid "" "The import system now uses the ``__spec__`` attribute on modules before " "falling back on :meth:`!module_repr` for a module's ``__repr__()`` method. " @@ -3306,30 +3272,30 @@ msgstr "" "module_repr` 作為模組的 ``__repr__()`` 方法。計劃在 Python 3.12 中刪除 " "``module_repr()`` 的使用。(由 Brett Cannon 在 :issue:`42137` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1712 +#: ../../whatsnew/3.10.rst:1713 msgid "" -":meth:`!importlib.abc.Loader.module_repr`, :meth:`!" -"importlib.machinery.FrozenLoader.module_repr`, and :meth:`!" -"importlib.machinery.BuiltinLoader.module_repr` are deprecated and slated for " -"removal in Python 3.12. (Contributed by Brett Cannon in :issue:`42136`.)" +":meth:`!importlib.abc.Loader.module_repr`, :meth:`!importlib.machinery." +"FrozenLoader.module_repr`, and :meth:`!importlib.machinery.BuiltinLoader." +"module_repr` are deprecated and slated for removal in Python 3.12. " +"(Contributed by Brett Cannon in :issue:`42136`.)" msgstr "" -":meth:`!importlib.abc.Loader.module_repr`、:meth:`!" -"importlib.machinery.FrozenLoader.module_repr` 和 :meth:`!" -"importlib.machinery.BuiltinLoader.module_repr` 已棄用並計劃在 Python 3.12 中" -"刪除。(由 Brett Cannon 在 :issue:`42136` 中貢獻。)" +":meth:`!importlib.abc.Loader.module_repr`、:meth:`!importlib.machinery." +"FrozenLoader.module_repr` 和 :meth:`!importlib.machinery.BuiltinLoader." +"module_repr` 已棄用並計劃在 Python 3.12 中刪除。(由 Brett Cannon 在 :issue:" +"`42136` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1718 +#: ../../whatsnew/3.10.rst:1719 msgid "" "``sqlite3.OptimizedUnicode`` has been undocumented and obsolete since Python " "3.3, when it was made an alias to :class:`str`. It is now deprecated, " -"scheduled for removal in Python 3.12. (Contributed by Erlend E. Aasland " -"in :issue:`42264`.)" +"scheduled for removal in Python 3.12. (Contributed by Erlend E. Aasland in :" +"issue:`42264`.)" msgstr "" "自 Python 3.3 起,``sqlite3.OptimizedUnicode`` 就沒有文件記錄並且已過時,當時" "它被用作 :class:`str` 的別名。它現已被棄用,並計劃在 Python 3.12 中刪除。" "(由 Erlend E. Aasland 在 :issue:`42264` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1723 +#: ../../whatsnew/3.10.rst:1724 msgid "" "The undocumented built-in function ``sqlite3.enable_shared_cache`` is now " "deprecated, scheduled for removal in Python 3.12. Its use is strongly " @@ -3344,67 +3310,67 @@ msgstr "" "使用共享快取,請使用 ``cache=shared`` 查詢參數以 URI 模式打開資料庫。(由 " "Erlend E. Aasland 在 :issue:`24464` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1731 +#: ../../whatsnew/3.10.rst:1732 msgid "The following ``threading`` methods are now deprecated:" msgstr "以下 ``threading`` 方法現已棄用:" -#: ../../whatsnew/3.10.rst:1733 +#: ../../whatsnew/3.10.rst:1734 msgid "``threading.currentThread`` => :func:`threading.current_thread`" msgstr "``threading.currentThread`` => :func:`threading.current_thread`" -#: ../../whatsnew/3.10.rst:1735 +#: ../../whatsnew/3.10.rst:1736 msgid "``threading.activeCount`` => :func:`threading.active_count`" msgstr "``threading.activeCount`` => :func:`threading.active_count`" -#: ../../whatsnew/3.10.rst:1737 +#: ../../whatsnew/3.10.rst:1738 msgid "" "``threading.Condition.notifyAll`` => :meth:`threading.Condition.notify_all`" msgstr "" "``threading.Condition.notifyAll`` => :meth:`threading.Condition.notify_all`" -#: ../../whatsnew/3.10.rst:1740 +#: ../../whatsnew/3.10.rst:1741 msgid "``threading.Event.isSet`` => :meth:`threading.Event.is_set`" msgstr "``threading.Event.isSet`` => :meth:`threading.Event.is_set`" -#: ../../whatsnew/3.10.rst:1742 +#: ../../whatsnew/3.10.rst:1743 msgid "``threading.Thread.setName`` => :attr:`threading.Thread.name`" msgstr "``threading.Thread.setName`` => :attr:`threading.Thread.name`" -#: ../../whatsnew/3.10.rst:1744 +#: ../../whatsnew/3.10.rst:1745 msgid "``threading.thread.getName`` => :attr:`threading.Thread.name`" msgstr "``threading.thread.getName`` => :attr:`threading.Thread.name`" -#: ../../whatsnew/3.10.rst:1746 +#: ../../whatsnew/3.10.rst:1747 msgid "``threading.Thread.isDaemon`` => :attr:`threading.Thread.daemon`" msgstr "``threading.Thread.isDaemon`` => :attr:`threading.Thread.daemon`" -#: ../../whatsnew/3.10.rst:1748 +#: ../../whatsnew/3.10.rst:1749 msgid "``threading.Thread.setDaemon`` => :attr:`threading.Thread.daemon`" msgstr "``threading.Thread.setDaemon`` => :attr:`threading.Thread.daemon`" -#: ../../whatsnew/3.10.rst:1750 +#: ../../whatsnew/3.10.rst:1751 msgid "(Contributed by Jelle Zijlstra in :gh:`87889`.)" msgstr "(由 Jelle Zijlstra 在 :gh:`87889` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1752 +#: ../../whatsnew/3.10.rst:1753 msgid "" ":meth:`!pathlib.Path.link_to` is deprecated and slated for removal in Python " "3.12. Use :meth:`pathlib.Path.hardlink_to` instead. (Contributed by Barney " "Gale in :issue:`39950`.)" msgstr "" -":meth:`!pathlib.Path.link_to` 已棄用並計劃在 Python 3.12 中刪除。請改" -"用 :meth:`pathlib.Path.hardlink_to`。(由 Barney Gale 在 :issue:`39950` 中貢" +":meth:`!pathlib.Path.link_to` 已棄用並計劃在 Python 3.12 中刪除。請改用 :" +"meth:`pathlib.Path.hardlink_to`。(由 Barney Gale 在 :issue:`39950` 中貢" "獻。)" -#: ../../whatsnew/3.10.rst:1756 +#: ../../whatsnew/3.10.rst:1757 msgid "" "``cgi.log()`` is deprecated and slated for removal in Python 3.12. " "(Contributed by Inada Naoki in :issue:`41139`.)" msgstr "" -"``cgi.log()`` 已棄用並計劃在 Python 3.12 中刪除。(由 Inada Naoki " -"在 :issue:`41139` 中貢獻。)" +"``cgi.log()`` 已棄用並計劃在 Python 3.12 中刪除。(由 Inada Naoki 在 :issue:" +"`41139` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1759 +#: ../../whatsnew/3.10.rst:1760 msgid "" "The following :mod:`ssl` features have been deprecated since Python 3.6, " "Python 3.7, or OpenSSL 1.1.0 and will be removed in 3.11:" @@ -3412,53 +3378,51 @@ msgstr "" "自 Python 3.6、Python 3.7 或 OpenSSL 1.1.0 起,以下 :mod:`ssl` 功能已被棄用," "並將在 3.11 中刪除:" -#: ../../whatsnew/3.10.rst:1762 +#: ../../whatsnew/3.10.rst:1763 msgid "" ":data:`!OP_NO_SSLv2`, :data:`!OP_NO_SSLv3`, :data:`!OP_NO_TLSv1`, :data:`!" "OP_NO_TLSv1_1`, :data:`!OP_NO_TLSv1_2`, and :data:`!OP_NO_TLSv1_3` are " -"replaced by :attr:`~ssl.SSLContext.minimum_version` " -"and :attr:`~ssl.SSLContext.maximum_version`." +"replaced by :attr:`~ssl.SSLContext.minimum_version` and :attr:`~ssl." +"SSLContext.maximum_version`." msgstr "" ":data:`!OP_NO_SSLv2`、:data:`!OP_NO_SSLv3`、:data:`!OP_NO_TLSv1`、:data:`!" "OP_NO_TLSv1_1`、:data:`!OP_NO_TLSv1_2`、和 :data:`!OP_NO_TLSv1_3` 已被替換" -"為 :attr:`~ssl.sslSSLContext.minimum_version` " -"和 :attr:`~ssl.sslSSLContext.maximum_version`。" +"為 :attr:`~ssl.sslSSLContext.minimum_version` 和 :attr:`~ssl.sslSSLContext." +"maximum_version`。" -#: ../../whatsnew/3.10.rst:1768 +#: ../../whatsnew/3.10.rst:1769 msgid "" -":data:`!PROTOCOL_SSLv2`, :data:`!PROTOCOL_SSLv3`, :data:`!" -"PROTOCOL_SSLv23`, :data:`!PROTOCOL_TLSv1`, :data:`!" -"PROTOCOL_TLSv1_1`, :data:`!PROTOCOL_TLSv1_2`, and :const:`!PROTOCOL_TLS` are " -"deprecated in favor of :const:`~ssl.PROTOCOL_TLS_CLIENT` " -"and :const:`~ssl.PROTOCOL_TLS_SERVER`" +":data:`!PROTOCOL_SSLv2`, :data:`!PROTOCOL_SSLv3`, :data:`!PROTOCOL_SSLv23`, :" +"data:`!PROTOCOL_TLSv1`, :data:`!PROTOCOL_TLSv1_1`, :data:`!" +"PROTOCOL_TLSv1_2`, and :const:`!PROTOCOL_TLS` are deprecated in favor of :" +"const:`~ssl.PROTOCOL_TLS_CLIENT` and :const:`~ssl.PROTOCOL_TLS_SERVER`" msgstr "" -":data:`!PROTOCOL_SSLv2`、:data:`!PROTOCOL_SSLv3`、:data:`!" -"PROTOCOL_SSLv23`、:data:`!PROTOCOL_TLSv1`、:data:`!" -"PROTOCOL_TLSv1_1`、:data:`!PROTOCOL_TLSv1_2` 和 :const:`!PROTOCOL_TLS` 已棄" -"用,取而代之的是 :const:`~ssl.PROTOCOL_TLS_CLIENT` " -"和 :const:`~ssl.PROTOCOL_TLS_SERVER`" +":data:`!PROTOCOL_SSLv2`、:data:`!PROTOCOL_SSLv3`、:data:`!PROTOCOL_SSLv23`、:" +"data:`!PROTOCOL_TLSv1`、:data:`!PROTOCOL_TLSv1_1`、:data:`!PROTOCOL_TLSv1_2` " +"和 :const:`!PROTOCOL_TLS` 已棄用,取而代之的是 :const:`~ssl." +"PROTOCOL_TLS_CLIENT` 和 :const:`~ssl.PROTOCOL_TLS_SERVER`" -#: ../../whatsnew/3.10.rst:1774 +#: ../../whatsnew/3.10.rst:1775 msgid ":func:`!wrap_socket` is replaced by :meth:`ssl.SSLContext.wrap_socket`" msgstr ":func:`!wrap_socket` 被替換為 :meth:`ssl.SSLContext.wrap_socket`" -#: ../../whatsnew/3.10.rst:1776 +#: ../../whatsnew/3.10.rst:1777 msgid ":func:`!match_hostname`" msgstr ":func:`!match_hostname`" -#: ../../whatsnew/3.10.rst:1778 +#: ../../whatsnew/3.10.rst:1779 msgid ":func:`!RAND_pseudo_bytes`, :func:`!RAND_egd`" msgstr ":func:`!RAND_pseudo_bytes`, :func:`!RAND_egd`" -#: ../../whatsnew/3.10.rst:1780 +#: ../../whatsnew/3.10.rst:1781 msgid "" -"NPN features like :meth:`ssl.SSLSocket.selected_npn_protocol` " -"and :meth:`ssl.SSLContext.set_npn_protocols` are replaced by ALPN." +"NPN features like :meth:`ssl.SSLSocket.selected_npn_protocol` and :meth:`ssl." +"SSLContext.set_npn_protocols` are replaced by ALPN." msgstr "" -"NPN 功能如 :meth:`ssl.SSLSocket.selected_npn_protocol` " -"和 :meth:`ssl.SSLContext.set_npn_protocols` 已被 ALPN 取代。" +"NPN 功能如 :meth:`ssl.SSLSocket.selected_npn_protocol` 和 :meth:`ssl." +"SSLContext.set_npn_protocols` 已被 ALPN 取代。" -#: ../../whatsnew/3.10.rst:1783 +#: ../../whatsnew/3.10.rst:1784 msgid "" "The threading debug (:envvar:`!PYTHONTHREADDEBUG` environment variable) is " "deprecated in Python 3.10 and will be removed in Python 3.12. This feature " @@ -3469,60 +3433,60 @@ msgstr "" "並將在 Python 3.12 中刪除。此功能需要一個 :ref:`Python 的除錯用建置版本 " "`。(由 Victor Stinner 在 :issue:`44584` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1788 +#: ../../whatsnew/3.10.rst:1789 msgid "" -"Importing from the ``typing.io`` and ``typing.re`` submodules will now " -"emit :exc:`DeprecationWarning`. These submodules will be removed in a " -"future version of Python. Anything belonging to these submodules should be " +"Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" +"exc:`DeprecationWarning`. These submodules will be removed in a future " +"version of Python. Anything belonging to these submodules should be " "imported directly from :mod:`typing` instead. (Contributed by Sebastian " "Rittau in :issue:`38291`.)" msgstr "" -"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發" -"出 :exc:`DeprecationWarning`。這些子模組將在 Python 的未來版本中刪除。屬於這" -"些子模組的任何內容都應該直接從 :mod:`typing` 引入。(由 Sebastian Rittau " -"在 :issue:`38291` 中貢獻。)" +"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發出 :exc:" +"`DeprecationWarning`。這些子模組將在 Python 的未來版本中刪除。屬於這些子模組" +"的任何內容都應該直接從 :mod:`typing` 引入。(由 Sebastian Rittau 在 :issue:" +"`38291` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1797 ../../whatsnew/3.10.rst:2220 +#: ../../whatsnew/3.10.rst:1798 ../../whatsnew/3.10.rst:2221 msgid "Removed" msgstr "已刪除" -#: ../../whatsnew/3.10.rst:1799 +#: ../../whatsnew/3.10.rst:1800 msgid "" "Removed special methods ``__int__``, ``__float__``, ``__floordiv__``, " "``__mod__``, ``__divmod__``, ``__rfloordiv__``, ``__rmod__`` and " -"``__rdivmod__`` of the :class:`complex` class. They always raised " -"a :exc:`TypeError`. (Contributed by Serhiy Storchaka in :issue:`41974`.)" +"``__rdivmod__`` of the :class:`complex` class. They always raised a :exc:" +"`TypeError`. (Contributed by Serhiy Storchaka in :issue:`41974`.)" msgstr "" "刪除了 :class:`complex` 類別的特殊方法 ``__int__``、``__float__``、" "``__floordiv__``、``__mod__``、``__divmod__``、``__rfloordiv__``、" "``__rmod__`` 和 ``__rdivmod__`` 。它們都會引發 :exc:`TypeError`。(由 Serhiy " "Storchaka 在 :issue:`41974` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1805 +#: ../../whatsnew/3.10.rst:1806 msgid "" "The ``ParserBase.error()`` method from the private and undocumented " "``_markupbase`` module has been removed. :class:`html.parser.HTMLParser` is " "the only subclass of ``ParserBase`` and its ``error()`` implementation was " -"already removed in Python 3.5. (Contributed by Berker Peksag " -"in :issue:`31844`.)" +"already removed in Python 3.5. (Contributed by Berker Peksag in :issue:" +"`31844`.)" msgstr "" "``_markupbase`` 模組中私有、未於文件記錄的 ``ParserBase.error()`` 方法已被刪" "除。:class:`html.parser.HTMLParser` 是 ``ParserBase`` 的唯一子類別,它的 " "``error()`` 實作已在 Python 3.5 中刪除。(由 Berker Peksag 在 :issue:`31844` " "中貢獻。)" -#: ../../whatsnew/3.10.rst:1811 +#: ../../whatsnew/3.10.rst:1812 msgid "" "Removed the ``unicodedata.ucnhash_CAPI`` attribute which was an internal " "PyCapsule object. The related private ``_PyUnicode_Name_CAPI`` structure was " -"moved to the internal C API. (Contributed by Victor Stinner " -"in :issue:`42157`.)" +"moved to the internal C API. (Contributed by Victor Stinner in :issue:" +"`42157`.)" msgstr "" "刪除了 ``unicodedata.ucnhash_CAPI`` 屬性,該屬性是內部 PyCapsule 物件。相關的" -"私有 ``_PyUnicode_Name_CAPI`` 結構已移至內部 C API。(由 Victor Stinner " -"在 :issue:`42157` 中貢獻。)" +"私有 ``_PyUnicode_Name_CAPI`` 結構已移至內部 C API。(由 Victor Stinner 在 :" +"issue:`42157` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1816 +#: ../../whatsnew/3.10.rst:1817 msgid "" "Removed the ``parser`` module, which was deprecated in 3.9 due to the switch " "to the new PEG parser, as well as all the C source and header files that " @@ -3533,7 +3497,7 @@ msgstr "" "析器使用的所有 C 原始碼和標頭檔也已被刪除,包括 ``node.h``、``parser.h``、" "``graminit.h`` 和 ``grammar.h``。" -#: ../../whatsnew/3.10.rst:1821 +#: ../../whatsnew/3.10.rst:1822 msgid "" "Removed the Public C API functions ``PyParser_SimpleParseStringFlags``, " "``PyParser_SimpleParseStringFlagsFilename``, " @@ -3545,7 +3509,7 @@ msgstr "" "``PyParser_SimpleParseFileFlags`` 和 ``PyNode_Compile``,這些函式由於切換到新" "的 PEG 剖析器而在 3.9 中被棄用。" -#: ../../whatsnew/3.10.rst:1826 +#: ../../whatsnew/3.10.rst:1827 msgid "" "Removed the ``formatter`` module, which was deprecated in Python 3.4. It is " "somewhat obsolete, little used, and not tested. It was originally scheduled " @@ -3558,39 +3522,39 @@ msgstr "" "Python 2.7 EOL 之後。現有使用者應該將他們使用的任何類別複製到他們的程式碼中。" "(由 Donghee Na 和 Terry J. Reedy 在 :issue:`42299` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1833 +#: ../../whatsnew/3.10.rst:1834 msgid "" "Removed the :c:func:`!PyModule_GetWarningsModule` function that was useless " "now due to the :mod:`!_warnings` module was converted to a builtin module in " "2.6. (Contributed by Hai Shi in :issue:`42599`.)" msgstr "" -"刪除了 :c:func:`!PyModule_GetWarningsModule` 函式,該函式現在無用,因" -"為 :mod:`!_warnings` 模組在 2.6 中已轉換為內建模組。(由 Hai Shi " -"在 :issue:`42599` 中貢獻。)" +"刪除了 :c:func:`!PyModule_GetWarningsModule` 函式,該函式現在無用,因為 :mod:" +"`!_warnings` 模組在 2.6 中已轉換為內建模組。(由 Hai Shi 在 :issue:`42599` 中" +"貢獻。)" -#: ../../whatsnew/3.10.rst:1837 +#: ../../whatsnew/3.10.rst:1838 msgid "" "Remove deprecated aliases to :ref:`collections-abstract-base-classes` from " -"the :mod:`collections` module. (Contributed by Victor Stinner " -"in :issue:`37324`.)" +"the :mod:`collections` module. (Contributed by Victor Stinner in :issue:" +"`37324`.)" msgstr "" "從 :mod:`collections` 模組中刪除已棄用的、對 :ref:`collections-abstract-base-" "classes` 的別名。(由 Victor Stinner 在 :issue:`37324` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1841 +#: ../../whatsnew/3.10.rst:1842 msgid "" -"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ " -"'s :doc:`high-level API <../library/asyncio-api-index>` following " -"deprecation in Python 3.8. The motivation behind this change is multifold:" +"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" +"doc:`high-level API <../library/asyncio-api-index>` following deprecation in " +"Python 3.8. The motivation behind this change is multifold:" msgstr "" "在 Python 3.8 中棄用後,``loop`` 參數已從大多數 :mod:`asyncio` 的\\ :doc:`高" "階 API <../library/asyncio-api-index>` 中刪除。這一變化的背後動機是多方面的:" -#: ../../whatsnew/3.10.rst:1845 +#: ../../whatsnew/3.10.rst:1846 msgid "This simplifies the high-level API." msgstr "這簡化了高階 API。" -#: ../../whatsnew/3.10.rst:1846 +#: ../../whatsnew/3.10.rst:1847 msgid "" "The functions in the high-level API have been implicitly getting the current " "thread's running event loop since Python 3.7. There isn't a need to pass " @@ -3599,43 +3563,43 @@ msgstr "" "自 Python 3.7 以來,高階 API 中的函式一直隱式取得目前執行緒正在運行的事件循" "環。在大多數正常用例中,不需要將事件循環傳遞給 API。" -#: ../../whatsnew/3.10.rst:1849 +#: ../../whatsnew/3.10.rst:1850 msgid "" "Event loop passing is error-prone especially when dealing with loops running " "in different threads." msgstr "事件循環的傳遞很容易出錯,尤其是在處理在不同執行緒中運行的循環時。" -#: ../../whatsnew/3.10.rst:1852 +#: ../../whatsnew/3.10.rst:1853 msgid "" "Note that the low-level API will still accept ``loop``. See :ref:`changes-" "python-api` for examples of how to replace existing code." msgstr "" -"請注意,低階 API 仍會接受 ``loop``。有關如何替換現有程式碼的範例,請參" -"閱 :ref:`changes-python-api`。" +"請注意,低階 API 仍會接受 ``loop``。有關如何替換現有程式碼的範例,請參閱 :" +"ref:`changes-python-api`。" -#: ../../whatsnew/3.10.rst:1855 ../../whatsnew/3.10.rst:1927 +#: ../../whatsnew/3.10.rst:1856 ../../whatsnew/3.10.rst:1928 msgid "" "(Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and Kyle " "Stanley in :issue:`42392`.)" msgstr "" -"(由 Yurii Karabas、Andrew Svetlov、Yury Selivanov 和 Kyle Stanley " -"在 :issue:`42392` 中貢獻。)" +"(由 Yurii Karabas、Andrew Svetlov、Yury Selivanov 和 Kyle Stanley 在 :issue:" +"`42392` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1860 ../../whatsnew/3.10.rst:2147 +#: ../../whatsnew/3.10.rst:1861 ../../whatsnew/3.10.rst:2148 msgid "Porting to Python 3.10" msgstr "移植到 Python 3.10" -#: ../../whatsnew/3.10.rst:1862 +#: ../../whatsnew/3.10.rst:1863 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "本節列出了前面描述的更改以及可能需要更改程式碼的其他錯誤修復。" -#: ../../whatsnew/3.10.rst:1867 +#: ../../whatsnew/3.10.rst:1868 msgid "Changes in the Python syntax" msgstr "Python 語法的變化" -#: ../../whatsnew/3.10.rst:1869 +#: ../../whatsnew/3.10.rst:1870 msgid "" "Deprecation warning is now emitted when compiling previously valid syntax if " "the numeric literal is immediately followed by a keyword (like in ``0in " @@ -3649,35 +3613,34 @@ msgstr "" "要消除警告並使程式碼與未來版本相容,只需在數字字面值和以下關鍵字之間新增一個" "空格即可。(由 Serhiy Storchaka 在 :issue:`43833` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1880 +#: ../../whatsnew/3.10.rst:1881 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.10.rst:1882 +#: ../../whatsnew/3.10.rst:1883 msgid "" -"The *etype* parameters of " -"the :func:`~traceback.format_exception`, :func:`~traceback.format_exception_only`, " -"and :func:`~traceback.print_exception` functions in the :mod:`traceback` " -"module have been renamed to *exc*. (Contributed by Zackery Spytz and " -"Matthias Bussonnier in :issue:`26389`.)" +"The *etype* parameters of the :func:`~traceback.format_exception`, :func:" +"`~traceback.format_exception_only`, and :func:`~traceback.print_exception` " +"functions in the :mod:`traceback` module have been renamed to *exc*. " +"(Contributed by Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" msgstr "" -":func:`~traceback.format_exception`、:func:`~traceback.format_exception_only` " -"和 :mod:`traceback` 模組中的 :func:`~traceback.print_exception` 函式的 " -"*etype* 參數已重命名為 *exc*。(由 Zackery Spytz 和 Matthias Bussonnier " -"在 :issue:`26389` 中貢獻。)" +":func:`~traceback.format_exception`、:func:`~traceback." +"format_exception_only` 和 :mod:`traceback` 模組中的 :func:`~traceback." +"print_exception` 函式的 *etype* 參數已重命名為 *exc*。(由 Zackery Spytz 和 " +"Matthias Bussonnier 在 :issue:`26389` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1888 +#: ../../whatsnew/3.10.rst:1889 msgid "" -":mod:`atexit`: At Python exit, if a callback registered " -"with :func:`atexit.register` fails, its exception is now logged. Previously, " -"only some exceptions were logged, and the last exception was always silently " -"ignored. (Contributed by Victor Stinner in :issue:`42639`.)" +":mod:`atexit`: At Python exit, if a callback registered with :func:`atexit." +"register` fails, its exception is now logged. Previously, only some " +"exceptions were logged, and the last exception was always silently ignored. " +"(Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" ":mod:`atexit`:在 Python 退出時,如果一個使用 :func:`atexit.register` 註冊的" "回呼 (callback) 失敗,該例外現在會被記錄下來。在以前只記錄一些例外,並且最後" "一個例外總是被默默地忽略。(由 Victor Stinner 在 :issue:`42639` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1894 +#: ../../whatsnew/3.10.rst:1895 msgid "" ":class:`collections.abc.Callable` generic now flattens type parameters, " "similar to what :data:`typing.Callable` currently does. This means that " @@ -3686,44 +3649,43 @@ msgid "" "accesses the arguments via :func:`typing.get_args` or ``__args__`` need to " "account for this change. Furthermore, :exc:`TypeError` may be raised for " "invalid forms of parameterizing :class:`collections.abc.Callable` which may " -"have passed silently in Python 3.9. (Contributed by Ken Jin " -"in :issue:`42195`.)" -msgstr "" -":class:`collections.abc.Callable` 泛型現在會攤平型別參數,類似" -"於 :data:`typing.Callable` 目前的做法。這意味著 " -"``collections.abc.Callable[[int, str], str]`` 將具有 ``(int, str, str)`` 的 " -"``__args__``;以前這是 ``([int, str], str)``。透過 :func:`typing.get_args` " -"或 ``__args__`` 存取參數的程式碼需要考慮此變更。此外,對於無效形式的參數" -"化 :class:`collections.abc.Callable`,可能會引發 :exc:`TypeError`,而在 " -"Python 3.9 中,該參數可能已被默默地傳遞。(由 Ken Jin 在 :issue:`42195` 中貢" -"獻。)" +"have passed silently in Python 3.9. (Contributed by Ken Jin in :issue:" +"`42195`.)" +msgstr "" +":class:`collections.abc.Callable` 泛型現在會攤平型別參數,類似於 :data:" +"`typing.Callable` 目前的做法。這意味著 ``collections.abc.Callable[[int, " +"str], str]`` 將具有 ``(int, str, str)`` 的 ``__args__``;以前這是 ``([int, " +"str], str)``。透過 :func:`typing.get_args` 或 ``__args__`` 存取參數的程式碼需" +"要考慮此變更。此外,對於無效形式的參數化 :class:`collections.abc.Callable`," +"可能會引發 :exc:`TypeError`,而在 Python 3.9 中,該參數可能已被默默地傳遞。" +"(由 Ken Jin 在 :issue:`42195` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1904 +#: ../../whatsnew/3.10.rst:1905 msgid "" ":meth:`socket.htons` and :meth:`socket.ntohs` now raise :exc:`OverflowError` " "instead of :exc:`DeprecationWarning` if the given parameter will not fit in " -"a 16-bit unsigned integer. (Contributed by Erlend E. Aasland " -"in :issue:`42393`.)" +"a 16-bit unsigned integer. (Contributed by Erlend E. Aasland in :issue:" +"`42393`.)" msgstr "" -"如果給定參數不適合 16 位元無符號整數 (16-bit unsigned " -"integer),:meth:`socket.htons` 和 :meth:`socket.ntohs` 現在會引" -"發 :exc:`OverflowError` 而不是 :exc:`DeprecationWarning`。(由 Erlend E. " -"Aasland 在 :issue:`42393` 中貢獻。)" +"如果給定參數不適合 16 位元無符號整數 (16-bit unsigned integer),:meth:" +"`socket.htons` 和 :meth:`socket.ntohs` 現在會引發 :exc:`OverflowError` 而不" +"是 :exc:`DeprecationWarning`。(由 Erlend E. Aasland 在 :issue:`42393` 中貢" +"獻。)" -#: ../../whatsnew/3.10.rst:1909 +#: ../../whatsnew/3.10.rst:1910 msgid "" -"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ " -"'s :doc:`high-level API <../library/asyncio-api-index>` following " -"deprecation in Python 3.8." +"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" +"doc:`high-level API <../library/asyncio-api-index>` following deprecation in " +"Python 3.8." msgstr "" "在 Python 3.8 中棄用後,``loop`` 參數已從大多數 :mod:`asyncio` 的\\ :doc:`高" "階 API <../library/asyncio-api-index>` 中刪除。" -#: ../../whatsnew/3.10.rst:1913 +#: ../../whatsnew/3.10.rst:1914 msgid "A coroutine that currently looks like this::" msgstr "目前如下所示的協程: ::" -#: ../../whatsnew/3.10.rst:1915 +#: ../../whatsnew/3.10.rst:1916 msgid "" "async def foo(loop):\n" " await asyncio.sleep(1, loop=loop)" @@ -3731,11 +3693,11 @@ msgstr "" "async def foo(loop):\n" " await asyncio.sleep(1, loop=loop)" -#: ../../whatsnew/3.10.rst:1918 +#: ../../whatsnew/3.10.rst:1919 msgid "Should be replaced with this::" msgstr "應替換為: ::" -#: ../../whatsnew/3.10.rst:1920 +#: ../../whatsnew/3.10.rst:1921 msgid "" "async def foo():\n" " await asyncio.sleep(1)" @@ -3743,7 +3705,7 @@ msgstr "" "async def foo():\n" " await asyncio.sleep(1)" -#: ../../whatsnew/3.10.rst:1923 +#: ../../whatsnew/3.10.rst:1924 msgid "" "If ``foo()`` was specifically designed *not* to run in the current thread's " "running event loop (e.g. running in another thread's event loop), consider " @@ -3752,28 +3714,27 @@ msgstr "" "如果 ``foo()`` 被專門設計為 *不* 在目前執行緒的事件循環中運行(例如在另一個執" "行緒的事件循環中運行),請考慮改用 :func:`asyncio.run_coroutine_threadsafe`。" -#: ../../whatsnew/3.10.rst:1930 +#: ../../whatsnew/3.10.rst:1931 msgid "" "The :data:`types.FunctionType` constructor now inherits the current builtins " "if the *globals* dictionary has no ``\"__builtins__\"`` key, rather than " -"using ``{\"None\": None}`` as builtins: same behavior as :func:`eval` " -"and :func:`exec` functions. Defining a function with ``def " -"function(...): ...`` in Python is not affected, globals cannot be overridden " -"with this syntax: it also inherits the current builtins. (Contributed by " -"Victor Stinner in :issue:`42990`.)" -msgstr "" -"如果 *globals* 字典沒有 ``\"__builtins__\"`` 鍵," -"則 :data:`types.FunctionType` 建構函式現在會繼承目前的內建物件,而不是使用 " -"``{\"None\": None}``:相同行為如 :func:`eval` 和 :func:`exec` 函式。在 " -"Python 中使用 ``def function(...): ...`` 定義函式不受影響,全域變數不能用此語" -"法覆蓋:它也繼承目前的內建物件。(由 Victor Stinner 在 :issue:`42990` 中貢" -"獻。)" - -#: ../../whatsnew/3.10.rst:1939 +"using ``{\"None\": None}`` as builtins: same behavior as :func:`eval` and :" +"func:`exec` functions. Defining a function with ``def function(...): ...`` " +"in Python is not affected, globals cannot be overridden with this syntax: it " +"also inherits the current builtins. (Contributed by Victor Stinner in :issue:" +"`42990`.)" +msgstr "" +"如果 *globals* 字典沒有 ``\"__builtins__\"`` 鍵,則 :data:`types." +"FunctionType` 建構函式現在會繼承目前的內建物件,而不是使用 ``{\"None\": None}" +"``:相同行為如 :func:`eval` 和 :func:`exec` 函式。在 Python 中使用 ``def " +"function(...): ...`` 定義函式不受影響,全域變數不能用此語法覆蓋:它也繼承目前" +"的內建物件。(由 Victor Stinner 在 :issue:`42990` 中貢獻。)" + +#: ../../whatsnew/3.10.rst:1940 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.10.rst:1941 +#: ../../whatsnew/3.10.rst:1942 msgid "" "The C API functions ``PyParser_SimpleParseStringFlags``, " "``PyParser_SimpleParseStringFlagsFilename``, " @@ -3786,7 +3747,7 @@ msgstr "" "``PyParser_SimpleParseFileFlags``、``PyNode_Compile`` 和被這些函式使用的型別 " "``struct _node`` 被刪除。" -#: ../../whatsnew/3.10.rst:1947 +#: ../../whatsnew/3.10.rst:1948 msgid "" "Source should be now be compiled directly to a code object using, for " "example, :c:func:`Py_CompileString`. The resulting code object can then be " @@ -3796,11 +3757,11 @@ msgstr "" "件。然後可以(例如透過 :c:func:`PyEval_EvalCode`)為產生的程式碼物件求值 " "(evaluated)。" -#: ../../whatsnew/3.10.rst:1951 +#: ../../whatsnew/3.10.rst:1952 msgid "Specifically:" msgstr "具體來說:" -#: ../../whatsnew/3.10.rst:1953 +#: ../../whatsnew/3.10.rst:1954 msgid "" "A call to ``PyParser_SimpleParseStringFlags`` followed by ``PyNode_Compile`` " "can be replaced by calling :c:func:`Py_CompileString`." @@ -3808,7 +3769,7 @@ msgstr "" "後跟有 ``PyNode_Compile`` 呼叫的 ``PyParser_SimpleParseStringFlags`` 呼叫,可" "以替換為呼叫 :c:func:`Py_CompileString`。" -#: ../../whatsnew/3.10.rst:1956 +#: ../../whatsnew/3.10.rst:1957 msgid "" "There is no direct replacement for ``PyParser_SimpleParseFileFlags``. To " "compile code from a ``FILE *`` argument, you will need to read the file in C " @@ -3817,21 +3778,20 @@ msgstr "" "沒有 ``PyParser_SimpleParseFileFlags`` 的直接替代品。要從 ``FILE *`` 引數編譯" "程式碼,你需要用 C 讀取檔案並將結果緩衝區傳遞給 :c:func:`Py_CompileString`。" -#: ../../whatsnew/3.10.rst:1960 +#: ../../whatsnew/3.10.rst:1961 msgid "" "To compile a file given a ``char *`` filename, explicitly open the file, " "read it and compile the result. One way to do this is using the :py:mod:`io` " -"module " -"with :c:func:`PyImport_ImportModule`, :c:func:`PyObject_CallMethod`, :c:func:`PyBytes_AsString` " -"and :c:func:`Py_CompileString`, as sketched below. (Declarations and error " -"handling are omitted.) ::" +"module with :c:func:`PyImport_ImportModule`, :c:func:`PyObject_CallMethod`, :" +"c:func:`PyBytes_AsString` and :c:func:`Py_CompileString`, as sketched below. " +"(Declarations and error handling are omitted.) ::" msgstr "" "要編譯給定 ``char *`` 檔案名稱的檔案,請顯式打開該檔案,讀取它並編譯結果。一" -"種方法是使用 :py:mod:`io` 模組" -"和 :c:func:`PyImport_ImportModule`、:c:func:`PyObject_CallMethod`、:c:func:`PyBytes_AsString` " -"和 :c:func:`Py_CompileString`,如下所示。(宣告和錯誤處理在此被省略。): ::" +"種方法是使用 :py:mod:`io` 模組和 :c:func:`PyImport_ImportModule`、:c:func:" +"`PyObject_CallMethod`、:c:func:`PyBytes_AsString` 和 :c:func:" +"`Py_CompileString`,如下所示。(宣告和錯誤處理在此被省略。): ::" -#: ../../whatsnew/3.10.rst:1966 +#: ../../whatsnew/3.10.rst:1967 msgid "" "io_module = Import_ImportModule(\"io\");\n" "fileobject = PyObject_CallMethod(io_module, \"open\", \"ss\", filename, " @@ -3849,15 +3809,15 @@ msgstr "" "source_buf = PyBytes_AsString(source_bytes_object);\n" "code = Py_CompileString(source_buf, filename, Py_file_input);" -#: ../../whatsnew/3.10.rst:1973 +#: ../../whatsnew/3.10.rst:1974 msgid "" "For ``FrameObject`` objects, the :attr:`~frame.f_lasti` member now " "represents a wordcode offset instead of a simple offset into the bytecode " "string. This means that this number needs to be multiplied by 2 to be used " "with APIs that expect a byte offset instead (like :c:func:`PyCode_Addr2Line` " "for example). Notice as well that the :attr:`!f_lasti` member of " -"``FrameObject`` objects is not considered stable: please " -"use :c:func:`PyFrame_GetLineNumber` instead." +"``FrameObject`` objects is not considered stable: please use :c:func:" +"`PyFrame_GetLineNumber` instead." msgstr "" "對於 ``FrameObject`` 物件,:attr:`~frame.f_lasti` 成員現在表示了字碼偏移量 " "(wordcode offset),而不是位元組碼字串的簡單偏移量。這意味著這個數字需要乘以 " @@ -3865,11 +3825,11 @@ msgstr "" "還要注意,``FrameObject`` 物件的 :attr:`!f_lasti` 成員不被認為是穩定的:請改" "用 :c:func:`PyFrame_GetLineNumber`。" -#: ../../whatsnew/3.10.rst:1981 +#: ../../whatsnew/3.10.rst:1982 msgid "CPython bytecode changes" msgstr "CPython 位元組碼變更" -#: ../../whatsnew/3.10.rst:1983 +#: ../../whatsnew/3.10.rst:1984 msgid "" "The ``MAKE_FUNCTION`` instruction now accepts either a dict or a tuple of " "strings as the function's annotations. (Contributed by Yurii Karabas and " @@ -3878,11 +3838,11 @@ msgstr "" "``MAKE_FUNCTION`` 指令現在接受字典或字串元組作為函式的註釋。(由 Yurii " "Karabas 和 Inada Naoki 在 :issue:`42202` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1988 +#: ../../whatsnew/3.10.rst:1989 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.10.rst:1990 +#: ../../whatsnew/3.10.rst:1991 msgid "" ":pep:`644`: Python now requires OpenSSL 1.1.1 or newer. OpenSSL 1.0.2 is no " "longer supported. (Contributed by Christian Heimes in :issue:`43669`.)" @@ -3890,7 +3850,7 @@ msgstr "" ":pep:`644`:Python 現在需要 OpenSSL 1.1.1 或更高版本。不再支援 OpenSSL " "1.0.2。(由 Christian Heimes 在 :issue:`43669` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1994 +#: ../../whatsnew/3.10.rst:1995 msgid "" "The C99 functions :c:func:`snprintf` and :c:func:`vsnprintf` are now " "required to build Python. (Contributed by Victor Stinner in :issue:`36020`.)" @@ -3898,7 +3858,7 @@ msgstr "" "現在需要 C99 函式 :c:func:`snprintf` 和 :c:func:`vsnprintf` 來建置 Python。 " "(由 Victor Stinner 在 :issue:`36020` 中貢獻。)" -#: ../../whatsnew/3.10.rst:1998 +#: ../../whatsnew/3.10.rst:1999 msgid "" ":mod:`sqlite3` requires SQLite 3.7.15 or higher. (Contributed by Sergey " "Fedoseev and Erlend E. Aasland in :issue:`40744` and :issue:`40810`.)" @@ -3906,25 +3866,25 @@ msgstr "" ":mod:`sqlite3` 需要 SQLite 3.7.15 或更新版本。(由 Sergey Fedoseev 和 Erlend " "E. Aasland 在 :issue:`40744` 和 :issue:`40810` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2001 +#: ../../whatsnew/3.10.rst:2002 msgid "" "The :mod:`atexit` module must now always be built as a built-in module. " "(Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" -":mod:`atexit` 模組現在必須都被建置為內建模組。(由 Victor Stinner " -"在 :issue:`42639` 中貢獻。)" +":mod:`atexit` 模組現在必須都被建置為內建模組。(由 Victor Stinner 在 :issue:" +"`42639` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2004 +#: ../../whatsnew/3.10.rst:2005 msgid "" "Add :option:`--disable-test-modules` option to the ``configure`` script: " "don't build nor install test modules. (Contributed by Xavier de Gaye, Thomas " "Petazzoni and Peixing Xin in :issue:`27640`.)" msgstr "" "將 :option:`--disable-test-modules` 選項新增到 ``configure`` 腳本中:不建置也" -"不安裝測試模組。(由 Xavier de Gaye、Thomas Petazzoni 和 Peixing Xin " -"在 :issue:`27640` 中貢獻。)" +"不安裝測試模組。(由 Xavier de Gaye、Thomas Petazzoni 和 Peixing Xin 在 :" +"issue:`27640` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2008 +#: ../../whatsnew/3.10.rst:2009 msgid "" "Add :option:`--with-wheel-pkg-dir=PATH option <--with-wheel-pkg-dir>` to the " "``./configure`` script. If specified, the :mod:`ensurepip` module looks for " @@ -3937,36 +3897,36 @@ msgstr "" "``setuptools`` 和 ``pip`` wheel 套件:如果兩者都存在,則使用這些 wheel 套件而" "不是 ensurepip 捆綁的 wheel 套件。" -#: ../../whatsnew/3.10.rst:2014 +#: ../../whatsnew/3.10.rst:2015 msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" -"share/python-wheels/`` directory and don't install the " -"``ensurepip._bundled`` package." +"share/python-wheels/`` directory and don't install the ``ensurepip." +"_bundled`` package." msgstr "" "一些 Linux 發行版的打包策略建議不要一併包入依賴項目。例如,Fedora 在 ``/usr/" -"share/python-wheels/`` 目錄中安裝 wheel 套件,並且不安裝 " -"``ensurepip._bundled`` 套件。" +"share/python-wheels/`` 目錄中安裝 wheel 套件,並且不安裝 ``ensurepip." +"_bundled`` 套件。" -#: ../../whatsnew/3.10.rst:2019 +#: ../../whatsnew/3.10.rst:2020 msgid "(Contributed by Victor Stinner in :issue:`42856`.)" msgstr "(由 Victor Stinner 在 :issue:`42856` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2021 +#: ../../whatsnew/3.10.rst:2022 msgid "" "Add a new :option:`configure --without-static-libpython option <--without-" "static-libpython>` to not build the ``libpythonMAJOR.MINOR.a`` static " "library and not install the ``python.o`` object file." msgstr "" "新增 :option:`configure --without-static-libpython 選項 <--without-static-" -"libpython>` 以不建置 ``libpythonMAJOR.MINOR.a`` 靜態函式庫且不安裝 " -"``python.o`` 目標檔案。" +"libpython>` 以不建置 ``libpythonMAJOR.MINOR.a`` 靜態函式庫且不安裝 ``python." +"o`` 目標檔案。" -#: ../../whatsnew/3.10.rst:2025 +#: ../../whatsnew/3.10.rst:2026 msgid "(Contributed by Victor Stinner in :issue:`43103`.)" msgstr "(由 Victor Stinner 在 :issue:`43103` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2027 +#: ../../whatsnew/3.10.rst:2028 msgid "" "The ``configure`` script now uses the ``pkg-config`` utility, if available, " "to detect the location of Tcl/Tk headers and libraries. As before, those " @@ -3979,7 +3939,7 @@ msgstr "" "includes`` 和 ``--with-tcltk-libs`` 配置選項顯式指定這些位置。(由 Manolis " "Stamatogiannakis 在 :issue:`42603` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2033 +#: ../../whatsnew/3.10.rst:2034 msgid "" "Add :option:`--with-openssl-rpath` option to ``configure`` script. The " "option simplifies building Python with a custom OpenSSL installation, e.g. " @@ -3991,63 +3951,61 @@ msgstr "" "openssl=/path/to/openssl --with-openssl-rpath=auto``。(由 Christian Heimes " "在 :issue:`43466` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2040 +#: ../../whatsnew/3.10.rst:2041 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.10.rst:2043 +#: ../../whatsnew/3.10.rst:2044 msgid "PEP 652: Maintaining the Stable ABI" msgstr "PEP 652:維護穩定 ABI" -#: ../../whatsnew/3.10.rst:2045 +#: ../../whatsnew/3.10.rst:2046 msgid "" "The Stable ABI (Application Binary Interface) for extension modules or " "embedding Python is now explicitly defined. :ref:`stable` describes C API " "and ABI stability guarantees along with best practices for using the Stable " "ABI." msgstr "" -"用於擴充模組或嵌入 Python 的穩定 ABI(應用程式二進位介面)現已明確定" -"義。 :ref:`stable` 描述了 C API 和 ABI 穩定性保證以及使用穩定 ABI 的最佳實" -"踐。" +"用於擴充模組或嵌入 Python 的穩定 ABI(應用程式二進位介面)現已明確定義。 :" +"ref:`stable` 描述了 C API 和 ABI 穩定性保證以及使用穩定 ABI 的最佳實踐。" -#: ../../whatsnew/3.10.rst:2050 +#: ../../whatsnew/3.10.rst:2051 msgid "(Contributed by Petr Viktorin in :pep:`652` and :issue:`43795`.)" msgstr "(由 Petr Viktorin 在 :pep:`652` 和 :issue:`43795` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2055 +#: ../../whatsnew/3.10.rst:2056 msgid "" -"The result of :c:func:`PyNumber_Index` now always has exact " -"type :class:`int`. Previously, the result could have been an instance of a " -"subclass of ``int``. (Contributed by Serhiy Storchaka in :issue:`40792`.)" +"The result of :c:func:`PyNumber_Index` now always has exact type :class:" +"`int`. Previously, the result could have been an instance of a subclass of " +"``int``. (Contributed by Serhiy Storchaka in :issue:`40792`.)" msgstr "" ":c:func:`PyNumber_Index` 的結果現在都具有精確的 :class:`int` 型別。在以前,結" "果可能是 ``int`` 子類別的實例。(由 Serhiy Storchaka 在 :issue:`40792` 中貢" "獻。)" -#: ../../whatsnew/3.10.rst:2059 +#: ../../whatsnew/3.10.rst:2060 msgid "" "Add a new :c:member:`~PyConfig.orig_argv` member to the :c:type:`PyConfig` " "structure: the list of the original command line arguments passed to the " "Python executable. (Contributed by Victor Stinner in :issue:`23427`.)" msgstr "" "將新的 :c:member:`~PyConfig.orig_argv` 成員新增到 :c:type:`PyConfig` 結構:傳" -"遞給 Python 可執行檔案的原始命令列參數列表。(由 Victor Stinner " -"在 :issue:`23427` 中貢獻。)" +"遞給 Python 可執行檔案的原始命令列參數列表。(由 Victor Stinner 在 :issue:" +"`23427` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2064 +#: ../../whatsnew/3.10.rst:2065 msgid "" -"The :c:func:`PyDateTime_DATE_GET_TZINFO` " -"and :c:func:`PyDateTime_TIME_GET_TZINFO` macros have been added for " -"accessing the ``tzinfo`` attributes of :class:`datetime.datetime` " -"and :class:`datetime.time` objects. (Contributed by Zackery Spytz " -"in :issue:`30155`.)" +"The :c:func:`PyDateTime_DATE_GET_TZINFO` and :c:func:" +"`PyDateTime_TIME_GET_TZINFO` macros have been added for accessing the " +"``tzinfo`` attributes of :class:`datetime.datetime` and :class:`datetime." +"time` objects. (Contributed by Zackery Spytz in :issue:`30155`.)" msgstr "" -"新增了 :c:func:`PyDateTime_DATE_GET_TZINFO` " -"和 :c:func:`PyDateTime_TIME_GET_TZINFO` 巨集,用於存" -"取 :class:`datetime.datetime` 和 :class:`datetime.time` 物件的 ``tzinfo`` 屬" -"性。(由 Zackery Spytz 在 :issue:`30155` 中貢獻。)" +"新增了 :c:func:`PyDateTime_DATE_GET_TZINFO` 和 :c:func:" +"`PyDateTime_TIME_GET_TZINFO` 巨集,用於存取 :class:`datetime.datetime` 和 :" +"class:`datetime.time` 物件的 ``tzinfo`` 屬性。(由 Zackery Spytz 在 :issue:" +"`30155` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2070 +#: ../../whatsnew/3.10.rst:2071 msgid "" "Add a :c:func:`PyCodec_Unregister` function to unregister a codec search " "function. (Contributed by Hai Shi in :issue:`41842`.)" @@ -4055,7 +4013,7 @@ msgstr "" "新增 :c:func:`PyCodec_Unregister` 函式來取消註冊編解碼器搜尋函式。(由 Hai " "Shi 在 :issue:`41842` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2074 +#: ../../whatsnew/3.10.rst:2075 msgid "" "The :c:func:`PyIter_Send` function was added to allow sending value into " "iterator without raising ``StopIteration`` exception. (Contributed by " @@ -4064,7 +4022,7 @@ msgstr "" "新增了 :c:func:`PyIter_Send` 函式,以允許將值發送到疊代器中,而不會引發 " "``StopIteration`` 例外。(由 Vladimir Matveev 在 :issue:`41756` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2078 +#: ../../whatsnew/3.10.rst:2079 msgid "" "Add :c:func:`PyUnicode_AsUTF8AndSize` to the limited C API. (Contributed by " "Alex Gaynor in :issue:`41784`.)" @@ -4072,17 +4030,17 @@ msgstr "" "將 :c:func:`PyUnicode_AsUTF8AndSize` 新增到受限 C API (limited C API) 中。" "(由 Alex Gaynor 在 :issue:`41784` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2081 +#: ../../whatsnew/3.10.rst:2082 msgid "" -"Add :c:func:`PyModule_AddObjectRef` function: similar " -"to :c:func:`PyModule_AddObject` but don't steal a reference to the value on " -"success. (Contributed by Victor Stinner in :issue:`1635741`.)" +"Add :c:func:`PyModule_AddObjectRef` function: similar to :c:func:" +"`PyModule_AddObject` but don't steal a reference to the value on success. " +"(Contributed by Victor Stinner in :issue:`1635741`.)" msgstr "" -"新增 :c:func:`PyModule_AddObjectRef` 函式:類似" -"於 :c:func:`PyModule_AddObject` 但成功時不竊取對值的參照。(由 Victor " -"Stinner 在 :issue:`1635741` 中貢獻。)" +"新增 :c:func:`PyModule_AddObjectRef` 函式:類似於 :c:func:" +"`PyModule_AddObject` 但成功時不竊取對值的參照。(由 Victor Stinner 在 :issue:" +"`1635741` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2086 +#: ../../whatsnew/3.10.rst:2087 msgid "" "Add :c:func:`Py_NewRef` and :c:func:`Py_XNewRef` functions to increment the " "reference count of an object and return the object. (Contributed by Victor " @@ -4091,17 +4049,17 @@ msgstr "" "新增 :c:func:`Py_NewRef` 和 :c:func:`Py_XNewRef` 函式來增加物件的參照計數並回" "傳物件。(由 Victor Stinner 在 :issue:`42262` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2090 +#: ../../whatsnew/3.10.rst:2091 msgid "" -"The :c:func:`PyType_FromSpecWithBases` " -"and :c:func:`PyType_FromModuleAndSpec` functions now accept a single class " -"as the *bases* argument. (Contributed by Serhiy Storchaka in :issue:`42423`.)" +"The :c:func:`PyType_FromSpecWithBases` and :c:func:" +"`PyType_FromModuleAndSpec` functions now accept a single class as the " +"*bases* argument. (Contributed by Serhiy Storchaka in :issue:`42423`.)" msgstr "" ":c:func:`PyType_FromSpecWithBases` 和 :c:func:`PyType_FromModuleAndSpec` 函式" "現在接受單個類別作為 *bases* 引數。(由 Serhiy Storchaka 在 :issue:`42423` 中" "貢獻。)" -#: ../../whatsnew/3.10.rst:2094 +#: ../../whatsnew/3.10.rst:2095 msgid "" "The :c:func:`PyType_FromModuleAndSpec` function now accepts NULL ``tp_doc`` " "slot. (Contributed by Hai Shi in :issue:`41832`.)" @@ -4109,7 +4067,7 @@ msgstr "" ":c:func:`PyType_FromModuleAndSpec` 函式現在接受 NULL ``tp_doc`` 槽位。(由 " "Hai Shi 在 :issue:`41832` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2098 +#: ../../whatsnew/3.10.rst:2099 msgid "" "The :c:func:`PyType_GetSlot` function can accept :ref:`static types `. (Contributed by Hai Shi and Petr Viktorin in :issue:`41073`.)" @@ -4117,7 +4075,7 @@ msgstr "" ":c:func:`PyType_GetSlot` 函式可以接受\\ :ref:`靜態型別 (static type) `。(由 Hai Shi 和 Petr Viktorin 在 :issue:`41073` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2102 +#: ../../whatsnew/3.10.rst:2103 msgid "" "Add a new :c:func:`PySet_CheckExact` function to the C-API to check if an " "object is an instance of :class:`set` but not an instance of a subtype. " @@ -4126,7 +4084,7 @@ msgstr "" "向 C-API 新增 :c:func:`PySet_CheckExact` 函式,以檢查物件是否是 :class:`set` " "的實例而不是子型別的實例。(由 Pablo Galindo 在 :issue:`43277` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2106 +#: ../../whatsnew/3.10.rst:2107 msgid "" "Add :c:func:`PyErr_SetInterruptEx` which allows passing a signal number to " "simulate. (Contributed by Antoine Pitrou in :issue:`43356`.)" @@ -4134,17 +4092,17 @@ msgstr "" "新增 :c:func:`PyErr_SetInterruptEx`,它允許傳遞信號編號來進行模擬。(由 " "Antoine Pitrou 在 :issue:`43356` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2110 +#: ../../whatsnew/3.10.rst:2111 msgid "" "The limited C API is now supported if :ref:`Python is built in debug mode " "` (if the ``Py_DEBUG`` macro is defined). In the limited C API, " "the :c:func:`Py_INCREF` and :c:func:`Py_DECREF` functions are now " -"implemented as opaque function calls, rather than accessing directly " -"the :c:member:`PyObject.ob_refcnt` member, if Python is built in debug mode " -"and the ``Py_LIMITED_API`` macro targets Python 3.10 or newer. It became " -"possible to support the limited C API in debug mode because " -"the :c:type:`PyObject` structure is the same in release and debug mode since " -"Python 3.8 (see :issue:`36465`)." +"implemented as opaque function calls, rather than accessing directly the :c:" +"member:`PyObject.ob_refcnt` member, if Python is built in debug mode and the " +"``Py_LIMITED_API`` macro targets Python 3.10 or newer. It became possible to " +"support the limited C API in debug mode because the :c:type:`PyObject` " +"structure is the same in release and debug mode since Python 3.8 (see :issue:" +"`36465`)." msgstr "" "如 :ref:`Python 是在除錯模式 (debug mode) ` 下建置的(如果有定" "義 ``Py_DEBUG`` 巨集),現在會支援受限 C API。在受限 C API 中,如果 Python 是" @@ -4154,43 +4112,42 @@ msgstr "" "C API 成為可能,因為自 Python 3.8 以來,:c:type:`PyObject` 結構在發布和除錯模" "式下是相同的(請參閱:issue:`36465`)。" -#: ../../whatsnew/3.10.rst:2120 +#: ../../whatsnew/3.10.rst:2121 msgid "" "The limited C API is still not supported in the :option:`--with-trace-refs` " -"special build (``Py_TRACE_REFS`` macro). (Contributed by Victor Stinner " -"in :issue:`43688`.)" +"special build (``Py_TRACE_REFS`` macro). (Contributed by Victor Stinner in :" +"issue:`43688`.)" msgstr "" ":option:`--with-trace-refs` 特殊建置(``Py_TRACE_REFS`` 巨集)仍不支援受限 C " "API。(由 Victor Stinner 在 :issue:`43688` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2124 +#: ../../whatsnew/3.10.rst:2125 msgid "" "Add the :c:func:`Py_Is(x, y) ` function to test if the *x* object is " -"the *y* object, the same as ``x is y`` in Python. Add also " -"the :c:func:`Py_IsNone`, :c:func:`Py_IsTrue`, :c:func:`Py_IsFalse` functions " -"to test if an object is, respectively, the ``None`` singleton, the ``True`` " -"singleton or the ``False`` singleton. (Contributed by Victor Stinner " -"in :issue:`43753`.)" +"the *y* object, the same as ``x is y`` in Python. Add also the :c:func:" +"`Py_IsNone`, :c:func:`Py_IsTrue`, :c:func:`Py_IsFalse` functions to test if " +"an object is, respectively, the ``None`` singleton, the ``True`` singleton " +"or the ``False`` singleton. (Contributed by Victor Stinner in :issue:" +"`43753`.)" msgstr "" "新增 :c:func:`Py_Is(x, y) ` 函式來測試 *x* 物件是否為 *y* 物件,與 " -"Python 中的 ``x is y`` 相同。還新" -"增 :c:func:`Py_IsNone`、:c:func:`Py_IsTrue`、:c:func:`Py_IsFalse` 函式來分別" -"測試物件是否為 ``None`` 單例、 ``True`` 單例或 ``False`` 單例。(由 Victor " -"Stinner 在 :issue:`43753` 中貢獻。)" +"Python 中的 ``x is y`` 相同。還新增 :c:func:`Py_IsNone`、:c:func:" +"`Py_IsTrue`、:c:func:`Py_IsFalse` 函式來分別測試物件是否為 ``None`` 單例、 " +"``True`` 單例或 ``False`` 單例。(由 Victor Stinner 在 :issue:`43753` 中貢" +"獻。)" -#: ../../whatsnew/3.10.rst:2131 +#: ../../whatsnew/3.10.rst:2132 msgid "" -"Add new functions to control the garbage collector from C " -"code: :c:func:`PyGC_Enable()`, :c:func:`PyGC_Disable()`, :c:func:`PyGC_IsEnabled()`. " -"These functions allow to activate, deactivate and query the state of the " -"garbage collector from C code without having to import the :mod:`gc` module." +"Add new functions to control the garbage collector from C code: :c:func:" +"`PyGC_Enable()`, :c:func:`PyGC_Disable()`, :c:func:`PyGC_IsEnabled()`. These " +"functions allow to activate, deactivate and query the state of the garbage " +"collector from C code without having to import the :mod:`gc` module." msgstr "" -"新增函式以從 C 程式碼控制垃圾收集" -"器::c:func:`PyGC_Enable()`、:c:func:`PyGC_Disable()`、:c:func:`PyGC_IsEnabled()`。" -"這些函式使得能夠從 C 程式碼啟用、停用和查詢垃圾收集器的狀態,而無需引" -"入 :mod:`gc` 模組。" +"新增函式以從 C 程式碼控制垃圾收集器::c:func:`PyGC_Enable()`、:c:func:" +"`PyGC_Disable()`、:c:func:`PyGC_IsEnabled()`。這些函式使得能夠從 C 程式碼啟" +"用、停用和查詢垃圾收集器的狀態,而無需引入 :mod:`gc` 模組。" -#: ../../whatsnew/3.10.rst:2138 +#: ../../whatsnew/3.10.rst:2139 msgid "" "Add a new :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` type flag to disallow " "creating type instances. (Contributed by Victor Stinner in :issue:`43916`.)" @@ -4198,30 +4155,30 @@ msgstr "" "新增 :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` 型別旗標以禁止建立型別實" "例。(由 Victor Stinner 在 :issue:`43916` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2142 +#: ../../whatsnew/3.10.rst:2143 msgid "" "Add a new :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` type flag for creating " "immutable type objects: type attributes cannot be set nor deleted. " "(Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)" msgstr "" "新增 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 型別旗標用於建立不可變型別物件:無法" -"設定或刪除型別屬性。(由 Victor Stinner 和 Erlend E. Aasland " -"在 :issue:`43908` 中貢獻。)" +"設定或刪除型別屬性。(由 Victor Stinner 和 Erlend E. Aasland 在 :issue:" +"`43908` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2149 +#: ../../whatsnew/3.10.rst:2150 msgid "" -"The ``PY_SSIZE_T_CLEAN`` macro must now be defined to " -"use :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use " -"``#``: ``es#``, ``et#``, ``s#``, ``u#``, ``y#``, ``z#``, ``U#`` and ``Z#``. " -"See :ref:`arg-parsing` and :pep:`353`. (Contributed by Victor Stinner " -"in :issue:`40943`.)" +"The ``PY_SSIZE_T_CLEAN`` macro must now be defined to use :c:func:" +"`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use ``#``: " +"``es#``, ``et#``, ``s#``, ``u#``, ``y#``, ``z#``, ``U#`` and ``Z#``. See :" +"ref:`arg-parsing` and :pep:`353`. (Contributed by Victor Stinner in :issue:" +"`40943`.)" msgstr "" -"現在必須定義 ``PY_SSIZE_T_CLEAN`` 巨集以使用 :c:func:`PyArg_ParseTuple` " -"和 :c:func:`Py_BuildValue` 格式,這些格式使用 ``#``: ``es#``, ``et#``、" -"``s#``、``u#``、``y#``、``z#``、``U#`` 和 ``Z#``。請參閱 :ref:`arg-parsing` " -"和 :pep:`353`。(由 Victor Stinner 在 :issue:`40943` 中貢獻。)" +"現在必須定義 ``PY_SSIZE_T_CLEAN`` 巨集以使用 :c:func:`PyArg_ParseTuple` 和 :" +"c:func:`Py_BuildValue` 格式,這些格式使用 ``#``: ``es#``, ``et#``、``s#``、" +"``u#``、``y#``、``z#``、``U#`` 和 ``Z#``。請參閱 :ref:`arg-parsing` 和 :pep:" +"`353`。(由 Victor Stinner 在 :issue:`40943` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2155 +#: ../../whatsnew/3.10.rst:2156 msgid "" "Since :c:func:`Py_REFCNT()` is changed to the inline static function, " "``Py_REFCNT(obj) = new_refcnt`` must be replaced with ``Py_SET_REFCNT(obj, " @@ -4233,7 +4190,7 @@ msgstr "" "new_refcnt)`` :參見 :c:func:`Py_SET_REFCNT()` (自 Python 3.9 起可用)。為了" "向後相容,可以使用該巨集: ::" -#: ../../whatsnew/3.10.rst:2160 +#: ../../whatsnew/3.10.rst:2161 msgid "" "#if PY_VERSION_HEX < 0x030900A4\n" "# define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)\n" @@ -4243,21 +4200,21 @@ msgstr "" "# define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)\n" "#endif" -#: ../../whatsnew/3.10.rst:2164 +#: ../../whatsnew/3.10.rst:2165 msgid "(Contributed by Victor Stinner in :issue:`39573`.)" msgstr "(由 Victor Stinner 在 :issue:`39573` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2166 +#: ../../whatsnew/3.10.rst:2167 msgid "" "Calling :c:func:`PyDict_GetItem` without :term:`GIL` held had been allowed " "for historical reason. It is no longer allowed. (Contributed by Victor " "Stinner in :issue:`40839`.)" msgstr "" -"由於過去的種種原因,過去在不持有 :term:`GIL` 的情況下呼" -"叫 :c:func:`PyDict_GetItem` 是被允許的。目前已被禁止。(由 Victor Stinner " -"在 :issue:`40839` 中貢獻。)" +"由於過去的種種原因,過去在不持有 :term:`GIL` 的情況下呼叫 :c:func:" +"`PyDict_GetItem` 是被允許的。目前已被禁止。(由 Victor Stinner 在 :issue:" +"`40839` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2170 +#: ../../whatsnew/3.10.rst:2171 msgid "" "``PyUnicode_FromUnicode(NULL, size)`` and " "``PyUnicode_FromStringAndSize(NULL, size)`` raise ``DeprecationWarning`` " @@ -4269,7 +4226,7 @@ msgstr "" "分配沒有初始資料的 Unicode 物件。(由 Inada Naoki 在 :issue:`36346` 中貢" "獻。)" -#: ../../whatsnew/3.10.rst:2175 +#: ../../whatsnew/3.10.rst:2176 msgid "" "The private ``_PyUnicode_Name_CAPI`` structure of the PyCapsule API " "``unicodedata.ucnhash_CAPI`` has been moved to the internal C API. " @@ -4278,67 +4235,66 @@ msgstr "" "PyCapsule API ``unicodedata.ucnhash_CAPI`` 的私有 ``_PyUnicode_Name_CAPI`` 結" "構已移至內部 C API。(由 Victor Stinner 在 :issue:`42157` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2179 +#: ../../whatsnew/3.10.rst:2180 msgid "" -":c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` " -"and :c:func:`Py_GetProgramName` functions now return ``NULL`` if called " -"before :c:func:`Py_Initialize` (before Python is initialized). Use the " -"new :ref:`init-config` API to get the :ref:`init-path-config`. (Contributed " -"by Victor Stinner in :issue:`42260`.)" +":c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:" +"func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and :c:func:" +"`Py_GetProgramName` functions now return ``NULL`` if called before :c:func:" +"`Py_Initialize` (before Python is initialized). Use the new :ref:`init-" +"config` API to get the :ref:`init-path-config`. (Contributed by Victor " +"Stinner in :issue:`42260`.)" msgstr "" -"如果在 :c:func:`Py_Initialize` 之前(Python 初始化之前)被呼" -"叫,:c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:`Py_GetExecPrefix`、:c:func:`Py_GetProgramFullPath`、:c:func:`Py_GetPythonHome` " -"和 :c:func:`Py_GetProgramName` 現在會回傳 ``NULL``。使用新的 :ref:`init-" -"config` API 來取得 :ref:`init-path-config`。(由 Victor Stinner " -"在 :issue:`42260` 中貢獻。)" +"如果在 :c:func:`Py_Initialize` 之前(Python 初始化之前)被呼叫,:c:func:" +"`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:`Py_GetExecPrefix`、:c:func:" +"`Py_GetProgramFullPath`、:c:func:`Py_GetPythonHome` 和 :c:func:" +"`Py_GetProgramName` 現在會回傳 ``NULL``。使用新的 :ref:`init-config` API 來取" +"得 :ref:`init-path-config`。(由 Victor Stinner 在 :issue:`42260` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2186 +#: ../../whatsnew/3.10.rst:2187 msgid "" -":c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` " -"and :c:func:`PyCell_SET` macros can no longer be used as l-value or r-value. " -"For example, ``x = PyList_SET_ITEM(a, b, c)`` and ``PyList_SET_ITEM(a, b, c) " -"= x`` now fail with a compiler error. It prevents bugs like ``if " +":c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` and :c:func:" +"`PyCell_SET` macros can no longer be used as l-value or r-value. For " +"example, ``x = PyList_SET_ITEM(a, b, c)`` and ``PyList_SET_ITEM(a, b, c) = " +"x`` now fail with a compiler error. It prevents bugs like ``if " "(PyList_SET_ITEM (a, b, c) < 0) ...`` test. (Contributed by Zackery Spytz " "and Victor Stinner in :issue:`30459`.)" msgstr "" -":c:func:`PyList_SET_ITEM`、:c:func:`PyTuple_SET_ITEM` " -"和 :c:func:`PyCell_SET` 巨集不能再用作左值 (l-value) 或右值 (r-value)。例如," -"``x = PyList_SET_ITEM(a, b, c)`` 和 ``PyList_SET_ITEM(a, b, c) = x`` 現在會失" -"敗並出現編譯器錯誤。它可以防止如 ``if (PyList_SET_ITEM (a, b, c) < 0) ...`` " -"測試之類的錯誤。(由 Zackery Spytz 和 Victor Stinner 在 :issue:`30459` 中貢" -"獻。)" +":c:func:`PyList_SET_ITEM`、:c:func:`PyTuple_SET_ITEM` 和 :c:func:" +"`PyCell_SET` 巨集不能再用作左值 (l-value) 或右值 (r-value)。例如,``x = " +"PyList_SET_ITEM(a, b, c)`` 和 ``PyList_SET_ITEM(a, b, c) = x`` 現在會失敗並出" +"現編譯器錯誤。它可以防止如 ``if (PyList_SET_ITEM (a, b, c) < 0) ...`` 測試之" +"類的錯誤。(由 Zackery Spytz 和 Victor Stinner 在 :issue:`30459` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2193 +#: ../../whatsnew/3.10.rst:2194 msgid "" "The non-limited API files ``odictobject.h``, ``parser_interface.h``, " -"``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, " -"``pyfpe.h``, and ``pytime.h`` have been moved to the ``Include/cpython`` " -"directory. These files must not be included directly, as they are already " -"included in ``Python.h``; see :ref:`api-includes`. If they have been " -"included directly, consider including ``Python.h`` instead. (Contributed by " -"Nicholas Sim in :issue:`35134`.)" -msgstr "" -"非受限 API 檔案 ``odictobject.h``、``parser_interface.h``、" -"``picklebufobject.h``、``pyarena.h``、``pyctype.h``、``pydebug.h``、" -"``pyfpe.h`` 和 ``pytime.h`` 已移至 ``Include/cpython`` 目錄。這些檔案不得直接" -"被引入,因為它們已於 ``Python.h`` 中引入;請參閱 :ref:`api-includes`。如果直" -"接引入它們,請考慮改為引入 ``Python.h``。(由 Nicholas Sim 在 :issue:`35134` " -"中貢獻。)" +"``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, ``pyfpe." +"h``, and ``pytime.h`` have been moved to the ``Include/cpython`` directory. " +"These files must not be included directly, as they are already included in " +"``Python.h``; see :ref:`api-includes`. If they have been included directly, " +"consider including ``Python.h`` instead. (Contributed by Nicholas Sim in :" +"issue:`35134`.)" +msgstr "" +"非受限 API 檔案 ``odictobject.h``、``parser_interface.h``、``picklebufobject." +"h``、``pyarena.h``、``pyctype.h``、``pydebug.h``、``pyfpe.h`` 和 ``pytime." +"h`` 已移至 ``Include/cpython`` 目錄。這些檔案不得直接被引入,因為它們已於 " +"``Python.h`` 中引入;請參閱 :ref:`api-includes`。如果直接引入它們,請考慮改為" +"引入 ``Python.h``。(由 Nicholas Sim 在 :issue:`35134` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2201 +#: ../../whatsnew/3.10.rst:2202 msgid "" "Use the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` type flag to create immutable " "type objects. Do not rely on :c:macro:`Py_TPFLAGS_HEAPTYPE` to decide if a " "type object is mutable or not; check if :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` " -"is set instead. (Contributed by Victor Stinner and Erlend E. Aasland " -"in :issue:`43908`.)" +"is set instead. (Contributed by Victor Stinner and Erlend E. Aasland in :" +"issue:`43908`.)" msgstr "" "使用 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 型別旗標來建立不可變型別物件。不要依" "賴 :c:macro:`Py_TPFLAGS_HEAPTYPE` 來決定型別物件是否可變;應改為檢查是否設定" "了 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE`。(由 Victor Stinner 和 Erlend E. " "Aasland 在 :issue:`35134` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2207 +#: ../../whatsnew/3.10.rst:2208 msgid "" "The undocumented function ``Py_FrozenMain`` has been removed from the " "limited API. The function is mainly useful for custom builds of Python. " @@ -4347,7 +4303,7 @@ msgstr "" "未以說明文件記錄的函式 ``Py_FrozenMain`` 已從受限 API 中刪除。該函式主要用於 " "Python 的自定義建置。(由 Petr Viktorin 在 :issue:`26241` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2214 +#: ../../whatsnew/3.10.rst:2215 msgid "" "The ``PyUnicode_InternImmortal()`` function is now deprecated and will be " "removed in Python 3.12: use :c:func:`PyUnicode_InternInPlace` instead. " @@ -4357,7 +4313,7 @@ msgstr "" "用 :c:func:`PyUnicode_InternInPlace`。(由 Victor Stinner 在 :issue:`41692` " "中貢獻。)" -#: ../../whatsnew/3.10.rst:2222 +#: ../../whatsnew/3.10.rst:2223 msgid "" "Removed ``Py_UNICODE_str*`` functions manipulating ``Py_UNICODE*`` strings. " "(Contributed by Inada Naoki in :issue:`41123`.)" @@ -4365,47 +4321,47 @@ msgstr "" "刪除了操作 ``Py_UNICODE*`` 字串的 ``Py_UNICODE_str*`` 函式。(由 Inada Naoki " "在 :issue:`41123` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2225 +#: ../../whatsnew/3.10.rst:2226 msgid "" -"``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` " -"or :c:macro:`PyUnicode_GET_LENGTH`" +"``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` or :c:macro:" +"`PyUnicode_GET_LENGTH`" msgstr "" -"``Py_UNICODE_strlen``:使用 :c:func:`PyUnicode_GetLength` " -"或 :c:macro:`PyUnicode_GET_LENGTH`" +"``Py_UNICODE_strlen``:使用 :c:func:`PyUnicode_GetLength` 或 :c:macro:" +"`PyUnicode_GET_LENGTH`" -#: ../../whatsnew/3.10.rst:2227 +#: ../../whatsnew/3.10.rst:2228 msgid "" -"``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` " -"or :c:func:`PyUnicode_FromFormat`" +"``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" +"`PyUnicode_FromFormat`" msgstr "" -"``Py_UNICODE_strcat``:使用 :c:func:`PyUnicode_CopyCharacters` " -"或 :c:func:`PyUnicode_FromFormat`" +"``Py_UNICODE_strcat``:使用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:" +"`PyUnicode_FromFormat`" -#: ../../whatsnew/3.10.rst:2229 +#: ../../whatsnew/3.10.rst:2230 msgid "" -"``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: " -"use :c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" +"``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: use :c:func:" +"`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" msgstr "" -"``Py_UNICODE_strcpy``、``Py_UNICODE_strncpy``:使" -"用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:`PyUnicode_Substring`" +"``Py_UNICODE_strcpy``、``Py_UNICODE_strncpy``:使用 :c:func:" +"`PyUnicode_CopyCharacters` 或 :c:func:`PyUnicode_Substring`" -#: ../../whatsnew/3.10.rst:2231 +#: ../../whatsnew/3.10.rst:2232 msgid "``Py_UNICODE_strcmp``: use :c:func:`PyUnicode_Compare`" msgstr "``Py_UNICODE_strcmp``:使用 :c:func:`PyUnicode_Compare`" -#: ../../whatsnew/3.10.rst:2232 +#: ../../whatsnew/3.10.rst:2233 msgid "``Py_UNICODE_strncmp``: use :c:func:`PyUnicode_Tailmatch`" msgstr "``Py_UNICODE_strncmp``:使用 :c:func:`PyUnicode_Tailmatch`" -#: ../../whatsnew/3.10.rst:2233 +#: ../../whatsnew/3.10.rst:2234 msgid "" -"``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: " -"use :c:func:`PyUnicode_FindChar`" +"``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: use :c:func:" +"`PyUnicode_FindChar`" msgstr "" -"``Py_UNICODE_strchr``、``Py_UNICODE_strrchr``:使" -"用 :c:func:`PyUnicode_FindChar`" +"``Py_UNICODE_strchr``、``Py_UNICODE_strrchr``:使用 :c:func:" +"`PyUnicode_FindChar`" -#: ../../whatsnew/3.10.rst:2236 +#: ../../whatsnew/3.10.rst:2237 msgid "" "Removed ``PyUnicode_GetMax()``. Please migrate to new (:pep:`393`) APIs. " "(Contributed by Inada Naoki in :issue:`41103`.)" @@ -4413,26 +4369,25 @@ msgstr "" "刪除了 ``PyUnicode_GetMax()``。請改用新的 (:pep:`393`) API。(由 Inada Naoki " "在 :issue:`41103` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2239 +#: ../../whatsnew/3.10.rst:2240 msgid "" -"Removed ``PyLong_FromUnicode()``. Please migrate " -"to :c:func:`PyLong_FromUnicodeObject`. (Contributed by Inada Naoki " -"in :issue:`41103`.)" +"Removed ``PyLong_FromUnicode()``. Please migrate to :c:func:" +"`PyLong_FromUnicodeObject`. (Contributed by Inada Naoki in :issue:`41103`.)" msgstr "" "刪除了 ``PyLong_FromUnicode()``。請改用 :c:func:`PyLong_FromUnicodeObject`。" "(由 Inada Naoki 在 :issue:`41103` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2242 +#: ../../whatsnew/3.10.rst:2243 msgid "" -"Removed ``PyUnicode_AsUnicodeCopy()``. Please " -"use :c:func:`PyUnicode_AsUCS4Copy` or :c:func:`PyUnicode_AsWideCharString` " -"(Contributed by Inada Naoki in :issue:`41103`.)" +"Removed ``PyUnicode_AsUnicodeCopy()``. Please use :c:func:" +"`PyUnicode_AsUCS4Copy` or :c:func:`PyUnicode_AsWideCharString` (Contributed " +"by Inada Naoki in :issue:`41103`.)" msgstr "" "刪除了 ``PyUnicode_AsUnicodeCopy()``。請改用 :c:func:`PyUnicode_AsUCS4Copy` " "或 :c:func:`PyUnicode_AsWideCharString` (由 Inada Naoki 在 :issue:`41103` 中" "貢獻。)" -#: ../../whatsnew/3.10.rst:2246 +#: ../../whatsnew/3.10.rst:2247 msgid "" "Removed ``_Py_CheckRecursionLimit`` variable: it has been replaced by " "``ceval.recursion_limit`` of the :c:type:`PyInterpreterState` structure. " @@ -4442,29 +4397,28 @@ msgstr "" "結構的 ``ceval.recursion_limit`` 取代。(由 Victor Stinner 在 :issue:`41834` " "中貢獻。)" -#: ../../whatsnew/3.10.rst:2250 +#: ../../whatsnew/3.10.rst:2251 msgid "" "Removed undocumented macros ``Py_ALLOW_RECURSION`` and " -"``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of " -"the :c:type:`PyInterpreterState` structure. (Contributed by Serhiy Storchaka " -"in :issue:`41936`.)" +"``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of the :c:" +"type:`PyInterpreterState` structure. (Contributed by Serhiy Storchaka in :" +"issue:`41936`.)" msgstr "" "刪除了未被說明文件記錄的巨集 ``Py_ALLOW_RECURSION`` 和 " "``Py_END_ALLOW_RECURSION`` 以及 :c:type:`PyInterpreterState` 結構的 " "``recursion_ritic`` 欄位。(由 Serhiy Storchaka 在 :issue:`41936` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2255 +#: ../../whatsnew/3.10.rst:2256 msgid "" "Removed the undocumented ``PyOS_InitInterrupts()`` function. Initializing " -"Python already implicitly installs signal handlers: " -"see :c:member:`PyConfig.install_signal_handlers`. (Contributed by Victor " -"Stinner in :issue:`41713`.)" +"Python already implicitly installs signal handlers: see :c:member:`PyConfig." +"install_signal_handlers`. (Contributed by Victor Stinner in :issue:`41713`.)" msgstr "" "刪除了未被說明文件記錄的 ``PyOS_InitInterrupts()`` 函式。初始化 Python 已經隱" "式安裝信號處理程式:請參閱 :c:member:`PyConfig.install_signal_handlers`。" "(由 Victor Stinner 在 :issue:`41713` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2260 +#: ../../whatsnew/3.10.rst:2261 msgid "" "Remove the ``PyAST_Validate()`` function. It is no longer possible to build " "a AST object (``mod_ty`` type) with the public C API. The function was " @@ -4475,44 +4429,44 @@ msgstr "" "(``mod_ty`` 類型)。該函式已被排除在受限 C API 之外 (:pep:`384`)。(由 " "Victor Stinner 在 :issue:`43244` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2265 +#: ../../whatsnew/3.10.rst:2266 msgid "Remove the ``symtable.h`` header file and the undocumented functions:" msgstr "刪除 ``symtable.h`` 標頭檔和未被說明文件記錄的函式:" -#: ../../whatsnew/3.10.rst:2267 +#: ../../whatsnew/3.10.rst:2268 msgid "``PyST_GetScope()``" msgstr "``PyST_GetScope()``" -#: ../../whatsnew/3.10.rst:2268 +#: ../../whatsnew/3.10.rst:2269 msgid "``PySymtable_Build()``" msgstr "``PySymtable_Build()``" -#: ../../whatsnew/3.10.rst:2269 +#: ../../whatsnew/3.10.rst:2270 msgid "``PySymtable_BuildObject()``" msgstr "``PySymtable_BuildObject()``" -#: ../../whatsnew/3.10.rst:2270 +#: ../../whatsnew/3.10.rst:2271 msgid "``PySymtable_Free()``" msgstr "``PySymtable_Free()``" -#: ../../whatsnew/3.10.rst:2271 +#: ../../whatsnew/3.10.rst:2272 msgid "``Py_SymtableString()``" msgstr "``Py_SymtableString()``" -#: ../../whatsnew/3.10.rst:2272 +#: ../../whatsnew/3.10.rst:2273 msgid "``Py_SymtableStringObject()``" msgstr "``Py_SymtableStringObject()``" -#: ../../whatsnew/3.10.rst:2274 +#: ../../whatsnew/3.10.rst:2275 msgid "" "The ``Py_SymtableString()`` function was part the stable ABI by mistake but " "it could not be used, because the ``symtable.h`` header file was excluded " "from the limited C API." msgstr "" -"``Py_SymtableString()`` 函式錯誤地成為穩定 ABI 的一部分,但它因為 " -"``symtable.h`` 標頭檔被排除在受限 C API 之外而無法使用。" +"``Py_SymtableString()`` 函式錯誤地成為穩定 ABI 的一部分,但它因為 ``symtable." +"h`` 標頭檔被排除在受限 C API 之外而無法使用。" -#: ../../whatsnew/3.10.rst:2278 +#: ../../whatsnew/3.10.rst:2279 msgid "" "Use Python :mod:`symtable` module instead. (Contributed by Victor Stinner " "in :issue:`43244`.)" @@ -4520,7 +4474,7 @@ msgstr "" "請改用 Python :mod:`symtable` 模組。(由 Victor Stinner 在 :issue:`43244` 中" "貢獻。)" -#: ../../whatsnew/3.10.rst:2281 +#: ../../whatsnew/3.10.rst:2282 msgid "" "Remove :c:func:`PyOS_ReadlineFunctionPointer` from the limited C API headers " "and from ``python3.dll``, the library that provides the stable ABI on " @@ -4531,7 +4485,7 @@ msgstr "" "刪除 :c:func:`PyOS_ReadlineFunctionPointer`。由於該函式採用 FILE* 引數,因此" "無法保證其 ABI 穩定性。(由 Petr Viktorin 在 :issue:`43868` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2287 +#: ../../whatsnew/3.10.rst:2288 msgid "" "Remove ``ast.h``, ``asdl.h``, and ``Python-ast.h`` header files. These " "functions were undocumented and excluded from the limited C API. Most names " @@ -4544,94 +4498,94 @@ msgstr "" "刪除 ``ast.h``、``asdl.h`` 和 ``Python-ast.h`` 標頭檔。這些函式沒有文件記錄," "並且被排除在受限 C API 之外。這些標頭檔定義的大多數名稱都沒有前綴 ``Py``,因" "此可能會產生名稱衝突。例如,``Python-ast.h`` 定義了一個 ``Yield`` 巨集,它與 " -"Windows ```` 標頭使用的 ``Yield`` 有名稱衝突。請改用 " -"Python :mod:`ast` 模組。(由 Victor Stinner 在 :issue:`43244` 中貢獻。)" +"Windows ```` 標頭使用的 ``Yield`` 有名稱衝突。請改用 Python :mod:" +"`ast` 模組。(由 Victor Stinner 在 :issue:`43244` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2295 +#: ../../whatsnew/3.10.rst:2296 msgid "" "Remove the compiler and parser functions using ``struct _mod`` type, because " "the public AST C API was removed:" msgstr "" "刪除編譯器和使用 ``struct _mod`` 的剖析器函式,因為公開 AST C API 已被刪除:" -#: ../../whatsnew/3.10.rst:2298 +#: ../../whatsnew/3.10.rst:2299 msgid "``PyAST_Compile()``" msgstr "``PyAST_Compile()``" -#: ../../whatsnew/3.10.rst:2299 +#: ../../whatsnew/3.10.rst:2300 msgid "``PyAST_CompileEx()``" msgstr "``PyAST_CompileEx()``" -#: ../../whatsnew/3.10.rst:2300 +#: ../../whatsnew/3.10.rst:2301 msgid "``PyAST_CompileObject()``" msgstr "``PyAST_CompileObject()``" -#: ../../whatsnew/3.10.rst:2301 +#: ../../whatsnew/3.10.rst:2302 msgid "``PyFuture_FromAST()``" msgstr "``PyFuture_FromAST()``" -#: ../../whatsnew/3.10.rst:2302 +#: ../../whatsnew/3.10.rst:2303 msgid "``PyFuture_FromASTObject()``" msgstr "``PyFuture_FromASTObject()``" -#: ../../whatsnew/3.10.rst:2303 +#: ../../whatsnew/3.10.rst:2304 msgid "``PyParser_ASTFromFile()``" msgstr "``PyParser_ASTFromFile()``" -#: ../../whatsnew/3.10.rst:2304 +#: ../../whatsnew/3.10.rst:2305 msgid "``PyParser_ASTFromFileObject()``" msgstr "``PyParser_ASTFromFileObject()``" -#: ../../whatsnew/3.10.rst:2305 +#: ../../whatsnew/3.10.rst:2306 msgid "``PyParser_ASTFromFilename()``" msgstr "``PyParser_ASTFromFilename()``" -#: ../../whatsnew/3.10.rst:2306 +#: ../../whatsnew/3.10.rst:2307 msgid "``PyParser_ASTFromString()``" msgstr "``PyParser_ASTFromString()``" -#: ../../whatsnew/3.10.rst:2307 +#: ../../whatsnew/3.10.rst:2308 msgid "``PyParser_ASTFromStringObject()``" msgstr "``PyParser_ASTFromStringObject()``" -#: ../../whatsnew/3.10.rst:2309 +#: ../../whatsnew/3.10.rst:2310 msgid "" "These functions were undocumented and excluded from the limited C API. " "(Contributed by Victor Stinner in :issue:`43244`.)" msgstr "" -"這些函式沒有文件記錄,並且被排除在受限 C API 之外。(由 Victor Stinner " -"在 :issue:`43244` 中貢獻。)" +"這些函式沒有文件記錄,並且被排除在受限 C API 之外。(由 Victor Stinner 在 :" +"issue:`43244` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2312 +#: ../../whatsnew/3.10.rst:2313 msgid "Remove the ``pyarena.h`` header file with functions:" msgstr "刪除包含以下函式的 ``pyarena.h`` 標頭檔:" -#: ../../whatsnew/3.10.rst:2314 +#: ../../whatsnew/3.10.rst:2315 msgid "``PyArena_New()``" msgstr "``PyArena_New()``" -#: ../../whatsnew/3.10.rst:2315 +#: ../../whatsnew/3.10.rst:2316 msgid "``PyArena_Free()``" msgstr "``PyArena_Free()``" -#: ../../whatsnew/3.10.rst:2316 +#: ../../whatsnew/3.10.rst:2317 msgid "``PyArena_Malloc()``" msgstr "``PyArena_Malloc()``" -#: ../../whatsnew/3.10.rst:2317 +#: ../../whatsnew/3.10.rst:2318 msgid "``PyArena_AddPyObject()``" msgstr "``PyArena_AddPyObject()``" -#: ../../whatsnew/3.10.rst:2319 +#: ../../whatsnew/3.10.rst:2320 msgid "" "These functions were undocumented, excluded from the limited C API, and were " -"only used internally by the compiler. (Contributed by Victor Stinner " -"in :issue:`43244`.)" +"only used internally by the compiler. (Contributed by Victor Stinner in :" +"issue:`43244`.)" msgstr "" "這些函式沒有文件記錄、被排除在受限 C API 之外,並僅被編譯器於內部使用。(由 " "Victor Stinner 在 :issue:`43244` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2323 +#: ../../whatsnew/3.10.rst:2324 msgid "" "The ``PyThreadState.use_tracing`` member has been removed to optimize " "Python. (Contributed by Mark Shannon in :issue:`43760`.)" @@ -4639,11 +4593,11 @@ msgstr "" "為了 Python 最佳化,已刪除 ``PyThreadState.use_tracing`` 成員。(由 Mark " "Shannon 在 :issue:`43760` 中貢獻。)" -#: ../../whatsnew/3.10.rst:2328 +#: ../../whatsnew/3.10.rst:2329 msgid "Notable security feature in 3.10.7" msgstr "" -#: ../../whatsnew/3.10.rst:2330 +#: ../../whatsnew/3.10.rst:2331 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " @@ -4656,28 +4610,28 @@ msgid "" "digits in string form." msgstr "" -#: ../../whatsnew/3.10.rst:2341 +#: ../../whatsnew/3.10.rst:2342 msgid "Notable security feature in 3.10.8" msgstr "" -#: ../../whatsnew/3.10.rst:2343 +#: ../../whatsnew/3.10.rst:2344 msgid "" "The deprecated :mod:`!mailcap` module now refuses to inject unsafe text " "(filenames, MIME types, parameters) into shell commands. Instead of using " "such text, it will warn and act as if a match was not found (or for test " -"commands, as if the test failed). (Contributed by Petr Viktorin " -"in :gh:`98966`.)" +"commands, as if the test failed). (Contributed by Petr Viktorin in :gh:" +"`98966`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2350 +#: ../../whatsnew/3.10.rst:2351 msgid "Notable changes in 3.10.12" msgstr "" -#: ../../whatsnew/3.10.rst:2353 +#: ../../whatsnew/3.10.rst:2354 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.10.rst:2355 +#: ../../whatsnew/3.10.rst:2356 msgid "" "The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`, " "have a new a *filter* argument that allows limiting tar features than may be " From 3f0fb40bfb082eccb91482075e3214add0c6ec30 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 19 May 2025 00:17:59 +0000 Subject: [PATCH 08/14] sync with cpython 821a87e7 --- c-api/gcsupport.po | 9 +- library/asyncio-eventloop.po | 765 ++++++++++++++++++----------------- library/json.po | 501 ++++++++++++----------- tutorial/controlflow.po | 4 +- 4 files changed, 659 insertions(+), 620 deletions(-) diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index 5fd35ae6f8..94bcdb31f9 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-13 00:40+0000\n" +"POT-Creation-Date: 2025-05-19 00:16+0000\n" "PO-Revision-Date: 2018-05-23 14:31+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -255,9 +255,10 @@ msgstr "" #: ../../c-api/gcsupport.rst:185 msgid "" -"If *o* is not ``NULL``, call the *visit* callback, with arguments *o* and " -"*arg*. If *visit* returns a non-zero value, then return it. Using this " -"macro, :c:member:`~PyTypeObject.tp_traverse` handlers look like::" +"If the :c:expr:`PyObject *` *o* is not ``NULL``, call the *visit* callback, " +"with arguments *o* and *arg*. If *visit* returns a non-zero value, then " +"return it. Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers " +"look like::" msgstr "" #: ../../c-api/gcsupport.rst:190 diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index fe2e0e3861..e190cfa738 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-15 00:15+0000\n" +"POT-Creation-Date: 2025-05-19 00:16+0000\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -295,8 +295,8 @@ msgid "" msgstr "請注意,使用 :func:`asyncio.run` 時不需要呼叫此函式。" #: ../../library/asyncio-eventloop.rst:177 -#: ../../library/asyncio-eventloop.rst:1301 -#: ../../library/asyncio-eventloop.rst:1750 +#: ../../library/asyncio-eventloop.rst:1320 +#: ../../library/asyncio-eventloop.rst:1769 msgid "Example::" msgstr "範例: ::" @@ -587,13 +587,21 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:367 msgid "" +"The full function signature is largely the same as that of the :class:`Task` " +"constructor (or factory) - all of the keyword arguments to this function are " +"passed through to that interface, except *name*, or *context* if it is " +"``None``." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:372 +msgid "" "If the *name* argument is provided and not ``None``, it is set as the name " "of the task using :meth:`Task.set_name`." msgstr "" "如果提供了 *name* 引數且不為 ``None``,則將其設置為任務的名稱,使用 :meth:" "`Task.set_name`。" -#: ../../library/asyncio-eventloop.rst:370 +#: ../../library/asyncio-eventloop.rst:375 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. The current context " @@ -603,19 +611,32 @@ msgstr "" "`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立目前情境的副" "本。" -#: ../../library/asyncio-eventloop.rst:374 +#: ../../library/asyncio-eventloop.rst:379 msgid "Added the *name* parameter." msgstr "加入 *name* 參數。" -#: ../../library/asyncio-eventloop.rst:377 +#: ../../library/asyncio-eventloop.rst:382 msgid "Added the *context* parameter." msgstr "加入 *context* 參數。" -#: ../../library/asyncio-eventloop.rst:382 +#: ../../library/asyncio-eventloop.rst:385 +msgid "" +"Added ``kwargs`` which passes on arbitrary extra parameters, including " +"``name`` and ``context``." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:388 +msgid "" +"Rolled back the change that passes on *name* and *context* (if it is None), " +"while still passing on other arbitrary keyword arguments (to avoid breaking " +"backwards compatibility with 3.13.3)." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:394 msgid "Set a task factory that will be used by :meth:`loop.create_task`." msgstr "設置將由 :meth:`loop.create_task` 使用的任務工廠。" -#: ../../library/asyncio-eventloop.rst:385 +#: ../../library/asyncio-eventloop.rst:397 msgid "" "If *factory* is ``None`` the default task factory will be set. Otherwise, " "*factory* must be a *callable* with the signature matching ``(loop, coro, " @@ -628,21 +649,31 @@ msgstr "" "迴圈的參照、*coro* 是一個協程物件。該可呼叫物件必須傳遞所有 *kwargs* 並回傳一" "個與 :class:`asyncio.Task` 相容的物件。" -#: ../../library/asyncio-eventloop.rst:393 +#: ../../library/asyncio-eventloop.rst:403 +msgid "Required that all *kwargs* are passed on to :class:`asyncio.Task`." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:406 +msgid "" +"*name* is no longer passed to task factories. *context* is no longer passed " +"to task factories if it is ``None``." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:412 msgid "Return a task factory or ``None`` if the default one is in use." msgstr "回傳任務工廠,如果使用預設任務工廠則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:397 +#: ../../library/asyncio-eventloop.rst:416 msgid "Opening network connections" msgstr "打開網路連線" -#: ../../library/asyncio-eventloop.rst:409 +#: ../../library/asyncio-eventloop.rst:428 msgid "" "Open a streaming transport connection to a given address specified by *host* " "and *port*." msgstr "打開以 *host* 和 *port* 指定之給定地址的串流傳輸連線。" -#: ../../library/asyncio-eventloop.rst:412 +#: ../../library/asyncio-eventloop.rst:431 msgid "" "The socket family can be either :py:const:`~socket.AF_INET` or :py:const:" "`~socket.AF_INET6` depending on *host* (or the *family* argument, if " @@ -651,13 +682,13 @@ msgstr "" "根據 *host*(或提供的 *family* 引數)的情況,socket 家族可以是 :py:const:" "`~socket.AF_INET` 或 :py:const:`~socket.AF_INET6`。" -#: ../../library/asyncio-eventloop.rst:416 +#: ../../library/asyncio-eventloop.rst:435 msgid "The socket type will be :py:const:`~socket.SOCK_STREAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_STREAM`。" -#: ../../library/asyncio-eventloop.rst:418 -#: ../../library/asyncio-eventloop.rst:1211 -#: ../../library/asyncio-eventloop.rst:1228 +#: ../../library/asyncio-eventloop.rst:437 +#: ../../library/asyncio-eventloop.rst:1230 +#: ../../library/asyncio-eventloop.rst:1247 msgid "" "*protocol_factory* must be a callable returning an :ref:`asyncio protocol " "` implementation." @@ -665,24 +696,24 @@ msgstr "" "*protocol_factory* 必須是一個回傳 :ref:`asyncio protocol ` " "實作的可呼叫函式。" -#: ../../library/asyncio-eventloop.rst:421 +#: ../../library/asyncio-eventloop.rst:440 msgid "" "This method will try to establish the connection in the background. When " "successful, it returns a ``(transport, protocol)`` pair." msgstr "" "此方法將嘗試在背景建立連線。成功時,它將回傳一對 ``(transport, protocol)``。" -#: ../../library/asyncio-eventloop.rst:424 +#: ../../library/asyncio-eventloop.rst:443 msgid "The chronological synopsis of the underlying operation is as follows:" msgstr "底層操作的時間軸簡介如下:" -#: ../../library/asyncio-eventloop.rst:426 +#: ../../library/asyncio-eventloop.rst:445 msgid "" "The connection is established and a :ref:`transport ` is " "created for it." msgstr "建立連線並為其建立\\ :ref:`傳輸 `。" -#: ../../library/asyncio-eventloop.rst:429 +#: ../../library/asyncio-eventloop.rst:448 msgid "" "*protocol_factory* is called without arguments and is expected to return a :" "ref:`protocol ` instance." @@ -690,7 +721,7 @@ msgstr "" "*protocol_factory* 在無引數的情況下被呼叫,並且預計回傳一個 :ref:`協定 " "` 實例。" -#: ../../library/asyncio-eventloop.rst:432 +#: ../../library/asyncio-eventloop.rst:451 msgid "" "The protocol instance is coupled with the transport by calling its :meth:" "`~BaseProtocol.connection_made` method." @@ -698,21 +729,21 @@ msgstr "" "通過呼叫其 :meth:`~BaseProtocol.connection_made` 方法,將協議實例與傳輸連線在" "一起。" -#: ../../library/asyncio-eventloop.rst:435 +#: ../../library/asyncio-eventloop.rst:454 msgid "A ``(transport, protocol)`` tuple is returned on success." msgstr "成功時回傳一個 ``(transport, protocol)`` 元組。" -#: ../../library/asyncio-eventloop.rst:437 +#: ../../library/asyncio-eventloop.rst:456 msgid "" "The created transport is an implementation-dependent bidirectional stream." msgstr "建立的傳輸是一個依賴實作的雙向串流。" -#: ../../library/asyncio-eventloop.rst:440 -#: ../../library/asyncio-eventloop.rst:573 +#: ../../library/asyncio-eventloop.rst:459 +#: ../../library/asyncio-eventloop.rst:592 msgid "Other arguments:" msgstr "其他引數:" -#: ../../library/asyncio-eventloop.rst:442 +#: ../../library/asyncio-eventloop.rst:461 msgid "" "*ssl*: if given and not false, a SSL/TLS transport is created (by default a " "plain TCP transport is created). If *ssl* is a :class:`ssl.SSLContext` " @@ -724,11 +755,11 @@ msgstr "" "果 *ssl* 為 :class:`ssl.SSLContext` 物件,則使用該情境來建立傳輸;如果 *ssl* " "為 :const:`True`,則使用 :func:`ssl.create_default_context` 回傳的預設情境。" -#: ../../library/asyncio-eventloop.rst:448 +#: ../../library/asyncio-eventloop.rst:467 msgid ":ref:`SSL/TLS security considerations `" msgstr ":ref:`SSL/TLS 安全考量 `" -#: ../../library/asyncio-eventloop.rst:450 +#: ../../library/asyncio-eventloop.rst:469 msgid "" "*server_hostname* sets or overrides the hostname that the target server's " "certificate will be matched against. Should only be passed if *ssl* is not " @@ -743,7 +774,7 @@ msgstr "" "預設值,必須傳遞 *server_hostname* 的值。若 *server_hostname* 為空字串,將停" "用主機名稱匹配(這是一個嚴重的安全風險,可能導致中間人攻擊)。" -#: ../../library/asyncio-eventloop.rst:458 +#: ../../library/asyncio-eventloop.rst:477 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to getaddrinfo() for *host* resolution. If given, " @@ -754,7 +785,7 @@ msgstr "" "getaddrinfo() 進行 *host* 解析。若有給定這些應該都是相應 :mod:`socket` 模組常" "數的整數。" -#: ../../library/asyncio-eventloop.rst:463 +#: ../../library/asyncio-eventloop.rst:482 msgid "" "*happy_eyeballs_delay*, if given, enables Happy Eyeballs for this " "connection. It should be a floating-point number representing the amount of " @@ -768,7 +799,7 @@ msgstr "" "`8305` 中定義的「連線嘗試延遲」。RFC 建議的合理預設值為 ``0.25`` 秒(250 毫" "秒)。" -#: ../../library/asyncio-eventloop.rst:471 +#: ../../library/asyncio-eventloop.rst:490 msgid "" "*interleave* controls address reordering when a host name resolves to " "multiple IP addresses. If ``0`` or unspecified, no reordering is done, and " @@ -784,7 +815,7 @@ msgstr "" "族計數」。如果未指定 *happy_eyeballs_delay*,則預設值為 ``0``,如果指定則為 " "``1``。" -#: ../../library/asyncio-eventloop.rst:480 +#: ../../library/asyncio-eventloop.rst:499 msgid "" "*sock*, if given, should be an existing, already connected :class:`socket." "socket` object to be used by the transport. If *sock* is given, none of " @@ -795,9 +826,9 @@ msgstr "" "輸使用。如果提供了 *sock*,則不應指定 *host*、*port*、*family*、*proto*、" "*flags*、*happy_eyeballs_delay*、*interleave* 和 *local_addr* 中的任何一項。" -#: ../../library/asyncio-eventloop.rst:488 -#: ../../library/asyncio-eventloop.rst:604 -#: ../../library/asyncio-eventloop.rst:852 +#: ../../library/asyncio-eventloop.rst:507 +#: ../../library/asyncio-eventloop.rst:623 +#: ../../library/asyncio-eventloop.rst:871 msgid "" "The *sock* argument transfers ownership of the socket to the transport " "created. To close the socket, call the transport's :meth:`~asyncio." @@ -806,7 +837,7 @@ msgstr "" "引數 *sock* 將 socket 所有權轉移給所建立的傳輸 socket,請呼叫傳輸的 :meth:" "`~asyncio.BaseTransport.close` 方法。" -#: ../../library/asyncio-eventloop.rst:492 +#: ../../library/asyncio-eventloop.rst:511 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " "the socket locally. The *local_host* and *local_port* are looked up using " @@ -816,8 +847,8 @@ msgstr "" "地綁定 socket。將使用 ``getaddrinfo()`` 查找 *local_host* 和 *local_port*,方" "式類似於 *host* 和 *port*。" -#: ../../library/asyncio-eventloop.rst:496 -#: ../../library/asyncio-eventloop.rst:948 +#: ../../library/asyncio-eventloop.rst:515 +#: ../../library/asyncio-eventloop.rst:967 msgid "" "*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to " "wait for the TLS handshake to complete before aborting the connection. " @@ -827,10 +858,10 @@ msgstr "" "在那之前若未完成則會中斷連線。如果為 ``None`` (預設值),則會等待 ``60.0`` " "秒。" -#: ../../library/asyncio-eventloop.rst:500 -#: ../../library/asyncio-eventloop.rst:759 -#: ../../library/asyncio-eventloop.rst:863 -#: ../../library/asyncio-eventloop.rst:952 +#: ../../library/asyncio-eventloop.rst:519 +#: ../../library/asyncio-eventloop.rst:778 +#: ../../library/asyncio-eventloop.rst:882 +#: ../../library/asyncio-eventloop.rst:971 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " @@ -839,7 +870,7 @@ msgstr "" "*ssl_shutdown_timeout* 是等待 SSL 關閉完成以前中斷連線的時間,以秒為單位。如" "果為 ``None`` (預設值),則會等待 ``30.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:504 +#: ../../library/asyncio-eventloop.rst:523 msgid "" "*all_errors* determines what exceptions are raised when a connection cannot " "be created. By default, only a single ``Exception`` is raised: the first " @@ -853,12 +884,12 @@ msgstr "" "包含所有錯誤訊息的單一 ``OSError``。當 ``all_errors`` 為 ``True`` 時,將引發" "包含所有例外的 ``ExceptionGroup`` (即使只有一個例外)。" -#: ../../library/asyncio-eventloop.rst:514 -#: ../../library/asyncio-eventloop.rst:771 +#: ../../library/asyncio-eventloop.rst:533 +#: ../../library/asyncio-eventloop.rst:790 msgid "Added support for SSL/TLS in :class:`ProactorEventLoop`." msgstr "新增 :class:`ProactorEventLoop` 中的 SSL/TLS 支援。" -#: ../../library/asyncio-eventloop.rst:518 +#: ../../library/asyncio-eventloop.rst:537 msgid "" "The socket option :ref:`socket.TCP_NODELAY ` is set " "by default for all TCP connections." @@ -866,16 +897,16 @@ msgstr "" "所有 TCP 連線都預設有 :ref:`socket.TCP_NODELAY ` " "socket 選項。" -#: ../../library/asyncio-eventloop.rst:523 -#: ../../library/asyncio-eventloop.rst:873 +#: ../../library/asyncio-eventloop.rst:542 +#: ../../library/asyncio-eventloop.rst:892 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "增加 *ssl_handshake_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:527 +#: ../../library/asyncio-eventloop.rst:546 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "加入 *happy_eyeballs_delay* 和 *interleave* 參數。" -#: ../../library/asyncio-eventloop.rst:529 +#: ../../library/asyncio-eventloop.rst:548 msgid "" "Happy Eyeballs Algorithm: Success with Dual-Stack Hosts. When a server's " "IPv4 path and protocol are working, but the server's IPv6 path and protocol " @@ -891,24 +922,24 @@ msgstr "" "用戶端的使用者體驗變差。本文件具體說明了減少此用戶可見延遲的演算法要求並提供" "了一種演算法。" -#: ../../library/asyncio-eventloop.rst:538 +#: ../../library/asyncio-eventloop.rst:557 msgid "For more information: https://datatracker.ietf.org/doc/html/rfc6555" msgstr "更多資訊請見: https://datatracker.ietf.org/doc/html/rfc6555" -#: ../../library/asyncio-eventloop.rst:542 -#: ../../library/asyncio-eventloop.rst:668 -#: ../../library/asyncio-eventloop.rst:785 -#: ../../library/asyncio-eventloop.rst:825 -#: ../../library/asyncio-eventloop.rst:877 -#: ../../library/asyncio-eventloop.rst:960 +#: ../../library/asyncio-eventloop.rst:561 +#: ../../library/asyncio-eventloop.rst:687 +#: ../../library/asyncio-eventloop.rst:804 +#: ../../library/asyncio-eventloop.rst:844 +#: ../../library/asyncio-eventloop.rst:896 +#: ../../library/asyncio-eventloop.rst:979 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "增加 *ssl_shutdown_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:544 +#: ../../library/asyncio-eventloop.rst:563 msgid "*all_errors* was added." msgstr "已新增 *all_errors*。" -#: ../../library/asyncio-eventloop.rst:549 +#: ../../library/asyncio-eventloop.rst:568 msgid "" "The :func:`open_connection` function is a high-level alternative API. It " "returns a pair of (:class:`StreamReader`, :class:`StreamWriter`) that can be " @@ -917,11 +948,11 @@ msgstr "" "函式 :func:`open_connection` 是高階的替代 API。它回傳一對 (:class:" "`StreamReader`, :class:`StreamWriter`) 可直接在 async/await 程式碼中使用。" -#: ../../library/asyncio-eventloop.rst:560 +#: ../../library/asyncio-eventloop.rst:579 msgid "Create a datagram connection." msgstr "建立一個資料報連線。" -#: ../../library/asyncio-eventloop.rst:562 +#: ../../library/asyncio-eventloop.rst:581 msgid "" "The socket family can be either :py:const:`~socket.AF_INET`, :py:const:" "`~socket.AF_INET6`, or :py:const:`~socket.AF_UNIX`, depending on *host* (or " @@ -931,13 +962,13 @@ msgstr "" "或 :py:const:`~socket.AF_UNIX`,視乎 *host*\\ (或提供的 *family* 引數)而" "定。" -#: ../../library/asyncio-eventloop.rst:566 +#: ../../library/asyncio-eventloop.rst:585 msgid "The socket type will be :py:const:`~socket.SOCK_DGRAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_DGRAM`。" -#: ../../library/asyncio-eventloop.rst:568 -#: ../../library/asyncio-eventloop.rst:695 -#: ../../library/asyncio-eventloop.rst:844 +#: ../../library/asyncio-eventloop.rst:587 +#: ../../library/asyncio-eventloop.rst:714 +#: ../../library/asyncio-eventloop.rst:863 msgid "" "*protocol_factory* must be a callable returning a :ref:`protocol ` implementation." @@ -945,12 +976,12 @@ msgstr "" "*protocol_factory* 必須是可呼叫的函式,回傳 :ref:`protocol ` 實作。" -#: ../../library/asyncio-eventloop.rst:571 -#: ../../library/asyncio-eventloop.rst:650 +#: ../../library/asyncio-eventloop.rst:590 +#: ../../library/asyncio-eventloop.rst:669 msgid "A tuple of ``(transport, protocol)`` is returned on success." msgstr "成功時回傳 ``(transport, protocol)`` 元組。" -#: ../../library/asyncio-eventloop.rst:575 +#: ../../library/asyncio-eventloop.rst:594 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " "the socket locally. The *local_host* and *local_port* are looked up using :" @@ -959,7 +990,7 @@ msgstr "" "*local_addr*,如果提供,是一個 ``(local_host, local_port)`` 元組,用於在本地" "綁定 socket。*local_host* 和 *local_port* 使用 :meth:`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:579 +#: ../../library/asyncio-eventloop.rst:598 msgid "" "*remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used to " "connect the socket to a remote address. The *remote_host* and *remote_port* " @@ -969,7 +1000,7 @@ msgstr "" "socket 連線到遠端位址。 *remote_host* 和 *remote_port* 使用 :meth:" "`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:583 +#: ../../library/asyncio-eventloop.rst:602 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to :meth:`getaddrinfo` for *host* resolution. If " @@ -980,7 +1011,7 @@ msgstr "" "的可選地址家族、協定和旗標。如果提供,這些應該都是來自相應的 :mod:`socket` 模" "組常數的整數。" -#: ../../library/asyncio-eventloop.rst:588 +#: ../../library/asyncio-eventloop.rst:607 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " @@ -992,13 +1023,13 @@ msgstr "" "時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定義 :py:" "const:`~socket.SO_REUSEPORT` 常數,則不支援此功能。" -#: ../../library/asyncio-eventloop.rst:594 +#: ../../library/asyncio-eventloop.rst:613 msgid "" "*allow_broadcast* tells the kernel to allow this endpoint to send messages " "to the broadcast address." msgstr "*allow_broadcast* 告訴核心允許此端點向廣播位址發送訊息。" -#: ../../library/asyncio-eventloop.rst:597 +#: ../../library/asyncio-eventloop.rst:616 msgid "" "*sock* can optionally be specified in order to use a preexisting, already " "connected, :class:`socket.socket` object to be used by the transport. If " @@ -1009,7 +1040,7 @@ msgstr "" "供傳輸使用。如果指定,*local_addr* 和 *remote_addr* 應省略(必須是 :const:" "`None`\\ )。" -#: ../../library/asyncio-eventloop.rst:608 +#: ../../library/asyncio-eventloop.rst:627 msgid "" "See :ref:`UDP echo client protocol ` and :" "ref:`UDP echo server protocol ` examples." @@ -1017,7 +1048,7 @@ msgstr "" "請參閱 :ref:`UDP 回應用戶端協議 ` 和 :ref:" "`UDP 回應伺服器協議 ` 範例。" -#: ../../library/asyncio-eventloop.rst:611 +#: ../../library/asyncio-eventloop.rst:630 msgid "" "The *family*, *proto*, *flags*, *reuse_address*, *reuse_port*, " "*allow_broadcast*, and *sock* parameters were added." @@ -1025,11 +1056,11 @@ msgstr "" "新增 *family*、*proto*、*flags*、*reuse_address*、*reuse_port*、" "*allow_broadcast* 和 *sock* 參數。" -#: ../../library/asyncio-eventloop.rst:615 +#: ../../library/asyncio-eventloop.rst:634 msgid "Added support for Windows." msgstr "新增對於 Windows 的支援。" -#: ../../library/asyncio-eventloop.rst:618 +#: ../../library/asyncio-eventloop.rst:637 msgid "" "The *reuse_address* parameter is no longer supported, as using :ref:`socket." "SO_REUSEADDR ` poses a significant security concern " @@ -1038,7 +1069,7 @@ msgstr "" "不再支援 *reuse_address* 參數,因為使用 :py:const:`~sockets.SO_REUSEADDR` 對" "於 UDP 存有重大的安全疑慮。明確傳遞 ``reuse_address=True`` 將引發例外。" -#: ../../library/asyncio-eventloop.rst:624 +#: ../../library/asyncio-eventloop.rst:643 msgid "" "When multiple processes with differing UIDs assign sockets to an identical " "UDP socket address with ``SO_REUSEADDR``, incoming packets can become " @@ -1047,7 +1078,7 @@ msgstr "" "當具有不同 UID 的多個行程使用 ``SO_REUSEADDR`` 將 socket 分配給相同的 UDP " "socket 地址時,傳入的封包可能會在 socket 之間隨機分佈。" -#: ../../library/asyncio-eventloop.rst:628 +#: ../../library/asyncio-eventloop.rst:647 msgid "" "For supported platforms, *reuse_port* can be used as a replacement for " "similar functionality. With *reuse_port*, :ref:`socket.SO_REUSEPORT ` is set by default " @@ -1273,7 +1304,7 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設有 :" "ref:`socket.TCP_NODELAY ` socket 選項。" -#: ../../library/asyncio-eventloop.rst:789 +#: ../../library/asyncio-eventloop.rst:808 msgid "" "The :func:`start_server` function is a higher-level alternative API that " "returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " @@ -1282,7 +1313,7 @@ msgstr "" ":func:`start_server` 函式是一個更高階的替代 API,它回傳一對 :class:" "`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼中使用。" -#: ../../library/asyncio-eventloop.rst:801 +#: ../../library/asyncio-eventloop.rst:820 msgid "" "Similar to :meth:`loop.create_server` but works with the :py:const:`~socket." "AF_UNIX` socket family." @@ -1290,7 +1321,7 @@ msgstr "" "類似 :meth:`loop.create_server`,但適用於 :py:const:`~socket.AF_UNIX` socket " "家族。" -#: ../../library/asyncio-eventloop.rst:804 +#: ../../library/asyncio-eventloop.rst:823 msgid "" "*path* is the name of a Unix domain socket, and is required, unless a *sock* " "argument is provided. Abstract Unix sockets, :class:`str`, :class:`bytes`, " @@ -1300,7 +1331,7 @@ msgstr "" "象 Unix sockets、:class:`str`、:class:`bytes` 和 :class:`~pathlib.Path` 路" "徑。" -#: ../../library/asyncio-eventloop.rst:809 +#: ../../library/asyncio-eventloop.rst:828 msgid "" "If *cleanup_socket* is true then the Unix socket will automatically be " "removed from the filesystem when the server is closed, unless the socket has " @@ -1309,13 +1340,13 @@ msgstr "" "如果 *cleanup_socket* 為真,則 Unix socket 將在伺服器關閉時自動從檔案系統中刪" "除,除非在建立伺服器後替換了 socket。" -#: ../../library/asyncio-eventloop.rst:813 +#: ../../library/asyncio-eventloop.rst:832 msgid "" "See the documentation of the :meth:`loop.create_server` method for " "information about arguments to this method." msgstr "有關此方法的引數資訊,請參閱 :meth:`loop.create_server` 方法的文件。" -#: ../../library/asyncio-eventloop.rst:820 +#: ../../library/asyncio-eventloop.rst:839 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :class:`~pathlib.Path` object." @@ -1323,26 +1354,26 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可為一" "個 :class:`~pathlib.Path` 物件。" -#: ../../library/asyncio-eventloop.rst:829 +#: ../../library/asyncio-eventloop.rst:848 msgid "Added the *cleanup_socket* parameter." msgstr "加入 *cleanup_socket* 參數。" -#: ../../library/asyncio-eventloop.rst:837 +#: ../../library/asyncio-eventloop.rst:856 msgid "Wrap an already accepted connection into a transport/protocol pair." msgstr "將已接受的連線包裝成傳輸層/協議對。" -#: ../../library/asyncio-eventloop.rst:839 +#: ../../library/asyncio-eventloop.rst:858 msgid "" "This method can be used by servers that accept connections outside of " "asyncio but that use asyncio to handle them." msgstr "此方法可以由在 asyncio 外接受連線但使用 asyncio 處理連線的伺服器使用。" -#: ../../library/asyncio-eventloop.rst:842 -#: ../../library/asyncio-eventloop.rst:934 +#: ../../library/asyncio-eventloop.rst:861 +#: ../../library/asyncio-eventloop.rst:953 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-eventloop.rst:847 +#: ../../library/asyncio-eventloop.rst:866 msgid "" "*sock* is a preexisting socket object returned from :meth:`socket.accept " "`." @@ -1350,13 +1381,13 @@ msgstr "" "*sock* 是從 :meth:`socket.accept ` 回傳的預先存在的 " "socket 物件。" -#: ../../library/asyncio-eventloop.rst:856 +#: ../../library/asyncio-eventloop.rst:875 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the " "accepted connections." msgstr "*ssl* 可以設置為 :class:`~ssl.SSLContext` 以在已接受的連線上啟用 SSL。" -#: ../../library/asyncio-eventloop.rst:859 +#: ../../library/asyncio-eventloop.rst:878 msgid "" "*ssl_handshake_timeout* is (for an SSL connection) the time in seconds to " "wait for the SSL handshake to complete before aborting the connection. " @@ -1365,29 +1396,29 @@ msgstr "" "(對於 SSL 連線)\\ *ssl_handshake_timeout* 是在中斷連線之前等待 SSL 握手完成" "的時間(以秒為單位)。如果為 ``None``\\ (預設),則為 ``60.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:867 +#: ../../library/asyncio-eventloop.rst:886 msgid "Returns a ``(transport, protocol)`` pair." msgstr "回傳 ``(transport, protocol)`` 對。" -#: ../../library/asyncio-eventloop.rst:881 +#: ../../library/asyncio-eventloop.rst:900 msgid "Transferring files" msgstr "傳輸檔案" -#: ../../library/asyncio-eventloop.rst:887 +#: ../../library/asyncio-eventloop.rst:906 msgid "" "Send a *file* over a *transport*. Return the total number of bytes sent." msgstr "通過 *transport* 發送 *file*。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:890 +#: ../../library/asyncio-eventloop.rst:909 msgid "The method uses high-performance :meth:`os.sendfile` if available." msgstr "如果可用,該方法使用高性能 :meth:`os.sendfile`。" -#: ../../library/asyncio-eventloop.rst:892 +#: ../../library/asyncio-eventloop.rst:911 msgid "*file* must be a regular file object opened in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:894 -#: ../../library/asyncio-eventloop.rst:1155 +#: ../../library/asyncio-eventloop.rst:913 +#: ../../library/asyncio-eventloop.rst:1174 msgid "" "*offset* tells from where to start reading the file. If specified, *count* " "is the total number of bytes to transmit as opposed to sending the file " @@ -1399,7 +1430,7 @@ msgstr "" "不是發送檔案直到達到 EOF。即使此方法引發錯誤時,檔案位置也始終更新,可以使" "用 :meth:`file.tell() ` 取得實際發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:901 +#: ../../library/asyncio-eventloop.rst:920 msgid "" "*fallback* set to ``True`` makes asyncio to manually read and send the file " "when the platform does not support the sendfile system call (e.g. Windows or " @@ -1408,7 +1439,7 @@ msgstr "" "將 *fallback* 設置為 ``True`` 會使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:905 +#: ../../library/asyncio-eventloop.rst:924 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support the " "*sendfile* syscall and *fallback* is ``False``." @@ -1416,15 +1447,15 @@ msgstr "" "如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引發 :exc:" "`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:912 +#: ../../library/asyncio-eventloop.rst:931 msgid "TLS Upgrade" msgstr "TLS 升級" -#: ../../library/asyncio-eventloop.rst:920 +#: ../../library/asyncio-eventloop.rst:939 msgid "Upgrade an existing transport-based connection to TLS." msgstr "將基於傳輸的現有連線升級到 TLS。" -#: ../../library/asyncio-eventloop.rst:922 +#: ../../library/asyncio-eventloop.rst:941 msgid "" "Create a TLS coder/decoder instance and insert it between the *transport* " "and the *protocol*. The coder/decoder implements both *transport*-facing " @@ -1433,7 +1464,7 @@ msgstr "" "建立 TLS 編解碼器實例並在 *transport* 和 *protocol* 之間插入它。編解碼器既實" "作了對於 *transport* 的協議,也實作了對於 *protocol* 的傳輸。" -#: ../../library/asyncio-eventloop.rst:926 +#: ../../library/asyncio-eventloop.rst:945 msgid "" "Return the created two-interface instance. After *await*, the *protocol* " "must stop using the original *transport* and communicate with the returned " @@ -1444,13 +1475,13 @@ msgstr "" "*transport*,僅與回傳的物件通信,因為編碼器快取了 *protocol* 端的資料,並且" "與 *transport* 間歇性地交換額外的 TLS session 封包。" -#: ../../library/asyncio-eventloop.rst:931 +#: ../../library/asyncio-eventloop.rst:950 msgid "" "In some situations (e.g. when the passed transport is already closing) this " "may return ``None``." msgstr "在某些情況下(例如傳入的傳輸已經關閉),此函式可能回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:936 +#: ../../library/asyncio-eventloop.rst:955 msgid "" "*transport* and *protocol* instances that methods like :meth:`~loop." "create_server` and :meth:`~loop.create_connection` return." @@ -1458,11 +1489,11 @@ msgstr "" "*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` 和 :meth:" "`~loop.create_connection` 等方法回傳。" -#: ../../library/asyncio-eventloop.rst:940 +#: ../../library/asyncio-eventloop.rst:959 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:配置好的 :class:`~ssl.SSLContext` 實例。" -#: ../../library/asyncio-eventloop.rst:942 +#: ../../library/asyncio-eventloop.rst:961 msgid "" "*server_side* pass ``True`` when a server-side connection is being upgraded " "(like the one created by :meth:`~loop.create_server`)." @@ -1470,17 +1501,17 @@ msgstr "" "當升級伺服器端連線時(像由 :meth:`~loop.create_server` 建立的那樣)傳遞 " "``True``。" -#: ../../library/asyncio-eventloop.rst:945 +#: ../../library/asyncio-eventloop.rst:964 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設置或覆蓋將用於匹配目標伺服器憑證的主機名。" -#: ../../library/asyncio-eventloop.rst:965 +#: ../../library/asyncio-eventloop.rst:984 msgid "Watching file descriptors" msgstr "監視檔案描述器" -#: ../../library/asyncio-eventloop.rst:969 +#: ../../library/asyncio-eventloop.rst:988 msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." @@ -1488,14 +1519,14 @@ msgstr "" "開始監視 *fd* 檔案描述器的讀取可用性,一但 *fd* 可讀取,使用指定引數叫用 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:973 -#: ../../library/asyncio-eventloop.rst:987 +#: ../../library/asyncio-eventloop.rst:992 +#: ../../library/asyncio-eventloop.rst:1006 msgid "" "Any preexisting callback registered for *fd* is cancelled and replaced by " "*callback*." msgstr "任何預先存在、為 *fd* 註冊的回呼函式將被取消並替換為 *callback*。" -#: ../../library/asyncio-eventloop.rst:978 +#: ../../library/asyncio-eventloop.rst:997 msgid "" "Stop monitoring the *fd* file descriptor for read availability. Returns " "``True`` if *fd* was previously being monitored for reads." @@ -1503,7 +1534,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的讀取可用性。如果 *fd* 之前正在監視讀取,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:983 +#: ../../library/asyncio-eventloop.rst:1002 msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." @@ -1511,8 +1542,8 @@ msgstr "" "開始監視 *fd* 檔案描述器的寫入可用性,一旦 *fd* 可寫入,使用指定引數叫用 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:990 -#: ../../library/asyncio-eventloop.rst:1268 +#: ../../library/asyncio-eventloop.rst:1009 +#: ../../library/asyncio-eventloop.rst:1287 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." @@ -1520,7 +1551,7 @@ msgstr "" "使用 :func:`functools.partial` 向 *callback* :ref:`傳送關鍵字引數 `。" -#: ../../library/asyncio-eventloop.rst:995 +#: ../../library/asyncio-eventloop.rst:1014 msgid "" "Stop monitoring the *fd* file descriptor for write availability. Returns " "``True`` if *fd* was previously being monitored for writes." @@ -1528,7 +1559,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的寫入可用性。如果 *fd* 之前正在監視寫入,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:998 +#: ../../library/asyncio-eventloop.rst:1017 msgid "" "See also :ref:`Platform Support ` section for some " "limitations of these methods." @@ -1536,11 +1567,11 @@ msgstr "" "另請參閱\\ :ref:`平台支援 `\\ 部分以了解這些方法的" "一些限制。" -#: ../../library/asyncio-eventloop.rst:1003 +#: ../../library/asyncio-eventloop.rst:1022 msgid "Working with socket objects directly" msgstr "直接使用 socket 物件" -#: ../../library/asyncio-eventloop.rst:1005 +#: ../../library/asyncio-eventloop.rst:1024 msgid "" "In general, protocol implementations that use transport-based APIs such as :" "meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " @@ -1552,7 +1583,7 @@ msgstr "" "`loop.create_server`\\ )的協議實作比直接使用 socket 的實作更快。然而在某些情" "況下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" -#: ../../library/asyncio-eventloop.rst:1015 +#: ../../library/asyncio-eventloop.rst:1034 msgid "" "Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." "recv() `." @@ -1560,23 +1591,23 @@ msgstr "" "從 *sock* 接收最多 *nbytes*。:meth:`socket.recv() ` 的非" "同步版本。" -#: ../../library/asyncio-eventloop.rst:1018 +#: ../../library/asyncio-eventloop.rst:1037 msgid "Return the received data as a bytes object." msgstr "將接收到的資料作為 bytes 物件回傳。" -#: ../../library/asyncio-eventloop.rst:1020 -#: ../../library/asyncio-eventloop.rst:1035 -#: ../../library/asyncio-eventloop.rst:1047 -#: ../../library/asyncio-eventloop.rst:1060 -#: ../../library/asyncio-eventloop.rst:1076 -#: ../../library/asyncio-eventloop.rst:1092 -#: ../../library/asyncio-eventloop.rst:1103 -#: ../../library/asyncio-eventloop.rst:1130 -#: ../../library/asyncio-eventloop.rst:1169 +#: ../../library/asyncio-eventloop.rst:1039 +#: ../../library/asyncio-eventloop.rst:1054 +#: ../../library/asyncio-eventloop.rst:1066 +#: ../../library/asyncio-eventloop.rst:1079 +#: ../../library/asyncio-eventloop.rst:1095 +#: ../../library/asyncio-eventloop.rst:1111 +#: ../../library/asyncio-eventloop.rst:1122 +#: ../../library/asyncio-eventloop.rst:1149 +#: ../../library/asyncio-eventloop.rst:1188 msgid "*sock* must be a non-blocking socket." msgstr "*sock* 必須是非阻塞 socket。" -#: ../../library/asyncio-eventloop.rst:1022 +#: ../../library/asyncio-eventloop.rst:1041 msgid "" "Even though this method was always documented as a coroutine method, " "releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " @@ -1585,7 +1616,7 @@ msgstr "" "儘管此方法一直記錄為協程方法,但 Python 3.7 之前的版本回傳 :class:`Future`。" "自 Python 3.7 起,這是 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1030 +#: ../../library/asyncio-eventloop.rst:1049 msgid "" "Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" "meth:`socket.recv_into() ` method." @@ -1593,11 +1624,11 @@ msgstr "" "從 *sock* 接收資料到 *buf* 緩衝區。仿照阻塞 :meth:`socket.recv_into() " "` 方法。" -#: ../../library/asyncio-eventloop.rst:1033 +#: ../../library/asyncio-eventloop.rst:1052 msgid "Return the number of bytes written to the buffer." msgstr "回傳寫入緩衝區位元組的數目。" -#: ../../library/asyncio-eventloop.rst:1042 +#: ../../library/asyncio-eventloop.rst:1061 msgid "" "Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" "meth:`socket.recvfrom() `." @@ -1605,11 +1636,11 @@ msgstr "" "從 *sock* 接收最多 *bufsize* 大小的資料單元。:meth:`socket.recvfrom() " "` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1045 +#: ../../library/asyncio-eventloop.rst:1064 msgid "Return a tuple of (received data, remote address)." msgstr "回傳一個元組 (received data, remote address)。" -#: ../../library/asyncio-eventloop.rst:1054 +#: ../../library/asyncio-eventloop.rst:1073 msgid "" "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " "version of :meth:`socket.recvfrom_into() `." @@ -1617,11 +1648,11 @@ msgstr "" "從 *sock* 接收最多 *nbytes* 大小的資料單元到 *buf*。:meth:`socket." "recvfrom_into() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1058 +#: ../../library/asyncio-eventloop.rst:1077 msgid "Return a tuple of (number of bytes received, remote address)." msgstr "回傳一個元組 (number of bytes received, remote address)。" -#: ../../library/asyncio-eventloop.rst:1067 +#: ../../library/asyncio-eventloop.rst:1086 msgid "" "Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." "sendall() `." @@ -1629,7 +1660,7 @@ msgstr "" "將 *data* 發送到 *sock* socket。:meth:`socket.sendall() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1070 +#: ../../library/asyncio-eventloop.rst:1089 msgid "" "This method continues to send to the socket until either all data in *data* " "has been sent or an error occurs. ``None`` is returned on success. On " @@ -1641,8 +1672,8 @@ msgstr "" "回傳 ``None``。錯誤時引發例外。此外,沒有辦法確定接收端成功處理了多少資料(如" "果有的話)。" -#: ../../library/asyncio-eventloop.rst:1078 -#: ../../library/asyncio-eventloop.rst:1132 +#: ../../library/asyncio-eventloop.rst:1097 +#: ../../library/asyncio-eventloop.rst:1151 msgid "" "Even though the method was always documented as a coroutine method, before " "Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " @@ -1651,7 +1682,7 @@ msgstr "" "儘管該方法一直被記錄為協程方法,但在 Python 3.7 之前它回傳 :class:`Future`。" "從 Python 3.7 開始,這是一個 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1086 +#: ../../library/asyncio-eventloop.rst:1105 msgid "" "Send a datagram from *sock* to *address*. Asynchronous version of :meth:" "`socket.sendto() `." @@ -1659,20 +1690,20 @@ msgstr "" "從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1090 +#: ../../library/asyncio-eventloop.rst:1109 msgid "Return the number of bytes sent." msgstr "回傳發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:1099 +#: ../../library/asyncio-eventloop.rst:1118 msgid "Connect *sock* to a remote socket at *address*." msgstr "將 *sock* 連線到位於 *address* 的遠端 socket。" -#: ../../library/asyncio-eventloop.rst:1101 +#: ../../library/asyncio-eventloop.rst:1120 msgid "" "Asynchronous version of :meth:`socket.connect() `." msgstr ":meth:`socket.connect() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1105 +#: ../../library/asyncio-eventloop.rst:1124 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " "check if the *address* is already resolved by calling :func:`socket." @@ -1683,7 +1714,7 @@ msgstr "" "inet_pton` 檢查 *address* 是否已解析。如果沒有,將使用 :meth:`loop." "getaddrinfo` 解析 *address*。" -#: ../../library/asyncio-eventloop.rst:1114 +#: ../../library/asyncio-eventloop.rst:1133 msgid "" ":meth:`loop.create_connection` and :func:`asyncio.open_connection() " "`." @@ -1691,7 +1722,7 @@ msgstr "" ":meth:`loop.create_connection` 和 :func:`asyncio.open_connection() " "`。" -#: ../../library/asyncio-eventloop.rst:1121 +#: ../../library/asyncio-eventloop.rst:1140 msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "` method." @@ -1699,7 +1730,7 @@ msgstr "" "接受一個連線。模擬阻塞的 :meth:`socket.accept() ` 方" "法。" -#: ../../library/asyncio-eventloop.rst:1124 +#: ../../library/asyncio-eventloop.rst:1143 msgid "" "The socket must be bound to an address and listening for connections. The " "return value is a pair ``(conn, address)`` where *conn* is a *new* socket " @@ -1710,34 +1741,34 @@ msgstr "" "中 *conn* 是一個 *新* socket 物件,可在連線上發送和接收資料,*address* 是連接" "另一端對應的 socket 地址。" -#: ../../library/asyncio-eventloop.rst:1139 +#: ../../library/asyncio-eventloop.rst:1158 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr ":meth:`loop.create_server` 和 :func:`start_server`。" -#: ../../library/asyncio-eventloop.rst:1145 +#: ../../library/asyncio-eventloop.rst:1164 msgid "" "Send a file using high-performance :mod:`os.sendfile` if possible. Return " "the total number of bytes sent." msgstr "" "如果可行,使用高性能 :mod:`os.sendfile` 發送檔案。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:1148 +#: ../../library/asyncio-eventloop.rst:1167 msgid "" "Asynchronous version of :meth:`socket.sendfile() `." msgstr ":meth:`socket.sendfile() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1150 +#: ../../library/asyncio-eventloop.rst:1169 msgid "" "*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." "socket`." msgstr "" "*sock* 必須是非阻塞的 :const:`socket.SOCK_STREAM` :class:`~socket.socket`。" -#: ../../library/asyncio-eventloop.rst:1153 +#: ../../library/asyncio-eventloop.rst:1172 msgid "*file* must be a regular file object open in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:1162 +#: ../../library/asyncio-eventloop.rst:1181 msgid "" "*fallback*, when set to ``True``, makes asyncio manually read and send the " "file when the platform does not support the sendfile syscall (e.g. Windows " @@ -1746,7 +1777,7 @@ msgstr "" "當設置為 ``True`` 時,*fallback* 使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:1166 +#: ../../library/asyncio-eventloop.rst:1185 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support " "*sendfile* syscall and *fallback* is ``False``." @@ -1754,19 +1785,19 @@ msgstr "" "如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引發 :exc:" "`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:1175 +#: ../../library/asyncio-eventloop.rst:1194 msgid "DNS" msgstr "DNS" -#: ../../library/asyncio-eventloop.rst:1181 +#: ../../library/asyncio-eventloop.rst:1200 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr ":meth:`socket.getaddrinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1186 +#: ../../library/asyncio-eventloop.rst:1205 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr ":meth:`socket.getnameinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1189 +#: ../../library/asyncio-eventloop.rst:1208 msgid "" "Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous " "versions through the loop's default thread pool executor. When this executor " @@ -1776,7 +1807,7 @@ msgid "" "executor with a larger number of workers." msgstr "" -#: ../../library/asyncio-eventloop.rst:1196 +#: ../../library/asyncio-eventloop.rst:1215 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " "return a coroutine, but prior to Python 3.7 they were, in fact, returning :" @@ -1787,19 +1818,19 @@ msgstr "" "它們實際上回傳 :class:`asyncio.Future` 物件。從 Python 3.7 開始,兩個方法都是" "協程。" -#: ../../library/asyncio-eventloop.rst:1204 +#: ../../library/asyncio-eventloop.rst:1223 msgid "Working with pipes" msgstr "使用管道" -#: ../../library/asyncio-eventloop.rst:1209 +#: ../../library/asyncio-eventloop.rst:1228 msgid "Register the read end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的讀取端。" -#: ../../library/asyncio-eventloop.rst:1214 +#: ../../library/asyncio-eventloop.rst:1233 msgid "*pipe* is a :term:`file-like object `." msgstr "*pipe* 是 :term:`類檔案物件 `。" -#: ../../library/asyncio-eventloop.rst:1216 +#: ../../library/asyncio-eventloop.rst:1235 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports the :class:" "`ReadTransport` interface and *protocol* is an object instantiated by the " @@ -1808,22 +1839,22 @@ msgstr "" "回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" "`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1220 -#: ../../library/asyncio-eventloop.rst:1237 +#: ../../library/asyncio-eventloop.rst:1239 +#: ../../library/asyncio-eventloop.rst:1256 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "使用 :class:`SelectorEventLoop` 事件迴圈時,*pipe* 設置為非阻塞模式。" -#: ../../library/asyncio-eventloop.rst:1226 +#: ../../library/asyncio-eventloop.rst:1245 msgid "Register the write end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的寫入端。" -#: ../../library/asyncio-eventloop.rst:1231 +#: ../../library/asyncio-eventloop.rst:1250 msgid "*pipe* is :term:`file-like object `." msgstr "*pipe* 是 :term:`file-like object `。" -#: ../../library/asyncio-eventloop.rst:1233 +#: ../../library/asyncio-eventloop.rst:1252 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports :class:" "`WriteTransport` interface and *protocol* is an object instantiated by the " @@ -1832,7 +1863,7 @@ msgstr "" "回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" "`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1242 +#: ../../library/asyncio-eventloop.rst:1261 msgid "" ":class:`SelectorEventLoop` does not support the above methods on Windows. " "Use :class:`ProactorEventLoop` instead for Windows." @@ -1840,20 +1871,20 @@ msgstr "" ":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使用 :" "class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1247 +#: ../../library/asyncio-eventloop.rst:1266 msgid "" "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr ":meth:`loop.subprocess_exec` 和 :meth:`loop.subprocess_shell` 方法。" -#: ../../library/asyncio-eventloop.rst:1252 +#: ../../library/asyncio-eventloop.rst:1271 msgid "Unix signals" msgstr "Unix 訊號" -#: ../../library/asyncio-eventloop.rst:1258 +#: ../../library/asyncio-eventloop.rst:1277 msgid "Set *callback* as the handler for the *signum* signal." msgstr "將 *callback* 設置為 *signum* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1260 +#: ../../library/asyncio-eventloop.rst:1279 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " @@ -1864,7 +1895,7 @@ msgstr "" "用 :func:`signal.signal` 註冊的訊號處理程式不同,使用此函式註冊的回呼允許與事" "件迴圈進行互動。" -#: ../../library/asyncio-eventloop.rst:1265 +#: ../../library/asyncio-eventloop.rst:1284 msgid "" "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " "Raise :exc:`RuntimeError` if there is a problem setting up the handler." @@ -1872,16 +1903,16 @@ msgstr "" "如果訊號號無效或不可捕獲,引發 :exc:`ValueError`。如果設定處理程序有問題,拋" "出 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:1271 +#: ../../library/asyncio-eventloop.rst:1290 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." msgstr "像 :func:`signal.signal` 一樣,此函式必須在主執行緒中叫用。" -#: ../../library/asyncio-eventloop.rst:1276 +#: ../../library/asyncio-eventloop.rst:1295 msgid "Remove the handler for the *sig* signal." msgstr "移除 *sig* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1278 +#: ../../library/asyncio-eventloop.rst:1297 msgid "" "Return ``True`` if the signal handler was removed, or ``False`` if no " "handler was set for the given signal." @@ -1889,19 +1920,19 @@ msgstr "" "如果訊號處理程式被移除,回傳 ``True``;如果給定訊號沒有設置處理程式,回傳 " "``False``。" -#: ../../library/asyncio-eventloop.rst:1285 +#: ../../library/asyncio-eventloop.rst:1304 msgid "The :mod:`signal` module." msgstr ":mod:`signal` 模組。" -#: ../../library/asyncio-eventloop.rst:1289 +#: ../../library/asyncio-eventloop.rst:1308 msgid "Executing code in thread or process pools" msgstr "在執行緒池或行程池中執行程式碼" -#: ../../library/asyncio-eventloop.rst:1293 +#: ../../library/asyncio-eventloop.rst:1312 msgid "Arrange for *func* to be called in the specified executor." msgstr "安排在指定的執行器中呼叫 *func*。" -#: ../../library/asyncio-eventloop.rst:1295 +#: ../../library/asyncio-eventloop.rst:1314 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " "instance. The default executor is used if *executor* is ``None``. The " @@ -1910,7 +1941,7 @@ msgid "" "and used by :func:`run_in_executor` if needed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1303 +#: ../../library/asyncio-eventloop.rst:1322 msgid "" "import asyncio\n" "import concurrent.futures\n" @@ -1953,7 +1984,7 @@ msgid "" " asyncio.run(main())" msgstr "" -#: ../../library/asyncio-eventloop.rst:1343 +#: ../../library/asyncio-eventloop.rst:1362 msgid "" "Note that the entry point guard (``if __name__ == '__main__'``) is required " "for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " @@ -1965,11 +1996,11 @@ msgstr "" "== '__main__'``\\ )。請參閱\\ :ref:`主模組的安全引入 `。" -#: ../../library/asyncio-eventloop.rst:1348 +#: ../../library/asyncio-eventloop.rst:1367 msgid "This method returns a :class:`asyncio.Future` object." msgstr "此方法回傳 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:1350 +#: ../../library/asyncio-eventloop.rst:1369 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." @@ -1977,7 +2008,7 @@ msgstr "" "使用 :func:`functools.partial` 將來\\ :ref:`關鍵字引數傳遞 `\\ 給 *func*。" -#: ../../library/asyncio-eventloop.rst:1353 +#: ../../library/asyncio-eventloop.rst:1372 msgid "" ":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the " "thread pool executor it creates, instead leaving it up to the thread pool " @@ -1988,7 +2019,7 @@ msgstr "" "``max_workers``,而是讓執行緒池執行器(\\ :class:`~concurrent.futures." "ThreadPoolExecutor`)設定預設值。" -#: ../../library/asyncio-eventloop.rst:1362 +#: ../../library/asyncio-eventloop.rst:1381 msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " "*executor* must be an instance of :class:`~concurrent.futures." @@ -1997,26 +2028,26 @@ msgstr "" "將 *executor* 設置為 :meth:`run_in_executor` 使用的預設執行器。*executor* 必" "須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1366 +#: ../../library/asyncio-eventloop.rst:1385 msgid "" "*executor* must be an instance of :class:`~concurrent.futures." "ThreadPoolExecutor`." msgstr "" "*executor* 必須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1372 +#: ../../library/asyncio-eventloop.rst:1391 msgid "Error Handling API" msgstr "錯誤處理 API" -#: ../../library/asyncio-eventloop.rst:1374 +#: ../../library/asyncio-eventloop.rst:1393 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "允許自定義事件迴圈中的例外處理方式。" -#: ../../library/asyncio-eventloop.rst:1378 +#: ../../library/asyncio-eventloop.rst:1397 msgid "Set *handler* as the new event loop exception handler." msgstr "將 *handler* 設定為新的事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1380 +#: ../../library/asyncio-eventloop.rst:1399 msgid "" "If *handler* is ``None``, the default exception handler will be set. " "Otherwise, *handler* must be a callable with the signature matching ``(loop, " @@ -2029,7 +2060,7 @@ msgstr "" "圈的,``context`` 是包含例外詳細資訊的 ``dict`` 物件(有關情境的詳細資訊,請" "參閱 :meth:`call_exception_handler` 文件)。" -#: ../../library/asyncio-eventloop.rst:1388 +#: ../../library/asyncio-eventloop.rst:1407 msgid "" "If the handler is called on behalf of a :class:`~asyncio.Task` or :class:" "`~asyncio.Handle`, it is run in the :class:`contextvars.Context` of that " @@ -2038,7 +2069,7 @@ msgstr "" "如果代表 :class:`~asyncio.Task` 或 :class:`~asyncio.Handle` 呼叫處理程式,它" "將在該任務或回呼處理程式的 :class:`contextvars.Context` 中運行。" -#: ../../library/asyncio-eventloop.rst:1394 +#: ../../library/asyncio-eventloop.rst:1413 msgid "" "The handler may be called in the :class:`~contextvars.Context` of the task " "or handle where the exception originated." @@ -2046,18 +2077,18 @@ msgstr "" "處理程式可能在引發例外的任務或處理程式的 :class:`~contextvars.Context` 中被呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1399 +#: ../../library/asyncio-eventloop.rst:1418 msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" "回傳目前的例外處理程式,如果未設置自定義例外處理程式,則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:1406 +#: ../../library/asyncio-eventloop.rst:1425 msgid "Default exception handler." msgstr "預設例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1408 +#: ../../library/asyncio-eventloop.rst:1427 msgid "" "This is called when an exception occurs and no exception handler is set. " "This can be called by a custom exception handler that wants to defer to the " @@ -2066,17 +2097,17 @@ msgstr "" "當發生例外且未設置例外處理程式時呼叫此函式。自定義例外處理程式可以呼叫此函式" "以轉由預設處理程式處理。" -#: ../../library/asyncio-eventloop.rst:1412 +#: ../../library/asyncio-eventloop.rst:1431 msgid "" "*context* parameter has the same meaning as in :meth:" "`call_exception_handler`." msgstr "*context* 參數與 :meth:`call_exception_handler` 中的意思相同。" -#: ../../library/asyncio-eventloop.rst:1417 +#: ../../library/asyncio-eventloop.rst:1436 msgid "Call the current event loop exception handler." msgstr "呼叫目前事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1419 +#: ../../library/asyncio-eventloop.rst:1438 msgid "" "*context* is a ``dict`` object containing the following keys (new keys may " "be introduced in future Python versions):" @@ -2084,55 +2115,55 @@ msgstr "" "*context* 是一個包含以下鍵的 ``dict`` 物件(未來的 Python 版本中可能會引入新" "的鍵):" -#: ../../library/asyncio-eventloop.rst:1422 +#: ../../library/asyncio-eventloop.rst:1441 msgid "'message': Error message;" msgstr "'message':錯誤訊息;" -#: ../../library/asyncio-eventloop.rst:1423 +#: ../../library/asyncio-eventloop.rst:1442 msgid "'exception' (optional): Exception object;" msgstr "'exception'(可選):例外物件;" -#: ../../library/asyncio-eventloop.rst:1424 +#: ../../library/asyncio-eventloop.rst:1443 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "'future'(可選): :class:`asyncio.Future` 實例;" -#: ../../library/asyncio-eventloop.rst:1425 +#: ../../library/asyncio-eventloop.rst:1444 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "'task'(可選): :class:`asyncio.Task` 實例;" -#: ../../library/asyncio-eventloop.rst:1426 +#: ../../library/asyncio-eventloop.rst:1445 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "'handle'(可選): :class:`asyncio.Handle` 實例;" -#: ../../library/asyncio-eventloop.rst:1427 +#: ../../library/asyncio-eventloop.rst:1446 msgid "'protocol' (optional): :ref:`Protocol ` instance;" msgstr "'protocol'(可選): :ref:`Protocol ` 實例;" -#: ../../library/asyncio-eventloop.rst:1428 +#: ../../library/asyncio-eventloop.rst:1447 msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "'transport'(可選): :ref:`Transport ` 實例;" -#: ../../library/asyncio-eventloop.rst:1429 +#: ../../library/asyncio-eventloop.rst:1448 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "'socket'(可選): :class:`socket.socket` 實例;" -#: ../../library/asyncio-eventloop.rst:1430 +#: ../../library/asyncio-eventloop.rst:1449 msgid "'source_traceback' (optional): Traceback of the source;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1431 +#: ../../library/asyncio-eventloop.rst:1450 msgid "'handle_traceback' (optional): Traceback of the handle;" msgstr "" -#: ../../library/asyncio-eventloop.rst:1432 +#: ../../library/asyncio-eventloop.rst:1451 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "'asyncgen'(可選): 非同步產生器引發" -#: ../../library/asyncio-eventloop.rst:1433 +#: ../../library/asyncio-eventloop.rst:1452 msgid "the exception." msgstr "例外。" -#: ../../library/asyncio-eventloop.rst:1437 +#: ../../library/asyncio-eventloop.rst:1456 msgid "" "This method should not be overloaded in subclassed event loops. For custom " "exception handling, use the :meth:`set_exception_handler` method." @@ -2140,15 +2171,15 @@ msgstr "" "此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使用 :meth:" "`set_exception_handler` 方法。" -#: ../../library/asyncio-eventloop.rst:1442 +#: ../../library/asyncio-eventloop.rst:1461 msgid "Enabling debug mode" msgstr "啟用除錯模式" -#: ../../library/asyncio-eventloop.rst:1446 +#: ../../library/asyncio-eventloop.rst:1465 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "取得事件迴圈的除錯模式(\\ :class:`bool`\\ )。" -#: ../../library/asyncio-eventloop.rst:1448 +#: ../../library/asyncio-eventloop.rst:1467 msgid "" "The default value is ``True`` if the environment variable :envvar:" "`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." @@ -2156,17 +2187,17 @@ msgstr "" "如果環境變數 :envvar:`PYTHONASYNCIODEBUG` 被設定為非空字串,則預設值為 " "``True``,否則為 ``False``。" -#: ../../library/asyncio-eventloop.rst:1454 +#: ../../library/asyncio-eventloop.rst:1473 msgid "Set the debug mode of the event loop." msgstr "設定事件迴圈的除錯模式。" -#: ../../library/asyncio-eventloop.rst:1458 +#: ../../library/asyncio-eventloop.rst:1477 msgid "" "The new :ref:`Python Development Mode ` can now also be used to " "enable the debug mode." msgstr "現在也可以使用新的 :ref:`Python 開發模式 ` 啟用除錯模式。" -#: ../../library/asyncio-eventloop.rst:1463 +#: ../../library/asyncio-eventloop.rst:1482 msgid "" "This attribute can be used to set the minimum execution duration in seconds " "that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks " @@ -2175,19 +2206,19 @@ msgstr "" "此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式" "後,\"慢\"回呼將被記錄。" -#: ../../library/asyncio-eventloop.rst:1467 +#: ../../library/asyncio-eventloop.rst:1486 msgid "Default value is 100 milliseconds." msgstr "預設值為 100 毫秒" -#: ../../library/asyncio-eventloop.rst:1471 +#: ../../library/asyncio-eventloop.rst:1490 msgid "The :ref:`debug mode of asyncio `." msgstr ":ref:`asyncio 的除錯模式 `。" -#: ../../library/asyncio-eventloop.rst:1475 +#: ../../library/asyncio-eventloop.rst:1494 msgid "Running Subprocesses" msgstr "運行子行程" -#: ../../library/asyncio-eventloop.rst:1477 +#: ../../library/asyncio-eventloop.rst:1496 msgid "" "Methods described in this subsections are low-level. In regular async/await " "code consider using the high-level :func:`asyncio.create_subprocess_shell` " @@ -2197,7 +2228,7 @@ msgstr "" "func:`asyncio.create_subprocess_shell` 和 :func:`asyncio." "create_subprocess_exec` 輔助功能而不是。" -#: ../../library/asyncio-eventloop.rst:1484 +#: ../../library/asyncio-eventloop.rst:1503 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " "subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" @@ -2207,26 +2238,26 @@ msgstr "" "`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行程的支援 " "`。" -#: ../../library/asyncio-eventloop.rst:1496 +#: ../../library/asyncio-eventloop.rst:1515 msgid "" "Create a subprocess from one or more string arguments specified by *args*." msgstr "從 *args* 指定的一個或多個字串引數建立子行程。" -#: ../../library/asyncio-eventloop.rst:1499 +#: ../../library/asyncio-eventloop.rst:1518 msgid "*args* must be a list of strings represented by:" msgstr "*args* 必須是由以下項表示的字串串列:" -#: ../../library/asyncio-eventloop.rst:1501 +#: ../../library/asyncio-eventloop.rst:1520 msgid ":class:`str`;" msgstr ":class:`str`;" -#: ../../library/asyncio-eventloop.rst:1502 +#: ../../library/asyncio-eventloop.rst:1521 msgid "" "or :class:`bytes`, encoded to the :ref:`filesystem encoding `." msgstr "或 :class:`bytes`,編碼為 :ref:`檔案系統編碼 `。" -#: ../../library/asyncio-eventloop.rst:1505 +#: ../../library/asyncio-eventloop.rst:1524 msgid "" "The first string specifies the program executable, and the remaining strings " "specify the arguments. Together, string arguments form the ``argv`` of the " @@ -2235,7 +2266,7 @@ msgstr "" "第一個字串指定程序可執行檔案,其餘字串指定引數。字串引數一起組成程序的 " "``argv``。" -#: ../../library/asyncio-eventloop.rst:1509 +#: ../../library/asyncio-eventloop.rst:1528 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=False`` and the list of strings passed as the first " @@ -2246,7 +2277,7 @@ msgstr "" "字串串列作為第一個引數傳遞;然而,:class:`~subprocess.Popen` 接受單個字串串列" "引數,*subprocess_exec* 接受多個字串引數。" -#: ../../library/asyncio-eventloop.rst:1515 +#: ../../library/asyncio-eventloop.rst:1534 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`asyncio.SubprocessProtocol` class." @@ -2254,67 +2285,67 @@ msgstr "" "*protocol_factory* 必須是回傳 :class:`asyncio.SubprocessProtocol` 子類別的可" "呼叫物件。" -#: ../../library/asyncio-eventloop.rst:1518 +#: ../../library/asyncio-eventloop.rst:1537 msgid "Other parameters:" msgstr "其他參數:" -#: ../../library/asyncio-eventloop.rst:1520 +#: ../../library/asyncio-eventloop.rst:1539 msgid "*stdin* can be any of these:" msgstr "*stdin* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1522 -#: ../../library/asyncio-eventloop.rst:1533 -#: ../../library/asyncio-eventloop.rst:1543 +#: ../../library/asyncio-eventloop.rst:1541 +#: ../../library/asyncio-eventloop.rst:1552 +#: ../../library/asyncio-eventloop.rst:1562 msgid "a file-like object" msgstr "類檔案物件" -#: ../../library/asyncio-eventloop.rst:1523 +#: ../../library/asyncio-eventloop.rst:1542 msgid "" "an existing file descriptor (a positive integer), for example those created " "with :meth:`os.pipe`" msgstr "現有的檔案描述器(正整數),例如用 :meth:`os.pipe` 建立的" -#: ../../library/asyncio-eventloop.rst:1524 -#: ../../library/asyncio-eventloop.rst:1534 -#: ../../library/asyncio-eventloop.rst:1544 +#: ../../library/asyncio-eventloop.rst:1543 +#: ../../library/asyncio-eventloop.rst:1553 +#: ../../library/asyncio-eventloop.rst:1563 msgid "" "the :const:`subprocess.PIPE` constant (default) which will create a new pipe " "and connect it," msgstr ":const:`subprocess.PIPE` 常數(預設),它將建立一個新的管道並連線," -#: ../../library/asyncio-eventloop.rst:1526 -#: ../../library/asyncio-eventloop.rst:1536 -#: ../../library/asyncio-eventloop.rst:1546 +#: ../../library/asyncio-eventloop.rst:1545 +#: ../../library/asyncio-eventloop.rst:1555 +#: ../../library/asyncio-eventloop.rst:1565 msgid "" "the value ``None`` which will make the subprocess inherit the file " "descriptor from this process" msgstr "值 ``None`` 將使子行程從此行程繼承檔案描述器" -#: ../../library/asyncio-eventloop.rst:1528 -#: ../../library/asyncio-eventloop.rst:1538 -#: ../../library/asyncio-eventloop.rst:1548 +#: ../../library/asyncio-eventloop.rst:1547 +#: ../../library/asyncio-eventloop.rst:1557 +#: ../../library/asyncio-eventloop.rst:1567 msgid "" "the :const:`subprocess.DEVNULL` constant which indicates that the special :" "data:`os.devnull` file will be used" msgstr "" ":const:`subprocess.DEVNULL` 常數,表示將使用特殊的 :data:`os.devnull` 檔案" -#: ../../library/asyncio-eventloop.rst:1531 +#: ../../library/asyncio-eventloop.rst:1550 msgid "*stdout* can be any of these:" msgstr "*stdout* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1541 +#: ../../library/asyncio-eventloop.rst:1560 msgid "*stderr* can be any of these:" msgstr "*stderr* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1550 +#: ../../library/asyncio-eventloop.rst:1569 msgid "" "the :const:`subprocess.STDOUT` constant which will connect the standard " "error stream to the process' standard output stream" msgstr "" ":const:`subprocess.STDOUT` 常數,它將標準錯誤串流連線到行程的標準輸出串流" -#: ../../library/asyncio-eventloop.rst:1553 +#: ../../library/asyncio-eventloop.rst:1572 msgid "" "All other keyword arguments are passed to :class:`subprocess.Popen` without " "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " @@ -2324,7 +2355,7 @@ msgstr "" "*bufsize*、*universal_newlines*、*shell*、*text*、*encoding* 和 *errors* 除" "外,這些不應該指定。" -#: ../../library/asyncio-eventloop.rst:1558 +#: ../../library/asyncio-eventloop.rst:1577 msgid "" "The ``asyncio`` subprocess API does not support decoding the streams as " "text. :func:`bytes.decode` can be used to convert the bytes returned from " @@ -2333,7 +2364,7 @@ msgstr "" "``asyncio`` 子行程 API 不支援將串流解碼為文本。可以使用 :func:`bytes.decode` " "將從串流回傳的位元組轉換為文本。" -#: ../../library/asyncio-eventloop.rst:1562 +#: ../../library/asyncio-eventloop.rst:1581 msgid "" "If a file-like object passed as *stdin*, *stdout* or *stderr* represents a " "pipe, then the other side of this pipe should be registered with :meth:" @@ -2344,13 +2375,13 @@ msgstr "" "端應該使用 :meth:`~loop.connect_write_pipe` 或 :meth:`~loop." "connect_read_pipe` 註冊到事件迴圈中。" -#: ../../library/asyncio-eventloop.rst:1567 +#: ../../library/asyncio-eventloop.rst:1586 msgid "" "See the constructor of the :class:`subprocess.Popen` class for documentation " "on other arguments." msgstr "有關其他引數的文件,請參閱 :class:`subprocess.Popen` 類別的建構函式。" -#: ../../library/asyncio-eventloop.rst:1570 +#: ../../library/asyncio-eventloop.rst:1589 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " @@ -2360,7 +2391,7 @@ msgstr "" "SubprocessTransport` 基底類別,*protocol* 是由 *protocol_factory* 實例化的物" "件。" -#: ../../library/asyncio-eventloop.rst:1579 +#: ../../library/asyncio-eventloop.rst:1598 msgid "" "Create a subprocess from *cmd*, which can be a :class:`str` or a :class:" "`bytes` string encoded to the :ref:`filesystem encoding ` 的 :class:`bytes` 字串。" -#: ../../library/asyncio-eventloop.rst:1584 +#: ../../library/asyncio-eventloop.rst:1603 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=True``." @@ -2377,7 +2408,7 @@ msgstr "" "這類似於標準函式庫中的 :class:`subprocess.Popen` 類別,使用 ``shell=True`` 呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1587 +#: ../../library/asyncio-eventloop.rst:1606 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`SubprocessProtocol` class." @@ -2385,13 +2416,13 @@ msgstr "" "*protocol_factory* 必須是回傳 :class:`SubprocessProtocol` 子類別的可呼叫物" "件。" -#: ../../library/asyncio-eventloop.rst:1590 +#: ../../library/asyncio-eventloop.rst:1609 msgid "" "See :meth:`~loop.subprocess_exec` for more details about the remaining " "arguments." msgstr "有關其餘引數的更多詳細資訊,請參閱 :meth:`~loop.subprocess_exec`。" -#: ../../library/asyncio-eventloop.rst:1593 +#: ../../library/asyncio-eventloop.rst:1612 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`SubprocessTransport` base class and *protocol* is an object " @@ -2401,7 +2432,7 @@ msgstr "" "`SubprocessTransport` 基底類別,而 *protocol* 是由 *protocol_factory* 實例化" "的物件。" -#: ../../library/asyncio-eventloop.rst:1598 +#: ../../library/asyncio-eventloop.rst:1617 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -2414,11 +2445,11 @@ msgstr "" "wikipedia.org/wiki/Shell_injection#Shell_injection>`_\\ 風險。可以使用 :func:" "`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊字元。" -#: ../../library/asyncio-eventloop.rst:1607 +#: ../../library/asyncio-eventloop.rst:1626 msgid "Callback Handles" msgstr "回呼處理" -#: ../../library/asyncio-eventloop.rst:1611 +#: ../../library/asyncio-eventloop.rst:1630 msgid "" "A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." "call_soon_threadsafe`." @@ -2426,46 +2457,46 @@ msgstr "" "由 :meth:`loop.call_soon` 和 :meth:`loop.call_soon_threadsafe` 回傳的回呼包裝" "器。" -#: ../../library/asyncio-eventloop.rst:1616 +#: ../../library/asyncio-eventloop.rst:1635 msgid "" "Return the :class:`contextvars.Context` object associated with the handle." msgstr "回傳與處理相關聯的 :class:`contextvars.Context` 物件。" -#: ../../library/asyncio-eventloop.rst:1623 +#: ../../library/asyncio-eventloop.rst:1642 msgid "" "Cancel the callback. If the callback has already been canceled or executed, " "this method has no effect." msgstr "取消回呼。如果回呼已被取消或執行,此方法將不起作用。" -#: ../../library/asyncio-eventloop.rst:1628 +#: ../../library/asyncio-eventloop.rst:1647 msgid "Return ``True`` if the callback was cancelled." msgstr "如果回呼已被取消,回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1634 +#: ../../library/asyncio-eventloop.rst:1653 msgid "" "A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" "`loop.call_at`." msgstr "由 :meth:`loop.call_later` 和 :meth:`loop.call_at` 回傳的回呼包裝器。" -#: ../../library/asyncio-eventloop.rst:1637 +#: ../../library/asyncio-eventloop.rst:1656 msgid "This class is a subclass of :class:`Handle`." msgstr "這個類別是 :class:`Handle` 的子類別。" -#: ../../library/asyncio-eventloop.rst:1641 +#: ../../library/asyncio-eventloop.rst:1660 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "回傳預定的回呼時間,以 :class:`float` 秒為單位。" -#: ../../library/asyncio-eventloop.rst:1643 +#: ../../library/asyncio-eventloop.rst:1662 msgid "" "The time is an absolute timestamp, using the same time reference as :meth:" "`loop.time`." msgstr "時間是一個絕對的時間戳,使用與 :meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:1650 +#: ../../library/asyncio-eventloop.rst:1669 msgid "Server Objects" msgstr "Server 物件" -#: ../../library/asyncio-eventloop.rst:1652 +#: ../../library/asyncio-eventloop.rst:1671 msgid "" "Server objects are created by :meth:`loop.create_server`, :meth:`loop." "create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " @@ -2475,11 +2506,11 @@ msgstr "" "create_unix_server`、:func:`start_server` 和 :func:`start_unix_server` 函式所" "建立。" -#: ../../library/asyncio-eventloop.rst:1656 +#: ../../library/asyncio-eventloop.rst:1675 msgid "Do not instantiate the :class:`Server` class directly." msgstr "請勿直接實例化 :class:`Server` 類別。" -#: ../../library/asyncio-eventloop.rst:1660 +#: ../../library/asyncio-eventloop.rst:1679 msgid "" "*Server* objects are asynchronous context managers. When used in an ``async " "with`` statement, it's guaranteed that the Server object is closed and not " @@ -2488,7 +2519,7 @@ msgstr "" "*Server* 物件是非同步情境管理器。當在 ``async with`` 陳述中使用時,可以保證在" "完成 ``async with`` 陳述時,Server 物件將會關閉並停止接受新的連線: ::" -#: ../../library/asyncio-eventloop.rst:1665 +#: ../../library/asyncio-eventloop.rst:1684 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -2504,30 +2535,30 @@ msgstr "" "\n" "# 此時 srv 已關閉,不再接受新的連線。" -#: ../../library/asyncio-eventloop.rst:1673 +#: ../../library/asyncio-eventloop.rst:1692 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "自 Python 3.7 起,Server 物件是非同步情境管理器。" -#: ../../library/asyncio-eventloop.rst:1676 +#: ../../library/asyncio-eventloop.rst:1695 msgid "" "This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, " "3.10.3 and 3.11." msgstr "" "此類別在 Python 3.9.11、3.10.3 和 3.11 中以 ``asyncio.Server`` 的形式被公開。" -#: ../../library/asyncio-eventloop.rst:1681 +#: ../../library/asyncio-eventloop.rst:1700 msgid "" "Stop serving: close listening sockets and set the :attr:`sockets` attribute " "to ``None``." msgstr "停止服務:關閉監聽的 sockets 並將 :attr:`sockets` 屬性設為 ``None``。" -#: ../../library/asyncio-eventloop.rst:1684 +#: ../../library/asyncio-eventloop.rst:1703 msgid "" "The sockets that represent existing incoming client connections are left " "open." msgstr "代表現有傳入用戶端連線的 sockets 仍然保持開啟。" -#: ../../library/asyncio-eventloop.rst:1687 +#: ../../library/asyncio-eventloop.rst:1706 msgid "" "The server is closed asynchronously; use the :meth:`wait_closed` coroutine " "to wait until the server is closed (and no more connections are active)." @@ -2535,53 +2566,53 @@ msgstr "" "伺服器以非同步方式關閉;使用 :meth:`wait_close` 協程等待伺服器關閉(不再有活" "躍連線)。" -#: ../../library/asyncio-eventloop.rst:1693 +#: ../../library/asyncio-eventloop.rst:1712 msgid "Close all existing incoming client connections." msgstr "關閉所有現有的傳入客戶端連線。" -#: ../../library/asyncio-eventloop.rst:1695 +#: ../../library/asyncio-eventloop.rst:1714 msgid "" "Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1698 +#: ../../library/asyncio-eventloop.rst:1717 msgid "" ":meth:`close` should be called before :meth:`close_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1705 +#: ../../library/asyncio-eventloop.rst:1724 msgid "" "Close all existing incoming client connections immediately, without waiting " "for pending operations to complete." msgstr "立即關閉所有現有的傳入客戶端連線,而不等待待定操作完成。" -#: ../../library/asyncio-eventloop.rst:1708 +#: ../../library/asyncio-eventloop.rst:1727 msgid "" "Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1711 +#: ../../library/asyncio-eventloop.rst:1730 msgid "" ":meth:`close` should be called before :meth:`abort_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1718 +#: ../../library/asyncio-eventloop.rst:1737 msgid "Return the event loop associated with the server object." msgstr "回傳與伺服器物件關聯的事件迴圈。" -#: ../../library/asyncio-eventloop.rst:1725 +#: ../../library/asyncio-eventloop.rst:1744 msgid "Start accepting connections." msgstr "開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1727 +#: ../../library/asyncio-eventloop.rst:1746 msgid "" "This method is idempotent, so it can be called when the server is already " "serving." msgstr "此方法是幂等的,因此可以在伺服器已經運行時呼叫。" -#: ../../library/asyncio-eventloop.rst:1730 +#: ../../library/asyncio-eventloop.rst:1749 msgid "" "The *start_serving* keyword-only parameter to :meth:`loop.create_server` " "and :meth:`asyncio.start_server` allows creating a Server object that is not " @@ -2594,14 +2625,14 @@ msgstr "" "種情況下,可以使用 ``Server.start_serving()`` 或 :meth:`Server." "serve_forever` 來使 Server 開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1742 +#: ../../library/asyncio-eventloop.rst:1761 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" "開始接受連線,直到協程被取消。取消 ``serve_forever`` 任務會導致伺服器關閉。" -#: ../../library/asyncio-eventloop.rst:1746 +#: ../../library/asyncio-eventloop.rst:1765 msgid "" "This method can be called if the server is already accepting connections. " "Only one ``serve_forever`` task can exist per one *Server* object." @@ -2609,7 +2640,7 @@ msgstr "" "如果伺服器已經接受連線,則可以呼叫此方法。每個 *Server* 物件只能存在一個 " "``serve_forever`` 任務。" -#: ../../library/asyncio-eventloop.rst:1752 +#: ../../library/asyncio-eventloop.rst:1771 msgid "" "async def client_connected(reader, writer):\n" " # Communicate with the client with\n" @@ -2635,24 +2666,24 @@ msgstr "" "\n" "asyncio.run(main('127.0.0.1', 0))" -#: ../../library/asyncio-eventloop.rst:1768 +#: ../../library/asyncio-eventloop.rst:1787 msgid "Return ``True`` if the server is accepting new connections." msgstr "如果伺服器正在接受新連線,則回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1775 +#: ../../library/asyncio-eventloop.rst:1794 msgid "" "Wait until the :meth:`close` method completes and all active connections " "have finished." msgstr "等待 :meth:`close` 方法完成且所有活動連線都已結束。" -#: ../../library/asyncio-eventloop.rst:1780 +#: ../../library/asyncio-eventloop.rst:1799 msgid "" "List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the " "server is listening on." msgstr "" "伺服器正在監聽的類似 socket 的物件串列,``asyncio.trsock.TransportSocket``。" -#: ../../library/asyncio-eventloop.rst:1783 +#: ../../library/asyncio-eventloop.rst:1802 msgid "" "Prior to Python 3.7 ``Server.sockets`` used to return an internal list of " "server sockets directly. In 3.7 a copy of that list is returned." @@ -2660,11 +2691,11 @@ msgstr "" "在 Python 3.7 之前,``Server.sockets`` 曾經直接回傳內部伺服器 sockets 的串" "列。在 3.7 中回傳了該串列的副本。" -#: ../../library/asyncio-eventloop.rst:1793 +#: ../../library/asyncio-eventloop.rst:1812 msgid "Event Loop Implementations" msgstr "事件迴圈實作" -#: ../../library/asyncio-eventloop.rst:1795 +#: ../../library/asyncio-eventloop.rst:1814 msgid "" "asyncio ships with two different event loop implementations: :class:" "`SelectorEventLoop` and :class:`ProactorEventLoop`." @@ -2672,17 +2703,17 @@ msgstr "" "asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` 和 :class:" "`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1798 +#: ../../library/asyncio-eventloop.rst:1817 msgid "By default asyncio is configured to use :class:`EventLoop`." msgstr "預設情況下,asyncio 被配置為要使用 :class:`EventLoop`。" -#: ../../library/asyncio-eventloop.rst:1803 +#: ../../library/asyncio-eventloop.rst:1822 msgid "" "A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " "module." msgstr "基於 :mod:`selectors` 模組的一個 :class:`AbstractEventLoop` 子類別。" -#: ../../library/asyncio-eventloop.rst:1806 +#: ../../library/asyncio-eventloop.rst:1825 msgid "" "Uses the most efficient *selector* available for the given platform. It is " "also possible to manually configure the exact selector implementation to be " @@ -2691,7 +2722,7 @@ msgstr "" "使用特定平台上最有效的 *selector*。也可以手動配置要使用的確切 selector 實" "作: ::" -#: ../../library/asyncio-eventloop.rst:1810 +#: ../../library/asyncio-eventloop.rst:1829 msgid "" "import asyncio\n" "import selectors\n" @@ -2713,7 +2744,7 @@ msgstr "" "\n" "asyncio.set_event_loop_policy(MyPolicy())" -#: ../../library/asyncio-eventloop.rst:1826 +#: ../../library/asyncio-eventloop.rst:1845 msgid "" "A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " "Completion Ports\" (IOCP)." @@ -2721,7 +2752,7 @@ msgstr "" "用於 Windows 的 :class:`AbstractEventLoop` 子類別,使用「I/O 完成埠 (IOCP, I/" "O Completion Ports)」。" -#: ../../library/asyncio-eventloop.rst:1832 +#: ../../library/asyncio-eventloop.rst:1851 msgid "" "`MSDN documentation on I/O Completion Ports `_." @@ -2729,13 +2760,13 @@ msgstr "" "`I/O 完成埠的 MSDN 文件 `_。" -#: ../../library/asyncio-eventloop.rst:1837 +#: ../../library/asyncio-eventloop.rst:1856 msgid "" "An alias to the most efficient available subclass of :class:" "`AbstractEventLoop` for the given platform." msgstr "" -#: ../../library/asyncio-eventloop.rst:1840 +#: ../../library/asyncio-eventloop.rst:1859 msgid "" "It is an alias to :class:`SelectorEventLoop` on Unix and :class:" "`ProactorEventLoop` on Windows." @@ -2743,11 +2774,11 @@ msgstr "" "在 Unix 上是 :class:`SelectorEventLoop` 的別名,在 Windows 上是 :class:" "`ProactorEventLoop` 的別名。" -#: ../../library/asyncio-eventloop.rst:1846 +#: ../../library/asyncio-eventloop.rst:1865 msgid "Abstract base class for asyncio-compliant event loops." msgstr "為符合 asyncio 標準的事件迴圈的抽象基礎類別。" -#: ../../library/asyncio-eventloop.rst:1848 +#: ../../library/asyncio-eventloop.rst:1867 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." @@ -2755,11 +2786,11 @@ msgstr "" ":ref:`asyncio-event-loop-methods` 部分列出了替代 ``AbstractEventLoop`` 實作應" "該定義的所有方法。" -#: ../../library/asyncio-eventloop.rst:1854 +#: ../../library/asyncio-eventloop.rst:1873 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-eventloop.rst:1856 +#: ../../library/asyncio-eventloop.rst:1875 msgid "" "Note that all examples in this section **purposefully** show how to use the " "low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop." @@ -2770,11 +2801,11 @@ msgstr "" "`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式很少需要這" "種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" -#: ../../library/asyncio-eventloop.rst:1866 +#: ../../library/asyncio-eventloop.rst:1885 msgid "Hello World with call_soon()" msgstr "使用 call_soon() 的 Hello World 範例" -#: ../../library/asyncio-eventloop.rst:1868 +#: ../../library/asyncio-eventloop.rst:1887 msgid "" "An example using the :meth:`loop.call_soon` method to schedule a callback. " "The callback displays ``\"Hello World\"`` and then stops the event loop::" @@ -2782,7 +2813,7 @@ msgstr "" "使用 :meth:`loop.call_soon` 方法排程回呼的範例。回呼會顯示 ``\"Hello " "World\"``,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1872 +#: ../../library/asyncio-eventloop.rst:1891 msgid "" "import asyncio\n" "\n" @@ -2820,18 +2851,18 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1892 +#: ../../library/asyncio-eventloop.rst:1911 msgid "" "A similar :ref:`Hello World ` example created with a coroutine " "and the :func:`run` function." msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`Hello World ` 範例。" -#: ../../library/asyncio-eventloop.rst:1899 +#: ../../library/asyncio-eventloop.rst:1918 msgid "Display the current date with call_later()" msgstr "使用 call_later() 顯示目前日期" -#: ../../library/asyncio-eventloop.rst:1901 +#: ../../library/asyncio-eventloop.rst:1920 msgid "" "An example of a callback displaying the current date every second. The " "callback uses the :meth:`loop.call_later` method to reschedule itself after " @@ -2840,7 +2871,7 @@ msgstr "" "一個回呼的範例,每秒顯示目前日期。回呼使用 :meth:`loop.call_later` 方法在 5 " "秒後重新排程自己,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1905 +#: ../../library/asyncio-eventloop.rst:1924 msgid "" "import asyncio\n" "import datetime\n" @@ -2886,7 +2917,7 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1929 +#: ../../library/asyncio-eventloop.rst:1948 msgid "" "A similar :ref:`current date ` example created with a " "coroutine and the :func:`run` function." @@ -2894,11 +2925,11 @@ msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`current date " "` 範例。" -#: ../../library/asyncio-eventloop.rst:1936 +#: ../../library/asyncio-eventloop.rst:1955 msgid "Watch a file descriptor for read events" msgstr "監聽檔案描述器以進行讀取事件" -#: ../../library/asyncio-eventloop.rst:1938 +#: ../../library/asyncio-eventloop.rst:1957 msgid "" "Wait until a file descriptor received some data using the :meth:`loop." "add_reader` method and then close the event loop::" @@ -2906,7 +2937,7 @@ msgstr "" "使用 :meth:`loop.add_reader` 方法等待檔案描述器接收到某些資料,然後關閉事件迴" "圈: ::" -#: ../../library/asyncio-eventloop.rst:1941 +#: ../../library/asyncio-eventloop.rst:1960 msgid "" "import asyncio\n" "from socket import socketpair\n" @@ -2974,7 +3005,7 @@ msgstr "" " wsock.close()\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1976 +#: ../../library/asyncio-eventloop.rst:1995 msgid "" "A similar :ref:`example ` using " "transports, protocols, and the :meth:`loop.create_connection` method." @@ -2982,7 +3013,7 @@ msgstr "" "使用傳輸、協定和 :meth:`loop.create_connection` 方法的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1980 +#: ../../library/asyncio-eventloop.rst:1999 msgid "" "Another similar :ref:`example ` " "using the high-level :func:`asyncio.open_connection` function and streams." @@ -2990,15 +3021,15 @@ msgstr "" "另一個使用高階 :func:`asyncio.open_connection` 函式和串流的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1988 +#: ../../library/asyncio-eventloop.rst:2007 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "設定 SIGINT 和 SIGTERM 的訊號處理程式" -#: ../../library/asyncio-eventloop.rst:1990 +#: ../../library/asyncio-eventloop.rst:2009 msgid "(This ``signals`` example only works on Unix.)" msgstr "(此 ``signals`` 範例僅在 Unix 上運作。)" -#: ../../library/asyncio-eventloop.rst:1992 +#: ../../library/asyncio-eventloop.rst:2011 msgid "" "Register handlers for signals :const:`~signal.SIGINT` and :const:`~signal." "SIGTERM` using the :meth:`loop.add_signal_handler` method::" @@ -3006,7 +3037,7 @@ msgstr "" "使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` 和 :py:" "data:`SIGTERM` 的處理程式: ::" -#: ../../library/asyncio-eventloop.rst:1995 +#: ../../library/asyncio-eventloop.rst:2014 msgid "" "import asyncio\n" "import functools\n" diff --git a/library/json.po b/library/json.po index 485a9121cb..ed37751ef6 100644 --- a/library/json.po +++ b/library/json.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-09 00:15+0000\n" +"POT-Creation-Date: 2025-05-19 00:16+0000\n" "PO-Revision-Date: 2023-08-05 15:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,12 +30,12 @@ msgstr "**原始碼:**\\ :source:`Lib/json/__init__.py`" #: ../../library/json.rst:14 msgid "" -"`JSON (JavaScript Object Notation) `_, specified " -"by :rfc:`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, specified by :rfc:" +"`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, is a " -"lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is " -"not a strict subset of JavaScript [#rfc-errata]_ )." +"lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is not a " +"strict subset of JavaScript [#rfc-errata]_ )." msgstr "" "`JSON (JavaScript Object Notation) `_ 是一個輕量化的資料交" "換格式,在 :rfc:`7159`\\ (其廢棄了 :rfc:`4627`\\ )及 `ECMA-404 >> import json\n" ">>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])\n" @@ -101,22 +109,22 @@ msgstr "" ">>> io.getvalue()\n" "'[\"streaming API\"]'" -#: ../../library/json.rst:48 +#: ../../library/json.rst:53 msgid "Compact encoding::" msgstr "改用緊湊型編碼方式: ::" -#: ../../library/json.rst:50 +#: ../../library/json.rst:55 msgid "" ">>> import json\n" ">>> json.dumps([1, 2, 3, {'4': 5, '6': 7}], separators=(',', ':'))\n" "'[1,2,3,{\"4\":5,\"6\":7}]'" msgstr "" -#: ../../library/json.rst:54 +#: ../../library/json.rst:59 msgid "Pretty printing::" msgstr "美化輸出: ::" -#: ../../library/json.rst:56 +#: ../../library/json.rst:61 msgid "" ">>> import json\n" ">>> print(json.dumps({'6': 7, '4': 5}, sort_keys=True, indent=4))\n" @@ -132,28 +140,29 @@ msgstr "" " \"6\": 7\n" "}" -#: ../../library/json.rst:63 -msgid "Specializing JSON object encoding::" +#: ../../library/json.rst:68 +#, fuzzy +msgid "Customizing JSON object encoding::" msgstr "特殊化 JSON 物件解碼方式: ::" -#: ../../library/json.rst:65 +#: ../../library/json.rst:70 msgid "" ">>> import json\n" ">>> def custom_json(obj):\n" "... if isinstance(obj, complex):\n" -"... return {'__complex__': True, 'real': obj.real, 'imag': " -"obj.imag}\n" +"... return {'__complex__': True, 'real': obj.real, 'imag': obj." +"imag}\n" "... raise TypeError(f'Cannot serialize object of {type(obj)}')\n" "...\n" ">>> json.dumps(1 + 2j, default=custom_json)\n" "'{\"__complex__\": true, \"real\": 1.0, \"imag\": 2.0}'" msgstr "" -#: ../../library/json.rst:74 +#: ../../library/json.rst:79 msgid "Decoding JSON::" msgstr "JSON 解碼: ::" -#: ../../library/json.rst:76 +#: ../../library/json.rst:81 msgid "" ">>> import json\n" ">>> json.loads('[\"foo\", {\"bar\":[\"baz\", null, 1.0, 2]}]')\n" @@ -175,11 +184,12 @@ msgstr "" ">>> json.load(io)\n" "['streaming API']" -#: ../../library/json.rst:86 -msgid "Specializing JSON object decoding::" +#: ../../library/json.rst:91 +#, fuzzy +msgid "Customizing JSON object decoding::" msgstr "自訂特殊的 JSON 解碼方式: ::" -#: ../../library/json.rst:88 +#: ../../library/json.rst:93 msgid "" ">>> import json\n" ">>> def as_complex(dct):\n" @@ -207,11 +217,11 @@ msgstr "" ">>> json.loads('1.1', parse_float=decimal.Decimal)\n" "Decimal('1.1')" -#: ../../library/json.rst:101 +#: ../../library/json.rst:106 msgid "Extending :class:`JSONEncoder`::" msgstr "繼承 :class:`JSONEncoder` 類別並自行擴充額外的編碼方法: ::" -#: ../../library/json.rst:103 +#: ../../library/json.rst:108 msgid "" ">>> import json\n" ">>> class ComplexEncoder(json.JSONEncoder):\n" @@ -229,11 +239,11 @@ msgid "" "['[2.0', ', 1.0', ']']" msgstr "" -#: ../../library/json.rst:119 +#: ../../library/json.rst:124 msgid "Using :mod:`json.tool` from the shell to validate and pretty-print:" msgstr "在命令列介面裡使用 :mod:`json.tool` 來驗證 JSON 語法和美化呈現方式:" -#: ../../library/json.rst:121 +#: ../../library/json.rst:126 msgid "" "$ echo '{\"json\":\"obj\"}' | python -m json.tool\n" "{\n" @@ -249,11 +259,11 @@ msgstr "" "$ echo '{1.2:3.4}' | python -m json.tool\n" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" -#: ../../library/json.rst:130 +#: ../../library/json.rst:135 msgid "See :ref:`json-commandline` for detailed documentation." msgstr "更詳盡的文件請見 :ref:`json-commandline`。" -#: ../../library/json.rst:134 +#: ../../library/json.rst:139 msgid "" "JSON is a subset of `YAML `_ 1.2. The JSON produced by " "this module's default settings (in particular, the default *separators* " @@ -265,7 +275,7 @@ msgstr "" "輸出也符合 YAML 1.0 和 1.1 的子集合規範。因此你也可以利用這個模組來當作 YAML " "的序列化工具(serializer)。" -#: ../../library/json.rst:141 +#: ../../library/json.rst:146 msgid "" "This module's encoders and decoders preserve input and output order by " "default. Order is only lost if the underlying containers are unordered." @@ -273,23 +283,23 @@ msgstr "" "這個模組的編、解碼器預設會保存輸入與輸出資料的順序關係,除非一開始的輸入本身" "就是無序的。" -#: ../../library/json.rst:146 +#: ../../library/json.rst:151 msgid "Basic Usage" msgstr "基本用法" -#: ../../library/json.rst:153 +#: ../../library/json.rst:158 msgid "" "Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-" "supporting :term:`file-like object`) using this :ref:`Python-to-JSON " "conversion table `." msgstr "" "參考這個 :ref:`Python-to-JSON 轉換表 `\\ 將 *obj* 序列化為" -"符合 JSON 格式的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法" -"的 :term:`file-like object`)" +"符合 JSON 格式的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:" +"`file-like object`)" # SkyLull: 我想這裡的 "framed protocol" 指的是 # https://peps.python.org/pep-3154/#framing -#: ../../library/json.rst:159 +#: ../../library/json.rst:164 msgid "" "Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so " "trying to serialize multiple objects with repeated calls to :func:`dump` " @@ -303,32 +313,32 @@ msgstr "" msgid "Parameters" msgstr "參數" -#: ../../library/json.rst:163 +#: ../../library/json.rst:168 msgid "The Python object to be serialized." msgstr "要被序列化的 Python 物件。" -#: ../../library/json.rst:166 +#: ../../library/json.rst:171 msgid "" "The file-like object *obj* will be serialized to. The :mod:`!json` module " "always produces :class:`str` objects, not :class:`bytes` objects, therefore " "``fp.write()`` must support :class:`str` input." msgstr "" -#: ../../library/json.rst:173 +#: ../../library/json.rst:178 msgid "" -"If ``True``, keys that are not of a basic type " -"(:class:`str`, :class:`int`, :class:`float`, :class:`bool`, ``None``) will " -"be skipped instead of raising a :exc:`TypeError`. Default ``False``." +"If ``True``, keys that are not of a basic type (:class:`str`, :class:`int`, :" +"class:`float`, :class:`bool`, ``None``) will be skipped instead of raising " +"a :exc:`TypeError`. Default ``False``." msgstr "" -#: ../../library/json.rst:179 +#: ../../library/json.rst:184 msgid "" "If ``True`` (the default), the output is guaranteed to have all incoming non-" "ASCII characters escaped. If ``False``, these characters will be outputted " "as-is." msgstr "" -#: ../../library/json.rst:184 +#: ../../library/json.rst:189 msgid "" "If ``False``, the circular reference check for container types is skipped " "and a circular reference will result in a :exc:`RecursionError` (or worse). " @@ -338,7 +348,7 @@ msgstr "" "跳過,若有循環參照則最後將引發 :exc:`RecursionError`\\ (或其他更糟的錯誤)。" "預設為 ``True``。" -#: ../../library/json.rst:189 +#: ../../library/json.rst:194 msgid "" "If ``False``, serialization of out-of-range :class:`float` values (``nan``, " "``inf``, ``-inf``) will result in a :exc:`ValueError`, in strict compliance " @@ -350,14 +360,14 @@ msgstr "" "值),則將使用它們的 JavaScript 等效表示 (``NaN``, ``Infinity``, ``-" "Infinity``)。" -#: ../../library/json.rst:196 +#: ../../library/json.rst:201 msgid "" "If set, a custom JSON encoder with the :meth:`~JSONEncoder.default` method " "overridden, for serializing into custom datatypes. If ``None`` (the " "default), :class:`!JSONEncoder` is used." msgstr "" -#: ../../library/json.rst:203 +#: ../../library/json.rst:208 msgid "" "If a positive integer or string, JSON array elements and object members will " "be pretty-printed with that indent level. A positive integer indents that " @@ -366,7 +376,7 @@ msgid "" "inserted. If ``None`` (the default), the most compact representation is used." msgstr "" -#: ../../library/json.rst:213 +#: ../../library/json.rst:218 msgid "" "A two-tuple: ``(item_separator, key_separator)``. If ``None`` (the default), " "*separators* defaults to ``(', ', ': ')`` if *indent* is ``None``, and " @@ -377,42 +387,42 @@ msgstr "" "則 *separators* 被預設為 ``(', ', ': ')``,否則預設為 ``(',', ': ')``。想要獲" "得最緊湊的 JSON 表示形式,你可以指定 ``(',', ':')`` 來消除空格。" -#: ../../library/json.rst:222 +#: ../../library/json.rst:227 msgid "" "A function that is called for objects that can't otherwise be serialized. It " -"should return a JSON encodable version of the object or raise " -"a :exc:`TypeError`. If ``None`` (the default), :exc:`!TypeError` is raised." +"should return a JSON encodable version of the object or raise a :exc:" +"`TypeError`. If ``None`` (the default), :exc:`!TypeError` is raised." msgstr "" -#: ../../library/json.rst:229 +#: ../../library/json.rst:234 msgid "" "If ``True``, dictionaries will be outputted sorted by key. Default ``False``." msgstr "" -#: ../../library/json.rst:233 ../../library/json.rst:518 +#: ../../library/json.rst:238 ../../library/json.rst:523 msgid "Allow strings for *indent* in addition to integers." msgstr "除了整數之外,*indent* 還允許使用字串作為輸入。" -#: ../../library/json.rst:236 ../../library/json.rst:526 +#: ../../library/json.rst:241 ../../library/json.rst:531 msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." msgstr "如果 *indent* 不是 ``None``,則使用 ``(',', ': ')`` 作為預設值" -#: ../../library/json.rst:239 ../../library/json.rst:338 +#: ../../library/json.rst:244 ../../library/json.rst:343 msgid "" "All optional parameters are now :ref:`keyword-only `." msgstr "" "所有可選參數現在都是\\ :ref:`僅限關鍵字 `\\ 參數了。" -#: ../../library/json.rst:248 +#: ../../library/json.rst:253 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " -"table `. The arguments have the same meaning as " -"in :func:`dump`." +"table `. The arguments have the same meaning as in :func:" +"`dump`." msgstr "" -"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格" -"式 :class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" +"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格式 :" +"class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" -#: ../../library/json.rst:254 +#: ../../library/json.rst:259 msgid "" "Keys in key/value pairs of JSON are always of the type :class:`str`. When a " "dictionary is converted into JSON, all the keys of the dictionary are " @@ -425,7 +435,7 @@ msgstr "" "轉換回字典,則該字典可能不等於原始字典。也就是說,如果字典 x 含有非字串鍵值," "則 ``loads(dumps(x)) != x``。" -#: ../../library/json.rst:265 +#: ../../library/json.rst:270 msgid "" "Deserialize *fp* to a Python object using the :ref:`JSON-to-Python " "conversion table `." @@ -433,23 +443,23 @@ msgstr "" "使用此 :ref:`JSON-to-Python 轉換表 `\\ 將 *fp* 解碼為 " "Python 物件。" -#: ../../library/json.rst:268 +#: ../../library/json.rst:273 msgid "" "A ``.read()``-supporting :term:`text file` or :term:`binary file` containing " "the JSON document to be deserialized." msgstr "" -#: ../../library/json.rst:273 +#: ../../library/json.rst:278 msgid "" "If set, a custom JSON decoder. Additional keyword arguments to :func:`!load` " -"will be passed to the constructor of *cls*. If ``None`` (the " -"default), :class:`!JSONDecoder` is used." +"will be passed to the constructor of *cls*. If ``None`` (the default), :" +"class:`!JSONDecoder` is used." msgstr "" -#: ../../library/json.rst:280 +#: ../../library/json.rst:285 #, fuzzy msgid "" -"If set, a function that is called with the result of any object literal " +"If set, a function that is called with the result of any JSON object literal " "decoded (a :class:`dict`). The return value of this function will be used " "instead of the :class:`dict`. This feature can be used to implement custom " "decoders, for example `JSON-RPC `_ class hinting. " @@ -460,10 +470,10 @@ msgstr "" "先的 :class:`dict` 輸出。此功能可用於實作自訂解碼器(例如 `JSON-RPC `_ 類別提示)。" -#: ../../library/json.rst:290 +#: ../../library/json.rst:295 #, fuzzy msgid "" -"If set, a function that is called with the result of any object literal " +"If set, a function that is called with the result of any JSON object literal " "decoded with an ordered list of pairs. The return value of this function " "will be used instead of the :class:`dict`. This feature can be used to " "implement custom decoders. If *object_hook* is also set, *object_pairs_hook* " @@ -474,31 +484,31 @@ msgstr "" "*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作" "自訂解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" -#: ../../library/json.rst:300 +#: ../../library/json.rst:305 #, fuzzy msgid "" "If set, a function that is called with the string of every JSON float to be " "decoded. If ``None`` (the default), it is equivalent to ``float(num_str)``. " -"This can be used to parse JSON floats into custom datatypes, for " -"example :class:`decimal.Decimal`." +"This can be used to parse JSON floats into custom datatypes, for example :" +"class:`decimal.Decimal`." msgstr "" "*parse_float* 為可選函式,每個要被解碼的 JSON 浮點數字串都會改用這個參數給定" "的函式來進行解碼。預設情況這等效於 ``float(num_str)``。這個參數可用於將 JSON " "中的浮點數解碼或剖析為另一種資料型別(例如 :class:`decimal.Decimal`\\ )。" -#: ../../library/json.rst:308 +#: ../../library/json.rst:313 #, fuzzy msgid "" "If set, a function that is called with the string of every JSON int to be " "decoded. If ``None`` (the default), it is equivalent to ``int(num_str)``. " -"This can be used to parse JSON integers into custom datatypes, for " -"example :class:`float`." +"This can be used to parse JSON integers into custom datatypes, for example :" +"class:`float`." msgstr "" "*parse_int* 為可選函式,當解碼 JSON 整數字串時會被呼叫。預設情況等效於 " "``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別" "(例如 :class:`float`)。" -#: ../../library/json.rst:316 +#: ../../library/json.rst:321 #, fuzzy msgid "" "If set, a function that is called with one of the following strings: ``'-" @@ -513,32 +523,32 @@ msgstr "" msgid "Raises" msgstr "" -#: ../../library/json.rst:324 +#: ../../library/json.rst:329 #, fuzzy msgid "When the data being deserialized is not a valid JSON document." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" -"發 :exc:`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" +"`JSONDecodeError` 例外。" -#: ../../library/json.rst:327 +#: ../../library/json.rst:332 #, fuzzy msgid "" "When the data being deserialized does not contain UTF-8, UTF-16 or UTF-32 " "encoded data." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" -"發 :exc:`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" +"`JSONDecodeError` 例外。" -#: ../../library/json.rst:333 +#: ../../library/json.rst:338 msgid "Added the optional *object_pairs_hook* parameter." msgstr "新增可選的 *object_pairs_hook* 參數。" -#: ../../library/json.rst:334 +#: ../../library/json.rst:339 msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." msgstr "" "遭遇 'null'、'true' 或 'false' 時不再以 *parse_constant* 給定的函式來處理了。" -#: ../../library/json.rst:339 +#: ../../library/json.rst:344 msgid "" "*fp* can now be a :term:`binary file`. The input encoding should be UTF-8, " "UTF-16 or UTF-32." @@ -546,7 +556,7 @@ msgstr "" "現在,*fp* 可以是一個\\ :term:`二進位檔案 `,前提是其編碼格式為 " "UTF-8、UTF-16 或 UTF-32。" -#: ../../library/json.rst:342 +#: ../../library/json.rst:347 msgid "" "The default *parse_int* of :func:`int` now limits the maximum length of the " "integer string via the interpreter's :ref:`integer string conversion length " @@ -556,7 +566,7 @@ msgstr "" "由直譯器的\\ :ref:`整數字串轉換長度限制 `\\ 機制來達成," "這能防止阻斷服務攻擊 (Denial of Service attacks)。" -#: ../../library/json.rst:350 +#: ../../library/json.rst:355 #, fuzzy msgid "" "Identical to :func:`load`, but instead of a file-like object, deserialize " @@ -564,11 +574,11 @@ msgid "" "containing a JSON document) to a Python object using this :ref:`conversion " "table `." msgstr "" -"使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件" -"的 :class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去" -"序列化(deserialize)為一個 Python 物件" +"使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件的 :" +"class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去序列" +"化(deserialize)為一個 Python 物件" -#: ../../library/json.rst:355 +#: ../../library/json.rst:360 msgid "" "*s* can now be of type :class:`bytes` or :class:`bytearray`. The input " "encoding should be UTF-8, UTF-16 or UTF-32." @@ -576,95 +586,95 @@ msgstr "" "現在,*s* 可以是一個二進位檔案如 :class:`bytes` 或 :class:`bytearray`,前提是" "其編碼格式為 UTF-8、UTF-16 或 UTF-32。" -#: ../../library/json.rst:359 +#: ../../library/json.rst:364 msgid "The keyword argument *encoding* has been removed." msgstr "刪除關鍵字引數 *encoding*。" -#: ../../library/json.rst:364 +#: ../../library/json.rst:369 msgid "Encoders and Decoders" msgstr "編碼器與解碼器" -#: ../../library/json.rst:368 +#: ../../library/json.rst:373 msgid "Simple JSON decoder." msgstr "簡易 JSON 解碼器" -#: ../../library/json.rst:370 +#: ../../library/json.rst:375 msgid "Performs the following translations in decoding by default:" msgstr "預設將執行下列資料型別轉換:" -#: ../../library/json.rst:375 ../../library/json.rst:463 +#: ../../library/json.rst:380 ../../library/json.rst:468 msgid "JSON" msgstr "JSON" -#: ../../library/json.rst:375 ../../library/json.rst:463 +#: ../../library/json.rst:380 ../../library/json.rst:468 msgid "Python" msgstr "Python" -#: ../../library/json.rst:377 ../../library/json.rst:465 +#: ../../library/json.rst:382 ../../library/json.rst:470 msgid "object" msgstr "object" -#: ../../library/json.rst:377 ../../library/json.rst:465 +#: ../../library/json.rst:382 ../../library/json.rst:470 msgid "dict" msgstr "dict" -#: ../../library/json.rst:379 ../../library/json.rst:467 +#: ../../library/json.rst:384 ../../library/json.rst:472 msgid "array" msgstr "array" -#: ../../library/json.rst:379 +#: ../../library/json.rst:384 msgid "list" msgstr "list" -#: ../../library/json.rst:381 ../../library/json.rst:469 +#: ../../library/json.rst:386 ../../library/json.rst:474 msgid "string" msgstr "string" -#: ../../library/json.rst:381 ../../library/json.rst:469 +#: ../../library/json.rst:386 ../../library/json.rst:474 msgid "str" msgstr "str" -#: ../../library/json.rst:383 +#: ../../library/json.rst:388 msgid "number (int)" msgstr "number (整數)" -#: ../../library/json.rst:383 +#: ../../library/json.rst:388 msgid "int" msgstr "int" -#: ../../library/json.rst:385 +#: ../../library/json.rst:390 msgid "number (real)" msgstr "number (實數)" -#: ../../library/json.rst:385 +#: ../../library/json.rst:390 msgid "float" msgstr "float" -#: ../../library/json.rst:387 ../../library/json.rst:473 +#: ../../library/json.rst:392 ../../library/json.rst:478 msgid "true" msgstr "true" -#: ../../library/json.rst:387 ../../library/json.rst:473 +#: ../../library/json.rst:392 ../../library/json.rst:478 msgid "True" msgstr "True" -#: ../../library/json.rst:389 ../../library/json.rst:475 +#: ../../library/json.rst:394 ../../library/json.rst:480 msgid "false" msgstr "false" -#: ../../library/json.rst:389 ../../library/json.rst:475 +#: ../../library/json.rst:394 ../../library/json.rst:480 msgid "False" msgstr "False" -#: ../../library/json.rst:391 ../../library/json.rst:477 +#: ../../library/json.rst:396 ../../library/json.rst:482 msgid "null" msgstr "null" -#: ../../library/json.rst:391 ../../library/json.rst:477 +#: ../../library/json.rst:396 ../../library/json.rst:482 msgid "None" msgstr "None" -#: ../../library/json.rst:394 +#: ../../library/json.rst:399 msgid "" "It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their " "corresponding ``float`` values, which is outside the JSON spec." @@ -672,31 +682,31 @@ msgstr "" "雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,但解碼器依然" "能正確地將其轉換到相應的 Python ``float`` 值。" -#: ../../library/json.rst:397 +#: ../../library/json.rst:402 msgid "" "*object_hook* is an optional function that will be called with the result of " "every JSON object decoded and its return value will be used in place of the " -"given :class:`dict`. This can be used to provide custom deserializations " -"(e.g. to support `JSON-RPC `_ class hinting)." +"given :class:`dict`. This can be used to provide custom deserializations (e." +"g. to support `JSON-RPC `_ class hinting)." msgstr "" "*object_hook* 是一個可選函式,其接受一個解碼後的 JSON 物件作為輸入,並使用其" "回傳值來取代原先的 :class:`dict`。這個功能可用於提供自訂的去序列化(例如支援 " "`JSON-RPC `_ 類別提示)。" -#: ../../library/json.rst:402 +#: ../../library/json.rst:407 msgid "" "*object_pairs_hook* is an optional function that will be called with the " "result of every JSON object decoded with an ordered list of pairs. The " -"return value of *object_pairs_hook* will be used instead of " -"the :class:`dict`. This feature can be used to implement custom decoders. " -"If *object_hook* is also defined, the *object_pairs_hook* takes priority." +"return value of *object_pairs_hook* will be used instead of the :class:" +"`dict`. This feature can be used to implement custom decoders. If " +"*object_hook* is also defined, the *object_pairs_hook* takes priority." msgstr "" -#: ../../library/json.rst:408 +#: ../../library/json.rst:413 msgid "Added support for *object_pairs_hook*." msgstr "新增對於 *object_pairs_hook* 的支援。" -#: ../../library/json.rst:411 +#: ../../library/json.rst:416 msgid "" "*parse_float* is an optional function that will be called with the string of " "every JSON float to be decoded. By default, this is equivalent to " @@ -707,7 +717,7 @@ msgstr "" "的函式來進行解碼。預設情況這等效於 ``float(num_str)``。這個參數可用於將 JSON " "中的浮點數解碼或剖析為另一種資料型別(例如 :class:`decimal.Decimal`\\ )。" -#: ../../library/json.rst:416 +#: ../../library/json.rst:421 msgid "" "*parse_int* is an optional function that will be called with the string of " "every JSON int to be decoded. By default, this is equivalent to " @@ -718,7 +728,7 @@ msgstr "" "``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別" "(例如 :class:`float`)。" -#: ../../library/json.rst:421 +#: ../../library/json.rst:426 msgid "" "*parse_constant* is an optional function that will be called with one of the " "following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be " @@ -728,7 +738,7 @@ msgstr "" "``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函式來進行解碼。這" "也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。" -#: ../../library/json.rst:425 +#: ../../library/json.rst:430 msgid "" "If *strict* is false (``True`` is the default), then control characters will " "be allowed inside strings. Control characters in this context are those " @@ -739,33 +749,33 @@ msgstr "" "語境中的控制字元指的是 ASCII 字元編碼在 0~31 範圍內的字元,包括 ``'\\t'``" "(tab)、``'\\n'``、``'\\r'`` 和 ``'\\0'``。" -#: ../../library/json.rst:430 +#: ../../library/json.rst:435 msgid "" -"If the data being deserialized is not a valid JSON document, " -"a :exc:`JSONDecodeError` will be raised." +"If the data being deserialized is not a valid JSON document, a :exc:" +"`JSONDecodeError` will be raised." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" -"發 :exc:`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" +"`JSONDecodeError` 例外。" -#: ../../library/json.rst:433 ../../library/json.rst:534 +#: ../../library/json.rst:438 ../../library/json.rst:539 msgid "All parameters are now :ref:`keyword-only `." msgstr "" "所有參數現在都是\\ :ref:`僅限關鍵字參數 `\\ 了。" -#: ../../library/json.rst:438 +#: ../../library/json.rst:443 msgid "" "Return the Python representation of *s* (a :class:`str` instance containing " "a JSON document)." msgstr "" "回傳用 Python 型式表達的 *s* (一個含有 JSON 文件的 :class:`str` 實例)。" -#: ../../library/json.rst:441 +#: ../../library/json.rst:446 msgid "" ":exc:`JSONDecodeError` will be raised if the given JSON document is not " "valid." msgstr "若給定的輸入不符合 JSON 格式會引發 :exc:`JSONDecodeError` 例外。" -#: ../../library/json.rst:446 +#: ../../library/json.rst:451 msgid "" "Decode a JSON document from *s* (a :class:`str` beginning with a JSON " "document) and return a 2-tuple of the Python representation and the index in " @@ -774,43 +784,43 @@ msgstr "" "將 *s* (一個開頭部分含有合格 JSON 文件的 :class:`str`) 解碼,並將 JSON 文件" "結束點的索引值(index)和解碼結果合併為一個二元組(2-tuple)後回傳。" -#: ../../library/json.rst:450 +#: ../../library/json.rst:455 msgid "" "This can be used to decode a JSON document from a string that may have " "extraneous data at the end." msgstr "這個方法可以用來解碼尾段可能帶有 JSON 以外資料的文字。" -#: ../../library/json.rst:456 +#: ../../library/json.rst:461 msgid "Extensible JSON encoder for Python data structures." msgstr "可擴充的 Python 資料結構 JSON 編碼器。" -#: ../../library/json.rst:458 +#: ../../library/json.rst:463 msgid "Supports the following objects and types by default:" msgstr "預設可支援下列物件及型別:" -#: ../../library/json.rst:467 +#: ../../library/json.rst:472 msgid "list, tuple" msgstr "list, tuple" -#: ../../library/json.rst:471 +#: ../../library/json.rst:476 msgid "int, float, int- & float-derived Enums" msgstr "" "int、float 或可作為整數或浮點數運算的衍生列舉(int- or float-derived Enums)" -#: ../../library/json.rst:471 +#: ../../library/json.rst:476 msgid "number" msgstr "number" -#: ../../library/json.rst:480 +#: ../../library/json.rst:485 msgid "Added support for int- and float-derived Enum classes." msgstr "" "增加對整數(int)、浮點數(float)或可作為整數或浮點數運算的衍生列舉(int- " "or float-derived Enums)類別的支援性。" -#: ../../library/json.rst:483 +#: ../../library/json.rst:488 msgid "" -"To extend this to recognize other objects, subclass and implement " -"a :meth:`~JSONEncoder.default` method with another method that returns a " +"To extend this to recognize other objects, subclass and implement a :meth:" +"`~JSONEncoder.default` method with another method that returns a " "serializable object for ``o`` if possible, otherwise it should call the " "superclass implementation (to raise :exc:`TypeError`)." msgstr "" @@ -818,19 +828,18 @@ msgstr "" "方法。此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 " "JSONEncoder.default 方法(以引發 :exc:`TypeError` 例外)。" -#: ../../library/json.rst:488 +#: ../../library/json.rst:493 msgid "" "If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when " -"trying to encode keys that are " -"not :class:`str`, :class:`int`, :class:`float`, :class:`bool` or ``None``. " -"If *skipkeys* is true, such items are simply skipped." +"trying to encode keys that are not :class:`str`, :class:`int`, :class:" +"`float`, :class:`bool` or ``None``. If *skipkeys* is true, such items are " +"simply skipped." msgstr "" -"若 *skipkeys* 為 false(預設值),則當在編碼不" -"是 :class:`str`、:class:`int`、:class:`float`、:class:`bool` 或 ``None`` 的鍵" -"值時,將引發 :exc:`TypeError`。如果 *skipkeys* 為 true,這些項目將直接被跳" -"過。" +"若 *skipkeys* 為 false(預設值),則當在編碼不是 :class:`str`、:class:" +"`int`、:class:`float`、:class:`bool` 或 ``None`` 的鍵值時,將引發 :exc:" +"`TypeError`。如果 *skipkeys* 為 true,這些項目將直接被跳過。" -#: ../../library/json.rst:492 +#: ../../library/json.rst:497 msgid "" "If *ensure_ascii* is true (the default), the output is guaranteed to have " "all incoming non-ASCII characters escaped. If *ensure_ascii* is false, " @@ -839,7 +848,7 @@ msgstr "" "如果 *ensure_ascii* 被設為 true(預設值),則輸出時將確保所有輸入的非 ASCII " "字元都會被轉義。若 *ensure_ascii* 為 false,則這些字元將照原樣輸出。" -#: ../../library/json.rst:496 +#: ../../library/json.rst:501 msgid "" "If *check_circular* is true (the default), then lists, dicts, and custom " "encoded objects will be checked for circular references during encoding to " @@ -847,10 +856,10 @@ msgid "" "Otherwise, no such check takes place." msgstr "" "如果 *check_circular* 為 true(預設值),則會在編碼期間檢查串列(list)、字典" -"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導" -"致 :exc:`RecursionError` 例外的問題)。否則不會進行此類檢查。" +"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:" +"`RecursionError` 例外的問題)。否則不會進行此類檢查。" -#: ../../library/json.rst:501 +#: ../../library/json.rst:506 msgid "" "If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and ``-" "Infinity`` will be encoded as such. This behavior is not JSON specification " @@ -862,7 +871,7 @@ msgstr "" "數基於 JavaScript 的編碼器和解碼器一致。否則若設為 false,嘗試對這些浮點數進" "行編碼將引發 :exc:`ValueError` 例外。" -#: ../../library/json.rst:507 +#: ../../library/json.rst:512 msgid "" "If *sort_keys* is true (default: ``False``), then the output of dictionaries " "will be sorted by key; this is useful for regression tests to ensure that " @@ -872,7 +881,7 @@ msgstr "" "按鍵值排序。這項功能可確保 JSON 序列化的結果能被互相比較,能讓日常的回歸測試" "檢查變得方便一些。" -#: ../../library/json.rst:511 +#: ../../library/json.rst:516 msgid "" "If *indent* is a non-negative integer or string, then JSON array elements " "and object members will be pretty-printed with that indent level. An indent " @@ -886,7 +895,7 @@ msgstr "" "值)等於是選擇最緊湊的表示法。使用正整數縮排可以在每層縮排數量相同的空格。如" "果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個層級。" -#: ../../library/json.rst:521 +#: ../../library/json.rst:526 msgid "" "If specified, *separators* should be an ``(item_separator, key_separator)`` " "tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', " @@ -898,35 +907,35 @@ msgstr "" "')``,否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你可以改成" "指定 ``(',', ':')`` 來消除空格。" -#: ../../library/json.rst:529 +#: ../../library/json.rst:534 msgid "" "If specified, *default* should be a function that gets called for objects " "that can't otherwise be serialized. It should return a JSON encodable " -"version of the object or raise a :exc:`TypeError`. If not " -"specified, :exc:`TypeError` is raised." +"version of the object or raise a :exc:`TypeError`. If not specified, :exc:" +"`TypeError` is raised." msgstr "" "如果有指定本參數,*default* 會是一個遭遇無法序列化的物件時會被呼叫的函式。它" "應該回傳該物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會直接" "引發 :exc:`TypeError`。" -#: ../../library/json.rst:540 +#: ../../library/json.rst:545 msgid "" "Implement this method in a subclass such that it returns a serializable " -"object for *o*, or calls the base implementation (to raise " -"a :exc:`TypeError`)." +"object for *o*, or calls the base implementation (to raise a :exc:" +"`TypeError`)." msgstr "" "在任意一個子類別裡實作這個方法時須讓其回傳一個可序列化的物件 *o* ,或呼叫原始" "的實作以引發 :exc:`TypeError` 例外。" -#: ../../library/json.rst:544 +#: ../../library/json.rst:549 msgid "" -"For example, to support arbitrary iterators, you could " -"implement :meth:`~JSONEncoder.default` like this::" +"For example, to support arbitrary iterators, you could implement :meth:" +"`~JSONEncoder.default` like this::" msgstr "" -"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子" -"的 :meth:`~JSONEncoder.default`: ::" +"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子的 :meth:" +"`~JSONEncoder.default`: ::" -#: ../../library/json.rst:547 +#: ../../library/json.rst:552 msgid "" "def default(self, o):\n" " try:\n" @@ -939,13 +948,13 @@ msgid "" " return super().default(o)" msgstr "" -#: ../../library/json.rst:560 +#: ../../library/json.rst:565 msgid "" "Return a JSON string representation of a Python data structure, *o*. For " "example::" msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如: ::" -#: ../../library/json.rst:563 +#: ../../library/json.rst:568 msgid "" ">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" "'{\"foo\": [\"bar\", \"baz\"]}'" @@ -953,7 +962,7 @@ msgstr "" ">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" "'{\"foo\": [\"bar\", \"baz\"]}'" -#: ../../library/json.rst:569 +#: ../../library/json.rst:574 msgid "" "Encode the given object, *o*, and yield each string representation as " "available. For example::" @@ -961,7 +970,7 @@ msgstr "" "將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的物件。如下" "例: ::" -#: ../../library/json.rst:572 +#: ../../library/json.rst:577 msgid "" "for chunk in json.JSONEncoder().iterencode(bigobject):\n" " mysocket.write(chunk)" @@ -969,39 +978,39 @@ msgstr "" "for chunk in json.JSONEncoder().iterencode(bigobject):\n" " mysocket.write(chunk)" -#: ../../library/json.rst:577 +#: ../../library/json.rst:582 msgid "Exceptions" msgstr "例外" -#: ../../library/json.rst:581 +#: ../../library/json.rst:586 msgid "Subclass of :exc:`ValueError` with the following additional attributes:" msgstr ":exc:`ValueError` 的子類別具有下列額外屬性:" -#: ../../library/json.rst:585 +#: ../../library/json.rst:590 msgid "The unformatted error message." msgstr "未受格式化的錯誤訊息。" -#: ../../library/json.rst:589 +#: ../../library/json.rst:594 msgid "The JSON document being parsed." msgstr "正在被剖析的 JSON 文件。" -#: ../../library/json.rst:593 +#: ../../library/json.rst:598 msgid "The start index of *doc* where parsing failed." msgstr "*doc* 剖析失敗處的起始點的索引值。" -#: ../../library/json.rst:597 +#: ../../library/json.rst:602 msgid "The line corresponding to *pos*." msgstr "*pos* 所在的列(line)數。" -#: ../../library/json.rst:601 +#: ../../library/json.rst:606 msgid "The column corresponding to *pos*." msgstr "*pos* 所在的行(column)數。" -#: ../../library/json.rst:607 +#: ../../library/json.rst:612 msgid "Standard Compliance and Interoperability" msgstr "合規性與互通性(Interoperability)" -#: ../../library/json.rst:609 +#: ../../library/json.rst:614 msgid "" "The JSON format is specified by :rfc:`7159` and by `ECMA-404 `_. This " @@ -1014,7 +1023,7 @@ msgstr "" "組對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` " "子類別以及未明確提及的參數將不予討論。" -#: ../../library/json.rst:615 +#: ../../library/json.rst:620 msgid "" "This module does not comply with the RFC in a strict fashion, implementing " "some extensions that are valid JavaScript but not valid JSON. In particular:" @@ -1022,17 +1031,17 @@ msgstr "" "這個模組的部份實作並未非常嚴格地遵循 RFC 規範。準確來說,下列實際實作符合 " "JavaScript 語法格式,但並不符合 JSON 格式:" -#: ../../library/json.rst:618 +#: ../../library/json.rst:623 msgid "Infinite and NaN number values are accepted and output;" msgstr "無限(Infinite)和非數字(NaN)值會被接受。" -#: ../../library/json.rst:619 +#: ../../library/json.rst:624 msgid "" "Repeated names within an object are accepted, and only the value of the last " "name-value pair is used." msgstr "同一個物件內可以有重複的名稱,但只有最後一個同名物件是有效的。" -#: ../../library/json.rst:622 +#: ../../library/json.rst:627 msgid "" "Since the RFC permits RFC-compliant parsers to accept input texts that are " "not RFC-compliant, this module's deserializer is technically RFC-compliant " @@ -1041,11 +1050,11 @@ msgstr "" "不過 RFC 准許遵循 RFC 的剖析器接受不合規的文字輸入,所以技術上來說若以預設設" "定運作,本模組的去序列化器(deserializer)是符合 RFC 規範的。" -#: ../../library/json.rst:627 +#: ../../library/json.rst:632 msgid "Character Encodings" msgstr "字元編碼格式" -#: ../../library/json.rst:629 +#: ../../library/json.rst:634 msgid "" "The RFC requires that JSON be represented using either UTF-8, UTF-16, or " "UTF-32, with UTF-8 being the recommended default for maximum " @@ -1054,7 +1063,7 @@ msgstr "" "RFC 要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編碼以" "達成最佳的互通性。" -#: ../../library/json.rst:632 +#: ../../library/json.rst:637 msgid "" "As permitted, though not required, by the RFC, this module's serializer sets " "*ensure_ascii=True* by default, thus escaping the output so that the " @@ -1063,18 +1072,17 @@ msgstr "" "RFC 准許但並不強制編碼器的 *ensure_ascii=True* 行為是預設值,但本模組依然實作" "了此一選項作為預設,因此本模組預設會轉義所有非 ASCII 字元。" -#: ../../library/json.rst:636 +#: ../../library/json.rst:641 msgid "" "Other than the *ensure_ascii* parameter, this module is defined strictly in " "terms of conversion between Python objects and :class:`Unicode strings " "`, and thus does not otherwise directly address the issue of character " "encodings." msgstr "" -"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件" -"與 :class:`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的" -"問題。" +"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件與 :class:" +"`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的問題。" -#: ../../library/json.rst:641 +#: ../../library/json.rst:646 msgid "" "The RFC prohibits adding a byte order mark (BOM) to the start of a JSON " "text, and this module's serializer does not add a BOM to its output. The RFC " @@ -1087,24 +1095,24 @@ msgstr "" "(deserializer)忽略文件初始的端序記號,因此本模組的去序列化器將在遭遇位於文" "件開頭的端序記號時引發 :exc:`ValueError` 例外。" -#: ../../library/json.rst:647 +#: ../../library/json.rst:652 msgid "" "The RFC does not explicitly forbid JSON strings which contain byte sequences " "that don't correspond to valid Unicode characters (e.g. unpaired UTF-16 " "surrogates), but it does note that they may cause interoperability problems. " -"By default, this module accepts and outputs (when present in the " -"original :class:`str`) code points for such sequences." +"By default, this module accepts and outputs (when present in the original :" +"class:`str`) code points for such sequences." msgstr "" "RFC 並未明確禁止 JSON 文件包含無法對應有效 Unicode 字元的位元組序列(例如未配" "對的 UTF-16 代理對(surrogate pairs)),但這個特性的確可能會引起相容性問題。" "預設情況下,當原始輸入的 :class:`str` 中存在此類序列時,該模組將接受並輸出這" "些序列的編碼位置(code points)。" -#: ../../library/json.rst:655 +#: ../../library/json.rst:660 msgid "Infinite and NaN Number Values" msgstr "正負無限與非數值" -#: ../../library/json.rst:657 +#: ../../library/json.rst:662 msgid "" "The RFC does not permit the representation of infinite or NaN number values. " "Despite that, by default, this module accepts and outputs ``Infinity``, ``-" @@ -1113,7 +1121,7 @@ msgstr "" "RFC 不允許表現無限大或非數值(NaN)。但預設情況下,這個模組仍接受並輸出 " "``Infinity``、``-Infinity`` 和 ``NaN``,如同它們是有效的 JSON 數值字面值: ::" -#: ../../library/json.rst:661 +#: ../../library/json.rst:666 msgid "" ">>> # Neither of these calls raises an exception, but the results are not " "valid JSON\n" @@ -1128,7 +1136,7 @@ msgid "" "nan" msgstr "" -#: ../../library/json.rst:672 +#: ../../library/json.rst:677 msgid "" "In the serializer, the *allow_nan* parameter can be used to alter this " "behavior. In the deserializer, the *parse_constant* parameter can be used " @@ -1137,11 +1145,11 @@ msgstr "" "在序列化器中,*allow_nan* 參數可以改變這個行為。在去序列化器中," "*parse_constant* 參數可以改變這個行為。" -#: ../../library/json.rst:678 +#: ../../library/json.rst:683 msgid "Repeated Names Within an Object" msgstr "物件內重複的名稱" -#: ../../library/json.rst:680 +#: ../../library/json.rst:685 msgid "" "The RFC specifies that the names within a JSON object should be unique, but " "does not mandate how repeated names in JSON objects should be handled. By " @@ -1152,22 +1160,22 @@ msgstr "" "字。預設情況下,本模組不會因此引發例外;相反的,它會忽略該名字的所有重複鍵值" "對,並只保留最後一個: ::" -#: ../../library/json.rst:685 +#: ../../library/json.rst:690 msgid "" ">>> weird_json = '{\"x\": 1, \"x\": 2, \"x\": 3}'\n" ">>> json.loads(weird_json)\n" "{'x': 3}" msgstr "" -#: ../../library/json.rst:689 +#: ../../library/json.rst:694 msgid "The *object_pairs_hook* parameter can be used to alter this behavior." msgstr "*object_parts_hook* 參數可以改變這個行為。" -#: ../../library/json.rst:693 +#: ../../library/json.rst:698 msgid "Top-level Non-Object, Non-Array Values" msgstr "位於頂層的非物件及非列表值" -#: ../../library/json.rst:695 +#: ../../library/json.rst:700 msgid "" "The old version of JSON specified by the obsolete :rfc:`4627` required that " "the top-level value of a JSON text must be either a JSON object or array " @@ -1181,37 +1189,37 @@ msgstr "" "boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而本模組的序列化器或去串" "列化器中未曾實施過該限制。" -#: ../../library/json.rst:702 +#: ../../library/json.rst:707 msgid "" "Regardless, for maximum interoperability, you may wish to voluntarily adhere " "to the restriction yourself." msgstr "如果想要最大限度地保留互通性,你可能還是會想要自行施加這個限制。" -#: ../../library/json.rst:707 +#: ../../library/json.rst:712 msgid "Implementation Limitations" msgstr "實作限制" -#: ../../library/json.rst:709 +#: ../../library/json.rst:714 msgid "Some JSON deserializer implementations may set limits on:" msgstr "某些 JSON 去序列化器的實作可能會造成下列限制:" -#: ../../library/json.rst:711 +#: ../../library/json.rst:716 msgid "the size of accepted JSON texts" msgstr "JSON 文件長度上限" -#: ../../library/json.rst:712 +#: ../../library/json.rst:717 msgid "the maximum level of nesting of JSON objects and arrays" msgstr "JSON 物件或陣列的最大巢狀層數(level of nesting)限制" -#: ../../library/json.rst:713 +#: ../../library/json.rst:718 msgid "the range and precision of JSON numbers" msgstr "數字的精準度或範圍" -#: ../../library/json.rst:714 +#: ../../library/json.rst:719 msgid "the content and maximum length of JSON strings" msgstr "JSON 字串長度上限" -#: ../../library/json.rst:716 +#: ../../library/json.rst:721 msgid "" "This module does not impose any such limits beyond those of the relevant " "Python datatypes themselves or the Python interpreter itself." @@ -1219,7 +1227,7 @@ msgstr "" "本模組除了 Python 資料型態本身或 Python 直譯器本身的限制以外,不會設定任何此" "類限制。" -#: ../../library/json.rst:719 +#: ../../library/json.rst:724 msgid "" "When serializing to JSON, beware any such limitations in applications that " "may consume your JSON. In particular, it is common for JSON numbers to be " @@ -1234,31 +1242,30 @@ msgstr "" "因而受到其表示範圍和精度限制的影響。這在序列化極大的 Python :class:`int` 數" "值、或是序列化特殊數字型別的實例時(例如 :class:`decimal.Decimal`)尤其重要。" -#: ../../library/json.rst:732 +#: ../../library/json.rst:737 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/json.rst:737 +#: ../../library/json.rst:742 msgid "**Source code:** :source:`Lib/json/tool.py`" msgstr "**原始碼:**\\ :source:`Lib/json/tool.py`" -#: ../../library/json.rst:741 +#: ../../library/json.rst:746 msgid "" "The :mod:`json.tool` module provides a simple command line interface to " "validate and pretty-print JSON objects." msgstr "" ":mod:`json.tool` 模組提供了一個簡易的命令列介面以供校驗與美化呈現 JSON 物件。" -#: ../../library/json.rst:744 +#: ../../library/json.rst:749 msgid "" -"If the optional ``infile`` and ``outfile`` arguments are not " -"specified, :data:`sys.stdin` and :data:`sys.stdout` will be used " -"respectively:" +"If the optional ``infile`` and ``outfile`` arguments are not specified, :" +"data:`sys.stdin` and :data:`sys.stdout` will be used respectively:" msgstr "" -"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` " -"和 :data:`sys.stdout` 將各自做為輸入和輸出的預設值。" +"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :" +"data:`sys.stdout` 將各自做為輸入和輸出的預設值。" -#: ../../library/json.rst:747 +#: ../../library/json.rst:752 msgid "" "$ echo '{\"json\": \"obj\"}' | python -m json.tool\n" "{\n" @@ -1268,7 +1275,7 @@ msgid "" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" msgstr "" -#: ../../library/json.rst:756 +#: ../../library/json.rst:761 msgid "" "The output is now in the same order as the input. Use the :option:`--sort-" "keys` option to sort the output of dictionaries alphabetically by key." @@ -1276,15 +1283,15 @@ msgstr "" "現在開始輸出和輸入的資料順序會是相同的。傳入 :option:`--sort-keys` 引數以按照" "鍵值的字母順序對輸出進行排序。" -#: ../../library/json.rst:763 +#: ../../library/json.rst:768 msgid "Command line options" msgstr "命令列選項" -#: ../../library/json.rst:767 +#: ../../library/json.rst:772 msgid "The JSON file to be validated or pretty-printed:" msgstr "將被用於校驗或美化呈現的 JSON 文件:" -#: ../../library/json.rst:769 +#: ../../library/json.rst:774 msgid "" "$ python -m json.tool mp_films.json\n" "[\n" @@ -1310,45 +1317,45 @@ msgstr "" " }\n" "]" -#: ../../library/json.rst:783 +#: ../../library/json.rst:788 msgid "If *infile* is not specified, read from :data:`sys.stdin`." msgstr "如果沒有指定 *infile* 則會從 :data:`sys.stdin` 讀取輸入。" -#: ../../library/json.rst:787 +#: ../../library/json.rst:792 msgid "" "Write the output of the *infile* to the given *outfile*. Otherwise, write it " "to :data:`sys.stdout`." msgstr "" -"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入" -"到 :data:`sys.stdout`。" +"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到 :data:`sys." +"stdout`。" -#: ../../library/json.rst:792 +#: ../../library/json.rst:797 msgid "Sort the output of dictionaries alphabetically by key." msgstr "按照鍵值的字母順序對輸出字典進行排序。" -#: ../../library/json.rst:798 +#: ../../library/json.rst:803 msgid "" "Disable escaping of non-ascii characters, see :func:`json.dumps` for more " "information." msgstr "關閉非 ASCII 字元的自動轉義功能。詳情請參照 :func:`json.dumps`。" -#: ../../library/json.rst:804 +#: ../../library/json.rst:809 msgid "Parse every input line as separate JSON object." msgstr "將每一行輸入都單獨輸出為一個 JSON 物件。" -#: ../../library/json.rst:810 +#: ../../library/json.rst:815 msgid "Mutually exclusive options for whitespace control." msgstr "互斥的空白字元控制選項。" -#: ../../library/json.rst:816 +#: ../../library/json.rst:821 msgid "Show the help message." msgstr "顯示說明訊息。" -#: ../../library/json.rst:820 +#: ../../library/json.rst:825 msgid "Footnotes" msgstr "註解" -#: ../../library/json.rst:821 +#: ../../library/json.rst:826 msgid "" "As noted in `the errata for RFC 7159 `_, JSON permits literal U+2028 (LINE SEPARATOR) " diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index 6d5b5bfe33..cc79ef1e8e 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-18 00:18+0000\n" +"POT-Creation-Date: 2025-05-19 00:16+0000\n" "PO-Revision-Date: 2022-07-24 14:52+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2039,7 +2039,7 @@ msgid "" ">>> print(my_function.__doc__)\n" "Do nothing, but document it.\n" "\n" -" No, really, it doesn't do anything." +"No, really, it doesn't do anything." msgstr "" #: ../../tutorial/controlflow.rst:1064 From 99756054530184d0c31b35f347d6eb7c65f0d90a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 20 May 2025 00:17:30 +0000 Subject: [PATCH 09/14] sync with cpython edbde92a --- c-api/init.po | 1101 ++++++++++++++++++++++----------------------- library/base64.po | 206 +++++---- library/re.po | 371 +++++++-------- 3 files changed, 870 insertions(+), 808 deletions(-) diff --git a/c-api/init.po b/c-api/init.po index 0ce89e728e..1d9bd62d47 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-12 00:13+0000\n" +"POT-Creation-Date: 2025-05-20 00:16+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -205,8 +205,10 @@ msgstr ":c:func:`PyMutex_Unlock`" msgid "" "Despite their apparent similarity to some of the functions listed above, the " "following functions **should not be called** before the interpreter has been " -"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, " -"and :c:func:`Py_RunMain`." +"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:" +"`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:" +"`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:" +"`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, and :c:func:`Py_RunMain`." msgstr "" #: ../../c-api/init.rst:90 @@ -216,30 +218,30 @@ msgstr "" #: ../../c-api/init.rst:92 msgid "" "Python has variables for the global configuration to control different " -"features and options. By default, these flags are controlled " -"by :ref:`command line options `." +"features and options. By default, these flags are controlled by :ref:" +"`command line options `." msgstr "" #: ../../c-api/init.rst:96 msgid "" "When a flag is set by an option, the value of the flag is the number of " -"times that the option was set. For example, ``-b`` " -"sets :c:data:`Py_BytesWarningFlag` to 1 and ``-bb`` " -"sets :c:data:`Py_BytesWarningFlag` to 2." +"times that the option was set. For example, ``-b`` sets :c:data:" +"`Py_BytesWarningFlag` to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to " +"2." msgstr "" #: ../../c-api/init.rst:102 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.bytes_warning` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"bytes_warning` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:106 msgid "" -"Issue a warning when comparing :class:`bytes` or :class:`bytearray` " -"with :class:`str` or :class:`bytes` with :class:`int`. Issue an error if " -"greater or equal to ``2``." +"Issue a warning when comparing :class:`bytes` or :class:`bytearray` with :" +"class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater " +"or equal to ``2``." msgstr "" #: ../../c-api/init.rst:110 @@ -248,9 +250,9 @@ msgstr "由 :option:`-b` 選項設定。" #: ../../c-api/init.rst:116 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.parser_debug` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"parser_debug` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:120 @@ -267,9 +269,9 @@ msgstr "由 :option:`-d` 選項與 :envvar:`PYTHONDEBUG` 環境變數設定。" #: ../../c-api/init.rst:130 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.write_bytecode` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"write_bytecode` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:134 @@ -287,15 +289,15 @@ msgstr "" #: ../../c-api/init.rst:144 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.pathconfig_warnings` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"pathconfig_warnings` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:148 msgid "" -"Suppress error messages when calculating the module search path " -"in :c:func:`Py_GetPath`." +"Suppress error messages when calculating the module search path in :c:func:" +"`Py_GetPath`." msgstr "" #: ../../c-api/init.rst:151 @@ -304,9 +306,8 @@ msgstr "" #: ../../c-api/init.rst:157 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.hash_seed` " -"and :c:member:`PyConfig.use_hash_seed` should be used instead, " +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"hash_seed` and :c:member:`PyConfig.use_hash_seed` should be used instead, " "see :ref:`Python Initialization Configuration `." msgstr "" @@ -325,15 +326,15 @@ msgstr "" #: ../../c-api/init.rst:172 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.use_environment` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"use_environment` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:176 msgid "" -"Ignore all :envvar:`!PYTHON*` environment variables, " -"e.g. :envvar:`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." +"Ignore all :envvar:`!PYTHON*` environment variables, e.g. :envvar:" +"`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." msgstr "" "忽略所有可能被設定的 :envvar:`!PYTHON*` 環境變數,例如 :envvar:`PYTHONPATH` " "與 :envvar:`PYTHONHOME`。" @@ -344,9 +345,9 @@ msgstr "由 :option:`-E` 與 :option:`-I` 選項設定。" #: ../../c-api/init.rst:185 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.inspect` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"inspect` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:189 @@ -364,9 +365,9 @@ msgstr "由 :option:`-i` 選項與 :envvar:`PYTHONINSPECT` 環境變數設定。 #: ../../c-api/init.rst:200 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.interactive` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"interactive` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:204 @@ -375,9 +376,9 @@ msgstr "由 :option:`-i` 選項設定。" #: ../../c-api/init.rst:210 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.isolated` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"isolated` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:214 @@ -392,9 +393,9 @@ msgstr "由 :option:`-i` 選項設定。" #: ../../c-api/init.rst:225 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyPreConfig.legacy_windows_fs_encoding` should be used " -"instead, see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:229 @@ -422,15 +423,15 @@ msgstr "" #: ../../c-api/init.rst:244 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.legacy_windows_stdio` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"legacy_windows_stdio` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:248 msgid "" -"If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!" -"io._WindowsConsoleIO` for :mod:`sys` standard streams." +"If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!io." +"_WindowsConsoleIO` for :mod:`sys` standard streams." msgstr "" #: ../../c-api/init.rst:251 @@ -445,17 +446,17 @@ msgstr "更多詳情請見 :pep:`528`。" #: ../../c-api/init.rst:262 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.site_import` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"site_import` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:266 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " -"manipulations if :mod:`site` is explicitly imported later " -"(call :func:`site.main` if you want them to be triggered)." +"manipulations if :mod:`site` is explicitly imported later (call :func:`site." +"main` if you want them to be triggered)." msgstr "" #: ../../c-api/init.rst:271 @@ -464,30 +465,30 @@ msgstr "由 :option:`-S` 選項設定。" #: ../../c-api/init.rst:277 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.user_site_directory` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"user_site_directory` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:281 msgid "" -"Don't add the :data:`user site-packages directory ` " -"to :data:`sys.path`." +"Don't add the :data:`user site-packages directory ` to :data:" +"`sys.path`." msgstr "" #: ../../c-api/init.rst:284 msgid "" -"Set by the :option:`-s` and :option:`-I` options, and " -"the :envvar:`PYTHONNOUSERSITE` environment variable." +"Set by the :option:`-s` and :option:`-I` options, and the :envvar:" +"`PYTHONNOUSERSITE` environment variable." msgstr "" "由 :option:`-s` 選項、:option:`-I` 選項與 :envvar:`PYTHONNOUSERSITE` 環境變數" "設定。" #: ../../c-api/init.rst:291 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.optimization_level` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"optimization_level` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:295 @@ -498,9 +499,9 @@ msgstr "由 :option:`-O` 選項與 :envvar:`PYTHONOPTIMIZE` 環境變數設定 #: ../../c-api/init.rst:302 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.quiet` should be used instead, see :ref:`Python " -"Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"quiet` should be used instead, see :ref:`Python Initialization Configuration " +"`." msgstr "" #: ../../c-api/init.rst:306 @@ -514,9 +515,9 @@ msgstr "由 :option:`-q` 選項設定。" #: ../../c-api/init.rst:316 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.buffered_stdio` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"buffered_stdio` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:320 @@ -531,9 +532,9 @@ msgstr "由 :option:`-u` 選項與 :envvar:`PYTHONUNBUFFERED` 環境變數設定 #: ../../c-api/init.rst:329 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.verbose` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"verbose` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:333 @@ -557,9 +558,8 @@ msgstr "" #: ../../c-api/init.rst:360 msgid "" "Initialize the Python interpreter. In an application embedding Python, " -"this should be called before using any other Python/C API functions; " -"see :ref:`Before Python Initialization ` for the few " -"exceptions." +"this should be called before using any other Python/C API functions; see :" +"ref:`Before Python Initialization ` for the few exceptions." msgstr "" #: ../../c-api/init.rst:364 @@ -622,20 +622,19 @@ msgstr "" #: ../../c-api/init.rst:417 msgid "" "Undo all initializations made by :c:func:`Py_Initialize` and subsequent use " -"of Python/C API functions, and destroy all sub-interpreters " -"(see :c:func:`Py_NewInterpreter` below) that were created and not yet " -"destroyed since the last call to :c:func:`Py_Initialize`. Ideally, this " -"frees all memory allocated by the Python interpreter. This is a no-op when " -"called for a second time (without calling :c:func:`Py_Initialize` again " -"first)." +"of Python/C API functions, and destroy all sub-interpreters (see :c:func:" +"`Py_NewInterpreter` below) that were created and not yet destroyed since the " +"last call to :c:func:`Py_Initialize`. Ideally, this frees all memory " +"allocated by the Python interpreter. This is a no-op when called for a " +"second time (without calling :c:func:`Py_Initialize` again first)." msgstr "" #: ../../c-api/init.rst:424 msgid "" "Since this is the reverse of :c:func:`Py_Initialize`, it should be called in " "the same thread with the same interpreter active. That means the main " -"thread and the main interpreter. This should never be called " -"while :c:func:`Py_RunMain` is running." +"thread and the main interpreter. This should never be called while :c:func:" +"`Py_RunMain` is running." msgstr "" #: ../../c-api/init.rst:429 @@ -672,11 +671,11 @@ msgstr "" #: ../../c-api/init.rst:452 msgid "" -"Raises an :ref:`auditing event ` " -"``cpython._PySys_ClearAuditHooks`` with no arguments." +"Raises an :ref:`auditing event ` ``cpython." +"_PySys_ClearAuditHooks`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` " -"``cpython._PySys_ClearAuditHooks``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." +"_PySys_ClearAuditHooks``。" #: ../../c-api/init.rst:459 msgid "" @@ -736,9 +735,9 @@ msgstr "" #: ../../c-api/init.rst:503 msgid "" -"In terms of the CPython runtime configuration APIs documented in " -"the :ref:`runtime configuration ` section (and without " -"accounting for error handling), ``Py_Main`` is approximately equivalent to::" +"In terms of the CPython runtime configuration APIs documented in the :ref:" +"`runtime configuration ` section (and without accounting for " +"error handling), ``Py_Main`` is approximately equivalent to::" msgstr "" #: ../../c-api/init.rst:507 @@ -755,14 +754,14 @@ msgstr "" #: ../../c-api/init.rst:515 msgid "" "In normal usage, an embedding application will call this function *instead* " -"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` " -"or :c:func:`Py_InitializeFromConfig` directly, and all settings will be " -"applied as described elsewhere in this documentation. If this function is " -"instead called *after* a preceding runtime initialization API call, then " -"exactly which environmental and command line configuration settings will be " -"updated is version dependent (as it depends on which settings correctly " -"support being modified after they have already been set once when the " -"runtime was first initialized)." +"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` or :c:func:" +"`Py_InitializeFromConfig` directly, and all settings will be applied as " +"described elsewhere in this documentation. If this function is instead " +"called *after* a preceding runtime initialization API call, then exactly " +"which environmental and command line configuration settings will be updated " +"is version dependent (as it depends on which settings correctly support " +"being modified after they have already been set once when the runtime was " +"first initialized)." msgstr "" #: ../../c-api/init.rst:528 @@ -771,11 +770,11 @@ msgstr "" #: ../../c-api/init.rst:530 msgid "" -"Executes the command (:c:member:`PyConfig.run_command`), the script " -"(:c:member:`PyConfig.run_filename`) or the module " -"(:c:member:`PyConfig.run_module`) specified on the command line or in the " -"configuration. If none of these values are set, runs the interactive Python " -"prompt (REPL) using the ``__main__`` module's global namespace." +"Executes the command (:c:member:`PyConfig.run_command`), the script (:c:" +"member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." +"run_module`) specified on the command line or in the configuration. If none " +"of these values are set, runs the interactive Python prompt (REPL) using the " +"``__main__`` module's global namespace." msgstr "" #: ../../c-api/init.rst:536 @@ -803,15 +802,15 @@ msgstr "" #: ../../c-api/init.rst:552 msgid "" "This function always finalizes the Python interpreter regardless of whether " -"it returns a value or immediately exits the process due to an " -"unhandled :exc:`SystemExit` exception." +"it returns a value or immediately exits the process due to an unhandled :exc:" +"`SystemExit` exception." msgstr "" #: ../../c-api/init.rst:556 msgid "" "See :ref:`Python Configuration ` for an example of a " -"customized Python that always runs in isolated mode " -"using :c:func:`Py_RunMain`." +"customized Python that always runs in isolated mode using :c:func:" +"`Py_RunMain`." msgstr "" #: ../../c-api/init.rst:562 @@ -831,9 +830,9 @@ msgstr "" #: ../../c-api/init.rst:581 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.program_name` should be used instead, " -"see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"program_name` should be used instead, see :ref:`Python Initialization " +"Configuration `." msgstr "" #: ../../c-api/init.rst:585 @@ -853,8 +852,8 @@ msgstr "" #: ../../c-api/init.rst:596 ../../c-api/init.rst:838 ../../c-api/init.rst:874 #: ../../c-api/init.rst:900 msgid "" -"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get " -"a :c:expr:`wchar_t*` string." +"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" +"`wchar_t*` string." msgstr "" #: ../../c-api/init.rst:604 @@ -907,11 +906,11 @@ msgid "" "with :c:member:`PyConfig.program_name` and some environment variables; for " "example, if the program name is ``'/usr/local/bin/python'``, the exec-prefix " "is ``'/usr/local'``. The returned string points into static storage; the " -"caller should not modify its value. This corresponds to " -"the :makevar:`exec_prefix` variable in the top-level :file:`Makefile` and " -"the ``--exec-prefix`` argument to the :program:`configure` script at build " -"time. The value is available to Python code as ``sys.base_exec_prefix``. " -"It is only useful on Unix." +"caller should not modify its value. This corresponds to the :makevar:" +"`exec_prefix` variable in the top-level :file:`Makefile` and the ``--exec-" +"prefix`` argument to the :program:`configure` script at build time. The " +"value is available to Python code as ``sys.base_exec_prefix``. It is only " +"useful on Unix." msgstr "" #: ../../c-api/init.rst:654 @@ -939,16 +938,16 @@ msgstr "" #: ../../c-api/init.rst:671 msgid "" -"System administrators will know how to configure the :program:`mount` " -"or :program:`automount` programs to share :file:`/usr/local` between " -"platforms while having :file:`/usr/local/plat` be a different filesystem for " -"each platform." +"System administrators will know how to configure the :program:`mount` or :" +"program:`automount` programs to share :file:`/usr/local` between platforms " +"while having :file:`/usr/local/plat` be a different filesystem for each " +"platform." msgstr "" #: ../../c-api/init.rst:682 msgid "" -"Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` " -"if :ref:`virtual environments ` need to be handled." +"Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if :ref:" +"`virtual environments ` need to be handled." msgstr "" #: ../../c-api/init.rst:692 @@ -992,8 +991,8 @@ msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " "period. The returned string points into static storage; the caller should " -"not modify its value. The value is available to Python code " -"as :data:`sys.version`." +"not modify its value. The value is available to Python code as :data:`sys." +"version`." msgstr "" #: ../../c-api/init.rst:750 @@ -1056,10 +1055,10 @@ msgstr "\"#67, Aug 1 1997, 22:34:28\"" #: ../../c-api/init.rst:813 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.argv`, :c:member:`PyConfig.parse_argv` " -"and :c:member:`PyConfig.safe_path` should be used instead, see :ref:`Python " -"Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " +"should be used instead, see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:818 @@ -1083,8 +1082,8 @@ msgstr "" #: ../../c-api/init.rst:830 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " -"path of the directory where the script is located is prepended " -"to :data:`sys.path`." +"path of the directory where the script is located is prepended to :data:`sys." +"path`." msgstr "" #: ../../c-api/init.rst:833 @@ -1110,8 +1109,8 @@ msgstr "" #: ../../c-api/init.rst:850 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " -"popping the first :data:`sys.path` element after having " -"called :c:func:`PySys_SetArgv`, for example using::" +"popping the first :data:`sys.path` element after having called :c:func:" +"`PySys_SetArgv`, for example using::" msgstr "" #: ../../c-api/init.rst:854 @@ -1120,17 +1119,16 @@ msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" #: ../../c-api/init.rst:866 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` should " -"be used instead, see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" +"`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:870 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " -"``1`` unless the :program:`python` interpreter was started with " -"the :option:`-I`." +"``1`` unless the :program:`python` interpreter was started with the :option:" +"`-I`." msgstr "" #: ../../c-api/init.rst:880 @@ -1139,9 +1137,9 @@ msgstr "" #: ../../c-api/init.rst:887 msgid "" -"This API is kept for backward compatibility: " -"setting :c:member:`PyConfig.home` should be used instead, see :ref:`Python " -"Initialization Configuration `." +"This API is kept for backward compatibility: setting :c:member:`PyConfig." +"home` should be used instead, see :ref:`Python Initialization Configuration " +"`." msgstr "" #: ../../c-api/init.rst:891 @@ -1161,9 +1159,9 @@ msgstr "" #: ../../c-api/init.rst:908 msgid "" -"Return the default \"home\", that is, the value set " -"by :c:member:`PyConfig.home`, or the value of the :envvar:`PYTHONHOME` " -"environment variable if it is set." +"Return the default \"home\", that is, the value set by :c:member:`PyConfig." +"home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " +"is set." msgstr "" #: ../../c-api/init.rst:918 @@ -1190,13 +1188,12 @@ msgstr "" #: ../../c-api/init.rst:943 msgid "" -"Therefore, the rule exists that only the thread that has acquired " -"the :term:`GIL` may operate on Python objects or call Python/C API " -"functions. In order to emulate concurrency of execution, the interpreter " -"regularly tries to switch threads (see :func:`sys.setswitchinterval`). The " -"lock is also released around potentially blocking I/O operations like " -"reading or writing a file, so that other Python threads can run in the " -"meantime." +"Therefore, the rule exists that only the thread that has acquired the :term:" +"`GIL` may operate on Python objects or call Python/C API functions. In order " +"to emulate concurrency of execution, the interpreter regularly tries to " +"switch threads (see :func:`sys.setswitchinterval`). The lock is also " +"released around potentially blocking I/O operations like reading or writing " +"a file, so that other Python threads can run in the meantime." msgstr "" #: ../../c-api/init.rst:953 @@ -1284,10 +1281,10 @@ msgstr "" #: ../../c-api/init.rst:1018 msgid "" -"When threads are created using the dedicated Python APIs (such as " -"the :mod:`threading` module), a thread state is automatically associated to " -"them and the code showed above is therefore correct. However, when threads " -"are created from C (for example by a third-party library with its own thread " +"When threads are created using the dedicated Python APIs (such as the :mod:" +"`threading` module), a thread state is automatically associated to them and " +"the code showed above is therefore correct. However, when threads are " +"created from C (for example by a third-party library with its own thread " "management), they don't hold the GIL, nor is there a thread state structure " "for them." msgstr "" @@ -1327,9 +1324,9 @@ msgstr "" msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " -"supports the creation of additional interpreters " -"(using :c:func:`Py_NewInterpreter`), but mixing multiple interpreters and " -"the ``PyGILState_*`` API is unsupported." +"supports the creation of additional interpreters (using :c:func:" +"`Py_NewInterpreter`), but mixing multiple interpreters and the " +"``PyGILState_*`` API is unsupported." msgstr "" #: ../../c-api/init.rst:1057 @@ -1355,11 +1352,11 @@ msgid "" "of additional (non-Python) locks that need to be acquired before or reset " "after a fork. OS facilities such as :c:func:`!pthread_atfork` would need to " "be used to accomplish the same thing. Additionally, when extending or " -"embedding Python, calling :c:func:`fork` directly rather than " -"through :func:`os.fork` (and returning to or calling into Python) may result " -"in a deadlock by one of Python's internal locks being held by a thread that " -"is defunct after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the " -"necessary locks, but is not always able to." +"embedding Python, calling :c:func:`fork` directly rather than through :func:" +"`os.fork` (and returning to or calling into Python) may result in a deadlock " +"by one of Python's internal locks being held by a thread that is defunct " +"after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the necessary " +"locks, but is not always able to." msgstr "" #: ../../c-api/init.rst:1080 @@ -1451,8 +1448,8 @@ msgid "" "ensues." msgstr "" -#: ../../c-api/init.rst:1164 ../../c-api/init.rst:1223 -#: ../../c-api/init.rst:1519 +#: ../../c-api/init.rst:1164 ../../c-api/init.rst:1224 +#: ../../c-api/init.rst:1520 msgid "" "Calling this function from a thread when the runtime is finalizing will " "terminate the thread, even if the thread was not created by Python. You can " @@ -1488,60 +1485,65 @@ msgstr "" #: ../../c-api/init.rst:1192 msgid "" "Swap the current thread state with the thread state given by the argument " -"*tstate*, which may be ``NULL``. The global interpreter lock must be held " -"and is not released." +"*tstate*, which may be ``NULL``." msgstr "" -#: ../../c-api/init.rst:1197 +#: ../../c-api/init.rst:1195 +msgid "" +"The :term:`GIL` does not need to be held, but will be held upon returning if " +"*tstate* is non-``NULL``." +msgstr "" + +#: ../../c-api/init.rst:1198 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:1202 +#: ../../c-api/init.rst:1203 msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the global interpreter lock. This may " "be called as many times as desired by a thread as long as each call is " "matched with a call to :c:func:`PyGILState_Release`. In general, other " -"thread-related APIs may be used between :c:func:`PyGILState_Ensure` " -"and :c:func:`PyGILState_Release` calls as long as the thread state is " -"restored to its previous state before the Release(). For example, normal " -"usage of the :c:macro:`Py_BEGIN_ALLOW_THREADS` " -"and :c:macro:`Py_END_ALLOW_THREADS` macros is acceptable." +"thread-related APIs may be used between :c:func:`PyGILState_Ensure` and :c:" +"func:`PyGILState_Release` calls as long as the thread state is restored to " +"its previous state before the Release(). For example, normal usage of the :" +"c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS` macros " +"is acceptable." msgstr "" -#: ../../c-api/init.rst:1212 +#: ../../c-api/init.rst:1213 msgid "" -"The return value is an opaque \"handle\" to the thread state " -"when :c:func:`PyGILState_Ensure` was called, and must be passed " -"to :c:func:`PyGILState_Release` to ensure Python is left in the same state. " -"Even though recursive calls are allowed, these handles *cannot* be shared - " -"each unique call to :c:func:`PyGILState_Ensure` must save the handle for its " -"call to :c:func:`PyGILState_Release`." +"The return value is an opaque \"handle\" to the thread state when :c:func:" +"`PyGILState_Ensure` was called, and must be passed to :c:func:" +"`PyGILState_Release` to ensure Python is left in the same state. Even though " +"recursive calls are allowed, these handles *cannot* be shared - each unique " +"call to :c:func:`PyGILState_Ensure` must save the handle for its call to :c:" +"func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1219 +#: ../../c-api/init.rst:1220 msgid "" "When the function returns, the current thread will hold the GIL and be able " "to call arbitrary Python code. Failure is a fatal error." msgstr "" -#: ../../c-api/init.rst:1231 +#: ../../c-api/init.rst:1232 msgid "" "Release any resources previously acquired. After this call, Python's state " -"will be the same as it was prior to the " -"corresponding :c:func:`PyGILState_Ensure` call (but generally this state " -"will be unknown to the caller, hence the use of the GILState API)." +"will be the same as it was prior to the corresponding :c:func:" +"`PyGILState_Ensure` call (but generally this state will be unknown to the " +"caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1236 +#: ../../c-api/init.rst:1237 msgid "" -"Every call to :c:func:`PyGILState_Ensure` must be matched by a call " -"to :c:func:`PyGILState_Release` on the same thread." +"Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" +"func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:1242 +#: ../../c-api/init.rst:1243 msgid "" "Get the current thread state for this thread. May return ``NULL`` if no " "GILState API has been used on the current thread. Note that the main thread " @@ -1549,7 +1551,7 @@ msgid "" "made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1250 +#: ../../c-api/init.rst:1251 msgid "" "Return ``1`` if the current thread is holding the GIL and ``0`` otherwise. " "This function can be called from any thread at any time. Only if it has had " @@ -1560,248 +1562,248 @@ msgid "" "otherwise behave differently." msgstr "" -#: ../../c-api/init.rst:1262 +#: ../../c-api/init.rst:1263 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1268 +#: ../../c-api/init.rst:1269 msgid "" -"This macro expands to ``{ PyThreadState *_save; _save = " -"PyEval_SaveThread();``. Note that it contains an opening brace; it must be " -"matched with a following :c:macro:`Py_END_ALLOW_THREADS` macro. See above " -"for further discussion of this macro." +"This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" +"``. Note that it contains an opening brace; it must be matched with a " +"following :c:macro:`Py_END_ALLOW_THREADS` macro. See above for further " +"discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1276 +#: ../../c-api/init.rst:1277 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " -"contains a closing brace; it must be matched with an " -"earlier :c:macro:`Py_BEGIN_ALLOW_THREADS` macro. See above for further " -"discussion of this macro." +"contains a closing brace; it must be matched with an earlier :c:macro:" +"`Py_BEGIN_ALLOW_THREADS` macro. See above for further discussion of this " +"macro." msgstr "" -#: ../../c-api/init.rst:1284 +#: ../../c-api/init.rst:1285 msgid "" -"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent " -"to :c:macro:`Py_END_ALLOW_THREADS` without the closing brace." +"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" +"c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1290 +#: ../../c-api/init.rst:1291 msgid "" -"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent " -"to :c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " +"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" +"c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1296 +#: ../../c-api/init.rst:1297 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1298 +#: ../../c-api/init.rst:1299 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1300 +#: ../../c-api/init.rst:1301 msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1306 +#: ../../c-api/init.rst:1307 msgid "" "Create a new interpreter state object. The global interpreter lock need not " "be held, but may be held if it is necessary to serialize calls to this " "function." msgstr "" -#: ../../c-api/init.rst:1310 +#: ../../c-api/init.rst:1311 msgid "" -"Raises an :ref:`auditing event ` " -"``cpython.PyInterpreterState_New`` with no arguments." +"Raises an :ref:`auditing event ` ``cpython." +"PyInterpreterState_New`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` " -"``cpython.PyInterpreterState_New``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." +"PyInterpreterState_New``。" -#: ../../c-api/init.rst:1315 +#: ../../c-api/init.rst:1316 msgid "" "Reset all information in an interpreter state object. The global " "interpreter lock must be held." msgstr "" -#: ../../c-api/init.rst:1318 +#: ../../c-api/init.rst:1319 msgid "" -"Raises an :ref:`auditing event ` " -"``cpython.PyInterpreterState_Clear`` with no arguments." +"Raises an :ref:`auditing event ` ``cpython." +"PyInterpreterState_Clear`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` " -"``cpython.PyInterpreterState_Clear``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." +"PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1323 +#: ../../c-api/init.rst:1324 msgid "" "Destroy an interpreter state object. The global interpreter lock need not " "be held. The interpreter state must have been reset with a previous call " "to :c:func:`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1330 +#: ../../c-api/init.rst:1331 msgid "" "Create a new thread state object belonging to the given interpreter object. " "The global interpreter lock need not be held, but may be held if it is " "necessary to serialize calls to this function." msgstr "" -#: ../../c-api/init.rst:1337 +#: ../../c-api/init.rst:1338 msgid "" "Reset all information in a thread state object. The global interpreter lock " "must be held." msgstr "" -#: ../../c-api/init.rst:1340 +#: ../../c-api/init.rst:1341 msgid "" "This function now calls the :c:member:`PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1344 +#: ../../c-api/init.rst:1345 msgid "The :c:member:`PyThreadState.on_delete` callback was removed." msgstr ":c:member:`PyThreadState.on_delete` 回呼已被移除。" -#: ../../c-api/init.rst:1350 +#: ../../c-api/init.rst:1351 msgid "" "Destroy a thread state object. The global interpreter lock need not be " -"held. The thread state must have been reset with a previous call " -"to :c:func:`PyThreadState_Clear`." +"held. The thread state must have been reset with a previous call to :c:func:" +"`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1357 +#: ../../c-api/init.rst:1358 msgid "" "Destroy the current thread state and release the global interpreter lock. " "Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " -"held. The thread state must have been reset with a previous call " -"to :c:func:`PyThreadState_Clear`." +"held. The thread state must have been reset with a previous call to :c:func:" +"`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1365 +#: ../../c-api/init.rst:1366 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1367 +#: ../../c-api/init.rst:1368 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1370 +#: ../../c-api/init.rst:1371 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1372 ../../c-api/init.rst:1381 -#: ../../c-api/init.rst:1390 +#: ../../c-api/init.rst:1373 ../../c-api/init.rst:1382 +#: ../../c-api/init.rst:1391 msgid "*tstate* must not be ``NULL``." msgstr "*tstate* 不可為 ``NULL``。" -#: ../../c-api/init.rst:1379 +#: ../../c-api/init.rst:1380 msgid "" "Get the unique thread state identifier of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1388 +#: ../../c-api/init.rst:1389 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1397 +#: ../../c-api/init.rst:1398 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1399 +#: ../../c-api/init.rst:1400 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1406 +#: ../../c-api/init.rst:1407 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1409 +#: ../../c-api/init.rst:1410 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1417 +#: ../../c-api/init.rst:1418 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1419 +#: ../../c-api/init.rst:1420 msgid "" "Issue a fatal error if there no current Python thread state or no current " "interpreter. It cannot return NULL." msgstr "" -#: ../../c-api/init.rst:1422 ../../c-api/init.rst:1432 -#: ../../c-api/init.rst:1454 +#: ../../c-api/init.rst:1423 ../../c-api/init.rst:1433 +#: ../../c-api/init.rst:1455 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/init.rst:1429 +#: ../../c-api/init.rst:1430 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1439 +#: ../../c-api/init.rst:1440 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1443 +#: ../../c-api/init.rst:1444 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1451 +#: ../../c-api/init.rst:1452 msgid "" "Return a :term:`strong reference` to the ``__main__`` :ref:`module object " "` for the given interpreter." msgstr "" -#: ../../c-api/init.rst:1461 +#: ../../c-api/init.rst:1462 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1463 +#: ../../c-api/init.rst:1464 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1466 +#: ../../c-api/init.rst:1467 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1469 +#: ../../c-api/init.rst:1470 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1474 +#: ../../c-api/init.rst:1475 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1476 ../../c-api/init.rst:1484 +#: ../../c-api/init.rst:1477 ../../c-api/init.rst:1485 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1482 +#: ../../c-api/init.rst:1483 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1491 +#: ../../c-api/init.rst:1492 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1810,7 +1812,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1500 +#: ../../c-api/init.rst:1501 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1822,34 +1824,33 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1508 +#: ../../c-api/init.rst:1509 msgid "" -"The type of the *id* parameter changed from :c:expr:`long` " -"to :c:expr:`unsigned long`." +"The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" +"`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1514 +#: ../../c-api/init.rst:1515 msgid "" "Acquire the global interpreter lock and set the current thread state to " "*tstate*, which must not be ``NULL``. The lock must have been created " "earlier. If this thread already has the lock, deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1525 +#: ../../c-api/init.rst:1526 msgid "" -"Updated to be consistent " -"with :c:func:`PyEval_RestoreThread`, :c:func:`Py_END_ALLOW_THREADS`, " -"and :c:func:`PyGILState_Ensure`, and terminate the current thread if called " -"while the interpreter is finalizing." +"Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" +"`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " +"current thread if called while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1530 +#: ../../c-api/init.rst:1531 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1536 +#: ../../c-api/init.rst:1537 msgid "" "Reset the current thread state to ``NULL`` and release the global " "interpreter lock. The lock must have been created earlier and must be held " @@ -1858,17 +1859,17 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1542 +#: ../../c-api/init.rst:1543 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1549 +#: ../../c-api/init.rst:1550 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1551 +#: ../../c-api/init.rst:1552 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1876,7 +1877,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1556 +#: ../../c-api/init.rst:1557 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1887,134 +1888,134 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1563 +#: ../../c-api/init.rst:1564 msgid "" -"You can switch between sub-interpreters using " -"the :c:func:`PyThreadState_Swap` function. You can create and destroy them " -"using the following functions:" +"You can switch between sub-interpreters using the :c:func:" +"`PyThreadState_Swap` function. You can create and destroy them using the " +"following functions:" msgstr "" -#: ../../c-api/init.rst:1569 +#: ../../c-api/init.rst:1570 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1575 +#: ../../c-api/init.rst:1576 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1579 +#: ../../c-api/init.rst:1580 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1583 +#: ../../c-api/init.rst:1584 msgid "" -"If this is ``0`` " -"then :c:member:`~PyInterpreterConfig.check_multi_interp_extensions` must be " -"``1`` (non-zero). If this is ``1`` then :c:member:`~PyInterpreterConfig.gil` " -"must not be :c:macro:`PyInterpreterConfig_OWN_GIL`." +"If this is ``0`` then :c:member:`~PyInterpreterConfig." +"check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " +"then :c:member:`~PyInterpreterConfig.gil` must not be :c:macro:" +"`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1591 +#: ../../c-api/init.rst:1592 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1595 +#: ../../c-api/init.rst:1596 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1600 +#: ../../c-api/init.rst:1601 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1605 +#: ../../c-api/init.rst:1606 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1610 +#: ../../c-api/init.rst:1611 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1616 +#: ../../c-api/init.rst:1617 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " -"create daemon threads. Otherwise daemon threads are allowed (as long " -"as :c:member:`~PyInterpreterConfig.allow_threads` is non-zero)." +"create daemon threads. Otherwise daemon threads are allowed (as long as :c:" +"member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1623 +#: ../../c-api/init.rst:1624 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " -"is currently active. Otherwise only multi-phase init extension modules " -"(see :pep:`489`) may be imported. (Also " -"see :c:macro:`Py_mod_multiple_interpreters`.)" +"is currently active. Otherwise only multi-phase init extension modules (see :" +"pep:`489`) may be imported. (Also see :c:macro:" +"`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1630 +#: ../../c-api/init.rst:1631 msgid "" -"This must be ``1`` (non-zero) " -"if :c:member:`~PyInterpreterConfig.use_main_obmalloc` is ``0``." +"This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." +"use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1635 +#: ../../c-api/init.rst:1636 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1642 +#: ../../c-api/init.rst:1643 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1646 +#: ../../c-api/init.rst:1647 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1650 +#: ../../c-api/init.rst:1651 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1652 +#: ../../c-api/init.rst:1653 msgid "" -"If this is :c:macro:`PyInterpreterConfig_OWN_GIL` " -"then :c:member:`PyInterpreterConfig.use_main_obmalloc` must be ``0``." +"If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" +"`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1666 +#: ../../c-api/init.rst:1667 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " "interpreter has separate, independent versions of all imported modules, " -"including the fundamental modules :mod:`builtins`, :mod:`__main__` " -"and :mod:`sys`. The table of loaded modules (``sys.modules``) and the " -"module search path (``sys.path``) are also separate. The new environment " -"has no ``sys.argv`` variable. It has new standard I/O stream file objects " -"``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` (however these refer to the " -"same underlying file descriptors)." +"including the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:" +"`sys`. The table of loaded modules (``sys.modules``) and the module search " +"path (``sys.path``) are also separate. The new environment has no ``sys." +"argv`` variable. It has new standard I/O stream file objects ``sys.stdin``, " +"``sys.stdout`` and ``sys.stderr`` (however these refer to the same " +"underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1676 +#: ../../c-api/init.rst:1677 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1679 +#: ../../c-api/init.rst:1680 msgid "" "Upon success, *tstate_p* will be set to the first thread state created in " "the new sub-interpreter. This thread state is made in the current thread " @@ -2025,7 +2026,7 @@ msgid "" "state." msgstr "" -#: ../../c-api/init.rst:1688 +#: ../../c-api/init.rst:1689 msgid "" "Like all other Python/C API functions, the global interpreter lock must be " "held before calling this function and is still held when it returns. " @@ -2037,13 +2038,13 @@ msgid "" "released here." msgstr "" -#: ../../c-api/init.rst:1699 +#: ../../c-api/init.rst:1700 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1702 +#: ../../c-api/init.rst:1703 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2075,59 +2076,58 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init.rst:1717 +#: ../../c-api/init.rst:1718 msgid "" "Note that the config is used only briefly and does not get modified. During " -"initialization the config's values are converted into " -"various :c:type:`PyInterpreterState` values. A read-only copy of the config " -"may be stored internally on the :c:type:`PyInterpreterState`." +"initialization the config's values are converted into various :c:type:" +"`PyInterpreterState` values. A read-only copy of the config may be stored " +"internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1726 +#: ../../c-api/init.rst:1727 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1728 +#: ../../c-api/init.rst:1729 msgid "" -"For modules using multi-phase initialization, " -"e.g. :c:func:`PyModule_FromDefAndSpec`, a separate module object is created " -"and initialized for each interpreter. Only C-level static and global " -"variables are shared between these module objects." +"For modules using multi-phase initialization, e.g. :c:func:" +"`PyModule_FromDefAndSpec`, a separate module object is created and " +"initialized for each interpreter. Only C-level static and global variables " +"are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1734 +#: ../../c-api/init.rst:1735 msgid "" -"For modules using single-phase initialization, " -"e.g. :c:func:`PyModule_Create`, the first time a particular extension is " -"imported, it is initialized normally, and a (shallow) copy of its module's " -"dictionary is squirreled away. When the same extension is imported by " -"another (sub-)interpreter, a new module is initialized and filled with the " -"contents of this copy; the extension's ``init`` function is not called. " -"Objects in the module's dictionary thus end up shared across " -"(sub-)interpreters, which might cause unwanted behavior (see `Bugs and " -"caveats`_ below)." +"For modules using single-phase initialization, e.g. :c:func:" +"`PyModule_Create`, the first time a particular extension is imported, it is " +"initialized normally, and a (shallow) copy of its module's dictionary is " +"squirreled away. When the same extension is imported by another " +"(sub-)interpreter, a new module is initialized and filled with the contents " +"of this copy; the extension's ``init`` function is not called. Objects in " +"the module's dictionary thus end up shared across (sub-)interpreters, which " +"might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1745 +#: ../../c-api/init.rst:1746 msgid "" "Note that this is different from what happens when an extension is imported " -"after the interpreter has been completely re-initialized by " -"calling :c:func:`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, " -"the extension's ``initmodule`` function *is* called again. As with multi-" -"phase initialization, this means that only C-level static and global " -"variables are shared between these modules." +"after the interpreter has been completely re-initialized by calling :c:func:" +"`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, the extension's " +"``initmodule`` function *is* called again. As with multi-phase " +"initialization, this means that only C-level static and global variables are " +"shared between these modules." msgstr "" -#: ../../c-api/init.rst:1765 +#: ../../c-api/init.rst:1766 msgid "" -"Create a new sub-interpreter. This is essentially just a wrapper " -"around :c:func:`Py_NewInterpreterFromConfig` with a config that preserves " -"the existing behavior. The result is an unisolated sub-interpreter that " -"shares the main interpreter's GIL, allows fork/exec, allows daemon threads, " -"and allows single-phase init modules." +"Create a new sub-interpreter. This is essentially just a wrapper around :c:" +"func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " +"behavior. The result is an unisolated sub-interpreter that shares the main " +"interpreter's GIL, allows fork/exec, allows daemon threads, and allows " +"single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1777 +#: ../../c-api/init.rst:1778 msgid "" "Destroy the (sub-)interpreter represented by the given thread state. The " "given thread state must be the current thread state. See the discussion of " @@ -2137,17 +2137,17 @@ msgid "" "be held before calling this function. No GIL is held when it returns." msgstr "" -#: ../../c-api/init.rst:1785 +#: ../../c-api/init.rst:1786 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1790 +#: ../../c-api/init.rst:1791 msgid "A Per-Interpreter GIL" msgstr "直譯器各別持有的 GIL" -#: ../../c-api/init.rst:1792 +#: ../../c-api/init.rst:1793 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2159,7 +2159,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1802 +#: ../../c-api/init.rst:1803 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2173,7 +2173,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1813 +#: ../../c-api/init.rst:1814 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2181,7 +2181,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1818 +#: ../../c-api/init.rst:1819 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2191,11 +2191,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1829 +#: ../../c-api/init.rst:1830 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1831 +#: ../../c-api/init.rst:1832 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2208,7 +2208,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1841 +#: ../../c-api/init.rst:1842 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2217,37 +2217,37 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1847 +#: ../../c-api/init.rst:1848 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " "and OS-level threads, an assumption broken by the presence of sub-" "interpreters. It is highly recommended that you don't switch sub-" -"interpreters between a pair of matching :c:func:`PyGILState_Ensure` " -"and :c:func:`PyGILState_Release` calls. Furthermore, extensions (such " -"as :mod:`ctypes`) using these APIs to allow calling of Python code from non-" -"Python created threads will probably be broken when using sub-interpreters." +"interpreters between a pair of matching :c:func:`PyGILState_Ensure` and :c:" +"func:`PyGILState_Release` calls. Furthermore, extensions (such as :mod:" +"`ctypes`) using these APIs to allow calling of Python code from non-Python " +"created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1858 +#: ../../c-api/init.rst:1859 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1860 +#: ../../c-api/init.rst:1861 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1867 +#: ../../c-api/init.rst:1868 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1871 +#: ../../c-api/init.rst:1872 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2255,17 +2255,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1876 +#: ../../c-api/init.rst:1877 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1877 +#: ../../c-api/init.rst:1878 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1880 +#: ../../c-api/init.rst:1881 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2273,30 +2273,30 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1885 +#: ../../c-api/init.rst:1886 msgid "" "This function doesn't need a current thread state to run, and it doesn't " "need the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:1888 +#: ../../c-api/init.rst:1889 msgid "" "To call this function in a subinterpreter, the caller must hold the GIL. " "Otherwise, the function *func* can be scheduled to be called from the wrong " "interpreter." msgstr "" -#: ../../c-api/init.rst:1893 +#: ../../c-api/init.rst:1894 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " "thread is busy executing a system call, *func* won't be called before the " "system call returns. This function is generally **not** suitable for " -"calling Python code from arbitrary C threads. Instead, use " -"the :ref:`PyGILState API`." +"calling Python code from arbitrary C threads. Instead, use the :ref:" +"`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1902 +#: ../../c-api/init.rst:1903 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2304,18 +2304,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1911 +#: ../../c-api/init.rst:1912 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1916 +#: ../../c-api/init.rst:1917 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:1920 +#: ../../c-api/init.rst:1921 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2325,76 +2325,78 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1930 +#: ../../c-api/init.rst:1931 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " "the registration function as *obj*, *frame* is the frame object to which the " -"event pertains, *what* is one of the " -"constants :c:data:`PyTrace_CALL`, :c:data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`, :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:`PyTrace_C_RETURN`, " -"or :c:data:`PyTrace_OPCODE`, and *arg* depends on the value of *what*:" +"event pertains, *what* is one of the constants :c:data:`PyTrace_CALL`, :c:" +"data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`, :" +"c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:" +"`PyTrace_C_RETURN`, or :c:data:`PyTrace_OPCODE`, and *arg* depends on the " +"value of *what*:" msgstr "" -#: ../../c-api/init.rst:1939 +#: ../../c-api/init.rst:1940 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1939 +#: ../../c-api/init.rst:1940 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:1941 +#: ../../c-api/init.rst:1942 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1941 ../../c-api/init.rst:1946 -#: ../../c-api/init.rst:1957 +#: ../../c-api/init.rst:1942 ../../c-api/init.rst:1947 +#: ../../c-api/init.rst:1958 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1943 +#: ../../c-api/init.rst:1944 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1943 +#: ../../c-api/init.rst:1944 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1946 +#: ../../c-api/init.rst:1947 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1948 +#: ../../c-api/init.rst:1949 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1948 +#: ../../c-api/init.rst:1949 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1951 +#: ../../c-api/init.rst:1952 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1951 ../../c-api/init.rst:1953 -#: ../../c-api/init.rst:1955 +#: ../../c-api/init.rst:1952 ../../c-api/init.rst:1954 +#: ../../c-api/init.rst:1956 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:1953 +#: ../../c-api/init.rst:1954 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1955 +#: ../../c-api/init.rst:1956 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1957 +#: ../../c-api/init.rst:1958 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1962 +#: ../../c-api/init.rst:1963 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2403,7 +2405,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1971 +#: ../../c-api/init.rst:1972 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2415,134 +2417,133 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1982 +#: ../../c-api/init.rst:1983 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " -"reported. It may be disabled for a frame by " -"setting :attr:`~frame.f_trace_lines` to *0* on that frame." +"reported. It may be disabled for a frame by setting :attr:`~frame." +"f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:1990 +#: ../../c-api/init.rst:1991 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:1996 +#: ../../c-api/init.rst:1997 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:2002 +#: ../../c-api/init.rst:2003 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:2008 +#: ../../c-api/init.rst:2009 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:2014 +#: ../../c-api/init.rst:2015 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " -"event is not emitted by default: it must be explicitly requested by " -"setting :attr:`~frame.f_trace_opcodes` to *1* on the frame." +"event is not emitted by default: it must be explicitly requested by setting :" +"attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:2022 +#: ../../c-api/init.rst:2023 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " "If the profile function needs to maintain state, using a different value for " "*obj* for each thread provides a convenient and thread-safe place to store " -"it. The profile function is called for all monitored events " -"except :c:data:`PyTrace_LINE` :c:data:`PyTrace_OPCODE` " -"and :c:data:`PyTrace_EXCEPTION`." +"it. The profile function is called for all monitored events except :c:data:" +"`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:2029 +#: ../../c-api/init.rst:2030 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: ../../c-api/init.rst:2031 ../../c-api/init.rst:2038 -#: ../../c-api/init.rst:2057 ../../c-api/init.rst:2064 +#: ../../c-api/init.rst:2032 ../../c-api/init.rst:2039 +#: ../../c-api/init.rst:2058 ../../c-api/init.rst:2065 msgid "The caller must hold the :term:`GIL`." msgstr "呼叫者必須持有 :term:`GIL`。" -#: ../../c-api/init.rst:2035 +#: ../../c-api/init.rst:2036 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:2040 +#: ../../c-api/init.rst:2041 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:2048 +#: ../../c-api/init.rst:2049 msgid "" -"Set the tracing function to *func*. This is similar " -"to :c:func:`PyEval_SetProfile`, except the tracing function does receive " -"line-number events and per-opcode events, but does not receive any event " -"related to C function objects being called. Any trace function registered " -"using :c:func:`PyEval_SetTrace` will not " -"receive :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION` " -"or :c:data:`PyTrace_C_RETURN` as a value for the *what* parameter." +"Set the tracing function to *func*. This is similar to :c:func:" +"`PyEval_SetProfile`, except the tracing function does receive line-number " +"events and per-opcode events, but does not receive any event related to C " +"function objects being called. Any trace function registered using :c:func:" +"`PyEval_SetTrace` will not receive :c:data:`PyTrace_C_CALL`, :c:data:" +"`PyTrace_C_EXCEPTION` or :c:data:`PyTrace_C_RETURN` as a value for the " +"*what* parameter." msgstr "" -#: ../../c-api/init.rst:2055 +#: ../../c-api/init.rst:2056 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:2061 +#: ../../c-api/init.rst:2062 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:2066 +#: ../../c-api/init.rst:2067 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2072 +#: ../../c-api/init.rst:2073 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:2078 +#: ../../c-api/init.rst:2079 msgid "" -"The type of the trace function registered " -"using :c:func:`PyRefTracer_SetTracer`. The first parameter is a Python " -"object that has been just created (when **event** is set " -"to :c:data:`PyRefTracer_CREATE`) or about to be destroyed (when **event** is " -"set to :c:data:`PyRefTracer_DESTROY`). The **data** argument is the opaque " -"pointer that was provided when :c:func:`PyRefTracer_SetTracer` was called." +"The type of the trace function registered using :c:func:" +"`PyRefTracer_SetTracer`. The first parameter is a Python object that has " +"been just created (when **event** is set to :c:data:`PyRefTracer_CREATE`) or " +"about to be destroyed (when **event** is set to :c:data:" +"`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer that was " +"provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:2088 +#: ../../c-api/init.rst:2089 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:2093 +#: ../../c-api/init.rst:2094 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:2098 +#: ../../c-api/init.rst:2099 msgid "" "Register a reference tracer function. The function will be called when a new " "Python has been created or when an object is going to be destroyed. If " @@ -2551,7 +2552,7 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:2104 +#: ../../c-api/init.rst:2105 msgid "" "Not that tracer functions **must not** create Python objects inside or " "otherwise the call will be re-entrant. The tracer also **must not** clear " @@ -2559,11 +2560,11 @@ msgid "" "the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2109 ../../c-api/init.rst:2120 +#: ../../c-api/init.rst:2110 ../../c-api/init.rst:2121 msgid "The GIL must be held when calling this function." msgstr "" -#: ../../c-api/init.rst:2115 +#: ../../c-api/init.rst:2116 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2571,48 +2572,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:2127 +#: ../../c-api/init.rst:2128 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2132 +#: ../../c-api/init.rst:2133 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2137 +#: ../../c-api/init.rst:2138 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2142 +#: ../../c-api/init.rst:2143 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2147 +#: ../../c-api/init.rst:2148 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2153 +#: ../../c-api/init.rst:2154 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2159 +#: ../../c-api/init.rst:2160 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2166 +#: ../../c-api/init.rst:2167 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2170 +#: ../../c-api/init.rst:2171 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2622,42 +2623,42 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2177 +#: ../../c-api/init.rst:2178 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:2180 +#: ../../c-api/init.rst:2181 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2184 +#: ../../c-api/init.rst:2185 msgid "" -"None of these API functions handle memory management on behalf of " -"the :c:expr:`void*` values. You need to allocate and deallocate them " -"yourself. If the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, " -"these functions don't do refcount operations on them either." +"None of these API functions handle memory management on behalf of the :c:" +"expr:`void*` values. You need to allocate and deallocate them yourself. If " +"the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, these functions " +"don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2192 +#: ../../c-api/init.rst:2193 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2194 +#: ../../c-api/init.rst:2195 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2200 +#: ../../c-api/init.rst:2201 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2205 +#: ../../c-api/init.rst:2206 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2665,67 +2666,66 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2210 +#: ../../c-api/init.rst:2211 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2216 +#: ../../c-api/init.rst:2217 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:2221 +#: ../../c-api/init.rst:2222 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2223 +#: ../../c-api/init.rst:2224 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2230 +#: ../../c-api/init.rst:2231 msgid "" -"Return a value which is the same state as a value initialized " -"with :c:macro:`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic " -"allocation failure." +"Return a value which is the same state as a value initialized with :c:macro:" +"`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: ../../c-api/init.rst:2237 +#: ../../c-api/init.rst:2238 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2243 +#: ../../c-api/init.rst:2244 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2248 +#: ../../c-api/init.rst:2249 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2250 +#: ../../c-api/init.rst:2251 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " -"undefined if the given :c:type:`Py_tss_t` has not been initialized " -"by :c:func:`PyThread_tss_create`." +"undefined if the given :c:type:`Py_tss_t` has not been initialized by :c:" +"func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2258 +#: ../../c-api/init.rst:2259 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2264 +#: ../../c-api/init.rst:2265 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2734,40 +2734,40 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2273 +#: ../../c-api/init.rst:2274 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " -"destroyed key is able to be initialized again " -"by :c:func:`PyThread_tss_create`. This function can be called repeatedly on " -"the same key -- calling it on an already destroyed key is a no-op." +"destroyed key is able to be initialized again by :c:func:" +"`PyThread_tss_create`. This function can be called repeatedly on the same " +"key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2282 +#: ../../c-api/init.rst:2283 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2289 +#: ../../c-api/init.rst:2290 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2297 +#: ../../c-api/init.rst:2298 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2299 +#: ../../c-api/init.rst:2300 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2304 +#: ../../c-api/init.rst:2305 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2776,62 +2776,62 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2309 +#: ../../c-api/init.rst:2310 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:2320 +#: ../../c-api/init.rst:2321 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2322 +#: ../../c-api/init.rst:2323 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2326 +#: ../../c-api/init.rst:2327 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" -#: ../../c-api/init.rst:2329 +#: ../../c-api/init.rst:2330 msgid "PyMutex mutex = {0};" msgstr "" -#: ../../c-api/init.rst:2331 +#: ../../c-api/init.rst:2332 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" -#: ../../c-api/init.rst:2337 +#: ../../c-api/init.rst:2338 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" -#: ../../c-api/init.rst:2345 +#: ../../c-api/init.rst:2346 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " "temporarily release the :term:`GIL` if it is held." msgstr "" -#: ../../c-api/init.rst:2353 +#: ../../c-api/init.rst:2354 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2361 +#: ../../c-api/init.rst:2362 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2363 +#: ../../c-api/init.rst:2364 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded ` CPython. They are " @@ -2839,18 +2839,17 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2368 +#: ../../c-api/init.rst:2369 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " -"sections and releasing the locks during calls " -"to :c:func:`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is " -"called, the most recent critical section is resumed, and its locks " -"reacquired. This means the critical section API provides weaker guarantees " -"than traditional locks -- they are useful because their behavior is similar " -"to the :term:`GIL`." +"sections and releasing the locks during calls to :c:func:" +"`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is called, the most " +"recent critical section is resumed, and its locks reacquired. This means " +"the critical section API provides weaker guarantees than traditional locks " +"-- they are useful because their behavior is similar to the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:2375 +#: ../../c-api/init.rst:2376 msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " @@ -2858,20 +2857,20 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2382 +#: ../../c-api/init.rst:2383 msgid "" -"Operations that need to lock two objects at once must " -"use :c:macro:`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical " -"sections to lock more than one object at once, because the inner critical " -"section may suspend the outer critical sections. This API does not provide " -"a way to lock more than two objects at once." +"Operations that need to lock two objects at once must use :c:macro:" +"`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " +"lock more than one object at once, because the inner critical section may " +"suspend the outer critical sections. This API does not provide a way to " +"lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2388 +#: ../../c-api/init.rst:2389 msgid "Example usage::" msgstr "" -#: ../../c-api/init.rst:2390 +#: ../../c-api/init.rst:2391 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -2883,71 +2882,71 @@ msgid "" "}" msgstr "" -#: ../../c-api/init.rst:2399 +#: ../../c-api/init.rst:2400 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " "critical section API avoids potential deadlocks due to reentrancy and lock " "ordering by allowing the runtime to temporarily suspend the critical section " -"if the code triggered by the finalizer blocks and " -"calls :c:func:`PyEval_SaveThread`." +"if the code triggered by the finalizer blocks and calls :c:func:" +"`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2407 +#: ../../c-api/init.rst:2408 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2410 ../../c-api/init.rst:2424 -#: ../../c-api/init.rst:2439 ../../c-api/init.rst:2453 +#: ../../c-api/init.rst:2411 ../../c-api/init.rst:2425 +#: ../../c-api/init.rst:2440 ../../c-api/init.rst:2454 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2412 +#: ../../c-api/init.rst:2413 msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" msgstr "" -#: ../../c-api/init.rst:2416 ../../c-api/init.rst:2445 +#: ../../c-api/init.rst:2417 ../../c-api/init.rst:2446 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2422 +#: ../../c-api/init.rst:2423 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2426 +#: ../../c-api/init.rst:2427 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" msgstr "" -#: ../../c-api/init.rst:2429 ../../c-api/init.rst:2458 +#: ../../c-api/init.rst:2430 ../../c-api/init.rst:2459 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2435 +#: ../../c-api/init.rst:2436 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2441 +#: ../../c-api/init.rst:2442 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" msgstr "" -#: ../../c-api/init.rst:2451 +#: ../../c-api/init.rst:2452 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2455 +#: ../../c-api/init.rst:2456 msgid "" " PyCriticalSection2_End(&_py_cs2);\n" "}" @@ -2966,19 +2965,19 @@ msgid "path (in module sys)" msgstr "path(sys 模組中)" #: ../../c-api/init.rst:350 ../../c-api/init.rst:710 ../../c-api/init.rst:1145 -#: ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 +#: ../../c-api/init.rst:1659 ../../c-api/init.rst:1758 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1659 ../../c-api/init.rst:1758 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1659 ../../c-api/init.rst:1758 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1659 ../../c-api/init.rst:1758 msgid "sys" msgstr "sys" @@ -2990,7 +2989,7 @@ msgstr "search(搜尋)" msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1722 ../../c-api/init.rst:1775 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1723 ../../c-api/init.rst:1776 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" @@ -3086,22 +3085,22 @@ msgstr "PyEval_RestoreThread()" msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 +#: ../../c-api/init.rst:1659 ../../c-api/init.rst:1758 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 +#: ../../c-api/init.rst:1659 ../../c-api/init.rst:1758 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 +#: ../../c-api/init.rst:1659 ../../c-api/init.rst:1758 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1722 +#: ../../c-api/init.rst:1723 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1752 +#: ../../c-api/init.rst:1753 msgid "close (in module os)" msgstr "close(os 模組中)" diff --git a/library/base64.po b/library/base64.po index 6a500d7382..d716dcc3b7 100644 --- a/library/base64.po +++ b/library/base64.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-05-20 00:16+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,12 +28,13 @@ msgid "**Source code:** :source:`Lib/base64.py`" msgstr "**原始碼:** :source:`Lib/base64.py`" #: ../../library/base64.rst:16 +#, fuzzy msgid "" "This module provides functions for encoding binary data to printable ASCII " -"characters and decoding such encodings back to binary data. It provides " -"encoding and decoding functions for the encodings specified in :rfc:`4648`, " -"which defines the Base16, Base32, and Base64 algorithms, and for the de-" -"facto standard Ascii85 and Base85 encodings." +"characters and decoding such encodings back to binary data. This includes " +"the :ref:`encodings specified in ` :rfc:`4648` (Base64, " +"Base32 and Base16) and the non-standard :ref:`Base85 encodings `." msgstr "" "這個模組提供將二進位資料編碼成可顯示 ASCII 字元以及解碼回原始資料的功能,包括" "了 :rfc:`4648` 中的 Base16、Base32、Base64 等編碼方式,以及標準 Ascii85、" @@ -41,16 +42,6 @@ msgstr "" #: ../../library/base64.rst:22 msgid "" -"The :rfc:`4648` encodings are suitable for encoding binary data so that it " -"can be safely sent by email, used as parts of URLs, or included as part of " -"an HTTP POST request. The encoding algorithm is not the same as the :" -"program:`uuencode` program." -msgstr "" -":rfc:`4648` 編碼適合對二進位資料進行編碼來使得電子郵件、URL 或是 HTTP POST 內" -"容等傳輸管道安全地傳遞資料。這些編碼演算法與 :program:`uuencode` 並不相同。" - -#: ../../library/base64.rst:27 -msgid "" "There are two interfaces provided by this module. The modern interface " "supports encoding :term:`bytes-like objects ` to ASCII :" "class:`bytes`, and decoding :term:`bytes-like objects ` " @@ -63,27 +54,28 @@ msgstr "" "義的兩種 base-64 字母表(常見和 URL 安全 (URL-safe) 及檔案系統安全 " "(filesystem-safe) 字母表)。" -#: ../../library/base64.rst:33 +#: ../../library/base64.rst:28 +#, fuzzy msgid "" -"The legacy interface does not support decoding from strings, but it does " -"provide functions for encoding and decoding to and from :term:`file objects " -"`. It only supports the Base64 standard alphabet, and it adds " -"newlines every 76 characters as per :rfc:`2045`. Note that if you are " -"looking for :rfc:`2045` support you probably want to be looking at the :mod:" -"`email` package instead." +"The :ref:`legacy interface ` does not support decoding from " +"strings, but it does provide functions for encoding and decoding to and " +"from :term:`file objects `. It only supports the Base64 " +"standard alphabet, and it adds newlines every 76 characters as per :rfc:" +"`2045`. Note that if you are looking for :rfc:`2045` support you probably " +"want to be looking at the :mod:`email` package instead." msgstr "" "舊版介面不支援從字串解碼,但它提供對\\ :term:`檔案物件 `\\ 進行" "編碼和解碼的函式。它僅支援 Base64 標準字母表,並且按照 :rfc:`2045` 每 76 個字" "元添加換行字元。請注意,如果你需要 :rfc:`2045` 的支援,你可能會需要 :mod:" "`email` 函式庫。" -#: ../../library/base64.rst:41 +#: ../../library/base64.rst:36 msgid "" "ASCII-only Unicode strings are now accepted by the decoding functions of the " "modern interface." msgstr "新介面的解碼功能現在接受 ASCII-only 的 Unicode 字串。" -#: ../../library/base64.rst:45 +#: ../../library/base64.rst:40 msgid "" "Any :term:`bytes-like objects ` are now accepted by all " "encoding and decoding functions in this module. Ascii85/Base85 support " @@ -92,11 +84,22 @@ msgstr "" "任何\\ :term:`類位元組物件 `\\ 現在被該模組中的所有編碼和" "解碼函式接受。新增了對 Ascii85/Base85 的支援。" -#: ../../library/base64.rst:49 -msgid "The modern interface provides:" -msgstr "新介面提供:" +#: ../../library/base64.rst:48 +#, fuzzy +msgid "RFC 4648 Encodings" +msgstr "base64 encoding(base64 編碼)" -#: ../../library/base64.rst:53 +#: ../../library/base64.rst:50 +#, fuzzy +msgid "" +"The :rfc:`4648` encodings are suitable for encoding binary data so that it " +"can be safely sent by email, used as parts of URLs, or included as part of " +"an HTTP POST request." +msgstr "" +":rfc:`4648` 編碼適合對二進位資料進行編碼來使得電子郵件、URL 或是 HTTP POST 內" +"容等傳輸管道安全地傳遞資料。這些編碼演算法與 :program:`uuencode` 並不相同。" + +#: ../../library/base64.rst:56 msgid "" "Encode the :term:`bytes-like object` *s* using Base64 and return the " "encoded :class:`bytes`." @@ -104,7 +107,7 @@ msgstr "" "使用 Base64 對\\ :term:`類位元組物件 ` *s* 進行編碼並回傳" "編碼過的 :class:`bytes`。" -#: ../../library/base64.rst:56 +#: ../../library/base64.rst:59 msgid "" "Optional *altchars* must be a :term:`bytes-like object` of length 2 which " "specifies an alternative alphabet for the ``+`` and ``/`` characters. This " @@ -117,7 +120,7 @@ msgstr "" "以生成對 URL 或檔案系統安全的 Base64 字串。預設值為 ``None``,即使用標準的 " "Base64 字母表。" -#: ../../library/base64.rst:61 +#: ../../library/base64.rst:64 msgid "" "May assert or raise a :exc:`ValueError` if the length of *altchars* is not " "2. Raises a :exc:`TypeError` if *altchars* is not a :term:`bytes-like " @@ -127,7 +130,7 @@ msgstr "" "*altchars* 不是\\ :term:`類位元組物件 `,則會引發 :exc:" "`TypeError`。" -#: ../../library/base64.rst:67 +#: ../../library/base64.rst:70 msgid "" "Decode the Base64 encoded :term:`bytes-like object` or ASCII string *s* and " "return the decoded :class:`bytes`." @@ -135,7 +138,7 @@ msgstr "" "將經過 Base64 編碼的\\ :term:`類位元組物件 `\\ 或 ASCII 字" "串 *s* 解碼,並回傳解碼後的 :class:`bytes`。" -#: ../../library/base64.rst:70 +#: ../../library/base64.rst:73 msgid "" "Optional *altchars* must be a :term:`bytes-like object` or ASCII string of " "length 2 which specifies the alternative alphabet used instead of the ``+`` " @@ -144,12 +147,12 @@ msgstr "" "可選的 *altchars* 必須是長度為 2 的\\ :term:`類位元組物件 `\\ 或 ASCII 字串,用於指定替代字母表,取代 ``+`` 和 ``/`` 字元。" -#: ../../library/base64.rst:74 +#: ../../library/base64.rst:77 msgid "" "A :exc:`binascii.Error` exception is raised if *s* is incorrectly padded." msgstr "如果 *s* 填充 (pad) 不正確,將引發 :exc:`binascii.Error` 例外。" -#: ../../library/base64.rst:77 +#: ../../library/base64.rst:80 msgid "" "If *validate* is ``False`` (the default), characters that are neither in the " "normal base-64 alphabet nor the alternative alphabet are discarded prior to " @@ -160,18 +163,18 @@ msgstr "" "不屬於標準 base-64 字母表和替代字母表的字元將被丟棄。如果 *validate* 為 " "``True``,輸入中的這些非字母表字元將導致引發 :exc:`binascii.Error`。" -#: ../../library/base64.rst:83 +#: ../../library/base64.rst:86 msgid "" "For more information about the strict base64 check, see :func:`binascii." "a2b_base64`" msgstr "有關嚴格的 base64 檢查的更多資訊,請參閱 :func:`binascii.a2b_base64`。" -#: ../../library/base64.rst:85 +#: ../../library/base64.rst:88 msgid "" "May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2." msgstr "如果 *altchars* 的長度不是 2,可能會斷言或引發 :exc:`ValueError`。" -#: ../../library/base64.rst:89 +#: ../../library/base64.rst:92 msgid "" "Encode :term:`bytes-like object` *s* using the standard Base64 alphabet and " "return the encoded :class:`bytes`." @@ -179,7 +182,7 @@ msgstr "" "使用標準 Base64 字母表對\\ :term:`類位元組物件 ` *s* 進行" "編碼,並回傳編碼後的 :class:`bytes`。" -#: ../../library/base64.rst:95 +#: ../../library/base64.rst:98 msgid "" "Decode :term:`bytes-like object` or ASCII string *s* using the standard " "Base64 alphabet and return the decoded :class:`bytes`." @@ -187,7 +190,7 @@ msgstr "" "使用標準 Base64 字母表對\\ :term:`類位元組物件 `\\ 或 " "ASCII 字串 *s* 進行解碼,並回傳解碼後的 :class:`bytes`。" -#: ../../library/base64.rst:101 +#: ../../library/base64.rst:104 msgid "" "Encode :term:`bytes-like object` *s* using the URL- and filesystem-safe " "alphabet, which substitutes ``-`` instead of ``+`` and ``_`` instead of ``/" @@ -198,7 +201,7 @@ msgstr "" "object>` *s* 進行編碼,該字母表將標準 Base64 字母表中的 ``+`` 替換為 ``-``," "``/`` 替換為 ``_``,並回傳編碼後的 :class:`bytes`。結果仍可能包含 ``=``。" -#: ../../library/base64.rst:110 +#: ../../library/base64.rst:113 msgid "" "Decode :term:`bytes-like object` or ASCII string *s* using the URL- and " "filesystem-safe alphabet, which substitutes ``-`` instead of ``+`` and ``_`` " @@ -209,7 +212,7 @@ msgstr "" "object>`\\ 或 ASCII 字串 *s* 進行解碼,該字母表將標準 Base64 字母表中的 " "``+`` 替換為 ``-``,``/`` 替換為 ``_``,並回傳解碼後的 :class:`bytes`。" -#: ../../library/base64.rst:119 +#: ../../library/base64.rst:122 msgid "" "Encode the :term:`bytes-like object` *s* using Base32 and return the " "encoded :class:`bytes`." @@ -217,7 +220,7 @@ msgstr "" "使用 Base32 對\\ :term:`類位元組物件 ` *s* 進行編碼,並回" "傳編碼後的 :class:`bytes`。" -#: ../../library/base64.rst:125 +#: ../../library/base64.rst:128 msgid "" "Decode the Base32 encoded :term:`bytes-like object` or ASCII string *s* and " "return the decoded :class:`bytes`." @@ -225,7 +228,7 @@ msgstr "" "解碼經過 Base32 編碼的\\ :term:`類位元組物件 `\\ 或 ASCII " "字串 *s*,並回傳解碼後的 :class:`bytes`。" -#: ../../library/base64.rst:128 ../../library/base64.rst:176 +#: ../../library/base64.rst:131 ../../library/base64.rst:179 msgid "" "Optional *casefold* is a flag specifying whether a lowercase alphabet is " "acceptable as input. For security purposes, the default is ``False``." @@ -233,7 +236,7 @@ msgstr "" "可選的 *casefold* 是一個是否接受小寫字母表作為輸入的旗標。出於安全性考量,預" "設值為 ``False``。" -#: ../../library/base64.rst:132 +#: ../../library/base64.rst:135 msgid "" ":rfc:`4648` allows for optional mapping of the digit 0 (zero) to the letter " "O (oh), and for optional mapping of the digit 1 (one) to either the letter I " @@ -248,14 +251,14 @@ msgstr "" "對映為哪個字母(當 *map01* 不為 ``None`` 時,數字 0 總是對映為字母 O)。出於" "安全性考量,預設值為 ``None``,因此不允許在輸入中使用數字 0 和 1。" -#: ../../library/base64.rst:139 ../../library/base64.rst:180 +#: ../../library/base64.rst:142 ../../library/base64.rst:183 msgid "" "A :exc:`binascii.Error` is raised if *s* is incorrectly padded or if there " "are non-alphabet characters present in the input." msgstr "" "如果 *s* 的填充不正確或輸入中存在非字母表字元,將引發 :exc:`binascii.Error`。" -#: ../../library/base64.rst:146 +#: ../../library/base64.rst:149 msgid "" "Similar to :func:`b32encode` but uses the Extended Hex Alphabet, as defined " "in :rfc:`4648`." @@ -263,14 +266,14 @@ msgstr "" "類似於 :func:`b32encode`,但使用在 :rfc:`4648` 中定義的擴展十六進位字母表 " "(Extended Hex Alphabet)。" -#: ../../library/base64.rst:154 +#: ../../library/base64.rst:157 msgid "" "Similar to :func:`b32decode` but uses the Extended Hex Alphabet, as defined " "in :rfc:`4648`." msgstr "" "類似於 :func:`b32encode`,但使用在 :rfc:`4648` 中定義的擴展十六進位字母表。" -#: ../../library/base64.rst:157 +#: ../../library/base64.rst:160 msgid "" "This version does not allow the digit 0 (zero) to the letter O (oh) and " "digit 1 (one) to either the letter I (eye) or letter L (el) mappings, all " @@ -280,7 +283,7 @@ msgstr "" "這個版本不允許將數字 0 對映為字母 O ,以及將數字 1 對映為字母 I 或字母 L,所" "有這些字元都包含在擴展十六進位字母表中,並且不能互換使用。" -#: ../../library/base64.rst:167 +#: ../../library/base64.rst:170 msgid "" "Encode the :term:`bytes-like object` *s* using Base16 and return the " "encoded :class:`bytes`." @@ -288,7 +291,7 @@ msgstr "" "使用 Base16 對\\ :term:`類位元組物件 ` *s* 進行編碼,並回" "傳編碼後的 :class:`bytes`。" -#: ../../library/base64.rst:173 +#: ../../library/base64.rst:176 msgid "" "Decode the Base16 encoded :term:`bytes-like object` or ASCII string *s* and " "return the decoded :class:`bytes`." @@ -296,7 +299,52 @@ msgstr "" "解碼經過 Base16 編碼的\\ :term:`類位元組物件 `\\ 或 ASCII " "字串 *s*,並回傳解碼後的 :class:`bytes`。" -#: ../../library/base64.rst:187 +#: ../../library/base64.rst:190 +#, fuzzy +msgid "Base85 Encodings" +msgstr "base64 encoding(base64 編碼)" + +#: ../../library/base64.rst:192 +msgid "" +"Base85 encoding is not formally specified but rather a de facto standard, " +"thus different systems perform the encoding differently." +msgstr "" + +#: ../../library/base64.rst:195 +msgid "" +"The :func:`a85encode` and :func:`b85encode` functions in this module are two " +"implementations of the de facto standard. You should call the function with " +"the Base85 implementation used by the software you intend to work with." +msgstr "" + +#: ../../library/base64.rst:199 +msgid "" +"The two functions present in this module differ in how they handle the " +"following:" +msgstr "" + +#: ../../library/base64.rst:201 +msgid "Whether to include enclosing ``<~`` and ``~>`` markers" +msgstr "" + +#: ../../library/base64.rst:202 +msgid "Whether to include newline characters" +msgstr "" + +#: ../../library/base64.rst:203 +msgid "The set of ASCII characters used for encoding" +msgstr "" + +#: ../../library/base64.rst:204 +msgid "Handling of null bytes" +msgstr "" + +#: ../../library/base64.rst:206 +msgid "" +"Refer to the documentation of the individual functions for more information." +msgstr "" + +#: ../../library/base64.rst:210 msgid "" "Encode the :term:`bytes-like object` *b* using Ascii85 and return the " "encoded :class:`bytes`." @@ -304,7 +352,7 @@ msgstr "" "使用 Ascii85 對\\ :term:`類位元組物件 ` *b* 進行編碼,並回" "傳編碼後的 :class:`bytes`。" -#: ../../library/base64.rst:190 +#: ../../library/base64.rst:213 msgid "" "*foldspaces* is an optional flag that uses the special short sequence 'y' " "instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This " @@ -314,7 +362,7 @@ msgstr "" "(ASCII 0x20),這是由 'btoa' 支援的功能。這個特性不被「標準」的 Ascii85 編碼所" "支援。" -#: ../../library/base64.rst:194 +#: ../../library/base64.rst:217 msgid "" "*wrapcol* controls whether the output should have newline (``b'\\n'``) " "characters added to it. If this is non-zero, each output line will be at " @@ -323,7 +371,7 @@ msgstr "" "*wrapcol* 控制輸出是否應該包含換行字元 (``b'\\n'``) 。如果這個值不為零,每行" "輸出的長度將不超過這個字元長度(不包含後面的換行符號)。" -#: ../../library/base64.rst:198 +#: ../../library/base64.rst:221 msgid "" "*pad* controls whether the input is padded to a multiple of 4 before " "encoding. Note that the ``btoa`` implementation always pads." @@ -331,7 +379,7 @@ msgstr "" "*pad* 控制是否在編碼之前將輸入填充為 4 的倍數。請注意,``btoa`` 實作始終會填" "充。" -#: ../../library/base64.rst:201 +#: ../../library/base64.rst:224 msgid "" "*adobe* controls whether the encoded byte sequence is framed with ``<~`` and " "``~>``, which is used by the Adobe implementation." @@ -339,7 +387,7 @@ msgstr "" "*adobe* 控制編碼的位元組序列前後是否加上 ``<~`` 和 ``~>``,這是 Adobe 實作中" "使用的。" -#: ../../library/base64.rst:209 +#: ../../library/base64.rst:232 msgid "" "Decode the Ascii85 encoded :term:`bytes-like object` or ASCII string *b* and " "return the decoded :class:`bytes`." @@ -347,7 +395,7 @@ msgstr "" "解碼經過 Ascii85 編碼的\\ :term:`類位元組物件 `\\ 或 " "ASCII 字串 *b*,並回傳解碼後的 :class:`bytes`。" -#: ../../library/base64.rst:212 +#: ../../library/base64.rst:235 msgid "" "*foldspaces* is a flag that specifies whether the 'y' short sequence should " "be accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature " @@ -356,7 +404,7 @@ msgstr "" "*foldspaces* 是一個旗標,指定是否應該將短序列 'y' 視為 4 個連續的空格 (ASCII " "0x20) 的簡寫。這個功能不受「標準」Ascii85 編碼的支援。" -#: ../../library/base64.rst:216 +#: ../../library/base64.rst:239 msgid "" "*adobe* controls whether the input sequence is in Adobe Ascii85 format (i.e. " "is framed with <~ and ~>)." @@ -364,7 +412,7 @@ msgstr "" "*adobe* 控制輸入序列是否符合 Adobe Ascii85 格式(即前後加上 ``<~`` 和 " "``~>``)。" -#: ../../library/base64.rst:219 +#: ../../library/base64.rst:242 msgid "" "*ignorechars* should be a :term:`bytes-like object` or ASCII string " "containing characters to ignore from the input. This should only contain " @@ -375,7 +423,7 @@ msgstr "" "like object>`\\ 或 ASCII 字串。這只包含空格字元,預設情況下包含 ASCII 中的所" "有空格字元。" -#: ../../library/base64.rst:229 +#: ../../library/base64.rst:252 msgid "" "Encode the :term:`bytes-like object` *b* using base85 (as used in e.g. git-" "style binary diffs) and return the encoded :class:`bytes`." @@ -383,7 +431,7 @@ msgstr "" "使用 Base85(例如,git 風格的二進位差異 (binary diff))對\\ :term:`類位元組物" "件 ` *b* 進行編碼,並回傳編碼後的 :class:`bytes`。" -#: ../../library/base64.rst:232 +#: ../../library/base64.rst:255 msgid "" "If *pad* is true, the input is padded with ``b'\\0'`` so its length is a " "multiple of 4 bytes before encoding." @@ -391,7 +439,7 @@ msgstr "" "如果 *pad* 為 true,則在編碼之前,輸入將使用 ``b'\\0'`` 進行填充,以使其長度" "為 4 的倍數。" -#: ../../library/base64.rst:240 +#: ../../library/base64.rst:263 msgid "" "Decode the base85-encoded :term:`bytes-like object` or ASCII string *b* and " "return the decoded :class:`bytes`. Padding is implicitly removed, if " @@ -400,7 +448,7 @@ msgstr "" "解碼經過 base85 編碼的\\ :term:`類位元組物件 `\\ 或 ASCII " "字串 *b*,並回傳解碼後的 :class:`bytes`。必要時會隱式移除填充。" -#: ../../library/base64.rst:249 +#: ../../library/base64.rst:272 #, fuzzy msgid "" "Encode the :term:`bytes-like object` *s* using Z85 (as used in ZeroMQ) and " @@ -410,7 +458,7 @@ msgstr "" "使用 Base85(例如,git 風格的二進位差異 (binary diff))對\\ :term:`類位元組物" "件 ` *b* 進行編碼,並回傳編碼後的 :class:`bytes`。" -#: ../../library/base64.rst:258 +#: ../../library/base64.rst:281 #, fuzzy msgid "" "Decode the Z85-encoded :term:`bytes-like object` or ASCII string *s* and " @@ -420,11 +468,12 @@ msgstr "" "解碼經過 base85 編碼的\\ :term:`類位元組物件 `\\ 或 ASCII " "字串 *b*,並回傳解碼後的 :class:`bytes`。必要時會隱式移除填充。" -#: ../../library/base64.rst:265 -msgid "The legacy interface:" +#: ../../library/base64.rst:291 +#, fuzzy +msgid "Legacy Interface" msgstr "舊版介面:" -#: ../../library/base64.rst:269 +#: ../../library/base64.rst:295 msgid "" "Decode the contents of the binary *input* file and write the resulting " "binary data to the *output* file. *input* and *output* must be :term:`file " @@ -435,7 +484,7 @@ msgstr "" "*input* 和 *output* 必須是\\ :term:`檔案物件 `。*input* 將被讀" "取,直到 ``input.readline()`` 回傳一個空的 bytes 物件為止。" -#: ../../library/base64.rst:277 +#: ../../library/base64.rst:303 msgid "" "Decode the :term:`bytes-like object` *s*, which must contain one or more " "lines of base64 encoded data, and return the decoded :class:`bytes`." @@ -443,7 +492,7 @@ msgstr "" "解碼必須包含一行或多行的 base64 編碼資料\\ :term:`類位元組物件 ` *s*,並回傳解碼後的 :class:`bytes`。" -#: ../../library/base64.rst:285 +#: ../../library/base64.rst:311 msgid "" "Encode the contents of the binary *input* file and write the resulting " "base64 encoded data to the *output* file. *input* and *output* must be :term:" @@ -458,7 +507,7 @@ msgstr "" "出的每 76 個位元組之後插入一個換行字元 (``b'\\n'``),並確保輸出始終以換行字元" "結尾,符合 :rfc:`2045` (MIME) 的規定。" -#: ../../library/base64.rst:295 +#: ../../library/base64.rst:321 msgid "" "Encode the :term:`bytes-like object` *s*, which can contain arbitrary binary " "data, and return :class:`bytes` containing the base64-encoded data, with " @@ -469,15 +518,15 @@ msgstr "" "碼,並回傳包含 base64 編碼資料 :class:`bytes`,在每 76 個輸出位元組後插入換行" "字元 (``b'\\n'``) ,並確保有尾隨換行字元,符合 :rfc:`2045` (MIME) 的規定。" -#: ../../library/base64.rst:303 +#: ../../library/base64.rst:329 msgid "An example usage of the module:" msgstr "模組的一個範例用法:" -#: ../../library/base64.rst:316 +#: ../../library/base64.rst:342 msgid "Security Considerations" msgstr "安全性注意事項" -#: ../../library/base64.rst:318 +#: ../../library/base64.rst:344 msgid "" "A new security considerations section was added to :rfc:`4648` (section 12); " "it's recommended to review the security section for any code deployed to " @@ -486,18 +535,18 @@ msgstr "" ":rfc:`4648`\\ (第 12 節)中添加了一個新的安全性考量部分;建議對部署到正式環" "境的任何程式碼進行安全性部分的審查。" -#: ../../library/base64.rst:323 +#: ../../library/base64.rst:349 msgid "Module :mod:`binascii`" msgstr ":mod:`binascii` 模組" -#: ../../library/base64.rst:324 +#: ../../library/base64.rst:350 msgid "" "Support module containing ASCII-to-binary and binary-to-ASCII conversions." msgstr "" "支援模組中包含 ASCII 到二進位 (ASCII-to-binary) 和二進位到 ASCII (binary-to-" "ASCII) 的轉換功能。" -#: ../../library/base64.rst:326 +#: ../../library/base64.rst:352 msgid "" ":rfc:`1521` - MIME (Multipurpose Internet Mail Extensions) Part One: " "Mechanisms for Specifying and Describing the Format of Internet Message " @@ -506,7 +555,7 @@ msgstr "" ":rfc:`1521` - MIME(多用途網際網路郵件擴展)第一部分:指定和描述網際網路主體" "格式的機制。" -#: ../../library/base64.rst:327 +#: ../../library/base64.rst:353 msgid "" "Section 5.2, \"Base64 Content-Transfer-Encoding,\" provides the definition " "of the base64 encoding." @@ -528,3 +577,6 @@ msgstr "MIME" #: ../../library/base64.rst:10 msgid "base64 encoding" msgstr "base64 encoding(base64 編碼)" + +#~ msgid "The modern interface provides:" +#~ msgstr "新介面提供:" diff --git a/library/re.po b/library/re.po index f62cafba70..cdbc06599a 100644 --- a/library/re.po +++ b/library/re.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-11 00:15+0000\n" +"POT-Creation-Date: 2025-05-20 00:16+0000\n" "PO-Revision-Date: 2023-09-16 14:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -169,7 +169,7 @@ msgstr "" msgid "The special characters are:" msgstr "" -#: ../../library/re.rst:101 ../../library/re.rst:1658 +#: ../../library/re.rst:101 ../../library/re.rst:1660 msgid "``.``" msgstr "``.``" @@ -1239,8 +1239,8 @@ msgstr "" #: ../../library/re.rst:896 ../../library/re.rst:928 ../../library/re.rst:946 #: ../../library/re.rst:957 ../../library/re.rst:1003 ../../library/re.rst:1037 -#: ../../library/re.rst:1052 ../../library/re.rst:1111 -#: ../../library/re.rst:1147 +#: ../../library/re.rst:1052 ../../library/re.rst:1114 +#: ../../library/re.rst:1149 msgid "" "The expression's behaviour can be modified by specifying a *flags* value. " "Values can be any of the `flags`_ variables, combined using bitwise OR (the " @@ -1393,9 +1393,9 @@ msgstr "如此一來,分隔符號元件始終可以在結果串列中的相同 #: ../../library/re.rst:991 msgid "" -"Empty matches for the pattern split the string only when not adjacent to a " -"previous empty match." -msgstr "只有當與先前的空匹配不相鄰時,模式的空匹配才會拆分字串。" +"Adjacent empty matches are not possible, but an empty match can occur " +"immediately after a non-empty match." +msgstr "" #: ../../library/re.rst:994 msgid "" @@ -1415,7 +1415,7 @@ msgstr "" "['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', " "'']" -#: ../../library/re.rst:1007 ../../library/re.rst:1115 +#: ../../library/re.rst:1007 ../../library/re.rst:1118 msgid "Added the optional flags argument." msgstr "新增可選的旗標引數。" @@ -1538,18 +1538,24 @@ msgid "The pattern may be a string or a :class:`~re.Pattern`." msgstr "此模式可以是字串或 :class:`~re.Pattern`。" #: ../../library/re.rst:1093 +#, fuzzy msgid "" "The optional argument *count* is the maximum number of pattern occurrences " "to be replaced; *count* must be a non-negative integer. If omitted or zero, " -"all occurrences will be replaced. Empty matches for the pattern are replaced " -"only when not adjacent to a previous empty match, so ``sub('x*', '-', " -"'abxd')`` returns ``'-a-b--d-'``." +"all occurrences will be replaced." msgstr "" "可選引數 *count* 是要替換的模式出現的最大次數;*count* 必須是非負整數。如果省" "略或為零,則所有出現的內容都將被替換。只有當與先前的空匹配不相鄰時,模式的空" "匹配才會被替換,因此 ``sub('x*', '-', 'abxd')`` 會回傳 ``'-a-b--d -'``。" -#: ../../library/re.rst:1101 +#: ../../library/re.rst:1097 +msgid "" +"Adjacent empty matches are not possible, but an empty match can occur " +"immediately after a non-empty match. As a result, ``sub('x*', '-', 'abxd')`` " +"returns ``'-a-b--d-'`` instead of ``'-a-b-d-'``." +msgstr "" + +#: ../../library/re.rst:1104 msgid "" "In string-type *repl* arguments, in addition to the character escapes and " "backreferences described above, ``\\g`` will use the substring matched " @@ -1568,27 +1574,27 @@ msgstr "" "群組 20 的參照,而不是對後面跟著字面字元 ``'0'`` 的群組 2 的參照。反向參照 " "``\\g<0>`` 會取代以 RE 所匹配到的整個子字串。" -#: ../../library/re.rst:1118 ../../library/re.rst:1396 +#: ../../library/re.rst:1121 ../../library/re.rst:1398 msgid "Unmatched groups are replaced with an empty string." msgstr "不匹配的群組將被替換為空字串。" -#: ../../library/re.rst:1121 +#: ../../library/re.rst:1124 msgid "" "Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now " "are errors." msgstr "" "在由 ``'\\'`` 和一個 ASCII 字母組成之 *pattern* 中的未知轉義符現在為錯誤。" -#: ../../library/re.rst:1125 +#: ../../library/re.rst:1128 +#, fuzzy msgid "" "Unknown escapes in *repl* consisting of ``'\\'`` and an ASCII letter now are " -"errors. Empty matches for the pattern are replaced when adjacent to a " -"previous non-empty match." +"errors. An empty match can occur immediately after a non-empty match." msgstr "" "由 ``'\\'`` 和一個 ASCII 字母組成之 *repl* 中的未知轉義符現在為錯誤。當與先前" "的非空匹配相鄰時,模式的空匹配將被替換。" -#: ../../library/re.rst:1131 +#: ../../library/re.rst:1133 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` replacement " "strings, group *name* can only contain bytes in the ASCII range " @@ -1597,7 +1603,7 @@ msgstr "" "群組 *id* 只能包含 ASCII 數字。在 :class:`bytes` 替換字串中,群組 *name* 只能" "包含 ASCII 範圍內的位元組 (``b'\\x00'``-``b'\\x7f'``)。" -#: ../../library/re.rst:1136 +#: ../../library/re.rst:1138 msgid "" "Passing *count* and *flags* as positional arguments is deprecated. In future " "Python versions they will be :ref:`keyword-only parameters `。" -#: ../../library/re.rst:1144 +#: ../../library/re.rst:1146 msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." @@ -1614,7 +1620,7 @@ msgstr "" "執行與 :func:`sub` 相同的操作,但回傳一個元組 ``(new_string, " "number_of_subs_made)``。" -#: ../../library/re.rst:1154 +#: ../../library/re.rst:1156 msgid "" "Escape special characters in *pattern*. This is useful if you want to match " "an arbitrary literal string that may have regular expression metacharacters " @@ -1623,7 +1629,7 @@ msgstr "" "對 *pattern* 中的特殊字元進行轉義。如果你想要匹配其中可能包含正規表示式元字" "元 (metacharacter) 的任意文本字串,這會非常有用。例如: ::" -#: ../../library/re.rst:1158 +#: ../../library/re.rst:1160 msgid "" ">>> print(re.escape('https://www.python.org'))\n" "https://www\\.python\\.org\n" @@ -1649,7 +1655,7 @@ msgstr "" ">>> print('|'.join(map(re.escape, sorted(operators, reverse=True))))\n" "/|\\-|\\+|\\*\\*|\\*" -#: ../../library/re.rst:1169 +#: ../../library/re.rst:1171 msgid "" "This function must not be used for the replacement string in :func:`sub` " "and :func:`subn`, only backslashes should be escaped. For example::" @@ -1657,7 +1663,7 @@ msgstr "" "此函式不得用於 :func:`sub` 和 :func:`subn` 中的替換字串,僅應轉義反斜線。例" "如: ::" -#: ../../library/re.rst:1172 +#: ../../library/re.rst:1174 msgid "" ">>> digits_re = r'\\d+'\n" ">>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'\n" @@ -1669,11 +1675,11 @@ msgstr "" ">>> print(re.sub(digits_re, digits_re.replace('\\\\', r'\\\\'), sample))\n" "/usr/sbin/sendmail - \\d+ errors, \\d+ warnings" -#: ../../library/re.rst:1177 +#: ../../library/re.rst:1179 msgid "The ``'_'`` character is no longer escaped." msgstr "``'_'`` 字元不再被轉義。" -#: ../../library/re.rst:1180 +#: ../../library/re.rst:1182 msgid "" "Only characters that can have special meaning in a regular expression are " "escaped. As a result, ``'!'``, ``'\"'``, ``'%'``, ``\"'\"``, ``','``, " @@ -1681,15 +1687,15 @@ msgid "" "are no longer escaped." msgstr "" -#: ../../library/re.rst:1189 +#: ../../library/re.rst:1191 msgid "Clear the regular expression cache." msgstr "清除正規表示式快取。" -#: ../../library/re.rst:1193 +#: ../../library/re.rst:1195 msgid "Exceptions" msgstr "例外" -#: ../../library/re.rst:1197 +#: ../../library/re.rst:1199 msgid "" "Exception raised when a string passed to one of the functions here is not a " "valid regular expression (for example, it might contain unmatched " @@ -1702,52 +1708,52 @@ msgstr "" "或在編譯或匹配期間發生某些其他錯誤時,將引發例外。如果字串不包含模式匹配項," "則絕不是錯誤。``PatternError`` 實例具有以下附加屬性:" -#: ../../library/re.rst:1205 +#: ../../library/re.rst:1207 msgid "The unformatted error message." msgstr "未格式化的錯誤訊息。" -#: ../../library/re.rst:1209 +#: ../../library/re.rst:1211 msgid "The regular expression pattern." msgstr "正規表示式模式。" -#: ../../library/re.rst:1213 +#: ../../library/re.rst:1215 msgid "The index in *pattern* where compilation failed (may be ``None``)." msgstr "*pattern* 中編譯失敗的索引(可能是 ``None``)。" -#: ../../library/re.rst:1217 +#: ../../library/re.rst:1219 msgid "The line corresponding to *pos* (may be ``None``)." msgstr "對應 *pos* 的列(可能是 ``None``)。" -#: ../../library/re.rst:1221 +#: ../../library/re.rst:1223 msgid "The column corresponding to *pos* (may be ``None``)." msgstr "對應 *pos* 的欄(可能是 ``None``)。" -#: ../../library/re.rst:1223 +#: ../../library/re.rst:1225 msgid "Added additional attributes." msgstr "新增額外屬性。" -#: ../../library/re.rst:1226 +#: ../../library/re.rst:1228 msgid "" "``PatternError`` was originally named ``error``; the latter is kept as an " "alias for backward compatibility." msgstr "" "``PatternError`` 最初被命名為 ``error``;後者為了向後相容性而被保留為別名。" -#: ../../library/re.rst:1233 +#: ../../library/re.rst:1235 msgid "Regular Expression Objects" msgstr "" -#: ../../library/re.rst:1237 +#: ../../library/re.rst:1239 msgid "Compiled regular expression object returned by :func:`re.compile`." msgstr "" -#: ../../library/re.rst:1239 +#: ../../library/re.rst:1241 msgid "" ":py:class:`re.Pattern` supports ``[]`` to indicate a Unicode (str) or bytes " "pattern. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1245 +#: ../../library/re.rst:1247 msgid "" "Scan through *string* looking for the first location where this regular " "expression produces a match, and return a corresponding :class:`~re.Match`. " @@ -1756,7 +1762,7 @@ msgid "" "string." msgstr "" -#: ../../library/re.rst:1250 +#: ../../library/re.rst:1252 msgid "" "The optional second parameter *pos* gives an index in the string where the " "search is to start; it defaults to ``0``. This is not completely equivalent " @@ -1765,7 +1771,7 @@ msgid "" "necessarily at the index where the search is to start." msgstr "" -#: ../../library/re.rst:1256 +#: ../../library/re.rst:1258 msgid "" "The optional parameter *endpos* limits how far the string will be searched; " "it will be as if the string is *endpos* characters long, so only the " @@ -1775,7 +1781,7 @@ msgid "" "equivalent to ``rx.search(string[:50], 0)``. ::" msgstr "" -#: ../../library/re.rst:1263 +#: ../../library/re.rst:1265 msgid "" ">>> pattern = re.compile(\"d\")\n" ">>> pattern.search(\"dog\") # Match at index 0\n" @@ -1783,7 +1789,7 @@ msgid "" ">>> pattern.search(\"dog\", 1) # No match; search doesn't include the \"d\"" msgstr "" -#: ../../library/re.rst:1271 +#: ../../library/re.rst:1273 msgid "" "If zero or more characters at the *beginning* of *string* match this regular " "expression, return a corresponding :class:`~re.Match`. Return ``None`` if " @@ -1791,13 +1797,13 @@ msgid "" "zero-length match." msgstr "" -#: ../../library/re.rst:1276 ../../library/re.rst:1294 +#: ../../library/re.rst:1278 ../../library/re.rst:1296 msgid "" "The optional *pos* and *endpos* parameters have the same meaning as for the :" "meth:`~Pattern.search` method. ::" msgstr "" -#: ../../library/re.rst:1279 +#: ../../library/re.rst:1281 msgid "" ">>> pattern = re.compile(\"o\")\n" ">>> pattern.match(\"dog\") # No match as \"o\" is not at the start of " @@ -1807,20 +1813,20 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1284 +#: ../../library/re.rst:1286 msgid "" "If you want to locate a match anywhere in *string*, use :meth:`~Pattern." "search` instead (see also :ref:`search-vs-match`)." msgstr "" -#: ../../library/re.rst:1290 +#: ../../library/re.rst:1292 msgid "" "If the whole *string* matches this regular expression, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -#: ../../library/re.rst:1297 +#: ../../library/re.rst:1299 msgid "" ">>> pattern = re.compile(\"o[gh]\")\n" ">>> pattern.fullmatch(\"dog\") # No match as \"o\" is not at the start " @@ -1831,72 +1837,72 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1308 +#: ../../library/re.rst:1310 msgid "Identical to the :func:`split` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1313 +#: ../../library/re.rst:1315 msgid "" "Similar to the :func:`findall` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1320 +#: ../../library/re.rst:1322 msgid "" "Similar to the :func:`finditer` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1327 +#: ../../library/re.rst:1329 msgid "Identical to the :func:`sub` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1332 +#: ../../library/re.rst:1334 msgid "Identical to the :func:`subn` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1337 +#: ../../library/re.rst:1339 msgid "" "The regex matching flags. This is a combination of the flags given to :func:" "`.compile`, any ``(?...)`` inline flags in the pattern, and implicit flags " "such as :py:const:`~re.UNICODE` if the pattern is a Unicode string." msgstr "" -#: ../../library/re.rst:1344 +#: ../../library/re.rst:1346 msgid "The number of capturing groups in the pattern." msgstr "" -#: ../../library/re.rst:1349 +#: ../../library/re.rst:1351 msgid "" "A dictionary mapping any symbolic group names defined by ``(?P)`` to " "group numbers. The dictionary is empty if no symbolic groups were used in " "the pattern." msgstr "" -#: ../../library/re.rst:1356 +#: ../../library/re.rst:1358 msgid "The pattern string from which the pattern object was compiled." msgstr "" -#: ../../library/re.rst:1359 +#: ../../library/re.rst:1361 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Compiled " "regular expression objects are considered atomic." msgstr "" -#: ../../library/re.rst:1367 +#: ../../library/re.rst:1369 msgid "Match Objects" msgstr "" -#: ../../library/re.rst:1369 +#: ../../library/re.rst:1371 msgid "" "Match objects always have a boolean value of ``True``. Since :meth:`~Pattern." "match` and :meth:`~Pattern.search` return ``None`` when there is no match, " "you can test whether there was a match with a simple ``if`` statement::" msgstr "" -#: ../../library/re.rst:1374 +#: ../../library/re.rst:1376 msgid "" "match = re.search(pattern, string)\n" "if match:\n" @@ -1906,17 +1912,17 @@ msgstr "" "if match:\n" " process(match)" -#: ../../library/re.rst:1380 +#: ../../library/re.rst:1382 msgid "Match object returned by successful ``match``\\ es and ``search``\\ es." msgstr "" -#: ../../library/re.rst:1382 +#: ../../library/re.rst:1384 msgid "" ":py:class:`re.Match` supports ``[]`` to indicate a Unicode (str) or bytes " "match. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1388 +#: ../../library/re.rst:1390 msgid "" "Return the string obtained by doing backslash substitution on the template " "string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such " @@ -1926,7 +1932,7 @@ msgid "" "backreference ``\\g<0>`` will be replaced by the entire match." msgstr "" -#: ../../library/re.rst:1401 +#: ../../library/re.rst:1403 msgid "" "Returns one or more subgroups of the match. If there is a single argument, " "the result is a single string; if there are multiple arguments, the result " @@ -1941,7 +1947,7 @@ msgid "" "the pattern that matched multiple times, the last match is returned. ::" msgstr "" -#: ../../library/re.rst:1413 +#: ../../library/re.rst:1415 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m.group(0) # The entire match\n" @@ -1954,7 +1960,7 @@ msgid "" "('Isaac', 'Newton')" msgstr "" -#: ../../library/re.rst:1423 +#: ../../library/re.rst:1425 msgid "" "If the regular expression uses the ``(?P...)`` syntax, the *groupN* " "arguments may also be strings identifying groups by their group name. If a " @@ -1962,11 +1968,11 @@ msgid "" "`IndexError` exception is raised." msgstr "" -#: ../../library/re.rst:1428 +#: ../../library/re.rst:1430 msgid "A moderately complicated example::" msgstr "" -#: ../../library/re.rst:1430 +#: ../../library/re.rst:1432 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -1982,11 +1988,11 @@ msgstr "" ">>> m.group('last_name')\n" "'Reynolds'" -#: ../../library/re.rst:1436 +#: ../../library/re.rst:1438 msgid "Named groups can also be referred to by their index::" msgstr "" -#: ../../library/re.rst:1438 +#: ../../library/re.rst:1440 msgid "" ">>> m.group(1)\n" "'Malcolm'\n" @@ -1998,24 +2004,24 @@ msgstr "" ">>> m.group(2)\n" "'Reynolds'" -#: ../../library/re.rst:1443 +#: ../../library/re.rst:1445 msgid "If a group matches multiple times, only the last match is accessible::" msgstr "" -#: ../../library/re.rst:1445 +#: ../../library/re.rst:1447 msgid "" ">>> m = re.match(r\"(..)+\", \"a1b2c3\") # Matches 3 times.\n" ">>> m.group(1) # Returns only the last match.\n" "'c3'" msgstr "" -#: ../../library/re.rst:1452 +#: ../../library/re.rst:1454 msgid "" "This is identical to ``m.group(g)``. This allows easier access to an " "individual group from a match::" msgstr "" -#: ../../library/re.rst:1455 +#: ../../library/re.rst:1457 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m[0] # The entire match\n" @@ -2026,11 +2032,11 @@ msgid "" "'Newton'" msgstr "" -#: ../../library/re.rst:1463 +#: ../../library/re.rst:1465 msgid "Named groups are supported as well::" msgstr "" -#: ../../library/re.rst:1465 +#: ../../library/re.rst:1467 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Isaac " "Newton\")\n" @@ -2046,18 +2052,18 @@ msgstr "" ">>> m['last_name']\n" "'Newton'" -#: ../../library/re.rst:1476 +#: ../../library/re.rst:1478 msgid "" "Return a tuple containing all the subgroups of the match, from 1 up to " "however many groups are in the pattern. The *default* argument is used for " "groups that did not participate in the match; it defaults to ``None``." msgstr "" -#: ../../library/re.rst:1480 ../../library/re.rst:1705 +#: ../../library/re.rst:1482 ../../library/re.rst:1707 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/re.rst:1482 +#: ../../library/re.rst:1484 msgid "" ">>> m = re.match(r\"(\\d+)\\.(\\d+)\", \"24.1632\")\n" ">>> m.groups()\n" @@ -2067,14 +2073,14 @@ msgstr "" ">>> m.groups()\n" "('24', '1632')" -#: ../../library/re.rst:1486 +#: ../../library/re.rst:1488 msgid "" "If we make the decimal place and everything after it optional, not all " "groups might participate in the match. These groups will default to " "``None`` unless the *default* argument is given::" msgstr "" -#: ../../library/re.rst:1490 +#: ../../library/re.rst:1492 msgid "" ">>> m = re.match(r\"(\\d+)\\.?(\\d+)?\", \"24\")\n" ">>> m.groups() # Second group defaults to None.\n" @@ -2083,14 +2089,14 @@ msgid "" "('24', '0')" msgstr "" -#: ../../library/re.rst:1499 +#: ../../library/re.rst:1501 msgid "" "Return a dictionary containing all the *named* subgroups of the match, keyed " "by the subgroup name. The *default* argument is used for groups that did " "not participate in the match; it defaults to ``None``. For example::" msgstr "" -#: ../../library/re.rst:1503 +#: ../../library/re.rst:1505 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -2102,7 +2108,7 @@ msgstr "" ">>> m.groupdict()\n" "{'first_name': 'Malcolm', 'last_name': 'Reynolds'}" -#: ../../library/re.rst:1511 +#: ../../library/re.rst:1513 msgid "" "Return the indices of the start and end of the substring matched by *group*; " "*group* defaults to zero (meaning the whole matched substring). Return " @@ -2111,11 +2117,11 @@ msgid "" "matched by group *g* (equivalent to ``m.group(g)``) is ::" msgstr "" -#: ../../library/re.rst:1517 +#: ../../library/re.rst:1519 msgid "m.string[m.start(g):m.end(g)]" msgstr "m.string[m.start(g):m.end(g)]" -#: ../../library/re.rst:1519 +#: ../../library/re.rst:1521 msgid "" "Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched " "a null string. For example, after ``m = re.search('b(c?)', 'cba')``, ``m." @@ -2123,11 +2129,11 @@ msgid "" "2, and ``m.start(2)`` raises an :exc:`IndexError` exception." msgstr "" -#: ../../library/re.rst:1524 +#: ../../library/re.rst:1526 msgid "An example that will remove *remove_this* from email addresses::" msgstr "" -#: ../../library/re.rst:1526 +#: ../../library/re.rst:1528 msgid "" ">>> email = \"tony@tiremove_thisger.net\"\n" ">>> m = re.search(\"remove_this\", email)\n" @@ -2139,28 +2145,28 @@ msgstr "" ">>> email[:m.start()] + email[m.end():]\n" "'tony@tiger.net'" -#: ../../library/re.rst:1534 +#: ../../library/re.rst:1536 msgid "" "For a match *m*, return the 2-tuple ``(m.start(group), m.end(group))``. Note " "that if *group* did not contribute to the match, this is ``(-1, -1)``. " "*group* defaults to zero, the entire match." msgstr "" -#: ../../library/re.rst:1541 +#: ../../library/re.rst:1543 msgid "" "The value of *pos* which was passed to the :meth:`~Pattern.search` or :meth:" "`~Pattern.match` method of a :ref:`regex object `. This is the " "index into the string at which the RE engine started looking for a match." msgstr "" -#: ../../library/re.rst:1548 +#: ../../library/re.rst:1550 msgid "" "The value of *endpos* which was passed to the :meth:`~Pattern.search` or :" "meth:`~Pattern.match` method of a :ref:`regex object `. This is " "the index into the string beyond which the RE engine will not go." msgstr "" -#: ../../library/re.rst:1555 +#: ../../library/re.rst:1557 msgid "" "The integer index of the last matched capturing group, or ``None`` if no " "group was matched at all. For example, the expressions ``(a)b``, ``((a)" @@ -2169,43 +2175,43 @@ msgid "" "applied to the same string." msgstr "" -#: ../../library/re.rst:1564 +#: ../../library/re.rst:1566 msgid "" "The name of the last matched capturing group, or ``None`` if the group " "didn't have a name, or if no group was matched at all." msgstr "" -#: ../../library/re.rst:1570 +#: ../../library/re.rst:1572 msgid "" "The :ref:`regular expression object ` whose :meth:`~Pattern." "match` or :meth:`~Pattern.search` method produced this match instance." msgstr "" -#: ../../library/re.rst:1576 +#: ../../library/re.rst:1578 msgid "The string passed to :meth:`~Pattern.match` or :meth:`~Pattern.search`." msgstr "" -#: ../../library/re.rst:1579 +#: ../../library/re.rst:1581 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Match objects " "are considered atomic." msgstr "" -#: ../../library/re.rst:1587 +#: ../../library/re.rst:1589 msgid "Regular Expression Examples" msgstr "" -#: ../../library/re.rst:1591 +#: ../../library/re.rst:1593 msgid "Checking for a Pair" msgstr "" -#: ../../library/re.rst:1593 +#: ../../library/re.rst:1595 msgid "" "In this example, we'll use the following helper function to display match " "objects a little more gracefully::" msgstr "" -#: ../../library/re.rst:1596 +#: ../../library/re.rst:1598 msgid "" "def displaymatch(match):\n" " if match is None:\n" @@ -2217,7 +2223,7 @@ msgstr "" " return None\n" " return '' % (match.group(), match.groups())" -#: ../../library/re.rst:1601 +#: ../../library/re.rst:1603 msgid "" "Suppose you are writing a poker program where a player's hand is represented " "as a 5-character string with each character representing a card, \"a\" for " @@ -2225,11 +2231,11 @@ msgid "" "\"2\" through \"9\" representing the card with that value." msgstr "" -#: ../../library/re.rst:1606 +#: ../../library/re.rst:1608 msgid "To see if a given string is a valid hand, one could do the following::" msgstr "" -#: ../../library/re.rst:1608 +#: ../../library/re.rst:1610 msgid "" ">>> valid = re.compile(r\"^[a2-9tjqk]{5}$\")\n" ">>> displaymatch(valid.match(\"akt5q\")) # Valid.\n" @@ -2240,14 +2246,14 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1616 +#: ../../library/re.rst:1618 msgid "" "That last hand, ``\"727ak\"``, contained a pair, or two of the same valued " "cards. To match this with a regular expression, one could use backreferences " "as such::" msgstr "" -#: ../../library/re.rst:1619 +#: ../../library/re.rst:1621 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> displaymatch(pair.match(\"717ak\")) # Pair of 7s.\n" @@ -2257,13 +2263,13 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1626 +#: ../../library/re.rst:1628 msgid "" "To find out what card the pair consists of, one could use the :meth:`~Match." "group` method of the match object in the following manner::" msgstr "" -#: ../../library/re.rst:1629 +#: ../../library/re.rst:1631 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> pair.match(\"717ak\").group(1)\n" @@ -2281,11 +2287,11 @@ msgid "" "'a'" msgstr "" -#: ../../library/re.rst:1645 +#: ../../library/re.rst:1647 msgid "Simulating scanf()" msgstr "模擬 scanf()" -#: ../../library/re.rst:1649 +#: ../../library/re.rst:1651 msgid "" "Python does not currently have an equivalent to :c:func:`!scanf`. Regular " "expressions are generally more powerful, though also more verbose, than :c:" @@ -2294,130 +2300,130 @@ msgid "" "expressions." msgstr "" -#: ../../library/re.rst:1656 +#: ../../library/re.rst:1658 msgid ":c:func:`!scanf` Token" msgstr "" -#: ../../library/re.rst:1656 +#: ../../library/re.rst:1658 msgid "Regular Expression" msgstr "" -#: ../../library/re.rst:1658 +#: ../../library/re.rst:1660 msgid "``%c``" msgstr "``%c``" -#: ../../library/re.rst:1660 +#: ../../library/re.rst:1662 msgid "``%5c``" msgstr "``%5c``" -#: ../../library/re.rst:1660 +#: ../../library/re.rst:1662 msgid "``.{5}``" msgstr "``.{5}``" -#: ../../library/re.rst:1662 +#: ../../library/re.rst:1664 msgid "``%d``" msgstr "``%d``" -#: ../../library/re.rst:1662 +#: ../../library/re.rst:1664 msgid "``[-+]?\\d+``" msgstr "``[-+]?\\d+``" -#: ../../library/re.rst:1664 +#: ../../library/re.rst:1666 msgid "``%e``, ``%E``, ``%f``, ``%g``" msgstr "``%e``, ``%E``, ``%f``, ``%g``" -#: ../../library/re.rst:1664 +#: ../../library/re.rst:1666 msgid "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" msgstr "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" -#: ../../library/re.rst:1666 +#: ../../library/re.rst:1668 msgid "``%i``" msgstr "``%i``" -#: ../../library/re.rst:1666 +#: ../../library/re.rst:1668 msgid "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" msgstr "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" -#: ../../library/re.rst:1668 +#: ../../library/re.rst:1670 msgid "``%o``" msgstr "``%o``" -#: ../../library/re.rst:1668 +#: ../../library/re.rst:1670 msgid "``[-+]?[0-7]+``" msgstr "``[-+]?[0-7]+``" -#: ../../library/re.rst:1670 +#: ../../library/re.rst:1672 msgid "``%s``" msgstr "``%s``" -#: ../../library/re.rst:1670 +#: ../../library/re.rst:1672 msgid "``\\S+``" msgstr "``\\S+``" -#: ../../library/re.rst:1672 +#: ../../library/re.rst:1674 msgid "``%u``" msgstr "``%u``" -#: ../../library/re.rst:1672 +#: ../../library/re.rst:1674 msgid "``\\d+``" msgstr "``\\d+``" -#: ../../library/re.rst:1674 +#: ../../library/re.rst:1676 msgid "``%x``, ``%X``" msgstr "``%x``、``%X``" -#: ../../library/re.rst:1674 +#: ../../library/re.rst:1676 msgid "``[-+]?(0[xX])?[\\dA-Fa-f]+``" msgstr "``[-+]?(0[xX])?[\\dA-Fa-f]+``" -#: ../../library/re.rst:1677 +#: ../../library/re.rst:1679 msgid "To extract the filename and numbers from a string like ::" msgstr "" -#: ../../library/re.rst:1679 +#: ../../library/re.rst:1681 msgid "/usr/sbin/sendmail - 0 errors, 4 warnings" msgstr "/usr/sbin/sendmail - 0 errors, 4 warnings" -#: ../../library/re.rst:1681 +#: ../../library/re.rst:1683 msgid "you would use a :c:func:`!scanf` format like ::" msgstr "" -#: ../../library/re.rst:1683 +#: ../../library/re.rst:1685 msgid "%s - %d errors, %d warnings" msgstr "" -#: ../../library/re.rst:1685 +#: ../../library/re.rst:1687 msgid "The equivalent regular expression would be ::" msgstr "" -#: ../../library/re.rst:1687 +#: ../../library/re.rst:1689 msgid "(\\S+) - (\\d+) errors, (\\d+) warnings" msgstr "" -#: ../../library/re.rst:1693 +#: ../../library/re.rst:1695 msgid "search() vs. match()" msgstr "search() vs. match()" -#: ../../library/re.rst:1697 +#: ../../library/re.rst:1699 msgid "" "Python offers different primitive operations based on regular expressions:" msgstr "" -#: ../../library/re.rst:1699 +#: ../../library/re.rst:1701 msgid ":func:`re.match` checks for a match only at the beginning of the string" msgstr "" -#: ../../library/re.rst:1700 +#: ../../library/re.rst:1702 msgid "" ":func:`re.search` checks for a match anywhere in the string (this is what " "Perl does by default)" msgstr "" -#: ../../library/re.rst:1702 +#: ../../library/re.rst:1704 msgid ":func:`re.fullmatch` checks for entire string to be a match" msgstr "" -#: ../../library/re.rst:1707 +#: ../../library/re.rst:1709 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"c\", \"abcdef\") # Match\n" @@ -2427,13 +2433,13 @@ msgid "" ">>> re.fullmatch(\"r.*n\", \"python\") # No match" msgstr "" -#: ../../library/re.rst:1714 +#: ../../library/re.rst:1716 msgid "" "Regular expressions beginning with ``'^'`` can be used with :func:`search` " "to restrict the match at the beginning of the string::" msgstr "" -#: ../../library/re.rst:1717 +#: ../../library/re.rst:1719 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"^c\", \"abcdef\") # No match\n" @@ -2441,7 +2447,7 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1722 +#: ../../library/re.rst:1724 msgid "" "Note however that in :const:`MULTILINE` mode :func:`match` only matches at " "the beginning of the string, whereas using :func:`search` with a regular " @@ -2449,18 +2455,18 @@ msgid "" "line. ::" msgstr "" -#: ../../library/re.rst:1726 +#: ../../library/re.rst:1728 msgid "" ">>> re.match(\"X\", \"A\\nB\\nX\", re.MULTILINE) # No match\n" ">>> re.search(\"^X\", \"A\\nB\\nX\", re.MULTILINE) # Match\n" "" msgstr "" -#: ../../library/re.rst:1732 +#: ../../library/re.rst:1734 msgid "Making a Phonebook" msgstr "" -#: ../../library/re.rst:1734 +#: ../../library/re.rst:1736 msgid "" ":func:`split` splits a string into a list delimited by the passed pattern. " "The method is invaluable for converting textual data into data structures " @@ -2468,13 +2474,13 @@ msgid "" "following example that creates a phonebook." msgstr "" -#: ../../library/re.rst:1739 +#: ../../library/re.rst:1741 msgid "" "First, here is the input. Normally it may come from a file, here we are " "using triple-quoted string syntax" msgstr "" -#: ../../library/re.rst:1742 +#: ../../library/re.rst:1744 msgid "" ">>> text = \"\"\"Ross McFluff: 834.345.1254 155 Elm Street\n" "...\n" @@ -2492,13 +2498,13 @@ msgstr "" "...\n" "... Heather Albrecht: 548.326.4584 919 Park Place\"\"\"" -#: ../../library/re.rst:1752 +#: ../../library/re.rst:1754 msgid "" "The entries are separated by one or more newlines. Now we convert the string " "into a list with each nonempty line having its own entry:" msgstr "" -#: ../../library/re.rst:1755 +#: ../../library/re.rst:1757 msgid "" ">>> entries = re.split(\"\\n+\", text)\n" ">>> entries\n" @@ -2514,14 +2520,14 @@ msgstr "" "'Frank Burger: 925.541.7625 662 South Dogwood Way',\n" "'Heather Albrecht: 548.326.4584 919 Park Place']" -#: ../../library/re.rst:1765 +#: ../../library/re.rst:1767 msgid "" "Finally, split each entry into a list with first name, last name, telephone " "number, and address. We use the ``maxsplit`` parameter of :func:`split` " "because the address has spaces, our splitting pattern, in it:" msgstr "" -#: ../../library/re.rst:1769 +#: ../../library/re.rst:1771 msgid "" ">>> [re.split(\":? \", entry, maxsplit=3) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],\n" @@ -2535,14 +2541,14 @@ msgstr "" "['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]" -#: ../../library/re.rst:1778 +#: ../../library/re.rst:1780 msgid "" "The ``:?`` pattern matches the colon after the last name, so that it does " "not occur in the result list. With a ``maxsplit`` of ``4``, we could " "separate the house number from the street name:" msgstr "" -#: ../../library/re.rst:1782 +#: ../../library/re.rst:1784 msgid "" ">>> [re.split(\":? \", entry, maxsplit=4) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],\n" @@ -2556,11 +2562,11 @@ msgstr "" "['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]" -#: ../../library/re.rst:1793 +#: ../../library/re.rst:1795 msgid "Text Munging" msgstr "" -#: ../../library/re.rst:1795 +#: ../../library/re.rst:1797 msgid "" ":func:`sub` replaces every occurrence of a pattern with a string or the " "result of a function. This example demonstrates using :func:`sub` with a " @@ -2568,7 +2574,7 @@ msgid "" "each word of a sentence except for the first and last characters::" msgstr "" -#: ../../library/re.rst:1800 +#: ../../library/re.rst:1802 msgid "" ">>> def repl(m):\n" "... inner_word = list(m.group(2))\n" @@ -2592,11 +2598,11 @@ msgstr "" ">>> re.sub(r\"(\\w)(\\w+)(\\w)\", repl, text)\n" "'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'" -#: ../../library/re.rst:1813 +#: ../../library/re.rst:1815 msgid "Finding all Adverbs" msgstr "" -#: ../../library/re.rst:1815 +#: ../../library/re.rst:1817 msgid "" ":func:`findall` matches *all* occurrences of a pattern, not just the first " "one as :func:`search` does. For example, if a writer wanted to find all of " @@ -2604,7 +2610,7 @@ msgid "" "manner::" msgstr "" -#: ../../library/re.rst:1820 +#: ../../library/re.rst:1822 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> re.findall(r\"\\w+ly\\b\", text)\n" @@ -2614,11 +2620,11 @@ msgstr "" ">>> re.findall(r\"\\w+ly\\b\", text)\n" "['carefully', 'quickly']" -#: ../../library/re.rst:1826 +#: ../../library/re.rst:1828 msgid "Finding all Adverbs and their Positions" msgstr "" -#: ../../library/re.rst:1828 +#: ../../library/re.rst:1830 msgid "" "If one wants more information about all matches of a pattern than the " "matched text, :func:`finditer` is useful as it provides :class:`~re.Match` " @@ -2627,7 +2633,7 @@ msgid "" "they would use :func:`finditer` in the following manner::" msgstr "" -#: ../../library/re.rst:1834 +#: ../../library/re.rst:1836 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> for m in re.finditer(r\"\\w+ly\\b\", text):\n" @@ -2641,11 +2647,11 @@ msgstr "" "07-16: carefully\n" "40-47: quickly" -#: ../../library/re.rst:1842 +#: ../../library/re.rst:1844 msgid "Raw String Notation" msgstr "" -#: ../../library/re.rst:1844 +#: ../../library/re.rst:1846 msgid "" "Raw string notation (``r\"text\"``) keeps regular expressions sane. Without " "it, every backslash (``'\\'``) in a regular expression would have to be " @@ -2653,7 +2659,7 @@ msgid "" "lines of code are functionally identical::" msgstr "" -#: ../../library/re.rst:1849 +#: ../../library/re.rst:1851 msgid "" ">>> re.match(r\"\\W(.)\\1\\W\", \" ff \")\n" "\n" @@ -2665,7 +2671,7 @@ msgstr "" ">>> re.match(\"\\\\W(.)\\\\1\\\\W\", \" ff \")\n" "" -#: ../../library/re.rst:1854 +#: ../../library/re.rst:1856 msgid "" "When one wants to match a literal backslash, it must be escaped in the " "regular expression. With raw string notation, this means ``r\"\\\\\"``. " @@ -2673,7 +2679,7 @@ msgid "" "following lines of code functionally identical::" msgstr "" -#: ../../library/re.rst:1859 +#: ../../library/re.rst:1861 msgid "" ">>> re.match(r\"\\\\\", r\"\\\\\")\n" "\n" @@ -2685,25 +2691,25 @@ msgstr "" ">>> re.match(\"\\\\\\\\\", r\"\\\\\")\n" "" -#: ../../library/re.rst:1866 +#: ../../library/re.rst:1868 msgid "Writing a Tokenizer" msgstr "" -#: ../../library/re.rst:1868 +#: ../../library/re.rst:1870 msgid "" "A `tokenizer or scanner `_ " "analyzes a string to categorize groups of characters. This is a useful " "first step in writing a compiler or interpreter." msgstr "" -#: ../../library/re.rst:1872 +#: ../../library/re.rst:1874 msgid "" "The text categories are specified with regular expressions. The technique " "is to combine those into a single master regular expression and to loop over " "successive matches::" msgstr "" -#: ../../library/re.rst:1876 +#: ../../library/re.rst:1878 msgid "" "from typing import NamedTuple\n" "import re\n" @@ -2759,11 +2765,11 @@ msgid "" " print(token)" msgstr "" -#: ../../library/re.rst:1928 +#: ../../library/re.rst:1930 msgid "The tokenizer produces the following output::" msgstr "" -#: ../../library/re.rst:1930 +#: ../../library/re.rst:1932 msgid "" "Token(type='IF', value='IF', line=2, column=4)\n" "Token(type='ID', value='quantity', line=2, column=7)\n" @@ -2805,7 +2811,7 @@ msgstr "" "Token(type='ENDIF', value='ENDIF', line=5, column=4)\n" "Token(type='END', value=';', line=5, column=9)" -#: ../../library/re.rst:1951 +#: ../../library/re.rst:1953 msgid "" "Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O'Reilly Media, " "2009. The third edition of the book no longer covers Python at all, but the " @@ -2830,7 +2836,7 @@ msgstr ". (點)" #: ../../library/re.rst:590 ../../library/re.rst:606 ../../library/re.rst:614 #: ../../library/re.rst:628 ../../library/re.rst:636 ../../library/re.rst:653 #: ../../library/re.rst:667 ../../library/re.rst:672 ../../library/re.rst:863 -#: ../../library/re.rst:1099 +#: ../../library/re.rst:1102 msgid "in regular expressions" msgstr "於正規表示式中" @@ -3030,13 +3036,18 @@ msgstr "\\\\" msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/re.rst:1099 +#: ../../library/re.rst:1102 msgid "\\g" msgstr "\\g" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1649 msgid "scanf (C function)" msgstr "scanf(C 函式)" +#~ msgid "" +#~ "Empty matches for the pattern split the string only when not adjacent to " +#~ "a previous empty match." +#~ msgstr "只有當與先前的空匹配不相鄰時,模式的空匹配才會拆分字串。" + #~ msgid "scanf()" #~ msgstr "scanf()" From c37dff0f5420f53158343e32e8461c23b2ea0a7c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 21 May 2025 00:18:35 +0000 Subject: [PATCH 10/14] sync with cpython 35eb3b82 --- library/code.po | 104 +++-- library/decimal.po | 451 ++++++++++--------- library/io.po | 147 +++--- whatsnew/3.13.po | 1063 ++++++++++++++++++++++---------------------- 4 files changed, 896 insertions(+), 869 deletions(-) diff --git a/library/code.po b/library/code.po index 3d680b5ea3..9b0c8b3e67 100644 --- a/library/code.po +++ b/library/code.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-05-21 00:17+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,37 +43,45 @@ msgid "" "``'__console__'`` and key ``'__doc__'`` set to ``None``." msgstr "" -#: ../../library/code.rst:28 +#: ../../library/code.rst:25 +msgid "" +"Note that functions and classes objects created under an :class:`!" +"InteractiveInterpreter` instance will belong to the namespace specified by " +"*locals*. They are only pickleable if *locals* is the namespace of an " +"existing module." +msgstr "" + +#: ../../library/code.rst:34 msgid "" "Closely emulate the behavior of the interactive Python interpreter. This " "class builds on :class:`InteractiveInterpreter` and adds prompting using the " "familiar ``sys.ps1`` and ``sys.ps2``, and input buffering. If *local_exit* " -"is true, ``exit()`` and ``quit()`` in the console will not " -"raise :exc:`SystemExit`, but instead return to the calling code." +"is true, ``exit()`` and ``quit()`` in the console will not raise :exc:" +"`SystemExit`, but instead return to the calling code." msgstr "" -#: ../../library/code.rst:34 ../../library/code.rst:52 +#: ../../library/code.rst:40 ../../library/code.rst:58 msgid "Added *local_exit* parameter." msgstr "新增 *local_exit* 參數。" -#: ../../library/code.rst:39 +#: ../../library/code.rst:45 msgid "" "Convenience function to run a read-eval-print loop. This creates a new " "instance of :class:`InteractiveConsole` and sets *readfunc* to be used as " "the :meth:`InteractiveConsole.raw_input` method, if provided. If *local* is " "provided, it is passed to the :class:`InteractiveConsole` constructor for " "use as the default namespace for the interpreter loop. If *local_exit* is " -"provided, it is passed to the :class:`InteractiveConsole` constructor. " -"The :meth:`~InteractiveConsole.interact` method of the instance is then run " -"with *banner* and *exitmsg* passed as the banner and exit message to use, if " +"provided, it is passed to the :class:`InteractiveConsole` constructor. The :" +"meth:`~InteractiveConsole.interact` method of the instance is then run with " +"*banner* and *exitmsg* passed as the banner and exit message to use, if " "provided. The console object is discarded after use." msgstr "" -#: ../../library/code.rst:49 +#: ../../library/code.rst:55 msgid "Added *exitmsg* parameter." msgstr "新增 *exitmsg* 參數。" -#: ../../library/code.rst:57 +#: ../../library/code.rst:63 msgid "" "This function is useful for programs that want to emulate Python's " "interpreter main loop (a.k.a. the read-eval-print loop). The tricky part is " @@ -83,7 +91,7 @@ msgid "" "real interpreter main loop." msgstr "" -#: ../../library/code.rst:64 +#: ../../library/code.rst:70 msgid "" "*source* is the source string; *filename* is the optional filename from " "which source was read, defaulting to ``''``; and *symbol* is the " @@ -91,7 +99,7 @@ msgid "" "``'eval'`` or ``'exec'``." msgstr "" -#: ../../library/code.rst:69 +#: ../../library/code.rst:75 msgid "" "Returns a code object (the same as ``compile(source, filename, symbol)``) if " "the command is complete and valid; ``None`` if the command is incomplete; " @@ -100,32 +108,32 @@ msgid "" "contains an invalid literal." msgstr "" -#: ../../library/code.rst:79 +#: ../../library/code.rst:85 msgid "Interactive Interpreter Objects" msgstr "" -#: ../../library/code.rst:84 +#: ../../library/code.rst:90 msgid "" "Compile and run some source in the interpreter. Arguments are the same as " "for :func:`compile_command`; the default for *filename* is ``''``, " "and for *symbol* is ``'single'``. One of several things can happen:" msgstr "" -#: ../../library/code.rst:88 +#: ../../library/code.rst:94 msgid "" -"The input is incorrect; :func:`compile_command` raised an exception " -"(:exc:`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be " -"printed by calling the :meth:`showsyntaxerror` method. :meth:`runsource` " -"returns ``False``." +"The input is incorrect; :func:`compile_command` raised an exception (:exc:" +"`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be printed " +"by calling the :meth:`showsyntaxerror` method. :meth:`runsource` returns " +"``False``." msgstr "" -#: ../../library/code.rst:93 +#: ../../library/code.rst:99 msgid "" "The input is incomplete, and more input is required; :func:`compile_command` " "returned ``None``. :meth:`runsource` returns ``True``." msgstr "" -#: ../../library/code.rst:96 +#: ../../library/code.rst:102 msgid "" "The input is complete; :func:`compile_command` returned a code object. The " "code is executed by calling the :meth:`runcode` (which also handles run-time " @@ -133,27 +141,27 @@ msgid "" "``False``." msgstr "" -#: ../../library/code.rst:100 +#: ../../library/code.rst:106 msgid "" -"The return value can be used to decide whether to use ``sys.ps1`` or " -"``sys.ps2`` to prompt the next line." +"The return value can be used to decide whether to use ``sys.ps1`` or ``sys." +"ps2`` to prompt the next line." msgstr "" -#: ../../library/code.rst:106 +#: ../../library/code.rst:112 msgid "" "Execute a code object. When an exception occurs, :meth:`showtraceback` is " -"called to display a traceback. All exceptions are caught " -"except :exc:`SystemExit`, which is allowed to propagate." +"called to display a traceback. All exceptions are caught except :exc:" +"`SystemExit`, which is allowed to propagate." msgstr "" -#: ../../library/code.rst:110 +#: ../../library/code.rst:116 msgid "" "A note about :exc:`KeyboardInterrupt`: this exception may occur elsewhere in " "this code, and may not always be caught. The caller should be prepared to " "deal with it." msgstr "" -#: ../../library/code.rst:117 +#: ../../library/code.rst:123 msgid "" "Display the syntax error that just occurred. This does not display a stack " "trace because there isn't one for syntax errors. If *filename* is given, it " @@ -162,38 +170,38 @@ msgid "" "string. The output is written by the :meth:`write` method." msgstr "" -#: ../../library/code.rst:126 +#: ../../library/code.rst:132 msgid "" "Display the exception that just occurred. We remove the first stack item " "because it is within the interpreter object implementation. The output is " "written by the :meth:`write` method." msgstr "" -#: ../../library/code.rst:130 +#: ../../library/code.rst:136 msgid "" "The full chained traceback is displayed instead of just the primary " "traceback." msgstr "" -#: ../../library/code.rst:136 +#: ../../library/code.rst:142 msgid "" "Write a string to the standard error stream (``sys.stderr``). Derived " "classes should override this to provide the appropriate output handling as " "needed." msgstr "" -#: ../../library/code.rst:143 +#: ../../library/code.rst:149 msgid "Interactive Console Objects" msgstr "" -#: ../../library/code.rst:145 +#: ../../library/code.rst:151 msgid "" -"The :class:`InteractiveConsole` class is a subclass " -"of :class:`InteractiveInterpreter`, and so offers all the methods of the " -"interpreter objects as well as the following additions." +"The :class:`InteractiveConsole` class is a subclass of :class:" +"`InteractiveInterpreter`, and so offers all the methods of the interpreter " +"objects as well as the following additions." msgstr "" -#: ../../library/code.rst:152 +#: ../../library/code.rst:158 msgid "" "Closely emulate the interactive Python console. The optional *banner* " "argument specify the banner to print before the first interaction; by " @@ -203,22 +211,22 @@ msgid "" "close!)." msgstr "" -#: ../../library/code.rst:158 +#: ../../library/code.rst:164 msgid "" "The optional *exitmsg* argument specifies an exit message printed when " "exiting. Pass the empty string to suppress the exit message. If *exitmsg* is " "not given or ``None``, a default message is printed." msgstr "" -#: ../../library/code.rst:162 +#: ../../library/code.rst:168 msgid "To suppress printing any banner, pass an empty string." msgstr "" -#: ../../library/code.rst:165 +#: ../../library/code.rst:171 msgid "Print an exit message when exiting." msgstr "" -#: ../../library/code.rst:171 +#: ../../library/code.rst:177 msgid "" "Push a line of source text to the interpreter. The line should not have a " "trailing newline; it may have internal newlines. The line is appended to a " @@ -231,14 +239,14 @@ msgid "" "same as :meth:`!runsource`)." msgstr "" -#: ../../library/code.rst:183 +#: ../../library/code.rst:189 msgid "Remove any unhandled source text from the input buffer." msgstr "" -#: ../../library/code.rst:188 +#: ../../library/code.rst:194 msgid "" "Write a prompt and read a line. The returned line does not include the " -"trailing newline. When the user enters the EOF key " -"sequence, :exc:`EOFError` is raised. The base implementation reads from " -"``sys.stdin``; a subclass may replace this with a different implementation." +"trailing newline. When the user enters the EOF key sequence, :exc:" +"`EOFError` is raised. The base implementation reads from ``sys.stdin``; a " +"subclass may replace this with a different implementation." msgstr "" diff --git a/library/decimal.po b/library/decimal.po index b2f4740813..11b40dbc0a 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-25 00:15+0000\n" +"POT-Creation-Date: 2025-05-21 00:17+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -146,7 +146,7 @@ msgid "" msgstr "" #: ../../library/decimal.rst:125 -msgid "Quick-start Tutorial" +msgid "Quick-start tutorial" msgstr "" #: ../../library/decimal.rst:127 @@ -1192,12 +1192,12 @@ msgstr "" msgid "Return the square root of the argument to full precision." msgstr "" -#: ../../library/decimal.rst:875 ../../library/decimal.rst:1512 +#: ../../library/decimal.rst:875 ../../library/decimal.rst:1524 msgid "" "Convert to a string, using engineering notation if an exponent is needed." msgstr "" -#: ../../library/decimal.rst:877 ../../library/decimal.rst:1514 +#: ../../library/decimal.rst:877 ../../library/decimal.rst:1526 msgid "" "Engineering notation has an exponent which is a multiple of 3. This can " "leave up to 3 digits to the left of the decimal place and may require the " @@ -1469,53 +1469,50 @@ msgid "" "field is not specified or is :const:`None`, all flags are cleared." msgstr "" -#: ../../library/decimal.rst:1074 +#: ../../library/decimal.rst:1076 msgid "" -"*prec* is an integer in the range [``1``, :const:`MAX_PREC`] that sets the " -"precision for arithmetic operations in the context." +"An integer in the range [``1``, :const:`MAX_PREC`] that sets the precision " +"for arithmetic operations in the context." msgstr "" -#: ../../library/decimal.rst:1077 -msgid "" -"The *rounding* option is one of the constants listed in the section " -"`Rounding Modes`_." +#: ../../library/decimal.rst:1081 +msgid "One of the constants listed in the section `Rounding Modes`_." msgstr "" -#: ../../library/decimal.rst:1080 +#: ../../library/decimal.rst:1086 msgid "" -"The *traps* and *flags* fields list any signals to be set. Generally, new " -"contexts should only set traps and leave the flags clear." +"Lists of any signals to be set. Generally, new contexts should only set " +"traps and leave the flags clear." msgstr "" -#: ../../library/decimal.rst:1083 +#: ../../library/decimal.rst:1092 msgid "" -"The *Emin* and *Emax* fields are integers specifying the outer limits " -"allowable for exponents. *Emin* must be in the range [:const:`MIN_EMIN`, " -"``0``], *Emax* in the range [``0``, :const:`MAX_EMAX`]." +"Integers specifying the outer limits allowable for exponents. *Emin* must be " +"in the range [:const:`MIN_EMIN`, ``0``], *Emax* in the range [``0``, :const:" +"`MAX_EMAX`]." msgstr "" -#: ../../library/decimal.rst:1087 +#: ../../library/decimal.rst:1098 msgid "" -"The *capitals* field is either ``0`` or ``1`` (the default). If set to " -"``1``, exponents are printed with a capital ``E``; otherwise, a lowercase " -"``e`` is used: ``Decimal('6.02e+23')``." +"Either ``0`` or ``1`` (the default). If set to ``1``, exponents are printed " +"with a capital ``E``; otherwise, a lowercase ``e`` is used: " +"``Decimal('6.02e+23')``." msgstr "" -#: ../../library/decimal.rst:1091 +#: ../../library/decimal.rst:1104 msgid "" -"The *clamp* field is either ``0`` (the default) or ``1``. If set to ``1``, " -"the exponent ``e`` of a :class:`Decimal` instance representable in this " -"context is strictly limited to the range ``Emin - prec + 1 <= e <= Emax - " -"prec + 1``. If *clamp* is ``0`` then a weaker condition holds: the adjusted " -"exponent of the :class:`Decimal` instance is at most :attr:`~Context.Emax`. " -"When *clamp* is ``1``, a large normal number will, where possible, have its " -"exponent reduced and a corresponding number of zeros added to its " -"coefficient, in order to fit the exponent constraints; this preserves the " -"value of the number but loses information about significant trailing zeros. " -"For example::" +"Either ``0`` (the default) or ``1``. If set to ``1``, the exponent ``e`` of " +"a :class:`Decimal` instance representable in this context is strictly " +"limited to the range ``Emin - prec + 1 <= e <= Emax - prec + 1``. If *clamp* " +"is ``0`` then a weaker condition holds: the adjusted exponent of the :class:" +"`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is ``1``, " +"a large normal number will, where possible, have its exponent reduced and a " +"corresponding number of zeros added to its coefficient, in order to fit the " +"exponent constraints; this preserves the value of the number but loses " +"information about significant trailing zeros. For example::" msgstr "" -#: ../../library/decimal.rst:1103 +#: ../../library/decimal.rst:1115 msgid "" ">>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')\n" "Decimal('1.23000E+999')" @@ -1523,13 +1520,13 @@ msgstr "" ">>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')\n" "Decimal('1.23000E+999')" -#: ../../library/decimal.rst:1106 +#: ../../library/decimal.rst:1118 msgid "" "A *clamp* value of ``1`` allows compatibility with the fixed-width decimal " "interchange formats specified in IEEE 754." msgstr "" -#: ../../library/decimal.rst:1109 +#: ../../library/decimal.rst:1121 msgid "" "The :class:`Context` class defines several general purpose methods as well " "as a large number of methods for doing arithmetic directly in a given " @@ -1542,30 +1539,30 @@ msgid "" "instance of :class:`int`) anywhere that a Decimal instance is accepted." msgstr "" -#: ../../library/decimal.rst:1122 +#: ../../library/decimal.rst:1134 msgid "Resets all of the flags to ``0``." msgstr "" -#: ../../library/decimal.rst:1126 +#: ../../library/decimal.rst:1138 msgid "Resets all of the traps to ``0``." msgstr "" -#: ../../library/decimal.rst:1132 +#: ../../library/decimal.rst:1144 msgid "Return a duplicate of the context." msgstr "" -#: ../../library/decimal.rst:1136 +#: ../../library/decimal.rst:1148 msgid "Return a copy of the Decimal instance num." msgstr "" -#: ../../library/decimal.rst:1140 +#: ../../library/decimal.rst:1152 msgid "" "Creates a new Decimal instance from *num* but using *self* as context. " "Unlike the :class:`Decimal` constructor, the context precision, rounding " "method, flags, and traps are applied to the conversion." msgstr "" -#: ../../library/decimal.rst:1144 +#: ../../library/decimal.rst:1156 msgid "" "This is useful because constants are often given to a greater precision than " "is needed by the application. Another benefit is that rounding immediately " @@ -1574,7 +1571,7 @@ msgid "" "sum can change the result:" msgstr "" -#: ../../library/decimal.rst:1150 +#: ../../library/decimal.rst:1162 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.4445') + Decimal('1.0023')\n" @@ -1588,14 +1585,14 @@ msgstr "" ">>> Decimal('3.4445') + Decimal(0) + Decimal('1.0023')\n" "Decimal('4.44')" -#: ../../library/decimal.rst:1158 +#: ../../library/decimal.rst:1170 msgid "" "This method implements the to-number operation of the IBM specification. If " "the argument is a string, no leading or trailing whitespace or underscores " "are permitted." msgstr "" -#: ../../library/decimal.rst:1164 +#: ../../library/decimal.rst:1176 msgid "" "Creates a new Decimal instance from a float *f* but rounding using *self* as " "the context. Unlike the :meth:`Decimal.from_float` class method, the " @@ -1603,7 +1600,7 @@ msgid "" "conversion." msgstr "" -#: ../../library/decimal.rst:1169 +#: ../../library/decimal.rst:1181 msgid "" ">>> context = Context(prec=5, rounding=ROUND_DOWN)\n" ">>> context.create_decimal_from_float(math.pi)\n" @@ -1623,18 +1620,18 @@ msgstr "" " ...\n" "decimal.Inexact: None" -#: ../../library/decimal.rst:1184 +#: ../../library/decimal.rst:1196 msgid "" "Returns a value equal to ``Emin - prec + 1`` which is the minimum exponent " "value for subnormal results. When underflow occurs, the exponent is set to :" "const:`Etiny`." msgstr "" -#: ../../library/decimal.rst:1190 +#: ../../library/decimal.rst:1202 msgid "Returns a value equal to ``Emax - prec + 1``." msgstr "" -#: ../../library/decimal.rst:1192 +#: ../../library/decimal.rst:1204 msgid "" "The usual approach to working with decimals is to create :class:`Decimal` " "instances and then apply arithmetic operations which take place within the " @@ -1644,189 +1641,189 @@ msgid "" "recounted here." msgstr "" -#: ../../library/decimal.rst:1202 +#: ../../library/decimal.rst:1214 msgid "Returns the absolute value of *x*." msgstr "" -#: ../../library/decimal.rst:1207 +#: ../../library/decimal.rst:1219 msgid "Return the sum of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1212 +#: ../../library/decimal.rst:1224 msgid "Returns the same Decimal object *x*." msgstr "" -#: ../../library/decimal.rst:1217 +#: ../../library/decimal.rst:1229 msgid "Compares *x* and *y* numerically." msgstr "" -#: ../../library/decimal.rst:1222 +#: ../../library/decimal.rst:1234 msgid "Compares the values of the two operands numerically." msgstr "" -#: ../../library/decimal.rst:1227 +#: ../../library/decimal.rst:1239 msgid "Compares two operands using their abstract representation." msgstr "" -#: ../../library/decimal.rst:1232 +#: ../../library/decimal.rst:1244 msgid "" "Compares two operands using their abstract representation, ignoring sign." msgstr "" -#: ../../library/decimal.rst:1237 +#: ../../library/decimal.rst:1249 msgid "Returns a copy of *x* with the sign set to 0." msgstr "" -#: ../../library/decimal.rst:1242 +#: ../../library/decimal.rst:1254 msgid "Returns a copy of *x* with the sign inverted." msgstr "" -#: ../../library/decimal.rst:1247 +#: ../../library/decimal.rst:1259 msgid "Copies the sign from *y* to *x*." msgstr "" -#: ../../library/decimal.rst:1252 +#: ../../library/decimal.rst:1264 msgid "Return *x* divided by *y*." msgstr "" -#: ../../library/decimal.rst:1257 +#: ../../library/decimal.rst:1269 msgid "Return *x* divided by *y*, truncated to an integer." msgstr "" -#: ../../library/decimal.rst:1262 +#: ../../library/decimal.rst:1274 msgid "Divides two numbers and returns the integer part of the result." msgstr "" -#: ../../library/decimal.rst:1267 +#: ../../library/decimal.rst:1279 msgid "Returns ``e ** x``." msgstr "" -#: ../../library/decimal.rst:1272 +#: ../../library/decimal.rst:1284 msgid "Returns *x* multiplied by *y*, plus *z*." msgstr "" -#: ../../library/decimal.rst:1277 +#: ../../library/decimal.rst:1289 msgid "Returns ``True`` if *x* is canonical; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1282 +#: ../../library/decimal.rst:1294 msgid "Returns ``True`` if *x* is finite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1287 +#: ../../library/decimal.rst:1299 msgid "Returns ``True`` if *x* is infinite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1292 +#: ../../library/decimal.rst:1304 msgid "Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1297 +#: ../../library/decimal.rst:1309 msgid "" "Returns ``True`` if *x* is a normal number; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1302 +#: ../../library/decimal.rst:1314 msgid "Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1307 +#: ../../library/decimal.rst:1319 msgid "Returns ``True`` if *x* is negative; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1312 +#: ../../library/decimal.rst:1324 msgid "" "Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1317 +#: ../../library/decimal.rst:1329 msgid "Returns ``True`` if *x* is subnormal; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1322 +#: ../../library/decimal.rst:1334 msgid "Returns ``True`` if *x* is a zero; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1327 +#: ../../library/decimal.rst:1339 msgid "Returns the natural (base e) logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1332 +#: ../../library/decimal.rst:1344 msgid "Returns the base 10 logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1337 +#: ../../library/decimal.rst:1349 msgid "Returns the exponent of the magnitude of the operand's MSD." msgstr "" -#: ../../library/decimal.rst:1342 +#: ../../library/decimal.rst:1354 msgid "Applies the logical operation *and* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1347 +#: ../../library/decimal.rst:1359 msgid "Invert all the digits in *x*." msgstr "" -#: ../../library/decimal.rst:1352 +#: ../../library/decimal.rst:1364 msgid "Applies the logical operation *or* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1357 +#: ../../library/decimal.rst:1369 msgid "Applies the logical operation *xor* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1362 +#: ../../library/decimal.rst:1374 msgid "Compares two values numerically and returns the maximum." msgstr "" -#: ../../library/decimal.rst:1367 ../../library/decimal.rst:1377 +#: ../../library/decimal.rst:1379 ../../library/decimal.rst:1389 msgid "Compares the values numerically with their sign ignored." msgstr "" -#: ../../library/decimal.rst:1372 +#: ../../library/decimal.rst:1384 msgid "Compares two values numerically and returns the minimum." msgstr "" -#: ../../library/decimal.rst:1382 +#: ../../library/decimal.rst:1394 msgid "Minus corresponds to the unary prefix minus operator in Python." msgstr "" -#: ../../library/decimal.rst:1387 +#: ../../library/decimal.rst:1399 msgid "Return the product of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1392 +#: ../../library/decimal.rst:1404 msgid "Returns the largest representable number smaller than *x*." msgstr "" -#: ../../library/decimal.rst:1397 +#: ../../library/decimal.rst:1409 msgid "Returns the smallest representable number larger than *x*." msgstr "" -#: ../../library/decimal.rst:1402 +#: ../../library/decimal.rst:1414 msgid "Returns the number closest to *x*, in direction towards *y*." msgstr "" -#: ../../library/decimal.rst:1407 +#: ../../library/decimal.rst:1419 msgid "Reduces *x* to its simplest form." msgstr "" -#: ../../library/decimal.rst:1412 +#: ../../library/decimal.rst:1424 msgid "Returns an indication of the class of *x*." msgstr "" -#: ../../library/decimal.rst:1417 +#: ../../library/decimal.rst:1429 msgid "" "Plus corresponds to the unary prefix plus operator in Python. This " "operation applies the context precision and rounding, so it is *not* an " "identity operation." msgstr "" -#: ../../library/decimal.rst:1424 +#: ../../library/decimal.rst:1436 msgid "Return ``x`` to the power of ``y``, reduced modulo ``modulo`` if given." msgstr "" -#: ../../library/decimal.rst:1426 +#: ../../library/decimal.rst:1438 msgid "" "With two arguments, compute ``x**y``. If ``x`` is negative then ``y`` must " "be integral. The result will be inexact unless ``y`` is integral and the " @@ -1835,42 +1832,42 @@ msgid "" "in the Python version." msgstr "" -#: ../../library/decimal.rst:1432 +#: ../../library/decimal.rst:1444 msgid "" "``Decimal(0) ** Decimal(0)`` results in ``InvalidOperation``, and if " "``InvalidOperation`` is not trapped, then results in ``Decimal('NaN')``." msgstr "" -#: ../../library/decimal.rst:1435 +#: ../../library/decimal.rst:1447 msgid "" "The C module computes :meth:`power` in terms of the correctly rounded :meth:" "`exp` and :meth:`ln` functions. The result is well-defined but only \"almost " "always correctly rounded\"." msgstr "" -#: ../../library/decimal.rst:1440 +#: ../../library/decimal.rst:1452 msgid "" "With three arguments, compute ``(x**y) % modulo``. For the three argument " "form, the following restrictions on the arguments hold:" msgstr "" -#: ../../library/decimal.rst:1443 +#: ../../library/decimal.rst:1455 msgid "all three arguments must be integral" msgstr "" -#: ../../library/decimal.rst:1444 +#: ../../library/decimal.rst:1456 msgid "``y`` must be nonnegative" msgstr "" -#: ../../library/decimal.rst:1445 +#: ../../library/decimal.rst:1457 msgid "at least one of ``x`` or ``y`` must be nonzero" msgstr "" -#: ../../library/decimal.rst:1446 +#: ../../library/decimal.rst:1458 msgid "``modulo`` must be nonzero and have at most 'precision' digits" msgstr "" -#: ../../library/decimal.rst:1448 +#: ../../library/decimal.rst:1460 msgid "" "The value resulting from ``Context.power(x, y, modulo)`` is equal to the " "value that would be obtained by computing ``(x**y) % modulo`` with unbounded " @@ -1879,110 +1876,110 @@ msgid "" "result is always exact." msgstr "" -#: ../../library/decimal.rst:1458 +#: ../../library/decimal.rst:1470 msgid "Returns a value equal to *x* (rounded), having the exponent of *y*." msgstr "" -#: ../../library/decimal.rst:1463 +#: ../../library/decimal.rst:1475 msgid "Just returns 10, as this is Decimal, :)" msgstr "" -#: ../../library/decimal.rst:1468 +#: ../../library/decimal.rst:1480 msgid "Returns the remainder from integer division." msgstr "" -#: ../../library/decimal.rst:1470 +#: ../../library/decimal.rst:1482 msgid "" "The sign of the result, if non-zero, is the same as that of the original " "dividend." msgstr "" -#: ../../library/decimal.rst:1476 +#: ../../library/decimal.rst:1488 msgid "" "Returns ``x - y * n``, where *n* is the integer nearest the exact value of " "``x / y`` (if the result is 0 then its sign will be the sign of *x*)." msgstr "" -#: ../../library/decimal.rst:1482 +#: ../../library/decimal.rst:1494 msgid "Returns a rotated copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1487 +#: ../../library/decimal.rst:1499 msgid "Returns ``True`` if the two operands have the same exponent." msgstr "" -#: ../../library/decimal.rst:1492 +#: ../../library/decimal.rst:1504 msgid "Returns the first operand after adding the second value its exp." msgstr "" -#: ../../library/decimal.rst:1497 +#: ../../library/decimal.rst:1509 msgid "Returns a shifted copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1502 +#: ../../library/decimal.rst:1514 msgid "Square root of a non-negative number to context precision." msgstr "" -#: ../../library/decimal.rst:1507 +#: ../../library/decimal.rst:1519 msgid "Return the difference between *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1521 +#: ../../library/decimal.rst:1533 msgid "Rounds to an integer." msgstr "" -#: ../../library/decimal.rst:1526 +#: ../../library/decimal.rst:1538 msgid "Converts a number to a string using scientific notation." msgstr "" -#: ../../library/decimal.rst:1533 +#: ../../library/decimal.rst:1545 msgid "Constants" msgstr "常數" -#: ../../library/decimal.rst:1535 +#: ../../library/decimal.rst:1547 msgid "" "The constants in this section are only relevant for the C module. They are " "also included in the pure Python version for compatibility." msgstr "" -#: ../../library/decimal.rst:1539 +#: ../../library/decimal.rst:1551 msgid "32-bit" msgstr "32 位元" -#: ../../library/decimal.rst:1539 +#: ../../library/decimal.rst:1551 msgid "64-bit" msgstr "64 位元" -#: ../../library/decimal.rst:1541 ../../library/decimal.rst:1543 +#: ../../library/decimal.rst:1553 ../../library/decimal.rst:1555 msgid "``425000000``" msgstr "``425000000``" -#: ../../library/decimal.rst:1541 ../../library/decimal.rst:1543 +#: ../../library/decimal.rst:1553 ../../library/decimal.rst:1555 msgid "``999999999999999999``" msgstr "``999999999999999999``" -#: ../../library/decimal.rst:1545 +#: ../../library/decimal.rst:1557 msgid "``-425000000``" msgstr "``-425000000``" -#: ../../library/decimal.rst:1545 +#: ../../library/decimal.rst:1557 msgid "``-999999999999999999``" msgstr "``-999999999999999999``" -#: ../../library/decimal.rst:1547 +#: ../../library/decimal.rst:1559 msgid "``-849999999``" msgstr "``-849999999``" -#: ../../library/decimal.rst:1547 +#: ../../library/decimal.rst:1559 msgid "``-1999999999999999997``" msgstr "``-1999999999999999997``" -#: ../../library/decimal.rst:1553 +#: ../../library/decimal.rst:1565 msgid "" "The value is ``True``. Deprecated, because Python now always has threads." msgstr "" -#: ../../library/decimal.rst:1559 +#: ../../library/decimal.rst:1571 msgid "" "The default value is ``True``. If Python is :option:`configured using the --" "without-decimal-contextvar option <--without-decimal-contextvar>`, the C " @@ -1991,55 +1988,55 @@ msgid "" "scenarios." msgstr "" -#: ../../library/decimal.rst:1568 +#: ../../library/decimal.rst:1580 msgid "Rounding modes" msgstr "" -#: ../../library/decimal.rst:1572 +#: ../../library/decimal.rst:1584 msgid "Round towards ``Infinity``." msgstr "" -#: ../../library/decimal.rst:1576 +#: ../../library/decimal.rst:1588 msgid "Round towards zero." msgstr "" -#: ../../library/decimal.rst:1580 +#: ../../library/decimal.rst:1592 msgid "Round towards ``-Infinity``." msgstr "" -#: ../../library/decimal.rst:1584 +#: ../../library/decimal.rst:1596 msgid "Round to nearest with ties going towards zero." msgstr "" -#: ../../library/decimal.rst:1588 +#: ../../library/decimal.rst:1600 msgid "Round to nearest with ties going to nearest even integer." msgstr "" -#: ../../library/decimal.rst:1592 +#: ../../library/decimal.rst:1604 msgid "Round to nearest with ties going away from zero." msgstr "" -#: ../../library/decimal.rst:1596 +#: ../../library/decimal.rst:1608 msgid "Round away from zero." msgstr "" -#: ../../library/decimal.rst:1600 +#: ../../library/decimal.rst:1612 msgid "" "Round away from zero if last digit after rounding towards zero would have " "been 0 or 5; otherwise round towards zero." msgstr "" -#: ../../library/decimal.rst:1607 +#: ../../library/decimal.rst:1619 msgid "Signals" msgstr "" -#: ../../library/decimal.rst:1609 +#: ../../library/decimal.rst:1621 msgid "" "Signals represent conditions that arise during computation. Each corresponds " "to one context flag and one context trap enabler." msgstr "" -#: ../../library/decimal.rst:1612 +#: ../../library/decimal.rst:1624 msgid "" "The context flag is set whenever the condition is encountered. After the " "computation, flags may be checked for informational purposes (for instance, " @@ -2047,7 +2044,7 @@ msgid "" "sure to clear all flags before starting the next computation." msgstr "" -#: ../../library/decimal.rst:1617 +#: ../../library/decimal.rst:1629 msgid "" "If the context's trap enabler is set for the signal, then the condition " "causes a Python exception to be raised. For example, if the :class:" @@ -2055,54 +2052,54 @@ msgid "" "raised upon encountering the condition." msgstr "" -#: ../../library/decimal.rst:1625 +#: ../../library/decimal.rst:1637 msgid "Altered an exponent to fit representation constraints." msgstr "" -#: ../../library/decimal.rst:1627 +#: ../../library/decimal.rst:1639 msgid "" "Typically, clamping occurs when an exponent falls outside the context's :" "attr:`~Context.Emin` and :attr:`~Context.Emax` limits. If possible, the " "exponent is reduced to fit by adding zeros to the coefficient." msgstr "" -#: ../../library/decimal.rst:1634 +#: ../../library/decimal.rst:1646 msgid "Base class for other signals and a subclass of :exc:`ArithmeticError`." msgstr "" -#: ../../library/decimal.rst:1639 +#: ../../library/decimal.rst:1651 msgid "Signals the division of a non-infinite number by zero." msgstr "" -#: ../../library/decimal.rst:1641 +#: ../../library/decimal.rst:1653 msgid "" "Can occur with division, modulo division, or when raising a number to a " "negative power. If this signal is not trapped, returns ``Infinity`` or ``-" "Infinity`` with the sign determined by the inputs to the calculation." msgstr "" -#: ../../library/decimal.rst:1648 +#: ../../library/decimal.rst:1660 msgid "Indicates that rounding occurred and the result is not exact." msgstr "" -#: ../../library/decimal.rst:1650 +#: ../../library/decimal.rst:1662 msgid "" "Signals when non-zero digits were discarded during rounding. The rounded " "result is returned. The signal flag or trap is used to detect when results " "are inexact." msgstr "" -#: ../../library/decimal.rst:1657 +#: ../../library/decimal.rst:1669 msgid "An invalid operation was performed." msgstr "" -#: ../../library/decimal.rst:1659 +#: ../../library/decimal.rst:1671 msgid "" "Indicates that an operation was requested that does not make sense. If not " "trapped, returns ``NaN``. Possible causes include::" msgstr "" -#: ../../library/decimal.rst:1662 +#: ../../library/decimal.rst:1674 msgid "" "Infinity - Infinity\n" "0 * Infinity\n" @@ -2124,11 +2121,11 @@ msgstr "" "x ** (non-integer)\n" "x ** Infinity" -#: ../../library/decimal.rst:1675 +#: ../../library/decimal.rst:1687 msgid "Numerical overflow." msgstr "" -#: ../../library/decimal.rst:1677 +#: ../../library/decimal.rst:1689 msgid "" "Indicates the exponent is larger than :attr:`Context.Emax` after rounding " "has occurred. If not trapped, the result depends on the rounding mode, " @@ -2137,42 +2134,42 @@ msgid "" "`Rounded` are also signaled." msgstr "" -#: ../../library/decimal.rst:1686 +#: ../../library/decimal.rst:1698 msgid "Rounding occurred though possibly no information was lost." msgstr "" -#: ../../library/decimal.rst:1688 +#: ../../library/decimal.rst:1700 msgid "" "Signaled whenever rounding discards digits; even if those digits are zero " "(such as rounding ``5.00`` to ``5.0``). If not trapped, returns the result " "unchanged. This signal is used to detect loss of significant digits." msgstr "" -#: ../../library/decimal.rst:1696 +#: ../../library/decimal.rst:1708 msgid "Exponent was lower than :attr:`~Context.Emin` prior to rounding." msgstr "" -#: ../../library/decimal.rst:1698 +#: ../../library/decimal.rst:1710 msgid "" "Occurs when an operation result is subnormal (the exponent is too small). If " "not trapped, returns the result unchanged." msgstr "" -#: ../../library/decimal.rst:1704 +#: ../../library/decimal.rst:1716 msgid "Numerical underflow with result rounded to zero." msgstr "" -#: ../../library/decimal.rst:1706 +#: ../../library/decimal.rst:1718 msgid "" "Occurs when a subnormal result is pushed to zero by rounding. :class:" "`Inexact` and :class:`Subnormal` are also signaled." msgstr "" -#: ../../library/decimal.rst:1712 +#: ../../library/decimal.rst:1724 msgid "Enable stricter semantics for mixing floats and Decimals." msgstr "" -#: ../../library/decimal.rst:1714 +#: ../../library/decimal.rst:1726 msgid "" "If the signal is not trapped (default), mixing floats and Decimals is " "permitted in the :class:`~decimal.Decimal` constructor, :meth:`~decimal." @@ -2183,18 +2180,18 @@ msgid "" "Context.create_decimal_from_float` do not set the flag." msgstr "" -#: ../../library/decimal.rst:1722 +#: ../../library/decimal.rst:1734 msgid "" "Otherwise (the signal is trapped), only equality comparisons and explicit " "conversions are silent. All other mixed operations raise :exc:" "`FloatOperation`." msgstr "" -#: ../../library/decimal.rst:1726 +#: ../../library/decimal.rst:1738 msgid "The following table summarizes the hierarchy of signals::" msgstr "" -#: ../../library/decimal.rst:1728 +#: ../../library/decimal.rst:1740 msgid "" "exceptions.ArithmeticError(exceptions.Exception)\n" " DecimalException\n" @@ -2220,15 +2217,15 @@ msgstr "" " Subnormal\n" " FloatOperation(DecimalException, exceptions.TypeError)" -#: ../../library/decimal.rst:1747 -msgid "Floating-Point Notes" +#: ../../library/decimal.rst:1759 +msgid "Floating-point notes" msgstr "" -#: ../../library/decimal.rst:1751 +#: ../../library/decimal.rst:1763 msgid "Mitigating round-off error with increased precision" msgstr "" -#: ../../library/decimal.rst:1753 +#: ../../library/decimal.rst:1765 msgid "" "The use of decimal floating point eliminates decimal representation error " "(making it possible to represent ``0.1`` exactly); however, some operations " @@ -2236,7 +2233,7 @@ msgid "" "precision." msgstr "" -#: ../../library/decimal.rst:1757 +#: ../../library/decimal.rst:1769 msgid "" "The effects of round-off error can be amplified by the addition or " "subtraction of nearly offsetting quantities resulting in loss of " @@ -2245,7 +2242,7 @@ msgid "" "of the associative and distributive properties of addition:" msgstr "" -#: ../../library/decimal.rst:1763 +#: ../../library/decimal.rst:1775 msgid "" "# Examples from Seminumerical Algorithms, Section 4.2.2.\n" ">>> from decimal import Decimal, getcontext\n" @@ -2264,13 +2261,13 @@ msgid "" "Decimal('0.0060000')" msgstr "" -#: ../../library/decimal.rst:1781 +#: ../../library/decimal.rst:1793 msgid "" "The :mod:`decimal` module makes it possible to restore the identities by " "expanding the precision sufficiently to avoid loss of significance:" msgstr "" -#: ../../library/decimal.rst:1784 +#: ../../library/decimal.rst:1796 msgid "" ">>> getcontext().prec = 20\n" ">>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n" @@ -2286,18 +2283,18 @@ msgid "" "Decimal('0.0060000')" msgstr "" -#: ../../library/decimal.rst:1801 +#: ../../library/decimal.rst:1813 msgid "Special values" msgstr "特殊值" -#: ../../library/decimal.rst:1803 +#: ../../library/decimal.rst:1815 msgid "" "The number system for the :mod:`decimal` module provides special values " "including ``NaN``, ``sNaN``, ``-Infinity``, ``Infinity``, and two zeros, " "``+0`` and ``-0``." msgstr "" -#: ../../library/decimal.rst:1807 +#: ../../library/decimal.rst:1819 msgid "" "Infinities can be constructed directly with: ``Decimal('Infinity')``. Also, " "they can arise from dividing by zero when the :exc:`DivisionByZero` signal " @@ -2306,14 +2303,14 @@ msgid "" "representable number." msgstr "" -#: ../../library/decimal.rst:1812 +#: ../../library/decimal.rst:1824 msgid "" "The infinities are signed (affine) and can be used in arithmetic operations " "where they get treated as very large, indeterminate numbers. For instance, " "adding a constant to infinity gives another infinite result." msgstr "" -#: ../../library/decimal.rst:1816 +#: ../../library/decimal.rst:1828 msgid "" "Some operations are indeterminate and return ``NaN``, or if the :exc:" "`InvalidOperation` signal is trapped, raise an exception. For example, " @@ -2324,14 +2321,14 @@ msgid "" "the calculation to proceed while flagging specific results as invalid." msgstr "" -#: ../../library/decimal.rst:1824 +#: ../../library/decimal.rst:1836 msgid "" "A variant is ``sNaN`` which signals rather than remaining quiet after every " "operation. This is a useful return value when an invalid result needs to " "interrupt a calculation for special handling." msgstr "" -#: ../../library/decimal.rst:1828 +#: ../../library/decimal.rst:1840 msgid "" "The behavior of Python's comparison operators can be a little surprising " "where a ``NaN`` is involved. A test for equality where one of the operands " @@ -2348,7 +2345,7 @@ msgid "" "compare_signal` methods instead." msgstr "" -#: ../../library/decimal.rst:1841 +#: ../../library/decimal.rst:1853 msgid "" "The signed zeros can result from calculations that underflow. They keep the " "sign that would have resulted if the calculation had been carried out to " @@ -2356,7 +2353,7 @@ msgid "" "negative zeros are treated as equal and their sign is informational." msgstr "" -#: ../../library/decimal.rst:1846 +#: ../../library/decimal.rst:1858 msgid "" "In addition to the two signed zeros which are distinct yet equal, there are " "various representations of zero with differing precisions yet equivalent in " @@ -2365,11 +2362,11 @@ msgid "" "that the following calculation returns a value equal to zero:" msgstr "" -#: ../../library/decimal.rst:1861 +#: ../../library/decimal.rst:1873 msgid "Working with threads" msgstr "" -#: ../../library/decimal.rst:1863 +#: ../../library/decimal.rst:1875 msgid "" "The :func:`getcontext` function accesses a different :class:`Context` object " "for each thread. Having separate thread contexts means that threads may " @@ -2377,20 +2374,20 @@ msgid "" "other threads." msgstr "" -#: ../../library/decimal.rst:1867 +#: ../../library/decimal.rst:1879 msgid "" "Likewise, the :func:`setcontext` function automatically assigns its target " "to the current thread." msgstr "" -#: ../../library/decimal.rst:1870 +#: ../../library/decimal.rst:1882 msgid "" "If :func:`setcontext` has not been called before :func:`getcontext`, then :" "func:`getcontext` will automatically create a new context for use in the " "current thread." msgstr "" -#: ../../library/decimal.rst:1874 +#: ../../library/decimal.rst:1886 msgid "" "The new context is copied from a prototype context called *DefaultContext*. " "To control the defaults so that each thread will use the same values " @@ -2399,7 +2396,7 @@ msgid "" "a race condition between threads calling :func:`getcontext`. For example::" msgstr "" -#: ../../library/decimal.rst:1880 +#: ../../library/decimal.rst:1892 msgid "" "# Set applicationwide defaults for all threads about to be launched\n" "DefaultContext.prec = 12\n" @@ -2415,17 +2412,17 @@ msgid "" " . . ." msgstr "" -#: ../../library/decimal.rst:1899 +#: ../../library/decimal.rst:1911 msgid "Recipes" msgstr "" -#: ../../library/decimal.rst:1901 +#: ../../library/decimal.rst:1913 msgid "" "Here are a few recipes that serve as utility functions and that demonstrate " "ways to work with the :class:`Decimal` class::" msgstr "" -#: ../../library/decimal.rst:1904 +#: ../../library/decimal.rst:1916 msgid "" "def moneyfmt(value, places=2, curr='', sep=',', dp='.',\n" " pos='', neg='-', trailneg=''):\n" @@ -2574,41 +2571,41 @@ msgid "" " return +s" msgstr "" -#: ../../library/decimal.rst:2056 +#: ../../library/decimal.rst:2068 msgid "Decimal FAQ" msgstr "" -#: ../../library/decimal.rst:2058 +#: ../../library/decimal.rst:2070 msgid "" "Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way " "to minimize typing when using the interactive interpreter?" msgstr "" -#: ../../library/decimal.rst:2061 +#: ../../library/decimal.rst:2073 msgid "A. Some users abbreviate the constructor to just a single letter:" msgstr "" -#: ../../library/decimal.rst:2067 +#: ../../library/decimal.rst:2079 msgid "" "Q. In a fixed-point application with two decimal places, some inputs have " "many places and need to be rounded. Others are not supposed to have excess " "digits and need to be validated. What methods should be used?" msgstr "" -#: ../../library/decimal.rst:2071 +#: ../../library/decimal.rst:2083 msgid "" "A. The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal " "places. If the :const:`Inexact` trap is set, it is also useful for " "validation:" msgstr "" -#: ../../library/decimal.rst:2089 +#: ../../library/decimal.rst:2101 msgid "" "Q. Once I have valid two place inputs, how do I maintain that invariant " "throughout an application?" msgstr "" -#: ../../library/decimal.rst:2092 +#: ../../library/decimal.rst:2104 msgid "" "A. Some operations like addition, subtraction, and multiplication by an " "integer will automatically preserve fixed point. Others operations, like " @@ -2616,13 +2613,13 @@ msgid "" "places and need to be followed-up with a :meth:`~Decimal.quantize` step:" msgstr "" -#: ../../library/decimal.rst:2110 +#: ../../library/decimal.rst:2122 msgid "" "In developing fixed-point applications, it is convenient to define functions " "to handle the :meth:`~Decimal.quantize` step:" msgstr "" -#: ../../library/decimal.rst:2124 +#: ../../library/decimal.rst:2136 msgid "" "Q. There are many ways to express the same value. The numbers ``200``, " "``200.000``, ``2E2``, and ``.02E+4`` all have the same value at various " @@ -2630,17 +2627,17 @@ msgid "" "canonical value?" msgstr "" -#: ../../library/decimal.rst:2129 +#: ../../library/decimal.rst:2141 msgid "" "A. The :meth:`~Decimal.normalize` method maps all equivalent values to a " "single representative:" msgstr "" -#: ../../library/decimal.rst:2136 +#: ../../library/decimal.rst:2148 msgid "Q. When does rounding occur in a computation?" msgstr "" -#: ../../library/decimal.rst:2138 +#: ../../library/decimal.rst:2150 msgid "" "A. It occurs *after* the computation. The philosophy of the decimal " "specification is that numbers are considered exact and are created " @@ -2650,7 +2647,7 @@ msgid "" "computation::" msgstr "" -#: ../../library/decimal.rst:2145 +#: ../../library/decimal.rst:2157 msgid "" ">>> getcontext().prec = 5\n" ">>> pi = Decimal('3.1415926535') # More than 5 digits\n" @@ -2664,13 +2661,13 @@ msgid "" "Decimal('3.1416')" msgstr "" -#: ../../library/decimal.rst:2156 +#: ../../library/decimal.rst:2168 msgid "" "Q. Some decimal values always print with exponential notation. Is there a " "way to get a non-exponential representation?" msgstr "" -#: ../../library/decimal.rst:2159 +#: ../../library/decimal.rst:2171 msgid "" "A. For some values, exponential notation is the only way to express the " "number of significant places in the coefficient. For example, expressing " @@ -2678,25 +2675,25 @@ msgid "" "original's two-place significance." msgstr "" -#: ../../library/decimal.rst:2164 +#: ../../library/decimal.rst:2176 msgid "" "If an application does not care about tracking significance, it is easy to " "remove the exponent and trailing zeroes, losing significance, but keeping " "the value unchanged:" msgstr "" -#: ../../library/decimal.rst:2174 +#: ../../library/decimal.rst:2186 msgid "Q. Is there a way to convert a regular float to a :class:`Decimal`?" msgstr "" -#: ../../library/decimal.rst:2176 +#: ../../library/decimal.rst:2188 msgid "" "A. Yes, any binary floating-point number can be exactly expressed as a " "Decimal though an exact conversion may take more precision than intuition " "would suggest:" msgstr "" -#: ../../library/decimal.rst:2180 +#: ../../library/decimal.rst:2192 msgid "" ">>> Decimal(math.pi)\n" "Decimal('3.141592653589793115997963468544185161590576171875')" @@ -2704,13 +2701,13 @@ msgstr "" ">>> Decimal(math.pi)\n" "Decimal('3.141592653589793115997963468544185161590576171875')" -#: ../../library/decimal.rst:2185 +#: ../../library/decimal.rst:2197 msgid "" "Q. Within a complex calculation, how can I make sure that I haven't gotten a " "spurious result because of insufficient precision or rounding anomalies." msgstr "" -#: ../../library/decimal.rst:2188 +#: ../../library/decimal.rst:2200 msgid "" "A. The decimal module makes it easy to test results. A best practice is to " "re-run calculations using greater precision and with various rounding modes. " @@ -2718,14 +2715,14 @@ msgid "" "issues, ill-conditioned inputs, or a numerically unstable algorithm." msgstr "" -#: ../../library/decimal.rst:2193 +#: ../../library/decimal.rst:2205 msgid "" "Q. I noticed that context precision is applied to the results of operations " "but not to the inputs. Is there anything to watch out for when mixing " "values of different precisions?" msgstr "" -#: ../../library/decimal.rst:2197 +#: ../../library/decimal.rst:2209 msgid "" "A. Yes. The principle is that all values are considered to be exact and so " "is the arithmetic on those values. Only the results are rounded. The " @@ -2734,7 +2731,7 @@ msgid "" "haven't been rounded:" msgstr "" -#: ../../library/decimal.rst:2202 +#: ../../library/decimal.rst:2214 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.104') + Decimal('2.104')\n" @@ -2748,30 +2745,30 @@ msgstr "" ">>> Decimal('3.104') + Decimal('0.000') + Decimal('2.104')\n" "Decimal('5.20')" -#: ../../library/decimal.rst:2210 +#: ../../library/decimal.rst:2222 msgid "" "The solution is either to increase precision or to force rounding of inputs " "using the unary plus operation:" msgstr "" -#: ../../library/decimal.rst:2213 +#: ../../library/decimal.rst:2225 msgid "" ">>> getcontext().prec = 3\n" ">>> +Decimal('1.23456789') # unary plus triggers rounding\n" "Decimal('1.23')" msgstr "" -#: ../../library/decimal.rst:2219 +#: ../../library/decimal.rst:2231 msgid "" "Alternatively, inputs can be rounded upon creation using the :meth:`Context." "create_decimal` method:" msgstr "" -#: ../../library/decimal.rst:2225 +#: ../../library/decimal.rst:2237 msgid "Q. Is the CPython implementation fast for large numbers?" msgstr "" -#: ../../library/decimal.rst:2227 +#: ../../library/decimal.rst:2239 msgid "" "A. Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of " "the decimal module integrate the high speed `libmpdec >> setcontext(Context(prec=MAX_PREC, Emax=MAX_EMAX, Emin=MIN_EMIN))\n" ">>> x = Decimal(2) ** 256\n" @@ -2810,13 +2807,13 @@ msgstr "" ">>> x / 128\n" "Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')" -#: ../../library/decimal.rst:2250 +#: ../../library/decimal.rst:2262 msgid "" "For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms " "and the available memory will be insufficient::" msgstr "" -#: ../../library/decimal.rst:2253 +#: ../../library/decimal.rst:2265 msgid "" ">>> Decimal(1) / 3\n" "Traceback (most recent call last):\n" @@ -2828,7 +2825,7 @@ msgstr "" " File \"\", line 1, in \n" "MemoryError" -#: ../../library/decimal.rst:2258 +#: ../../library/decimal.rst:2270 msgid "" "On systems with overallocation (e.g. Linux), a more sophisticated approach " "is to adjust :attr:`~Context.prec` to the amount of available RAM. Suppose " @@ -2836,7 +2833,7 @@ msgid "" "of 500MB each::" msgstr "" -#: ../../library/decimal.rst:2262 +#: ../../library/decimal.rst:2274 msgid "" ">>> import sys\n" ">>>\n" @@ -2860,14 +2857,14 @@ msgid "" " decimal.Inexact: []" msgstr "" -#: ../../library/decimal.rst:2282 +#: ../../library/decimal.rst:2294 msgid "" "In general (and especially on systems without overallocation), it is " "recommended to estimate even tighter bounds and set the :attr:`Inexact` trap " "if all calculations are expected to be exact." msgstr "" -#: ../../library/decimal.rst:2291 +#: ../../library/decimal.rst:2303 msgid "" "This approach now works for all exact results except for non-integer powers." msgstr "" diff --git a/library/io.po b/library/io.po index d248520927..e4f192af21 100644 --- a/library/io.po +++ b/library/io.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-04 00:16+0000\n" +"POT-Creation-Date: 2025-05-21 00:17+0000\n" "PO-Revision-Date: 2023-12-08 00:08+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -77,7 +77,7 @@ msgstr "" "原本會引發 :exc:`IOError` 的操作,現在將改成引發 :exc:`OSError`。因為 :exc:" "`IOError` 現在是 :exc:`OSError` 的別名。" -#: ../../library/io.rst:51 ../../library/io.rst:855 ../../library/io.rst:1150 +#: ../../library/io.rst:51 ../../library/io.rst:855 ../../library/io.rst:1151 msgid "Text I/O" msgstr "文字 I/O" @@ -118,7 +118,7 @@ msgid "" "`TextIOBase`." msgstr "文字資料串流 API 的詳細說明在 :class:`TextIOBase` 文件當中。" -#: ../../library/io.rst:72 ../../library/io.rst:1138 +#: ../../library/io.rst:72 ../../library/io.rst:1139 msgid "Binary I/O" msgstr "二進位 (Binary) I/O" @@ -778,7 +778,7 @@ msgid "" "negative" msgstr ":data:`os.SEEK_END` 或 ``2`` -- 串流的結尾;*offset* 通常是負數" -#: ../../library/io.rst:420 ../../library/io.rst:930 +#: ../../library/io.rst:420 ../../library/io.rst:931 msgid "The :data:`!SEEK_*` constants." msgstr ":data:`!SEEK_*` 常數。" @@ -1460,96 +1460,99 @@ msgid "" msgstr "" #: ../../library/io.rst:882 +#, fuzzy msgid "" -"The underlying binary buffer (a :class:`BufferedIOBase` instance) that :" -"class:`TextIOBase` deals with. This is not part of the :class:`TextIOBase` " -"API and may not exist in some implementations." +"The underlying binary buffer (a :class:`BufferedIOBase` or :class:" +"`RawIOBase` instance) that :class:`TextIOBase` deals with. This is not part " +"of the :class:`TextIOBase` API and may not exist in some implementations." msgstr "" +"底層的原始串流(一個 :class:`RawIOBase` 實例),:class:`BufferedIOBase` 處理" +"的對象。這不是 :class:`BufferedIOBase` API 的一部分,且在某些實作可能不存在。" -#: ../../library/io.rst:888 +#: ../../library/io.rst:889 msgid "" "Separate the underlying binary buffer from the :class:`TextIOBase` and " "return it." msgstr "" -#: ../../library/io.rst:891 +#: ../../library/io.rst:892 msgid "" "After the underlying buffer has been detached, the :class:`TextIOBase` is in " "an unusable state." msgstr "" -#: ../../library/io.rst:894 +#: ../../library/io.rst:895 msgid "" "Some :class:`TextIOBase` implementations, like :class:`StringIO`, may not " "have the concept of an underlying buffer and calling this method will raise :" "exc:`UnsupportedOperation`." msgstr "" -#: ../../library/io.rst:902 +#: ../../library/io.rst:903 msgid "" "Read and return at most *size* characters from the stream as a single :class:" "`str`. If *size* is negative or ``None``, reads until EOF." msgstr "" -#: ../../library/io.rst:907 +#: ../../library/io.rst:908 msgid "" "Read until newline or EOF and return a single :class:`str`. If the stream " "is already at EOF, an empty string is returned." msgstr "" -#: ../../library/io.rst:910 +#: ../../library/io.rst:911 msgid "If *size* is specified, at most *size* characters will be read." msgstr "" -#: ../../library/io.rst:914 +#: ../../library/io.rst:915 msgid "" "Change the stream position to the given *offset*. Behaviour depends on the " "*whence* parameter. The default value for *whence* is :data:`!SEEK_SET`." msgstr "" -#: ../../library/io.rst:918 +#: ../../library/io.rst:919 msgid "" ":data:`!SEEK_SET` or ``0``: seek from the start of the stream (the default); " "*offset* must either be a number returned by :meth:`TextIOBase.tell`, or " "zero. Any other *offset* value produces undefined behaviour." msgstr "" -#: ../../library/io.rst:922 +#: ../../library/io.rst:923 msgid "" ":data:`!SEEK_CUR` or ``1``: \"seek\" to the current position; *offset* must " "be zero, which is a no-operation (all other values are unsupported)." msgstr "" -#: ../../library/io.rst:925 +#: ../../library/io.rst:926 msgid "" ":data:`!SEEK_END` or ``2``: seek to the end of the stream; *offset* must be " "zero (all other values are unsupported)." msgstr "" -#: ../../library/io.rst:928 +#: ../../library/io.rst:929 msgid "Return the new absolute position as an opaque number." msgstr "" -#: ../../library/io.rst:935 +#: ../../library/io.rst:936 msgid "" "Return the current stream position as an opaque number. The number does not " "usually represent a number of bytes in the underlying binary storage." msgstr "" -#: ../../library/io.rst:941 +#: ../../library/io.rst:942 msgid "" "Write the string *s* to the stream and return the number of characters " "written." msgstr "" -#: ../../library/io.rst:948 +#: ../../library/io.rst:949 msgid "" "A buffered text stream providing higher-level access to a :class:" "`BufferedIOBase` buffered binary stream. It inherits from :class:" "`TextIOBase`." msgstr "" -#: ../../library/io.rst:952 +#: ../../library/io.rst:953 msgid "" "*encoding* gives the name of the encoding that the stream will be decoded or " "encoded with. In :ref:`UTF-8 Mode `, this defaults to UTF-8. " @@ -1558,7 +1561,7 @@ msgid "" "explicitly. See :ref:`io-text-encoding` for more information." msgstr "" -#: ../../library/io.rst:958 +#: ../../library/io.rst:959 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled. Pass ``'strict'`` to raise a :exc:`ValueError` " @@ -1573,13 +1576,13 @@ msgid "" "that has been registered with :func:`codecs.register_error` is also valid." msgstr "" -#: ../../library/io.rst:974 +#: ../../library/io.rst:975 msgid "" "*newline* controls how line endings are handled. It can be ``None``, " "``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as follows:" msgstr "" -#: ../../library/io.rst:977 +#: ../../library/io.rst:978 msgid "" "When reading input from the stream, if *newline* is ``None``, :term:" "`universal newlines` mode is enabled. Lines in the input can end in " @@ -1591,7 +1594,7 @@ msgid "" "returned to the caller untranslated." msgstr "" -#: ../../library/io.rst:986 +#: ../../library/io.rst:987 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -1600,13 +1603,13 @@ msgid "" "characters written are translated to the given string." msgstr "" -#: ../../library/io.rst:992 +#: ../../library/io.rst:993 msgid "" "If *line_buffering* is ``True``, :meth:`~IOBase.flush` is implied when a " "call to write contains a newline character or a carriage return." msgstr "" -#: ../../library/io.rst:995 +#: ../../library/io.rst:996 msgid "" "If *write_through* is ``True``, calls to :meth:`~BufferedIOBase.write` are " "guaranteed not to be buffered: any data written on the :class:" @@ -1614,11 +1617,11 @@ msgid "" "*buffer*." msgstr "" -#: ../../library/io.rst:999 +#: ../../library/io.rst:1000 msgid "The *write_through* argument has been added." msgstr "" -#: ../../library/io.rst:1002 +#: ../../library/io.rst:1003 msgid "" "The default *encoding* is now ``locale.getpreferredencoding(False)`` instead " "of ``locale.getpreferredencoding()``. Don't change temporary the locale " @@ -1626,108 +1629,108 @@ msgid "" "instead of the user preferred encoding." msgstr "" -#: ../../library/io.rst:1008 +#: ../../library/io.rst:1009 msgid "" "The *encoding* argument now supports the ``\"locale\"`` dummy encoding name." msgstr "" -#: ../../library/io.rst:1011 +#: ../../library/io.rst:1012 msgid "" ":class:`TextIOWrapper` provides these data attributes and methods in " "addition to those from :class:`TextIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:1016 +#: ../../library/io.rst:1017 msgid "Whether line buffering is enabled." msgstr "" -#: ../../library/io.rst:1020 +#: ../../library/io.rst:1021 msgid "Whether writes are passed immediately to the underlying binary buffer." msgstr "" -#: ../../library/io.rst:1028 +#: ../../library/io.rst:1029 msgid "" "Reconfigure this text stream using new settings for *encoding*, *errors*, " "*newline*, *line_buffering* and *write_through*." msgstr "" -#: ../../library/io.rst:1031 +#: ../../library/io.rst:1032 msgid "" "Parameters not specified keep current settings, except ``errors='strict'`` " "is used when *encoding* is specified but *errors* is not specified." msgstr "" -#: ../../library/io.rst:1035 +#: ../../library/io.rst:1036 msgid "" "It is not possible to change the encoding or newline if some data has " "already been read from the stream. On the other hand, changing encoding " "after write is possible." msgstr "" -#: ../../library/io.rst:1039 +#: ../../library/io.rst:1040 msgid "" "This method does an implicit stream flush before setting the new parameters." msgstr "" -#: ../../library/io.rst:1044 +#: ../../library/io.rst:1045 msgid "The method supports ``encoding=\"locale\"`` option." msgstr "" -#: ../../library/io.rst:1049 +#: ../../library/io.rst:1050 msgid "" "Set the stream position. Return the new stream position as an :class:`int`." msgstr "" -#: ../../library/io.rst:1052 +#: ../../library/io.rst:1053 msgid "" "Four operations are supported, given by the following argument combinations:" msgstr "" -#: ../../library/io.rst:1055 +#: ../../library/io.rst:1056 msgid "``seek(0, SEEK_SET)``: Rewind to the start of the stream." msgstr "" -#: ../../library/io.rst:1056 +#: ../../library/io.rst:1057 msgid "" "``seek(cookie, SEEK_SET)``: Restore a previous position; *cookie* **must " "be** a number returned by :meth:`tell`." msgstr "" -#: ../../library/io.rst:1058 +#: ../../library/io.rst:1059 msgid "``seek(0, SEEK_END)``: Fast-forward to the end of the stream." msgstr "" -#: ../../library/io.rst:1059 +#: ../../library/io.rst:1060 msgid "``seek(0, SEEK_CUR)``: Leave the current stream position unchanged." msgstr "" -#: ../../library/io.rst:1061 +#: ../../library/io.rst:1062 msgid "Any other argument combinations are invalid, and may raise exceptions." msgstr "" -#: ../../library/io.rst:1066 +#: ../../library/io.rst:1067 msgid ":data:`os.SEEK_SET`, :data:`os.SEEK_CUR`, and :data:`os.SEEK_END`." msgstr "" -#: ../../library/io.rst:1070 +#: ../../library/io.rst:1071 msgid "" "Return the stream position as an opaque number. The return value of :meth:`!" "tell` can be given as input to :meth:`seek`, to restore a previous stream " "position." msgstr "" -#: ../../library/io.rst:1077 +#: ../../library/io.rst:1078 msgid "" "A text stream using an in-memory text buffer. It inherits from :class:" "`TextIOBase`." msgstr "" -#: ../../library/io.rst:1080 +#: ../../library/io.rst:1081 msgid "" "The text buffer is discarded when the :meth:`~IOBase.close` method is called." msgstr "" -#: ../../library/io.rst:1083 +#: ../../library/io.rst:1084 msgid "" "The initial value of the buffer can be set by providing *initial_value*. If " "newline translation is enabled, newlines will be encoded as if by :meth:" @@ -1739,31 +1742,31 @@ msgid "" "at the end of the buffer." msgstr "" -#: ../../library/io.rst:1092 +#: ../../library/io.rst:1093 msgid "" "The *newline* argument works like that of :class:`TextIOWrapper`, except " "that when writing output to the stream, if *newline* is ``None``, newlines " "are written as ``\\n`` on all platforms." msgstr "" -#: ../../library/io.rst:1096 +#: ../../library/io.rst:1097 msgid "" ":class:`StringIO` provides this method in addition to those from :class:" "`TextIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:1101 +#: ../../library/io.rst:1102 msgid "" "Return a :class:`str` containing the entire contents of the buffer. Newlines " "are decoded as if by :meth:`~TextIOBase.read`, although the stream position " "is not changed." msgstr "" -#: ../../library/io.rst:1105 +#: ../../library/io.rst:1106 msgid "Example usage::" msgstr "使用範例: ::" -#: ../../library/io.rst:1107 +#: ../../library/io.rst:1108 msgid "" "import io\n" "\n" @@ -1780,23 +1783,23 @@ msgid "" "output.close()" msgstr "" -#: ../../library/io.rst:1127 +#: ../../library/io.rst:1128 msgid "" "A helper codec that decodes newlines for :term:`universal newlines` mode. It " "inherits from :class:`codecs.IncrementalDecoder`." msgstr "" -#: ../../library/io.rst:1132 +#: ../../library/io.rst:1133 msgid "Performance" msgstr "" -#: ../../library/io.rst:1134 +#: ../../library/io.rst:1135 msgid "" "This section discusses the performance of the provided concrete I/O " "implementations." msgstr "" -#: ../../library/io.rst:1140 +#: ../../library/io.rst:1141 msgid "" "By reading and writing only large chunks of data even when the user asks for " "a single byte, buffered I/O hides any inefficiency in calling and executing " @@ -1809,7 +1812,7 @@ msgid "" "data." msgstr "" -#: ../../library/io.rst:1152 +#: ../../library/io.rst:1153 msgid "" "Text I/O over a binary storage (such as a file) is significantly slower than " "binary I/O over the same storage, because it requires conversions between " @@ -1819,24 +1822,24 @@ msgid "" "the reconstruction algorithm used." msgstr "" -#: ../../library/io.rst:1159 +#: ../../library/io.rst:1160 msgid "" ":class:`StringIO`, however, is a native in-memory unicode container and will " "exhibit similar speed to :class:`BytesIO`." msgstr "" -#: ../../library/io.rst:1163 +#: ../../library/io.rst:1164 msgid "Multi-threading" msgstr "" -#: ../../library/io.rst:1165 +#: ../../library/io.rst:1166 msgid "" ":class:`FileIO` objects are thread-safe to the extent that the operating " "system calls (such as :manpage:`read(2)` under Unix) they wrap are thread-" "safe too." msgstr "" -#: ../../library/io.rst:1168 +#: ../../library/io.rst:1169 msgid "" "Binary buffered objects (instances of :class:`BufferedReader`, :class:" "`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) " @@ -1844,15 +1847,15 @@ msgid "" "them from multiple threads at once." msgstr "" -#: ../../library/io.rst:1173 +#: ../../library/io.rst:1174 msgid ":class:`TextIOWrapper` objects are not thread-safe." msgstr "" -#: ../../library/io.rst:1176 +#: ../../library/io.rst:1177 msgid "Reentrancy" msgstr "" -#: ../../library/io.rst:1178 +#: ../../library/io.rst:1179 msgid "" "Binary buffered objects (instances of :class:`BufferedReader`, :class:" "`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) are " @@ -1863,7 +1866,7 @@ msgid "" "from entering the buffered object." msgstr "" -#: ../../library/io.rst:1186 +#: ../../library/io.rst:1187 msgid "" "The above implicitly extends to text files, since the :func:`open` function " "will wrap a buffered object inside a :class:`TextIOWrapper`. This includes " @@ -1879,14 +1882,14 @@ msgstr "file object(檔案物件)" msgid "io module" msgstr "io 模組" -#: ../../library/io.rst:971 ../../library/io.rst:1122 +#: ../../library/io.rst:972 ../../library/io.rst:1123 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/io.rst:971 +#: ../../library/io.rst:972 msgid "io.TextIOWrapper class" msgstr "io.TextIOWrapper 類別" -#: ../../library/io.rst:1122 +#: ../../library/io.rst:1123 msgid "io.IncrementalNewlineDecoder class" msgstr "io.IncrementalNewlineDecoder 類別" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index 9fc480f716..699a5dba53 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-11 14:57+0000\n" +"POT-Creation-Date: 2025-05-21 00:17+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-" @@ -346,7 +346,7 @@ msgid "" "years of security fixes." msgstr "" -#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:2037 +#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:2053 msgid "New Features" msgstr "新增功能" @@ -1150,38 +1150,57 @@ msgid "" "(Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)" msgstr "" -#: ../../whatsnew/3.13.rst:744 +#: ../../whatsnew/3.13.rst:742 +msgid "" +"The function and methods named ``create_task`` have received a new " +"``**kwargs`` argument that is passed through to the task constructor. This " +"change was accidentally added in 3.13.3, and broke the API contract for " +"custom task factories. Several third-party task factories implemented " +"workarounds for this. In 3.13.4 and later releases the old factory contract " +"is honored once again (until 3.14). To keep the workarounds working, the " +"extra ``**kwargs`` argument still allows passing additional keyword " +"arguments to :class:`~asyncio.Task` and to custom task factories." +msgstr "" + +#: ../../whatsnew/3.13.rst:753 +msgid "" +"This affects the following function and methods: :meth:`asyncio." +"create_task`, :meth:`asyncio.loop.create_task`, :meth:`asyncio.TaskGroup." +"create_task`. (Contributed by Thomas Grainger in :gh:`128307`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:760 msgid "base64" msgstr "base64" -#: ../../whatsnew/3.13.rst:746 +#: ../../whatsnew/3.13.rst:762 msgid "" "Add :func:`~base64.z85encode` and :func:`~base64.z85decode` functions for " "encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data to :" "class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" msgstr "" -#: ../../whatsnew/3.13.rst:755 +#: ../../whatsnew/3.13.rst:771 msgid "compileall" msgstr "compileall" -#: ../../whatsnew/3.13.rst:757 ../../whatsnew/3.13.rst:765 -#: ../../whatsnew/3.13.rst:1024 +#: ../../whatsnew/3.13.rst:773 ../../whatsnew/3.13.rst:781 +#: ../../whatsnew/3.13.rst:1040 msgid "" "The default number of worker threads and processes is now selected using :" "func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " "Victor Stinner in :gh:`109649`.)" msgstr "" -#: ../../whatsnew/3.13.rst:763 +#: ../../whatsnew/3.13.rst:779 msgid "concurrent.futures" msgstr "concurrent.futures" -#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1673 +#: ../../whatsnew/3.13.rst:787 ../../whatsnew/3.13.rst:1689 msgid "configparser" msgstr "configparser" -#: ../../whatsnew/3.13.rst:773 +#: ../../whatsnew/3.13.rst:789 msgid "" ":class:`~configparser.ConfigParser` now has support for unnamed sections, " "which allows for top-level key-value pairs. This can be enabled with the new " @@ -1189,11 +1208,11 @@ msgid "" "gh:`66449`.)" msgstr "" -#: ../../whatsnew/3.13.rst:780 +#: ../../whatsnew/3.13.rst:796 msgid "copy" msgstr "copy" -#: ../../whatsnew/3.13.rst:782 +#: ../../whatsnew/3.13.rst:798 msgid "" "The new :func:`~copy.replace` function and the :meth:`replace protocol " "` make creating modified copies of objects much simpler. " @@ -1202,44 +1221,44 @@ msgid "" "protocol:" msgstr "" -#: ../../whatsnew/3.13.rst:788 +#: ../../whatsnew/3.13.rst:804 msgid ":func:`collections.namedtuple`" msgstr ":func:`collections.namedtuple`" -#: ../../whatsnew/3.13.rst:789 +#: ../../whatsnew/3.13.rst:805 msgid ":class:`dataclasses.dataclass`" msgstr ":class:`dataclasses.dataclass`" -#: ../../whatsnew/3.13.rst:790 +#: ../../whatsnew/3.13.rst:806 msgid "" ":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" msgstr "" ":class:`datetime.datetime`、:class:`datetime.date`、:class:`datetime.time`" -#: ../../whatsnew/3.13.rst:791 +#: ../../whatsnew/3.13.rst:807 msgid ":class:`inspect.Signature`, :class:`inspect.Parameter`" msgstr ":class:`inspect.Signature`、:class:`inspect.Parameter`" -#: ../../whatsnew/3.13.rst:792 +#: ../../whatsnew/3.13.rst:808 msgid ":class:`types.SimpleNamespace`" msgstr ":class:`types.SimpleNamespace`" -#: ../../whatsnew/3.13.rst:793 +#: ../../whatsnew/3.13.rst:809 msgid ":ref:`code objects `" msgstr ":ref:`程式碼物件 `" -#: ../../whatsnew/3.13.rst:795 +#: ../../whatsnew/3.13.rst:811 msgid "" "Any user-defined class can also support :func:`copy.replace` by defining " "the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka in :" "gh:`108751`.)" msgstr "" -#: ../../whatsnew/3.13.rst:801 +#: ../../whatsnew/3.13.rst:817 msgid "ctypes" msgstr "ctypes" -#: ../../whatsnew/3.13.rst:803 +#: ../../whatsnew/3.13.rst:819 msgid "" "As a consequence of necessary internal refactoring, initialization of " "internal metaclasses now happens in ``__init__`` rather than in ``__new__``. " @@ -1247,25 +1266,25 @@ msgid "" "custom initialization. Generally:" msgstr "" -#: ../../whatsnew/3.13.rst:809 +#: ../../whatsnew/3.13.rst:825 msgid "" "Custom logic that was done in ``__new__`` after calling ``super().__new__`` " "should be moved to ``__init__``." msgstr "" -#: ../../whatsnew/3.13.rst:811 +#: ../../whatsnew/3.13.rst:827 msgid "" "To create a class, call the metaclass, not only the metaclass's ``__new__`` " "method." msgstr "" -#: ../../whatsnew/3.13.rst:814 +#: ../../whatsnew/3.13.rst:830 msgid "" "See :gh:`124520` for discussion and links to changes in some affected " "projects." msgstr "" -#: ../../whatsnew/3.13.rst:817 +#: ../../whatsnew/3.13.rst:833 msgid "" ":class:`ctypes.Structure` objects have a new :attr:`~ctypes.Structure." "_align_` attribute which allows the alignment of the structure being packed " @@ -1273,29 +1292,29 @@ msgid "" "in :gh:`112433`)" msgstr "" -#: ../../whatsnew/3.13.rst:823 +#: ../../whatsnew/3.13.rst:839 msgid "dbm" msgstr "dbm" -#: ../../whatsnew/3.13.rst:825 +#: ../../whatsnew/3.13.rst:841 msgid "" "Add :mod:`dbm.sqlite3`, a new module which implements an SQLite backend, and " "make it the default :mod:`!dbm` backend. (Contributed by Raymond Hettinger " "and Erlend E. Aasland in :gh:`100414`.)" msgstr "" -#: ../../whatsnew/3.13.rst:829 +#: ../../whatsnew/3.13.rst:845 msgid "" "Allow removing all items from the database through the new :meth:`.gdbm." "clear` and :meth:`.ndbm.clear` methods. (Contributed by Donghee Na in :gh:" "`107122`.)" msgstr "" -#: ../../whatsnew/3.13.rst:835 +#: ../../whatsnew/3.13.rst:851 msgid "dis" msgstr "dis" -#: ../../whatsnew/3.13.rst:837 +#: ../../whatsnew/3.13.rst:853 msgid "" "Change the output of :mod:`dis` module functions to show logical labels for " "jump targets and exception handlers, rather than offsets. The offsets can be " @@ -1303,7 +1322,7 @@ msgid "" "the *show_offsets* argument. (Contributed by Irit Katriel in :gh:`112137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:844 +#: ../../whatsnew/3.13.rst:860 msgid "" ":meth:`~dis.get_instructions` no longer represents cache entries as separate " "instructions. Instead, it returns them as part of the :class:`~dis." @@ -1312,11 +1331,11 @@ msgid "" "(Contributed by Irit Katriel in :gh:`112962`.)" msgstr "" -#: ../../whatsnew/3.13.rst:856 +#: ../../whatsnew/3.13.rst:872 msgid "doctest" msgstr "doctest" -#: ../../whatsnew/3.13.rst:858 +#: ../../whatsnew/3.13.rst:874 msgid "" ":mod:`doctest` output is now colored by default. This can be controlled via " "the new :envvar:`PYTHON_COLORS` environment variable as well as the " @@ -1325,18 +1344,18 @@ msgid "" "`117225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:865 +#: ../../whatsnew/3.13.rst:881 msgid "" "The :meth:`.DocTestRunner.run` method now counts the number of skipped " "tests. Add the :attr:`.DocTestRunner.skips` and :attr:`.TestResults.skipped` " "attributes. (Contributed by Victor Stinner in :gh:`108794`.)" msgstr "" -#: ../../whatsnew/3.13.rst:871 +#: ../../whatsnew/3.13.rst:887 msgid "email" msgstr "email" -#: ../../whatsnew/3.13.rst:873 +#: ../../whatsnew/3.13.rst:889 msgid "" "Headers with embedded newlines are now quoted on output. The :mod:`~email." "generator` will now refuse to serialize (write) headers that are improperly " @@ -1346,7 +1365,7 @@ msgid "" "Bloemsaat and Petr Viktorin in :gh:`121650`.)" msgstr "" -#: ../../whatsnew/3.13.rst:881 +#: ../../whatsnew/3.13.rst:897 msgid "" ":func:`~email.utils.getaddresses` and :func:`~email.utils.parseaddr` now " "return ``('', '')`` pairs in more situations where invalid email addresses " @@ -1358,22 +1377,22 @@ msgid "" "Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" msgstr "" -#: ../../whatsnew/3.13.rst:893 +#: ../../whatsnew/3.13.rst:909 msgid "enum" msgstr "enum" -#: ../../whatsnew/3.13.rst:895 +#: ../../whatsnew/3.13.rst:911 msgid "" ":class:`~enum.EnumDict` has been made public to better support subclassing :" "class:`~enum.EnumType`." msgstr "" "公開 :class:`~enum.EnumDict` 以更好地支援 :class:`~enum.EnumType` 的子類別。" -#: ../../whatsnew/3.13.rst:900 +#: ../../whatsnew/3.13.rst:916 msgid "fractions" msgstr "fractions" -#: ../../whatsnew/3.13.rst:902 +#: ../../whatsnew/3.13.rst:918 msgid "" ":class:`~fractions.Fraction` objects now support the standard :ref:`format " "specification mini-language ` rules for fill, alignment, sign " @@ -1381,22 +1400,22 @@ msgid "" "`111320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:909 +#: ../../whatsnew/3.13.rst:925 msgid "glob" msgstr "glob" -#: ../../whatsnew/3.13.rst:911 +#: ../../whatsnew/3.13.rst:927 msgid "" "Add :func:`~glob.translate`, a function to convert a path specification with " "shell-style wildcards to a regular expression. (Contributed by Barney Gale " "in :gh:`72904`.)" msgstr "" -#: ../../whatsnew/3.13.rst:917 +#: ../../whatsnew/3.13.rst:933 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.13.rst:919 +#: ../../whatsnew/3.13.rst:935 msgid "" "The following functions in :mod:`importlib.resources` now allow accessing a " "directory (or tree) of resources, using multiple positional arguments (the " @@ -1404,37 +1423,37 @@ msgid "" "keyword-only):" msgstr "" -#: ../../whatsnew/3.13.rst:924 +#: ../../whatsnew/3.13.rst:940 msgid ":func:`~importlib.resources.is_resource`" msgstr ":func:`~importlib.resources.is_resource`" -#: ../../whatsnew/3.13.rst:925 +#: ../../whatsnew/3.13.rst:941 msgid ":func:`~importlib.resources.open_binary`" msgstr ":func:`~importlib.resources.open_binary`" -#: ../../whatsnew/3.13.rst:926 +#: ../../whatsnew/3.13.rst:942 msgid ":func:`~importlib.resources.open_text`" msgstr ":func:`~importlib.resources.open_text`" -#: ../../whatsnew/3.13.rst:927 +#: ../../whatsnew/3.13.rst:943 msgid ":func:`~importlib.resources.path`" msgstr ":func:`~importlib.resources.path`" -#: ../../whatsnew/3.13.rst:928 +#: ../../whatsnew/3.13.rst:944 msgid ":func:`~importlib.resources.read_binary`" msgstr ":func:`~importlib.resources.read_binary`" -#: ../../whatsnew/3.13.rst:929 +#: ../../whatsnew/3.13.rst:945 msgid ":func:`~importlib.resources.read_text`" msgstr ":func:`~importlib.resources.read_text`" -#: ../../whatsnew/3.13.rst:931 +#: ../../whatsnew/3.13.rst:947 msgid "" "These functions are no longer deprecated and are not scheduled for removal. " "(Contributed by Petr Viktorin in :gh:`116608`.)" msgstr "" -#: ../../whatsnew/3.13.rst:934 +#: ../../whatsnew/3.13.rst:950 msgid "" ":func:`~importlib.resources.contents` remains deprecated in favor of the " "fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " @@ -1442,11 +1461,11 @@ msgid "" "`116608`.)" msgstr "" -#: ../../whatsnew/3.13.rst:941 +#: ../../whatsnew/3.13.rst:957 msgid "io" msgstr "io" -#: ../../whatsnew/3.13.rst:943 +#: ../../whatsnew/3.13.rst:959 msgid "" "The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" "`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " @@ -1455,17 +1474,17 @@ msgid "" "build>`. (Contributed by Victor Stinner in :gh:`62948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:952 +#: ../../whatsnew/3.13.rst:968 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.13.rst:954 +#: ../../whatsnew/3.13.rst:970 msgid "" "Add the :attr:`.IPv4Address.ipv6_mapped` property, which returns the IPv4-" "mapped IPv6 address. (Contributed by Charles Machalow in :gh:`109466`.)" msgstr "" -#: ../../whatsnew/3.13.rst:958 +#: ../../whatsnew/3.13.rst:974 msgid "" "Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." "IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." @@ -1473,22 +1492,22 @@ msgid "" "Stasiak in :gh:`113171`.)" msgstr "" -#: ../../whatsnew/3.13.rst:965 +#: ../../whatsnew/3.13.rst:981 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.13.rst:967 +#: ../../whatsnew/3.13.rst:983 msgid "" ":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" "`ValueError` if the final batch is shorter than the specified batch size. " "(Contributed by Raymond Hettinger in :gh:`113202`.)" msgstr "" -#: ../../whatsnew/3.13.rst:974 +#: ../../whatsnew/3.13.rst:990 msgid "marshal" msgstr "marshal" -#: ../../whatsnew/3.13.rst:976 +#: ../../whatsnew/3.13.rst:992 msgid "" "Add the *allow_code* parameter in module functions. Passing " "``allow_code=False`` prevents serialization and de-serialization of code " @@ -1496,11 +1515,11 @@ msgid "" "Serhiy Storchaka in :gh:`113626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:983 +#: ../../whatsnew/3.13.rst:999 msgid "math" msgstr "math" -#: ../../whatsnew/3.13.rst:985 +#: ../../whatsnew/3.13.rst:1001 msgid "" "The new function :func:`~math.fma` performs fused multiply-add operations. " "This computes ``x * y + z`` with only a single round, and so avoids any " @@ -1510,11 +1529,11 @@ msgid "" "Stinner in :gh:`73468`.)" msgstr "" -#: ../../whatsnew/3.13.rst:995 +#: ../../whatsnew/3.13.rst:1011 msgid "mimetypes" msgstr "mimetypes" -#: ../../whatsnew/3.13.rst:997 +#: ../../whatsnew/3.13.rst:1013 msgid "" "Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " "from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " @@ -1522,18 +1541,18 @@ msgid "" "`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1004 +#: ../../whatsnew/3.13.rst:1020 msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.13.rst:1006 +#: ../../whatsnew/3.13.rst:1022 msgid "" ":class:`~mmap.mmap` is now protected from crashing on Windows when the " "mapped memory is inaccessible due to file system errors or access " "violations. (Contributed by Jannis Weigend in :gh:`118209`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1010 +#: ../../whatsnew/3.13.rst:1026 msgid "" ":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " "used when a seekable file-like object is required. The :meth:`~mmap.mmap." @@ -1541,7 +1560,7 @@ msgid "" "Na and Sylvie Liberman in :gh:`111835`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1015 +#: ../../whatsnew/3.13.rst:1031 msgid "" "The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " "descriptor duplication; if false, the file descriptor specified by *fileno* " @@ -1549,22 +1568,22 @@ msgid "" "gh:`78502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1022 +#: ../../whatsnew/3.13.rst:1038 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.13.rst:1030 +#: ../../whatsnew/3.13.rst:1046 msgid "os" msgstr "os" -#: ../../whatsnew/3.13.rst:1032 +#: ../../whatsnew/3.13.rst:1048 msgid "" "Add :func:`~os.process_cpu_count` function to get the number of logical CPU " "cores usable by the calling thread of the current process. (Contributed by " "Victor Stinner in :gh:`109649`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1036 +#: ../../whatsnew/3.13.rst:1052 msgid "" ":func:`~os.cpu_count` and :func:`~os.process_cpu_count` can be overridden " "through the new environment variable :envvar:`PYTHON_CPU_COUNT` or the new " @@ -1574,7 +1593,7 @@ msgid "" "Na in :gh:`109595`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1044 +#: ../../whatsnew/3.13.rst:1060 msgid "" "Add a :ref:`low level interface ` to Linux's :manpage:`timer " "file descriptors ` via :func:`~os.timerfd_create`, :func:" @@ -1585,7 +1604,7 @@ msgid "" "in :gh:`108277`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1053 +#: ../../whatsnew/3.13.rst:1069 msgid "" ":func:`~os.lchmod` and the *follow_symlinks* argument of :func:`~os.chmod` " "are both now available on Windows. Note that the default value of " @@ -1593,14 +1612,14 @@ msgid "" "by Serhiy Storchaka in :gh:`59616`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1059 +#: ../../whatsnew/3.13.rst:1075 msgid "" ":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " "both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" "`113191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1063 +#: ../../whatsnew/3.13.rst:1079 msgid "" "On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " "*mode* value of ``0o700`` to apply access control to the new directory. This " @@ -1609,14 +1628,14 @@ msgid "" "Steve Dower in :gh:`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1070 +#: ../../whatsnew/3.13.rst:1086 msgid "" ":func:`~os.posix_spawn` now accepts ``None`` for the *env* argument, which " "makes the newly spawned process use the current process environment. " "(Contributed by Jakub Kulik in :gh:`113119`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1074 +#: ../../whatsnew/3.13.rst:1090 msgid "" ":func:`~os.posix_spawn` can now use the :const:`~os.POSIX_SPAWN_CLOSEFROM` " "attribute in the *file_actions* parameter on platforms that support :c:func:" @@ -1624,76 +1643,76 @@ msgid "" "gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1081 +#: ../../whatsnew/3.13.rst:1097 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.13.rst:1083 +#: ../../whatsnew/3.13.rst:1099 msgid "" "Add :func:`~os.path.isreserved` to check if a path is reserved on the " "current system. This function is only available on Windows. (Contributed by " "Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1088 +#: ../../whatsnew/3.13.rst:1104 msgid "" "On Windows, :func:`~os.path.isabs` no longer considers paths starting with " "exactly one slash (``\\`` or ``/``) to be absolute. (Contributed by Barney " "Gale and Jon Foster in :gh:`44626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1092 +#: ../../whatsnew/3.13.rst:1108 msgid "" ":func:`~os.path.realpath` now resolves MS-DOS style file names even if the " "file is not accessible. (Contributed by Moonsik Park in :gh:`82367`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1098 ../../whatsnew/3.13.rst:1729 +#: ../../whatsnew/3.13.rst:1114 ../../whatsnew/3.13.rst:1745 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.13.rst:1100 +#: ../../whatsnew/3.13.rst:1116 msgid "" "Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" "`NotImplementedError` when a path operation isn't supported. (Contributed by " "Barney Gale in :gh:`89812`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1104 +#: ../../whatsnew/3.13.rst:1120 msgid "" "Add a new constructor for creating :class:`~pathlib.Path` objects from " "'file' URIs (``file:///``), :meth:`.Path.from_uri`. (Contributed by Barney " "Gale in :gh:`107465`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1108 +#: ../../whatsnew/3.13.rst:1124 msgid "" "Add :meth:`.PurePath.full_match` for matching paths with shell-style " "wildcards, including the recursive wildcard \"``**``\". (Contributed by " "Barney Gale in :gh:`73435`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1112 +#: ../../whatsnew/3.13.rst:1128 msgid "" "Add the :attr:`.PurePath.parser` class attribute to store the implementation " "of :mod:`os.path` used for low-level path parsing and joining. This will be " "either :mod:`!posixpath` or :mod:`!ntpath`." msgstr "" -#: ../../whatsnew/3.13.rst:1117 +#: ../../whatsnew/3.13.rst:1133 msgid "" "Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" "`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1121 +#: ../../whatsnew/3.13.rst:1137 msgid "" ":meth:`.Path.glob` and :meth:`~pathlib.Path.rglob` now return files and " "directories when given a pattern that ends with \"``**``\". Previously, only " "directories were returned. (Contributed by Barney Gale in :gh:`70303`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1126 +#: ../../whatsnew/3.13.rst:1142 msgid "" "Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " "`, :meth:`Path.is_dir `, :meth:`." @@ -1701,11 +1720,11 @@ msgid "" "`105793` and Kamil Turek in :gh:`107962`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1134 +#: ../../whatsnew/3.13.rst:1150 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.13.rst:1136 +#: ../../whatsnew/3.13.rst:1152 msgid "" ":func:`breakpoint` and :func:`~pdb.set_trace` now enter the debugger " "immediately rather than on the next line of code to be executed. This change " @@ -1714,20 +1733,20 @@ msgid "" "Gao in :gh:`118579`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1142 +#: ../../whatsnew/3.13.rst:1158 msgid "" "``sys.path[0]`` is no longer replaced by the directory of the script being " "debugged when :attr:`sys.flags.safe_path` is set. (Contributed by Tian Gao " "and Christian Walther in :gh:`111762`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1146 +#: ../../whatsnew/3.13.rst:1162 msgid "" ":mod:`zipapp` is now supported as a debugging target. (Contributed by Tian " "Gao in :gh:`118501`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1149 +#: ../../whatsnew/3.13.rst:1165 msgid "" "Add ability to move between chained exceptions during post-mortem debugging " "in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " @@ -1735,101 +1754,101 @@ msgid "" "`106676`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1154 +#: ../../whatsnew/3.13.rst:1170 msgid "" "Expressions and statements whose prefix is a pdb command are now correctly " "identified and executed. (Contributed by Tian Gao in :gh:`108464`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1160 +#: ../../whatsnew/3.13.rst:1176 msgid "queue" msgstr "queue" -#: ../../whatsnew/3.13.rst:1162 +#: ../../whatsnew/3.13.rst:1178 msgid "" "Add :meth:`Queue.shutdown ` and :exc:`~queue.ShutDown` " "to manage queue termination. (Contributed by Laurie Opperman and Yves Duprat " "in :gh:`104750`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1168 +#: ../../whatsnew/3.13.rst:1184 msgid "random" msgstr "random" -#: ../../whatsnew/3.13.rst:1170 +#: ../../whatsnew/3.13.rst:1186 msgid "" "Add a :ref:`command-line interface `. (Contributed by Hugo van " "Kemenade in :gh:`118131`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1175 ../../whatsnew/3.13.rst:1737 +#: ../../whatsnew/3.13.rst:1191 ../../whatsnew/3.13.rst:1753 msgid "re" msgstr "re" -#: ../../whatsnew/3.13.rst:1177 +#: ../../whatsnew/3.13.rst:1193 msgid "" "Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" "exc:`!re.error` is kept for backward compatibility." msgstr "" -#: ../../whatsnew/3.13.rst:1182 +#: ../../whatsnew/3.13.rst:1198 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.13.rst:1184 +#: ../../whatsnew/3.13.rst:1200 msgid "" "Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" "`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" msgstr "" -#: ../../whatsnew/3.13.rst:1190 +#: ../../whatsnew/3.13.rst:1206 msgid "site" msgstr "site" -#: ../../whatsnew/3.13.rst:1192 +#: ../../whatsnew/3.13.rst:1208 msgid "" ":file:`.pth` files are now decoded using UTF-8 first, and then with the :" "term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " "in :gh:`117802`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1198 +#: ../../whatsnew/3.13.rst:1214 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.13.rst:1200 +#: ../../whatsnew/3.13.rst:1216 msgid "" "A :exc:`ResourceWarning` is now emitted if a :class:`~sqlite3.Connection` " "object is not :meth:`closed ` explicitly. " "(Contributed by Erlend E. Aasland in :gh:`105539`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1204 +#: ../../whatsnew/3.13.rst:1220 msgid "" "Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " "filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" "`91602`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1210 +#: ../../whatsnew/3.13.rst:1226 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.13.rst:1212 +#: ../../whatsnew/3.13.rst:1228 msgid "" "The :func:`~ssl.create_default_context` API now includes :data:`~ssl." "VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " "default flags." msgstr "" -#: ../../whatsnew/3.13.rst:1218 +#: ../../whatsnew/3.13.rst:1234 msgid "" ":data:`~ssl.VERIFY_X509_STRICT` may reject pre-:rfc:`5280` or malformed " "certificates that the underlying OpenSSL implementation might otherwise " "accept. Whilst disabling this is not recommended, you can do so using:" msgstr "" -#: ../../whatsnew/3.13.rst:1223 +#: ../../whatsnew/3.13.rst:1239 msgid "" "import ssl\n" "\n" @@ -1841,15 +1860,15 @@ msgstr "" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" -#: ../../whatsnew/3.13.rst:1230 +#: ../../whatsnew/3.13.rst:1246 msgid "(Contributed by William Woodruff in :gh:`112389`.)" msgstr "(由 William Woodruff 在 :gh:`112389` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1234 +#: ../../whatsnew/3.13.rst:1250 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.13.rst:1236 +#: ../../whatsnew/3.13.rst:1252 msgid "" "Add :func:`~statistics.kde` for kernel density estimation. This makes it " "possible to estimate a continuous probability density function from a fixed " @@ -1857,24 +1876,24 @@ msgid "" "`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1241 +#: ../../whatsnew/3.13.rst:1257 msgid "" "Add :func:`~statistics.kde_random` for sampling from an estimated " "probability density function created by :func:`~statistics.kde`. " "(Contributed by Raymond Hettinger in :gh:`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1249 +#: ../../whatsnew/3.13.rst:1265 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.13.rst:1251 +#: ../../whatsnew/3.13.rst:1267 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations." msgstr "" -#: ../../whatsnew/3.13.rst:1254 +#: ../../whatsnew/3.13.rst:1270 msgid "" "Notably, when *close_fds* is ``True`` (the default), :func:`~os.posix_spawn` " "will be used when the C library provides :c:func:`!" @@ -1883,7 +1902,7 @@ msgid "" "existing Linux :c:func:`!vfork` based code." msgstr "" -#: ../../whatsnew/3.13.rst:1261 +#: ../../whatsnew/3.13.rst:1277 msgid "" "A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " "``False`` if you need to force :mod:`subprocess` to never use :func:`~os." @@ -1893,22 +1912,22 @@ msgid "" "`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1271 ../../whatsnew/3.13.rst:2811 +#: ../../whatsnew/3.13.rst:1287 ../../whatsnew/3.13.rst:2827 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.13.rst:1273 +#: ../../whatsnew/3.13.rst:1289 msgid "" "Add the :func:`~sys._is_interned` function to test if a string was interned. " "This function is not guaranteed to exist in all implementations of Python. " "(Contributed by Serhiy Storchaka in :gh:`78573`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1279 +#: ../../whatsnew/3.13.rst:1295 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.13.rst:1281 +#: ../../whatsnew/3.13.rst:1297 msgid "" "On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " "limits access to the new directory due to changes to :func:`os.mkdir`. This " @@ -1916,11 +1935,11 @@ msgid "" "`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1288 +#: ../../whatsnew/3.13.rst:1304 msgid "time" msgstr "time" -#: ../../whatsnew/3.13.rst:1290 +#: ../../whatsnew/3.13.rst:1306 msgid "" "On Windows, :func:`~time.monotonic` now uses the " "``QueryPerformanceCounter()`` clock for a resolution of 1 microsecond, " @@ -1928,7 +1947,7 @@ msgid "" "milliseconds. (Contributed by Victor Stinner in :gh:`88494`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1296 +#: ../../whatsnew/3.13.rst:1312 msgid "" "On Windows, :func:`~time.time` now uses the " "``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " @@ -1937,11 +1956,11 @@ msgid "" "`63207`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1304 +#: ../../whatsnew/3.13.rst:1320 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.13.rst:1306 +#: ../../whatsnew/3.13.rst:1322 msgid "" "Add :mod:`tkinter` widget methods: :meth:`!tk_busy_hold`, :meth:`!" "tk_busy_configure`, :meth:`!tk_busy_cget`, :meth:`!tk_busy_forget`, :meth:`!" @@ -1949,7 +1968,7 @@ msgid "" "klappnase and Serhiy Storchaka in :gh:`72684`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1312 +#: ../../whatsnew/3.13.rst:1328 msgid "" "The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " "attribute name without the minus prefix to get window attributes, for " @@ -1958,14 +1977,14 @@ msgid "" "wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1319 +#: ../../whatsnew/3.13.rst:1335 msgid "" ":meth:`!wm_attributes` can now return attributes as a :class:`dict`, by " "using the new optional keyword-only parameter *return_python_dict*. " "(Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1323 +#: ../../whatsnew/3.13.rst:1339 msgid "" ":meth:`!Text.count` can now return a simple :class:`int` when the new " "optional keyword-only parameter *return_ints* is used. Otherwise, the single " @@ -1973,27 +1992,27 @@ msgid "" "in :gh:`97928`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1328 +#: ../../whatsnew/3.13.rst:1344 msgid "" "Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." "element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " "Storchaka in :gh:`68166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1333 +#: ../../whatsnew/3.13.rst:1349 msgid "" "Add the :meth:`!after_info` method for Tkinter widgets. (Contributed by " "Cheryl Sabella in :gh:`77020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1336 +#: ../../whatsnew/3.13.rst:1352 msgid "" "Add a new :meth:`!copy_replace` method to :class:`!PhotoImage` to copy a " "region from one image to another, possibly with pixel zooming, subsampling, " "or both. (Contributed by Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1341 +#: ../../whatsnew/3.13.rst:1357 msgid "" "Add *from_coords* parameter to the :class:`!PhotoImage` methods :meth:`!" "copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and *subsample* " @@ -2001,7 +2020,7 @@ msgid "" "Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1347 +#: ../../whatsnew/3.13.rst:1363 msgid "" "Add the :class:`!PhotoImage` methods :meth:`!read` to read an image from a " "file and :meth:`!data` to get the image data. Add *background* and " @@ -2009,11 +2028,11 @@ msgid "" "Storchaka in :gh:`118271`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1355 +#: ../../whatsnew/3.13.rst:1371 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.13.rst:1357 +#: ../../whatsnew/3.13.rst:1373 msgid "" "Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" "class:`~traceback.TracebackException`, which holds a string display of the " @@ -2023,7 +2042,7 @@ msgid "" "(Contributed by Irit Katriel in :gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1366 +#: ../../whatsnew/3.13.rst:1382 msgid "" "Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." "format_exception_only` to (recursively) format the nested exceptions of a :" @@ -2031,11 +2050,11 @@ msgid "" "`105292`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1373 +#: ../../whatsnew/3.13.rst:1389 msgid "types" msgstr "types" -#: ../../whatsnew/3.13.rst:1375 +#: ../../whatsnew/3.13.rst:1391 msgid "" ":class:`~types.SimpleNamespace` can now take a single positional argument to " "initialise the namespace's arguments. This argument must either be a mapping " @@ -2043,63 +2062,63 @@ msgid "" "`108191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1382 ../../whatsnew/3.13.rst:1762 +#: ../../whatsnew/3.13.rst:1398 ../../whatsnew/3.13.rst:1778 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.13.rst:1384 +#: ../../whatsnew/3.13.rst:1400 msgid "" ":pep:`705`: Add :data:`~typing.ReadOnly`, a special typing construct to mark " "a :class:`~typing.TypedDict` item as read-only for type checkers." msgstr "" -#: ../../whatsnew/3.13.rst:1387 +#: ../../whatsnew/3.13.rst:1403 msgid "" ":pep:`742`: Add :data:`~typing.TypeIs`, a typing construct that can be used " "to instruct a type checker how to narrow a type." msgstr "" -#: ../../whatsnew/3.13.rst:1390 +#: ../../whatsnew/3.13.rst:1406 msgid "" "Add :data:`~typing.NoDefault`, a sentinel object used to represent the " "defaults of some parameters in the :mod:`typing` module. (Contributed by " "Jelle Zijlstra in :gh:`116126`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1394 +#: ../../whatsnew/3.13.rst:1410 msgid "" "Add :func:`~typing.get_protocol_members` to return the set of members " "defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" "`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1398 +#: ../../whatsnew/3.13.rst:1414 msgid "" "Add :func:`~typing.is_protocol` to check whether a class is a :class:" "`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1402 +#: ../../whatsnew/3.13.rst:1418 msgid "" ":data:`~typing.ClassVar` can now be nested in :data:`~typing.Final`, and " "vice versa. (Contributed by Mehdi Drissi in :gh:`89547`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1408 +#: ../../whatsnew/3.13.rst:1424 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.13.rst:1410 +#: ../../whatsnew/3.13.rst:1426 msgid "" "Update the Unicode database to `version 15.1.0`__. (Contributed by James " "Gerity in :gh:`109559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1417 +#: ../../whatsnew/3.13.rst:1433 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.13.rst:1419 +#: ../../whatsnew/3.13.rst:1435 msgid "" "Add support for creating source control management (SCM) ignore files in a " "virtual environment's directory. By default, Git is supported. This is " @@ -2109,11 +2128,11 @@ msgid "" "Cannon in :gh:`108125`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1430 +#: ../../whatsnew/3.13.rst:1446 msgid "warnings" msgstr "warnings" -#: ../../whatsnew/3.13.rst:1432 +#: ../../whatsnew/3.13.rst:1448 msgid "" ":pep:`702`: The new :func:`warnings.deprecated` decorator provides a way to " "communicate deprecations to a :term:`static type checker` and to warn on " @@ -2122,62 +2141,62 @@ msgid "" "(Contributed by Jelle Zijlstra in :gh:`104003`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1441 +#: ../../whatsnew/3.13.rst:1457 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.13.rst:1443 +#: ../../whatsnew/3.13.rst:1459 msgid "" "Allow controlling Expat >=2.6.0 reparse deferral (:cve:`2023-52425`) by " "adding five new methods:" msgstr "" -#: ../../whatsnew/3.13.rst:1446 +#: ../../whatsnew/3.13.rst:1462 msgid ":meth:`xml.etree.ElementTree.XMLParser.flush`" msgstr ":meth:`xml.etree.ElementTree.XMLParser.flush`" -#: ../../whatsnew/3.13.rst:1447 +#: ../../whatsnew/3.13.rst:1463 msgid ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" msgstr ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" -#: ../../whatsnew/3.13.rst:1448 +#: ../../whatsnew/3.13.rst:1464 msgid ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" msgstr ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1449 +#: ../../whatsnew/3.13.rst:1465 msgid ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" msgstr ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1450 +#: ../../whatsnew/3.13.rst:1466 msgid ":meth:`!xml.sax.expatreader.ExpatParser.flush`" msgstr ":meth:`!xml.sax.expatreader.ExpatParser.flush`" -#: ../../whatsnew/3.13.rst:1452 +#: ../../whatsnew/3.13.rst:1468 msgid "(Contributed by Sebastian Pipping in :gh:`115623`.)" msgstr "(由 Sebastian Pipping 在 :gh:`115623` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1454 +#: ../../whatsnew/3.13.rst:1470 msgid "" "Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." "ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " "Storchaka in :gh:`69893`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1460 +#: ../../whatsnew/3.13.rst:1476 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.13.rst:1462 +#: ../../whatsnew/3.13.rst:1478 msgid "" "Add support for ZIP64_ format files. Everybody loves huge data, right? " "(Contributed by Tim Hatch in :gh:`94146`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1470 +#: ../../whatsnew/3.13.rst:1486 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.13.rst:1472 +#: ../../whatsnew/3.13.rst:1488 msgid "" "Several standard library modules have had their import times significantly " "improved. For example, the import time of the :mod:`typing` module has been " @@ -2188,13 +2207,13 @@ msgid "" "Turner, Daniel Hollas, and others in :gh:`109653`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1483 +#: ../../whatsnew/3.13.rst:1499 msgid "" ":func:`textwrap.indent` is now around 30% faster than before for large " "input. (Contributed by Inada Naoki in :gh:`107369`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1486 +#: ../../whatsnew/3.13.rst:1502 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations, including when *close_fds* is ``True`` (the default) on " @@ -2204,15 +2223,15 @@ msgid "" "Kulik in :gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1496 +#: ../../whatsnew/3.13.rst:1512 msgid "Removed Modules And APIs" msgstr "被移除的模組和 API" -#: ../../whatsnew/3.13.rst:1502 +#: ../../whatsnew/3.13.rst:1518 msgid "PEP 594: Remove \"dead batteries\" from the standard library" msgstr "PEP 594:從標準函式庫中移除「用完的電池」" -#: ../../whatsnew/3.13.rst:1504 +#: ../../whatsnew/3.13.rst:1520 msgid "" ":pep:`594` proposed removing 19 modules from the standard library, " "colloquially referred to as 'dead batteries' due to their historic, " @@ -2223,38 +2242,38 @@ msgstr "" "池 (dead batteries)」的 19 個模組。以下所有模組在 Python 3.11 中已被棄用,現" "在已被移除:" -#: ../../whatsnew/3.13.rst:1510 +#: ../../whatsnew/3.13.rst:1526 msgid ":mod:`!aifc`" msgstr ":mod:`!aifc`" -#: ../../whatsnew/3.13.rst:1512 +#: ../../whatsnew/3.13.rst:1528 msgid "" ":pypi:`standard-aifc`: Use the redistribution of ``aifc`` library from PyPI." msgstr ":pypi:`standard-aifc`:PyPI 上的 ``aifc`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1515 +#: ../../whatsnew/3.13.rst:1531 msgid ":mod:`!audioop`" msgstr ":mod:`!audioop`" -#: ../../whatsnew/3.13.rst:1517 +#: ../../whatsnew/3.13.rst:1533 msgid ":pypi:`audioop-lts`: Use ``audioop-lts`` library from PyPI." msgstr ":pypi:`audioop-lts`:PyPI 上的 ``audioop-lts`` 函式庫。" -#: ../../whatsnew/3.13.rst:1520 +#: ../../whatsnew/3.13.rst:1536 msgid ":mod:`!chunk`" msgstr ":mod:`!chunk`" -#: ../../whatsnew/3.13.rst:1522 +#: ../../whatsnew/3.13.rst:1538 msgid "" ":pypi:`standard-chunk`: Use the redistribution of ``chunk`` library from " "PyPI." msgstr ":pypi:`standard-chunk`:PyPI 上的 ``chunk`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1525 +#: ../../whatsnew/3.13.rst:1541 msgid ":mod:`!cgi` and :mod:`!cgitb`" msgstr ":mod:`!cgi` 和 :mod:`!cgitb`" -#: ../../whatsnew/3.13.rst:1527 +#: ../../whatsnew/3.13.rst:1543 msgid "" ":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." "parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." @@ -2265,7 +2284,7 @@ msgstr "" "`urllib.parse.parse_qsl` 取代,而在於 ``POST`` 和 ``PUT`` 請求中可以被 :mod:" "`email.message` 模組或 :pypi:`multipart` 函式庫取代。" -#: ../../whatsnew/3.13.rst:1532 +#: ../../whatsnew/3.13.rst:1548 msgid "" ":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " "directly on the desired query string, unless the input is ``multipart/form-" @@ -2276,14 +2295,14 @@ msgstr "" "parse_qs` 來取代,除非輸入為 ``multipart/form-data``,而這種情況則應該如下所" "述地將 :func:`!cgi.parse_multipart` 給替換掉。" -#: ../../whatsnew/3.13.rst:1537 +#: ../../whatsnew/3.13.rst:1553 msgid "" ":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" "`email` package, which implements the same MIME RFCs. For example, with :" "class:`email.message.EmailMessage`:" msgstr "" -#: ../../whatsnew/3.13.rst:1541 +#: ../../whatsnew/3.13.rst:1557 msgid "" "from email.message import EmailMessage\n" "\n" @@ -2297,7 +2316,7 @@ msgstr "" "msg['content-type'] = 'application/json; charset=\"utf8\"'\n" "main, params = msg.get_content_type(), msg['content-type'].params" -#: ../../whatsnew/3.13.rst:1549 +#: ../../whatsnew/3.13.rst:1565 msgid "" ":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" "mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" @@ -2308,7 +2327,7 @@ msgstr "" "的功能取代,或者可以被 :pypi:`multipart` 函式庫取代,例如 :class:`email." "message.EmailMessage` 和 :class:`email.message.Message` 類別。" -#: ../../whatsnew/3.13.rst:1555 +#: ../../whatsnew/3.13.rst:1571 msgid "" ":pypi:`standard-cgi`: and :pypi:`standard-cgitb`: Use the redistribution of " "``cgi`` and ``cgitb`` library from PyPI." @@ -2316,29 +2335,29 @@ msgstr "" ":pypi:`standard-cgi` 和 :pypi:`standard-cgitb`:PyPI 上的 ``cgi`` 和 " "``cgitb`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1558 +#: ../../whatsnew/3.13.rst:1574 msgid "" ":mod:`!crypt` and the private :mod:`!_crypt` extension. The :mod:`hashlib` " "module may be an appropriate replacement when simply hashing a value is " "required. Otherwise, various third-party libraries on PyPI are available:" msgstr "" -#: ../../whatsnew/3.13.rst:1563 +#: ../../whatsnew/3.13.rst:1579 msgid "" ":pypi:`bcrypt`: Modern password hashing for your software and your servers." msgstr ":pypi:`bcrypt`:適用於你的軟體與伺服器的現代密碼雜湊演算法。" -#: ../../whatsnew/3.13.rst:1565 +#: ../../whatsnew/3.13.rst:1581 msgid "" ":pypi:`passlib`: Comprehensive password hashing framework supporting over 30 " "schemes." msgstr ":pypi:`passlib`:支援超過 30 種方案的廣泛密碼雜湊框架。" -#: ../../whatsnew/3.13.rst:1567 +#: ../../whatsnew/3.13.rst:1583 msgid ":pypi:`argon2-cffi`: The secure Argon2 password hashing algorithm." msgstr ":pypi:`argon2-cffi`:安全的 Argon2 密碼雜湊演算法。" -#: ../../whatsnew/3.13.rst:1569 +#: ../../whatsnew/3.13.rst:1585 msgid "" ":pypi:`legacycrypt`: :mod:`ctypes` wrapper to the POSIX crypt library call " "and associated functionality." @@ -2346,7 +2365,7 @@ msgstr "" ":pypi:`legacycrypt`:對 POSIX crypt 函式庫呼叫及相關功能的 :mod:`ctypes` 包" "裝。" -#: ../../whatsnew/3.13.rst:1572 +#: ../../whatsnew/3.13.rst:1588 msgid "" ":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" "`crypt_r(3)` library call and associated functionality." @@ -2354,7 +2373,7 @@ msgstr "" ":pypi:`crypt_r`:對 :mod:`!crypt` 模組的分支 (fork),對 :manpage:" "`crypt_r(3)` 函式庫呼叫及相關功能的包裝。" -#: ../../whatsnew/3.13.rst:1576 +#: ../../whatsnew/3.13.rst:1592 msgid "" ":pypi:`standard-crypt` and :pypi:`deprecated-crypt-alternative`: Use the " "redistribution of ``crypt`` and reimplementation of ``_crypt`` libraries " @@ -2363,7 +2382,7 @@ msgstr "" ":pypi:`standard-crypt` 和 :pypi:`deprecated-crypt-alternative`:PyPI 上的 " "``crypt`` 函式庫重新發布版和 ``_crypt`` 函式庫的重新實作。" -#: ../../whatsnew/3.13.rst:1579 +#: ../../whatsnew/3.13.rst:1595 msgid "" ":mod:`!imghdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements. For example, the :func:`!" @@ -2374,48 +2393,48 @@ msgstr "" "magic` 函式庫。例如 :func:`!puremagic.what` 函式可以取代 :mod:`!imghdr` 過去" "所支援所有文件格式的 :func:`!imghdr.what` 函式。" -#: ../../whatsnew/3.13.rst:1586 +#: ../../whatsnew/3.13.rst:1602 msgid "" ":pypi:`standard-imghdr`: Use the redistribution of ``imghdr`` library from " "PyPI." msgstr ":pypi:`standard-imghdr`:PyPI 上的 ``imghdr`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1589 +#: ../../whatsnew/3.13.rst:1605 msgid ":mod:`!mailcap`: Use the :mod:`mimetypes` module instead." msgstr ":mod:`!mailcap`:請改用 :mod:`mimetypes` 模組。" -#: ../../whatsnew/3.13.rst:1592 +#: ../../whatsnew/3.13.rst:1608 msgid "" ":pypi:`standard-mailcap`: Use the redistribution of ``mailcap`` library from " "PyPI." msgstr ":pypi:`standard-mailcap`:PyPI 上的 ``mailcap`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1595 +#: ../../whatsnew/3.13.rst:1611 msgid ":mod:`!msilib`" msgstr ":mod:`!msilib`" -#: ../../whatsnew/3.13.rst:1596 +#: ../../whatsnew/3.13.rst:1612 msgid ":mod:`!nis`" msgstr ":mod:`!nis`" -#: ../../whatsnew/3.13.rst:1597 +#: ../../whatsnew/3.13.rst:1613 msgid ":mod:`!nntplib`: Use the :pypi:`pynntp` library from PyPI instead." msgstr ":mod:`!nntplib`:請改用 PyPI 上的 :pypi:`pynntp` 函式庫。" -#: ../../whatsnew/3.13.rst:1600 +#: ../../whatsnew/3.13.rst:1616 msgid "" ":pypi:`standard-nntplib`: Use the redistribution of ``nntplib`` library from " "PyPI." msgstr ":pypi:`standard-nntplib`:PyPI 上的 ``nntplib`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1603 +#: ../../whatsnew/3.13.rst:1619 msgid "" ":mod:`!ossaudiodev`: For audio playback, use the :pypi:`pygame` library from " "PyPI instead." msgstr "" ":mod:`!ossaudiodev`:音訊播放方面,請改用 PyPI 上的 :pypi:`pygame` 函式庫。" -#: ../../whatsnew/3.13.rst:1605 +#: ../../whatsnew/3.13.rst:1621 msgid "" ":mod:`!pipes`: Use the :mod:`subprocess` module instead. Use :func:`shlex." "quote` to replace the undocumented ``pipes.quote`` function." @@ -2423,13 +2442,13 @@ msgstr "" ":mod:`!pipes`:請改用 :mod:`subprocess` 模組。使用 :func:`shlex.quote` 來取代" "未以文件紀錄的 ``pipes.quote`` 函式。" -#: ../../whatsnew/3.13.rst:1610 +#: ../../whatsnew/3.13.rst:1626 msgid "" ":pypi:`standard-pipes`: Use the redistribution of ``pipes`` library from " "PyPI." msgstr ":pypi:`standard-pipes`:PyPI 上的 ``pipes`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1613 +#: ../../whatsnew/3.13.rst:1629 msgid "" ":mod:`!sndhdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements." @@ -2437,27 +2456,27 @@ msgstr "" ":mod:`!sndhdr`:請改用 :pypi:`filetype`、:pypi:`puremagic` 或 :pypi:`python-" "magic` 函式庫。" -#: ../../whatsnew/3.13.rst:1617 +#: ../../whatsnew/3.13.rst:1633 msgid "" ":pypi:`standard-sndhdr`: Use the redistribution of ``sndhdr`` library from " "PyPI." msgstr ":pypi:`standard-sndhdr`:PyPI 上的 ``sndhdr`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1620 +#: ../../whatsnew/3.13.rst:1636 msgid ":mod:`!spwd`: Use the :pypi:`python-pam` library from PyPI instead." msgstr ":mod:`!spwd`:請改用 PyPI 上的 :pypi:`python-pam` 函式庫。" -#: ../../whatsnew/3.13.rst:1622 +#: ../../whatsnew/3.13.rst:1638 msgid ":mod:`!sunau`" msgstr ":mod:`!sunau`" -#: ../../whatsnew/3.13.rst:1624 +#: ../../whatsnew/3.13.rst:1640 msgid "" ":pypi:`standard-sunau`: Use the redistribution of ``sunau`` library from " "PyPI." msgstr ":pypi:`standard-sunau`:PyPI 上的 ``sunau`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1627 +#: ../../whatsnew/3.13.rst:1643 msgid "" ":mod:`!telnetlib`, Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries " "from PyPI instead." @@ -2465,33 +2484,33 @@ msgstr "" ":mod:`!telnetlib`:請改用 PyPI 上的 :pypi:`telnetlib3` 或 :pypi:`Exscript` 函" "式庫。" -#: ../../whatsnew/3.13.rst:1630 +#: ../../whatsnew/3.13.rst:1646 msgid "" ":pypi:`standard-telnetlib`: Use the redistribution of ``telnetlib`` library " "from PyPI." msgstr ":pypi:`standard-telnetlib`:PyPI 上的 ``telnetlib`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1633 +#: ../../whatsnew/3.13.rst:1649 msgid "" ":mod:`!uu`: Use the :mod:`base64` module instead, as a modern alternative." msgstr ":mod:`!uu`:請改用 :mod:`base64` 模組來作為當代的替代方案。" -#: ../../whatsnew/3.13.rst:1636 +#: ../../whatsnew/3.13.rst:1652 msgid "" ":pypi:`standard-uu`: Use the redistribution of ``uu`` library from PyPI." msgstr ":pypi:`standard-uu`:PyPI 上的 ``uu`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1639 +#: ../../whatsnew/3.13.rst:1655 msgid ":mod:`!xdrlib`" msgstr ":mod:`!xdrlib`" -#: ../../whatsnew/3.13.rst:1641 +#: ../../whatsnew/3.13.rst:1657 msgid "" ":pypi:`standard-xdrlib`: Use the redistribution of ``xdrlib`` library from " "PyPI." msgstr ":pypi:`standard-xdrlib`:PyPI 上的 ``xdrlib`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1644 +#: ../../whatsnew/3.13.rst:1660 msgid "" "(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" "`104780`.)" @@ -2499,22 +2518,22 @@ msgstr "" "(由 Victor Stinner 和 Zachary Ware 在 :gh:`104773` 和 :gh:`104780` 中貢" "獻。)" -#: ../../whatsnew/3.13.rst:1648 +#: ../../whatsnew/3.13.rst:1664 msgid "2to3" msgstr "2to3" -#: ../../whatsnew/3.13.rst:1650 +#: ../../whatsnew/3.13.rst:1666 msgid "" "Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " "previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1656 +#: ../../whatsnew/3.13.rst:1672 msgid "builtins" msgstr "builtins" -#: ../../whatsnew/3.13.rst:1658 +#: ../../whatsnew/3.13.rst:1674 msgid "" "Remove support for chained :class:`classmethod` descriptors (introduced in :" "gh:`63272`). These can no longer be used to wrap other descriptors, such as :" @@ -2524,47 +2543,47 @@ msgid "" "(Contributed by Raymond Hettinger in :gh:`89519`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1667 +#: ../../whatsnew/3.13.rst:1683 msgid "" "Raise a :exc:`RuntimeError` when calling :meth:`frame.clear` on a suspended " "frame (as has always been the case for an executing frame). (Contributed by " "Irit Katriel in :gh:`79932`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1675 +#: ../../whatsnew/3.13.rst:1691 msgid "" "Remove the undocumented :class:`!LegacyInterpolation` class, deprecated in " "the docstring since Python 3.2, and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104886`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1682 +#: ../../whatsnew/3.13.rst:1698 msgid "importlib.metadata" msgstr "importlib.metadata" -#: ../../whatsnew/3.13.rst:1684 +#: ../../whatsnew/3.13.rst:1700 msgid "" "Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" "`EntryPoint ` objects. (Contributed by Jason R. Coombs in :gh:" "`113175`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1690 +#: ../../whatsnew/3.13.rst:1706 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.13.rst:1692 +#: ../../whatsnew/3.13.rst:1708 msgid "" "Remove the :func:`!locale.resetlocale` function, deprecated in Python 3.11. " "Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. (Contributed by " "Victor Stinner in :gh:`104783`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1698 +#: ../../whatsnew/3.13.rst:1714 msgid "opcode" msgstr "opcode" -#: ../../whatsnew/3.13.rst:1700 +#: ../../whatsnew/3.13.rst:1716 msgid "" "Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." "ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " @@ -2572,7 +2591,7 @@ msgid "" "Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1705 +#: ../../whatsnew/3.13.rst:1721 msgid "" "Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" "attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " @@ -2580,11 +2599,11 @@ msgid "" "be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1713 +#: ../../whatsnew/3.13.rst:1729 msgid "optparse" msgstr "optparse" -#: ../../whatsnew/3.13.rst:1715 +#: ../../whatsnew/3.13.rst:1731 msgid "" "This module is no longer considered :term:`soft deprecated`. While :mod:" "`argparse` remains preferred for new projects that aren't using a third " @@ -2597,43 +2616,43 @@ msgid "" "(Contributed by Alyssa Coghlan and Serhiy Storchaka in :gh:`126180`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1731 +#: ../../whatsnew/3.13.rst:1747 msgid "" "Remove the ability to use :class:`~pathlib.Path` objects as context " "managers. This functionality was deprecated and has had no effect since " "Python 3.9. (Contributed by Barney Gale in :gh:`83863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1739 +#: ../../whatsnew/3.13.rst:1755 msgid "" "Remove the undocumented, deprecated, and broken :func:`!re.template` " "function and :attr:`!re.TEMPLATE` / :attr:`!re.T` flag. (Contributed by " "Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1745 +#: ../../whatsnew/3.13.rst:1761 msgid "tkinter.tix" msgstr "tkinter.tix" -#: ../../whatsnew/3.13.rst:1747 +#: ../../whatsnew/3.13.rst:1763 msgid "" "Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-" "party Tix library which the module wrapped is unmaintained. (Contributed by " "Zachary Ware in :gh:`75552`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1753 +#: ../../whatsnew/3.13.rst:1769 msgid "turtle" msgstr "turtle" -#: ../../whatsnew/3.13.rst:1755 +#: ../../whatsnew/3.13.rst:1771 msgid "" "Remove the :meth:`!RawTurtle.settiltangle` method, deprecated in the " "documentation since Python 3.1 and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104876`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1764 +#: ../../whatsnew/3.13.rst:1780 msgid "" "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " "since Python 3.8. The items in those namespaces can be imported directly " @@ -2641,66 +2660,66 @@ msgid "" "`92871`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1770 +#: ../../whatsnew/3.13.rst:1786 msgid "" "Remove the keyword-argument method of creating :class:`~typing.TypedDict` " "types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" "`104786`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1776 +#: ../../whatsnew/3.13.rst:1792 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.13.rst:1778 +#: ../../whatsnew/3.13.rst:1794 msgid "" "Remove the following :mod:`unittest` functions, deprecated in Python 3.11:" msgstr "移除以下在 Python 3.11 中已被棄用的 :mod:`unittest` 函式:" -#: ../../whatsnew/3.13.rst:1780 +#: ../../whatsnew/3.13.rst:1796 msgid ":func:`!unittest.findTestCases`" msgstr ":func:`!unittest.findTestCases`" -#: ../../whatsnew/3.13.rst:1781 +#: ../../whatsnew/3.13.rst:1797 msgid ":func:`!unittest.makeSuite`" msgstr ":func:`!unittest.makeSuite`" -#: ../../whatsnew/3.13.rst:1782 +#: ../../whatsnew/3.13.rst:1798 msgid ":func:`!unittest.getTestCaseNames`" msgstr ":func:`!unittest.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1784 +#: ../../whatsnew/3.13.rst:1800 msgid "Use :class:`~unittest.TestLoader` methods instead:" msgstr "" -#: ../../whatsnew/3.13.rst:1786 +#: ../../whatsnew/3.13.rst:1802 msgid ":meth:`~unittest.TestLoader.loadTestsFromModule`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromModule`" -#: ../../whatsnew/3.13.rst:1787 +#: ../../whatsnew/3.13.rst:1803 msgid ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" -#: ../../whatsnew/3.13.rst:1788 +#: ../../whatsnew/3.13.rst:1804 msgid ":meth:`~unittest.TestLoader.getTestCaseNames`" msgstr ":meth:`~unittest.TestLoader.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1790 +#: ../../whatsnew/3.13.rst:1806 msgid "(Contributed by Hugo van Kemenade in :gh:`104835`.)" msgstr "(由 Hugo van Kemenade 在 :gh:`104835` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1792 +#: ../../whatsnew/3.13.rst:1808 msgid "" "Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " "deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" "`104992`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1798 +#: ../../whatsnew/3.13.rst:1814 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.13.rst:1800 +#: ../../whatsnew/3.13.rst:1816 msgid "" "Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" "`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " @@ -2711,33 +2730,33 @@ msgid "" "Victor Stinner in :gh:`105382`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1811 +#: ../../whatsnew/3.13.rst:1827 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.13.rst:1813 +#: ../../whatsnew/3.13.rst:1829 msgid "" "Remove the untested and undocumented :class:`!MacOSX` class, deprecated in " "Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python " "3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1818 +#: ../../whatsnew/3.13.rst:1834 msgid "" "Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" "attr:`MacOSXOSAScript.name ` attribute instead. " "(Contributed by Nikita Sobolev in :gh:`105546`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1825 +#: ../../whatsnew/3.13.rst:1841 msgid "New Deprecations" msgstr "" -#: ../../whatsnew/3.13.rst:1827 +#: ../../whatsnew/3.13.rst:1843 msgid ":ref:`User-defined functions `:" msgstr "" -#: ../../whatsnew/3.13.rst:1829 +#: ../../whatsnew/3.13.rst:1845 msgid "" "Deprecate assignment to a function's :attr:`~function.__code__` attribute, " "where the new code object's type does not match the function's type. The " @@ -2745,12 +2764,12 @@ msgid "" "coroutine. (Contributed by Irit Katriel in :gh:`81137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1835 +#: ../../whatsnew/3.13.rst:1851 #: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../whatsnew/3.13.rst:1837 +#: ../../whatsnew/3.13.rst:1853 msgid "" "Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " "format code has been deprecated in documentation since Python 3.3, and will " @@ -2759,61 +2778,61 @@ msgid "" "`80480`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1844 +#: ../../whatsnew/3.13.rst:1860 #: ../../deprecations/pending-removal-in-3.15.rst:16 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../whatsnew/3.13.rst:1846 +#: ../../whatsnew/3.13.rst:1862 msgid "" "Deprecate the undocumented :func:`!SetPointerType` function, to be removed " "in Python 3.15. (Contributed by Victor Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1850 +#: ../../whatsnew/3.13.rst:1866 msgid "" ":term:`Soft-deprecate ` the :func:`~ctypes.ARRAY` function " "in favour of ``type * length`` multiplication. (Contributed by Victor " "Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1854 +#: ../../whatsnew/3.13.rst:1870 msgid ":mod:`decimal`:" msgstr ":mod:`decimal`:" -#: ../../whatsnew/3.13.rst:1856 +#: ../../whatsnew/3.13.rst:1872 msgid "" "Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format " "specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C " "implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1861 +#: ../../whatsnew/3.13.rst:1877 msgid ":mod:`dis`:" msgstr ":mod:`dis`:" -#: ../../whatsnew/3.13.rst:1863 +#: ../../whatsnew/3.13.rst:1879 msgid "" "Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" "`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1867 +#: ../../whatsnew/3.13.rst:1883 msgid ":mod:`gettext`:" msgstr ":mod:`gettext`:" -#: ../../whatsnew/3.13.rst:1869 +#: ../../whatsnew/3.13.rst:1885 msgid "" "Deprecate non-integer numbers as arguments to functions and methods that " "consider plural forms in the :mod:`!gettext` module, even if no translation " "was found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1874 +#: ../../whatsnew/3.13.rst:1890 msgid ":mod:`glob`:" msgstr ":mod:`glob`:" -#: ../../whatsnew/3.13.rst:1876 +#: ../../whatsnew/3.13.rst:1892 msgid "" "Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" "func:`~glob.glob` and pass a :term:`path-like object` specifying the root " @@ -2821,12 +2840,12 @@ msgid "" "in :gh:`117337`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1881 +#: ../../whatsnew/3.13.rst:1897 #: ../../deprecations/pending-removal-in-3.15.rst:21 msgid ":mod:`http.server`:" msgstr ":mod:`http.server`:" -#: ../../whatsnew/3.13.rst:1883 +#: ../../whatsnew/3.13.rst:1899 msgid "" "Deprecate :class:`~http.server.CGIHTTPRequestHandler`, to be removed in " "Python 3.15. Process-based CGI HTTP servers have been out of favor for a " @@ -2835,29 +2854,29 @@ msgid "" "by Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1890 +#: ../../whatsnew/3.13.rst:1906 msgid "" "Deprecate the :option:`!--cgi` flag to the :program:`python -m http.server` " "command-line interface, to be removed in Python 3.15. (Contributed by " "Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1895 +#: ../../whatsnew/3.13.rst:1911 msgid ":mod:`mimetypes`:" msgstr ":mod:`mimetypes`:" -#: ../../whatsnew/3.13.rst:1897 +#: ../../whatsnew/3.13.rst:1913 msgid "" ":term:`Soft-deprecate ` file path arguments to :func:" "`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` instead. " "(Contributed by Serhiy Storchaka in :gh:`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1902 +#: ../../whatsnew/3.13.rst:1918 msgid ":mod:`re`:" msgstr ":mod:`re`:" -#: ../../whatsnew/3.13.rst:1904 +#: ../../whatsnew/3.13.rst:1920 msgid "" "Deprecate passing the optional *maxsplit*, *count*, or *flags* arguments as " "positional arguments to the module-level :func:`~re.split`, :func:`~re.sub`, " @@ -2866,46 +2885,46 @@ msgid "" "by Serhiy Storchaka in :gh:`56166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1911 +#: ../../whatsnew/3.13.rst:1927 #: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../whatsnew/3.13.rst:1913 +#: ../../whatsnew/3.13.rst:1929 msgid "" "Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " "by Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1918 +#: ../../whatsnew/3.13.rst:1934 #: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../whatsnew/3.13.rst:1920 +#: ../../whatsnew/3.13.rst:1936 msgid "" "Deprecate :func:`~platform.java_ver`, to be removed in Python 3.15. This " "function is only useful for Jython support, has a confusing API, and is " "largely untested. (Contributed by Nikita Sobolev in :gh:`116349`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1926 +#: ../../whatsnew/3.13.rst:1942 msgid ":mod:`pydoc`:" msgstr ":mod:`pydoc`:" -#: ../../whatsnew/3.13.rst:1928 +#: ../../whatsnew/3.13.rst:1944 msgid "" "Deprecate the undocumented :func:`!ispackage` function. (Contributed by " "Zackery Spytz in :gh:`64020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1931 +#: ../../whatsnew/3.13.rst:1947 #: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.13.rst:1933 +#: ../../whatsnew/3.13.rst:1949 msgid "" "Deprecate passing more than one positional argument to the :func:`~sqlite3." "connect` function and the :class:`~sqlite3.Connection` constructor. The " @@ -2913,7 +2932,7 @@ msgid "" "by Erlend E. Aasland in :gh:`107948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1939 +#: ../../whatsnew/3.13.rst:1955 msgid "" "Deprecate passing name, number of arguments, and the callable as keyword " "arguments for :meth:`.Connection.create_function` and :meth:`.Connection." @@ -2921,7 +2940,7 @@ msgid "" "3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1945 +#: ../../whatsnew/3.13.rst:1961 msgid "" "Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." "Connection.set_authorizer`, :meth:`~sqlite3.Connection." @@ -2931,46 +2950,46 @@ msgid "" "`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1953 +#: ../../whatsnew/3.13.rst:1969 #: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../whatsnew/3.13.rst:1955 +#: ../../whatsnew/3.13.rst:1971 msgid "" "Deprecate the :func:`~sys._enablelegacywindowsfsencoding` function, to be " "removed in Python 3.16. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable instead. (Contributed by Inada Naoki in :gh:`73427`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1960 +#: ../../whatsnew/3.13.rst:1976 #: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../whatsnew/3.13.rst:1962 +#: ../../whatsnew/3.13.rst:1978 msgid "" "Deprecate the undocumented and unused :attr:`!TarFile.tarfile` attribute, to " "be removed in Python 3.16. (Contributed in :gh:`115256`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1966 +#: ../../whatsnew/3.13.rst:1982 msgid ":mod:`traceback`:" msgstr ":mod:`traceback`:" -#: ../../whatsnew/3.13.rst:1968 +#: ../../whatsnew/3.13.rst:1984 msgid "" "Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." "TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" "gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1972 +#: ../../whatsnew/3.13.rst:1988 #: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.13.rst:1974 +#: ../../whatsnew/3.13.rst:1990 msgid "" "Deprecate the undocumented keyword argument syntax for creating :class:" "`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " @@ -2978,7 +2997,7 @@ msgid "" "functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1981 +#: ../../whatsnew/3.13.rst:1997 msgid "" "Deprecate omitting the *fields* parameter when creating a :class:`~typing." "NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " @@ -2990,7 +3009,7 @@ msgid "" "Alex Waygood in :gh:`105566` and :gh:`105570`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1991 +#: ../../whatsnew/3.13.rst:2007 msgid "" "Deprecate the :func:`typing.no_type_check_decorator` decorator function, to " "be removed in in Python 3.15. After eight years in the :mod:`typing` module, " @@ -2998,7 +3017,7 @@ msgid "" "Waygood in :gh:`106309`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1997 +#: ../../whatsnew/3.13.rst:2013 msgid "" "Deprecate :data:`typing.AnyStr`. In Python 3.16, it will be removed from " "``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted at " @@ -3007,12 +3026,12 @@ msgid "" "(Contributed by Michael The in :gh:`107116`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2005 +#: ../../whatsnew/3.13.rst:2021 #: ../../deprecations/pending-removal-in-3.15.rst:100 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../whatsnew/3.13.rst:2007 +#: ../../whatsnew/3.13.rst:2023 msgid "" "Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" "`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" @@ -3928,11 +3947,11 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../whatsnew/3.13.rst:2024 +#: ../../whatsnew/3.13.rst:2040 msgid "CPython Bytecode Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2026 +#: ../../whatsnew/3.13.rst:2042 msgid "" "The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " "yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " @@ -3941,97 +3960,97 @@ msgid "" "`111354`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2034 +#: ../../whatsnew/3.13.rst:2050 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.13.rst:2039 +#: ../../whatsnew/3.13.rst:2055 msgid "" "Add the :ref:`PyMonitoring C API ` for generating :pep:" "`669` monitoring events:" msgstr "" -#: ../../whatsnew/3.13.rst:2042 +#: ../../whatsnew/3.13.rst:2058 msgid ":c:type:`PyMonitoringState`" msgstr ":c:type:`PyMonitoringState`" -#: ../../whatsnew/3.13.rst:2043 +#: ../../whatsnew/3.13.rst:2059 msgid ":c:func:`PyMonitoring_FirePyStartEvent`" msgstr ":c:func:`PyMonitoring_FirePyStartEvent`" -#: ../../whatsnew/3.13.rst:2044 +#: ../../whatsnew/3.13.rst:2060 msgid ":c:func:`PyMonitoring_FirePyResumeEvent`" msgstr ":c:func:`PyMonitoring_FirePyResumeEvent`" -#: ../../whatsnew/3.13.rst:2045 +#: ../../whatsnew/3.13.rst:2061 msgid ":c:func:`PyMonitoring_FirePyReturnEvent`" msgstr ":c:func:`PyMonitoring_FirePyReturnEvent`" -#: ../../whatsnew/3.13.rst:2046 +#: ../../whatsnew/3.13.rst:2062 msgid ":c:func:`PyMonitoring_FirePyYieldEvent`" msgstr ":c:func:`PyMonitoring_FirePyYieldEvent`" -#: ../../whatsnew/3.13.rst:2047 +#: ../../whatsnew/3.13.rst:2063 msgid ":c:func:`PyMonitoring_FireCallEvent`" msgstr ":c:func:`PyMonitoring_FireCallEvent`" -#: ../../whatsnew/3.13.rst:2048 +#: ../../whatsnew/3.13.rst:2064 msgid ":c:func:`PyMonitoring_FireLineEvent`" msgstr ":c:func:`PyMonitoring_FireLineEvent`" -#: ../../whatsnew/3.13.rst:2049 +#: ../../whatsnew/3.13.rst:2065 msgid ":c:func:`PyMonitoring_FireJumpEvent`" msgstr ":c:func:`PyMonitoring_FireJumpEvent`" -#: ../../whatsnew/3.13.rst:2050 +#: ../../whatsnew/3.13.rst:2066 msgid ":c:func:`PyMonitoring_FireBranchEvent`" msgstr ":c:func:`PyMonitoring_FireBranchEvent`" -#: ../../whatsnew/3.13.rst:2051 +#: ../../whatsnew/3.13.rst:2067 msgid ":c:func:`PyMonitoring_FireCReturnEvent`" msgstr ":c:func:`PyMonitoring_FireCReturnEvent`" -#: ../../whatsnew/3.13.rst:2052 +#: ../../whatsnew/3.13.rst:2068 msgid ":c:func:`PyMonitoring_FirePyThrowEvent`" msgstr ":c:func:`PyMonitoring_FirePyThrowEvent`" -#: ../../whatsnew/3.13.rst:2053 +#: ../../whatsnew/3.13.rst:2069 msgid ":c:func:`PyMonitoring_FireRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireRaiseEvent`" -#: ../../whatsnew/3.13.rst:2054 +#: ../../whatsnew/3.13.rst:2070 msgid ":c:func:`PyMonitoring_FireCRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireCRaiseEvent`" -#: ../../whatsnew/3.13.rst:2055 +#: ../../whatsnew/3.13.rst:2071 msgid ":c:func:`PyMonitoring_FireReraiseEvent`" msgstr ":c:func:`PyMonitoring_FireReraiseEvent`" -#: ../../whatsnew/3.13.rst:2056 +#: ../../whatsnew/3.13.rst:2072 msgid ":c:func:`PyMonitoring_FireExceptionHandledEvent`" msgstr ":c:func:`PyMonitoring_FireExceptionHandledEvent`" -#: ../../whatsnew/3.13.rst:2057 +#: ../../whatsnew/3.13.rst:2073 msgid ":c:func:`PyMonitoring_FirePyUnwindEvent`" msgstr ":c:func:`PyMonitoring_FirePyUnwindEvent`" -#: ../../whatsnew/3.13.rst:2058 +#: ../../whatsnew/3.13.rst:2074 msgid ":c:func:`PyMonitoring_FireStopIterationEvent`" msgstr ":c:func:`PyMonitoring_FireStopIterationEvent`" -#: ../../whatsnew/3.13.rst:2059 +#: ../../whatsnew/3.13.rst:2075 msgid ":c:func:`PyMonitoring_EnterScope`" msgstr ":c:func:`PyMonitoring_EnterScope`" -#: ../../whatsnew/3.13.rst:2060 +#: ../../whatsnew/3.13.rst:2076 msgid ":c:func:`PyMonitoring_ExitScope`" msgstr ":c:func:`PyMonitoring_ExitScope`" -#: ../../whatsnew/3.13.rst:2062 +#: ../../whatsnew/3.13.rst:2078 msgid "(Contributed by Irit Katriel in :gh:`111997`)." msgstr "(由 Irit Katriel 在 :gh:`111997` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2064 +#: ../../whatsnew/3.13.rst:2080 msgid "" "Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " "the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" @@ -4039,52 +4058,52 @@ msgid "" "operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2070 +#: ../../whatsnew/3.13.rst:2086 msgid "" "Add the :ref:`PyTime C API ` to provide access to system clocks:" msgstr "" -#: ../../whatsnew/3.13.rst:2072 +#: ../../whatsnew/3.13.rst:2088 msgid ":c:type:`PyTime_t`." msgstr ":c:type:`PyTime_t`。" -#: ../../whatsnew/3.13.rst:2073 +#: ../../whatsnew/3.13.rst:2089 msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX`." msgstr "" -#: ../../whatsnew/3.13.rst:2074 +#: ../../whatsnew/3.13.rst:2090 msgid ":c:func:`PyTime_AsSecondsDouble`." msgstr ":c:func:`PyTime_AsSecondsDouble`。" -#: ../../whatsnew/3.13.rst:2075 +#: ../../whatsnew/3.13.rst:2091 msgid ":c:func:`PyTime_Monotonic`." msgstr ":c:func:`PyTime_Monotonic`。" -#: ../../whatsnew/3.13.rst:2076 +#: ../../whatsnew/3.13.rst:2092 msgid ":c:func:`PyTime_MonotonicRaw`." msgstr ":c:func:`PyTime_MonotonicRaw`。" -#: ../../whatsnew/3.13.rst:2077 +#: ../../whatsnew/3.13.rst:2093 msgid ":c:func:`PyTime_PerfCounter`." msgstr ":c:func:`PyTime_PerfCounter`。" -#: ../../whatsnew/3.13.rst:2078 +#: ../../whatsnew/3.13.rst:2094 msgid ":c:func:`PyTime_PerfCounterRaw`." msgstr ":c:func:`PyTime_PerfCounterRaw`。" -#: ../../whatsnew/3.13.rst:2079 +#: ../../whatsnew/3.13.rst:2095 msgid ":c:func:`PyTime_Time`." msgstr ":c:func:`PyTime_Time`。" -#: ../../whatsnew/3.13.rst:2080 +#: ../../whatsnew/3.13.rst:2096 msgid ":c:func:`PyTime_TimeRaw`." msgstr ":c:func:`PyTime_TimeRaw`。" -#: ../../whatsnew/3.13.rst:2082 +#: ../../whatsnew/3.13.rst:2098 msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" msgstr "(由 Victor Stinner 和 Petr Viktorin 在 :gh:`110850` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2084 +#: ../../whatsnew/3.13.rst:2100 msgid "" "Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" "c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " @@ -4092,7 +4111,7 @@ msgid "" "by Victor Stinner in :gh:`108314`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2090 +#: ../../whatsnew/3.13.rst:2106 msgid "" "Add the :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " "functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " @@ -4102,7 +4121,7 @@ msgid "" "`106004`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2098 +#: ../../whatsnew/3.13.rst:2114 msgid "" "Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" "c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " @@ -4111,7 +4130,7 @@ msgid "" "dictionary. (Contributed by Sam Gross in :gh:`112066`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2106 +#: ../../whatsnew/3.13.rst:2122 msgid "" "Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " "remove a key from a dictionary and optionally return the removed value. This " @@ -4120,7 +4139,7 @@ msgid "" "Victor Stinner in :gh:`111262`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2113 +#: ../../whatsnew/3.13.rst:2129 msgid "" "Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" "`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" @@ -4131,7 +4150,7 @@ msgid "" "gh:`106307`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2123 +#: ../../whatsnew/3.13.rst:2139 msgid "" "Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" "`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" @@ -4142,37 +4161,37 @@ msgid "" "Serhiy Storchaka in :gh:`106521`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2133 +#: ../../whatsnew/3.13.rst:2149 msgid "" "Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" "`PyErr_WriteUnraisable` that allows customizing the warning message. " "(Contributed by Serhiy Storchaka in :gh:`108082`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2138 +#: ../../whatsnew/3.13.rst:2154 msgid "" "Add new functions that return a :term:`strong reference` instead of a :term:" "`borrowed reference` for frame locals, globals, and builtins, as part of :" "ref:`PEP 667 `:" msgstr "" -#: ../../whatsnew/3.13.rst:2142 +#: ../../whatsnew/3.13.rst:2158 msgid ":c:func:`PyEval_GetFrameBuiltins` replaces :c:func:`PyEval_GetBuiltins`" msgstr ":c:func:`PyEval_GetFrameBuiltins` 取代 :c:func:`PyEval_GetBuiltins`" -#: ../../whatsnew/3.13.rst:2143 +#: ../../whatsnew/3.13.rst:2159 msgid ":c:func:`PyEval_GetFrameGlobals` replaces :c:func:`PyEval_GetGlobals`" msgstr ":c:func:`PyEval_GetFrameGlobals` 取代 :c:func:`PyEval_GetGlobals`" -#: ../../whatsnew/3.13.rst:2144 +#: ../../whatsnew/3.13.rst:2160 msgid ":c:func:`PyEval_GetFrameLocals` replaces :c:func:`PyEval_GetLocals`" msgstr ":c:func:`PyEval_GetFrameLocals` 取代 :c:func:`PyEval_GetLocals`" -#: ../../whatsnew/3.13.rst:2146 +#: ../../whatsnew/3.13.rst:2162 msgid "(Contributed by Mark Shannon and Tian Gao in :gh:`74929`.)" msgstr "(由 Mark Shannon 和 Tian Gao 在 :gh:`74929` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2148 +#: ../../whatsnew/3.13.rst:2164 msgid "" "Add the :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` " "functions to get :term:`strong ` or :term:`borrowed " @@ -4181,7 +4200,7 @@ msgid "" "constant zero. (Contributed by Victor Stinner in :gh:`115754`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2155 +#: ../../whatsnew/3.13.rst:2171 msgid "" "Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" "func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " @@ -4189,35 +4208,35 @@ msgid "" "`105922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2160 +#: ../../whatsnew/3.13.rst:2176 msgid "" "Add the :c:func:`Py_IsFinalizing` function to check whether the main Python " "interpreter is :term:`shutting down `. (Contributed by " "Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2165 +#: ../../whatsnew/3.13.rst:2181 msgid "" "Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" "`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" "`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2170 +#: ../../whatsnew/3.13.rst:2186 msgid "" "Add the :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions, " "mirroring the Python :meth:`!list.extend` and :meth:`!list.clear` methods. " "(Contributed by Victor Stinner in :gh:`111138`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2174 +#: ../../whatsnew/3.13.rst:2190 msgid "" "Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" "`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" "c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2179 +#: ../../whatsnew/3.13.rst:2195 msgid "" "Add the :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes`, " "and :c:func:`PyLong_FromUnsignedNativeBytes` functions to simplify " @@ -4225,27 +4244,27 @@ msgid "" "(Contributed by Steve Dower in :gh:`111140`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2185 +#: ../../whatsnew/3.13.rst:2201 msgid "" "Add :c:func:`PyModule_Add` function, which is similar to :c:func:" "`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " "a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2190 +#: ../../whatsnew/3.13.rst:2206 msgid "" "Add the :c:func:`PyObject_GenericHash` function that implements the default " "hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" "`113024`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2194 +#: ../../whatsnew/3.13.rst:2210 msgid "" "Add the :c:func:`Py_HashPointer` function to hash a raw pointer. " "(Contributed by Victor Stinner in :gh:`111545`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2197 +#: ../../whatsnew/3.13.rst:2213 msgid "" "Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" "`PyObject_ClearManagedDict` functions. which must be called by the traverse " @@ -4254,7 +4273,7 @@ msgid "" "with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2205 +#: ../../whatsnew/3.13.rst:2221 msgid "" "Add the :c:func:`PyRefTracer_SetTracer` and :c:func:`PyRefTracer_GetTracer` " "functions, which enable tracking object creation and destruction in the same " @@ -4262,14 +4281,14 @@ msgid "" "in :gh:`93502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2211 +#: ../../whatsnew/3.13.rst:2227 msgid "" "Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" "`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2216 +#: ../../whatsnew/3.13.rst:2232 msgid "" "Add the :c:func:`PyThreadState_GetUnchecked()` function as an alternative " "to :c:func:`PyThreadState_Get()` that doesn't kill the process with a fatal " @@ -4277,7 +4296,7 @@ msgid "" "result is ``NULL``. (Contributed by Victor Stinner in :gh:`108867`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2222 +#: ../../whatsnew/3.13.rst:2238 msgid "" "Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " "fully qualified name. The module name is prepended if :attr:`type." @@ -4285,14 +4304,14 @@ msgid "" "``'__main__'``. (Contributed by Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2228 +#: ../../whatsnew/3.13.rst:2244 msgid "" "Add the :c:func:`PyType_GetModuleName` function to get the type's module " "name. This is equivalent to getting the :attr:`type.__module__` attribute. " "(Contributed by Eric Snow and Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2233 +#: ../../whatsnew/3.13.rst:2249 msgid "" "Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" "`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" @@ -4301,7 +4320,7 @@ msgid "" "Storchaka in :gh:`110289`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2240 +#: ../../whatsnew/3.13.rst:2256 msgid "" "Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" "`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " @@ -4309,16 +4328,16 @@ msgid "" "`105927`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2246 +#: ../../whatsnew/3.13.rst:2262 msgid "Add fixed variants of functions which silently ignore errors:" msgstr "" -#: ../../whatsnew/3.13.rst:2248 +#: ../../whatsnew/3.13.rst:2264 msgid "" ":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." msgstr ":c:func:`PyObject_HasAttrWithError` 取代 :c:func:`PyObject_HasAttr`。" -#: ../../whatsnew/3.13.rst:2249 +#: ../../whatsnew/3.13.rst:2265 msgid "" ":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" "`PyObject_HasAttrString`." @@ -4326,12 +4345,12 @@ msgstr "" ":c:func:`PyObject_HasAttrStringWithError` 取代 :c:func:" "`PyObject_HasAttrString`。" -#: ../../whatsnew/3.13.rst:2251 +#: ../../whatsnew/3.13.rst:2267 msgid "" ":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." msgstr ":c:func:`PyMapping_HasKeyWithError` 取代 :c:func:`PyMapping_HasKey`。" -#: ../../whatsnew/3.13.rst:2252 +#: ../../whatsnew/3.13.rst:2268 msgid "" ":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" "`PyMapping_HasKeyString`." @@ -4339,21 +4358,21 @@ msgstr "" ":c:func:`PyMapping_HasKeyStringWithError` 取代 :c:func:" "`PyMapping_HasKeyString`。" -#: ../../whatsnew/3.13.rst:2255 +#: ../../whatsnew/3.13.rst:2271 msgid "" "The new functions return ``-1`` for errors and the standard ``1`` for true " "and ``0`` for false." msgstr "" -#: ../../whatsnew/3.13.rst:2258 +#: ../../whatsnew/3.13.rst:2274 msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" msgstr "(由 Serhiy Storchaka 在 :gh:`108511` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2262 +#: ../../whatsnew/3.13.rst:2278 msgid "Changed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2264 +#: ../../whatsnew/3.13.rst:2280 msgid "" "The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" "func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " @@ -4366,20 +4385,20 @@ msgid "" "`65210`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2276 +#: ../../whatsnew/3.13.rst:2292 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " "parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2280 +#: ../../whatsnew/3.13.rst:2296 msgid "" "The :c:func:`!PyCode_GetFirstFree` function is now unstable API and is now " "named :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan " "Romanyuk in :gh:`115781`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2284 +#: ../../whatsnew/3.13.rst:2300 msgid "" "The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" "`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" @@ -4390,35 +4409,35 @@ msgid "" "documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2293 +#: ../../whatsnew/3.13.rst:2309 msgid "" "Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" "`PyUnicode_FromFormat`:" msgstr "" -#: ../../whatsnew/3.13.rst:2296 +#: ../../whatsnew/3.13.rst:2312 msgid "``%T``: Get the fully qualified name of an object type" msgstr "" -#: ../../whatsnew/3.13.rst:2297 +#: ../../whatsnew/3.13.rst:2313 msgid "``%#T``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2298 +#: ../../whatsnew/3.13.rst:2314 msgid "``%N``: Get the fully qualified name of a type" msgstr "" -#: ../../whatsnew/3.13.rst:2299 +#: ../../whatsnew/3.13.rst:2315 msgid "``%#N``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2301 +#: ../../whatsnew/3.13.rst:2317 msgid "" "See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" "`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2304 +#: ../../whatsnew/3.13.rst:2320 msgid "" "You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " "including :file:`Python.h` when using ``#`` formats in :ref:`format codes " @@ -4427,7 +4446,7 @@ msgid "" "`104922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2310 +#: ../../whatsnew/3.13.rst:2326 msgid "" "If Python is built in :ref:`debug mode ` or :option:`with " "assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" @@ -4435,61 +4454,61 @@ msgid "" "(Contributed by Victor Stinner in :gh:`106168`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2318 +#: ../../whatsnew/3.13.rst:2334 msgid "Limited C API Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2320 +#: ../../whatsnew/3.13.rst:2336 msgid "The following functions are now included in the Limited C API:" msgstr "" -#: ../../whatsnew/3.13.rst:2322 +#: ../../whatsnew/3.13.rst:2338 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../whatsnew/3.13.rst:2323 +#: ../../whatsnew/3.13.rst:2339 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../whatsnew/3.13.rst:2324 +#: ../../whatsnew/3.13.rst:2340 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../whatsnew/3.13.rst:2325 +#: ../../whatsnew/3.13.rst:2341 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../whatsnew/3.13.rst:2326 +#: ../../whatsnew/3.13.rst:2342 msgid ":c:func:`PySys_Audit`" msgstr ":c:func:`PySys_Audit`" -#: ../../whatsnew/3.13.rst:2327 +#: ../../whatsnew/3.13.rst:2343 msgid ":c:func:`PySys_AuditTuple`" msgstr ":c:func:`PySys_AuditTuple`" -#: ../../whatsnew/3.13.rst:2328 +#: ../../whatsnew/3.13.rst:2344 msgid ":c:func:`PyType_GetModuleByDef`" msgstr ":c:func:`PyType_GetModuleByDef`" -#: ../../whatsnew/3.13.rst:2330 +#: ../../whatsnew/3.13.rst:2346 msgid "" "(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" "`116936`.)" msgstr "" "(由 Victor Stinner 貢獻於 :gh:`85283`、:gh:`85283` 和 :gh:`116936`。)" -#: ../../whatsnew/3.13.rst:2332 +#: ../../whatsnew/3.13.rst:2348 msgid "" "Python built with :option:`--with-trace-refs` (tracing references) now " "supports the :ref:`Limited API `. (Contributed by Victor " "Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2338 +#: ../../whatsnew/3.13.rst:2354 msgid "Removed C APIs" msgstr "移除的 C API" -#: ../../whatsnew/3.13.rst:2340 +#: ../../whatsnew/3.13.rst:2356 msgid "" "Remove several functions, macros, variables, etc with names prefixed by " "``_Py`` or ``_PY`` (which are considered private). If your project is " @@ -4499,13 +4518,13 @@ msgid "" "Victor Stinner. (Contributed by Victor Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2348 +#: ../../whatsnew/3.13.rst:2364 msgid "" "Remove old buffer protocols deprecated in Python 3.0. Use :ref:" "`bufferobjects` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2351 +#: ../../whatsnew/3.13.rst:2367 msgid "" ":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " "test whether the object supports the buffer protocol. Note that :c:func:" @@ -4514,7 +4533,7 @@ msgid "" "example of :c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../whatsnew/3.13.rst:2359 +#: ../../whatsnew/3.13.rst:2375 msgid "" ":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" "func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" @@ -4522,7 +4541,7 @@ msgstr "" ":c:func:`!PyObject_AsCharBuffer`、:c:func:`!PyObject_AsReadBuffer`:請改用 :" "c:func:`PyObject_GetBuffer` 和 :c:func:`PyBuffer_Release`。" -#: ../../whatsnew/3.13.rst:2362 +#: ../../whatsnew/3.13.rst:2378 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" @@ -4533,7 +4552,7 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2372 +#: ../../whatsnew/3.13.rst:2388 msgid "" ":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" "func:`PyBuffer_Release` instead:" @@ -4541,7 +4560,7 @@ msgstr "" ":c:func:`!PyObject_AsWriteBuffer`:請改用 :c:func:`PyObject_GetBuffer` 和 :c:" "func:`PyBuffer_Release`。" -#: ../../whatsnew/3.13.rst:2375 +#: ../../whatsnew/3.13.rst:2391 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" @@ -4551,15 +4570,15 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2384 +#: ../../whatsnew/3.13.rst:2400 msgid "(Contributed by Inada Naoki in :gh:`85275`.)" msgstr "(由 Inada Naoki 貢獻於 :gh:`85275`。)" -#: ../../whatsnew/3.13.rst:2386 +#: ../../whatsnew/3.13.rst:2402 msgid "Remove various functions deprecated in Python 3.9:" msgstr "" -#: ../../whatsnew/3.13.rst:2388 +#: ../../whatsnew/3.13.rst:2404 msgid "" ":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" "c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." @@ -4567,7 +4586,7 @@ msgstr "" ":c:func:`!PyEval_CallObject`、:c:func:`!PyEval_CallObjectWithKeywords`:請改" "用 :c:func:`PyObject_CallNoArgs` 或 :c:func:`PyObject_Call`。" -#: ../../whatsnew/3.13.rst:2393 +#: ../../whatsnew/3.13.rst:2409 msgid "" "In :c:func:`PyObject_Call`, positional arguments must be a :class:`tuple` " "and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " @@ -4578,33 +4597,33 @@ msgid "" "`PyTuple_New(0) `." msgstr "" -#: ../../whatsnew/3.13.rst:2403 +#: ../../whatsnew/3.13.rst:2419 msgid "" ":c:func:`!PyEval_CallFunction`: Use :c:func:`PyObject_CallFunction` instead." msgstr "" ":c:func:`!PyEval_CallFunction`:請改用 :c:func:`PyObject_CallFunction`。" -#: ../../whatsnew/3.13.rst:2405 +#: ../../whatsnew/3.13.rst:2421 msgid "" ":c:func:`!PyEval_CallMethod`: Use :c:func:`PyObject_CallMethod` instead." msgstr ":c:func:`!PyEval_CallMethod`:請改用 :c:func:`PyObject_CallMethod`。" -#: ../../whatsnew/3.13.rst:2407 +#: ../../whatsnew/3.13.rst:2423 msgid ":c:func:`!PyCFunction_Call`: Use :c:func:`PyObject_Call` instead." msgstr ":c:func:`!PyCFunction_Call`:請改用 :c:func:`PyCFunction_Call`。" -#: ../../whatsnew/3.13.rst:2410 +#: ../../whatsnew/3.13.rst:2426 msgid "(Contributed by Victor Stinner in :gh:`105107`.)" msgstr "(由 Victor Stinner 貢獻於 :gh:`105107`。)" -#: ../../whatsnew/3.13.rst:2412 +#: ../../whatsnew/3.13.rst:2428 msgid "" "Remove the following old functions to configure the Python initialization, " "deprecated in Python 3.11:" msgstr "" "移除以下設定 Python 初始化的舊函式,這些函式在 Python 3.11 中已被棄用:" -#: ../../whatsnew/3.13.rst:2415 +#: ../../whatsnew/3.13.rst:2431 msgid "" ":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " "instead." @@ -4612,36 +4631,36 @@ msgstr "" ":c:func:`!PySys_AddWarnOptionUnicode`:請改用 :c:member:`PyConfig." "warnoptions`。" -#: ../../whatsnew/3.13.rst:2417 +#: ../../whatsnew/3.13.rst:2433 msgid "" ":c:func:`!PySys_AddWarnOption`: Use :c:member:`PyConfig.warnoptions` instead." msgstr "" ":c:func:`!PySys_AddWarnOption`:請改用 :c:member:`PyConfig.warnoptions`。" -#: ../../whatsnew/3.13.rst:2419 +#: ../../whatsnew/3.13.rst:2435 msgid ":c:func:`!PySys_AddXOption`: Use :c:member:`PyConfig.xoptions` instead." msgstr ":c:func:`!PySys_AddXOption`:請改用 :c:member:`PyConfig.xoptions`。" -#: ../../whatsnew/3.13.rst:2421 +#: ../../whatsnew/3.13.rst:2437 msgid "" ":c:func:`!PySys_HasWarnOptions`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" ":c:func:`!PySys_HasWarnOptions`:請改用 :c:member:`PyConfig.xoptions`。" -#: ../../whatsnew/3.13.rst:2423 +#: ../../whatsnew/3.13.rst:2439 msgid "" ":c:func:`!PySys_SetPath`: Set :c:member:`PyConfig.module_search_paths` " "instead." msgstr "" ":c:func:`!PySys_SetPath`:請改用 :c:member:`PyConfig.module_search_paths`。" -#: ../../whatsnew/3.13.rst:2425 +#: ../../whatsnew/3.13.rst:2441 msgid "" ":c:func:`!Py_SetPath`: Set :c:member:`PyConfig.module_search_paths` instead." msgstr "" ":c:func:`!Py_SetPath`:請改用 :c:member:`PyConfig.module_search_paths`。" -#: ../../whatsnew/3.13.rst:2427 +#: ../../whatsnew/3.13.rst:2443 msgid "" ":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." "stdio_encoding` instead, and set also maybe :c:member:`PyConfig." @@ -4651,14 +4670,14 @@ msgstr "" "stdio_encoding` 並設定可能的 :c:member:`PyConfig.legacy_windows_stdio`\\ " "(在 Windows 上)。" -#: ../../whatsnew/3.13.rst:2430 +#: ../../whatsnew/3.13.rst:2446 msgid "" ":c:func:`!_Py_SetProgramFullPath`: Set :c:member:`PyConfig.executable` " "instead." msgstr "" ":c:func:`!_Py_SetProgramFullPath`:請改用 :c:member:`PyConfig.executable`。" -#: ../../whatsnew/3.13.rst:2433 +#: ../../whatsnew/3.13.rst:2449 msgid "" "Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " "Configuration ` instead (:pep:`587`), added to Python 3.8. " @@ -4668,7 +4687,7 @@ msgstr "" "(:pep:`587`),這是在 Python 3.8 中新增的。(由 Victor Stinner 於 :gh:" "`105145` 貢獻。)" -#: ../../whatsnew/3.13.rst:2437 +#: ../../whatsnew/3.13.rst:2453 msgid "" "Remove :c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_ReleaseLock` " "functions, deprecated in Python 3.2. They didn't update the current thread " @@ -4678,25 +4697,25 @@ msgstr "" "些函式在 Python 3.2 中已被廢棄。它們不會更新目前的執行緒狀態。可以用以下函式" "取代:" -#: ../../whatsnew/3.13.rst:2442 +#: ../../whatsnew/3.13.rst:2458 msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2443 +#: ../../whatsnew/3.13.rst:2459 msgid "" "low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" msgstr "" "低階的 :c:func:`PyEval_AcquireThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2444 +#: ../../whatsnew/3.13.rst:2460 msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." msgstr "或 :c:func:`PyGILState_Ensure` 與 :c:func:`PyGILState_Release`。" -#: ../../whatsnew/3.13.rst:2446 +#: ../../whatsnew/3.13.rst:2462 msgid "(Contributed by Victor Stinner in :gh:`105182`.)" msgstr "(由 Victor Stinner 貢獻於 :gh:`105182`。)" -#: ../../whatsnew/3.13.rst:2448 +#: ../../whatsnew/3.13.rst:2464 msgid "" "Remove the :c:func:`!PyEval_ThreadsInitialized` function, deprecated in " "Python 3.9. Since Python 3.7, :c:func:`!Py_Initialize` always creates the " @@ -4709,7 +4728,7 @@ msgstr "" "PyEval_InitThreads` 不會有任何作用,而 :c:func:`!PyEval_ThreadsInitialized` " "總是會回傳非零值。(由 Victor Stinner 於 :gh:`105182` 貢獻。)" -#: ../../whatsnew/3.13.rst:2455 +#: ../../whatsnew/3.13.rst:2471 msgid "" "Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" "`PyInterpreterState_Get()` which was kept for backward compatibility with " @@ -4723,7 +4742,7 @@ msgstr "" "得 :c:func:`PyInterpreterState_Get()`。(由 Victor Stinner 於 :gh:`106320` 貢" "獻。)" -#: ../../whatsnew/3.13.rst:2462 +#: ../../whatsnew/3.13.rst:2478 msgid "" "Remove the private :c:func:`!_PyObject_FastCall` function: use :c:func:`!" "PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " @@ -4733,7 +4752,7 @@ msgstr "" "c:func:`!PyObject_Vectorcall` 函式(:pep:`590`)。(由 Victor Stinner 於 :gh:" "`106023` 貢獻。)" -#: ../../whatsnew/3.13.rst:2467 +#: ../../whatsnew/3.13.rst:2483 msgid "" "Remove the ``cpython/pytime.h`` header file, which only contained private " "functions. (Contributed by Victor Stinner in :gh:`106316`.)" @@ -4741,13 +4760,13 @@ msgstr "" "移除只包含私有函式的 ``cpython/pytime.h`` 標頭檔。(由 Victor Stinner 於 :gh:" "`106316` 貢獻。)" -#: ../../whatsnew/3.13.rst:2471 +#: ../../whatsnew/3.13.rst:2487 msgid "" "Remove the undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " "(Contributed by Victor Stinner in :gh:`110014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2474 +#: ../../whatsnew/3.13.rst:2490 msgid "" "Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END``. Replace both with the new macros " @@ -4758,15 +4777,15 @@ msgstr "" "將兩者都替換為新的巨集 ``Py_TRASHCAN_BEGIN`` 和 ``Py_TRASHCAN_END``。(由 " "Irit Katriel 在 :gh:`105111` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2481 +#: ../../whatsnew/3.13.rst:2497 msgid "Deprecated C APIs" msgstr "器用的 C API" -#: ../../whatsnew/3.13.rst:2483 +#: ../../whatsnew/3.13.rst:2499 msgid "Deprecate old Python initialization functions:" msgstr "棄用舊的 Python 初始化函式:" -#: ../../whatsnew/3.13.rst:2485 +#: ../../whatsnew/3.13.rst:2501 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" @@ -4775,30 +4794,30 @@ msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../whatsnew/3.13.rst:2487 +#: ../../whatsnew/3.13.rst:2503 msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../whatsnew/3.13.rst:2489 +#: ../../whatsnew/3.13.rst:2505 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../whatsnew/3.13.rst:2491 +#: ../../whatsnew/3.13.rst:2507 msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../whatsnew/3.13.rst:2493 +#: ../../whatsnew/3.13.rst:2509 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2495 +#: ../../whatsnew/3.13.rst:2511 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2497 +#: ../../whatsnew/3.13.rst:2513 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" ":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" @@ -4807,11 +4826,11 @@ msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" "`PYTHONHOME` 環境變數。" -#: ../../whatsnew/3.13.rst:2501 +#: ../../whatsnew/3.13.rst:2517 msgid "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "(由 Victor Stinner 在 :gh:`105145` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2503 +#: ../../whatsnew/3.13.rst:2519 msgid "" ":term:`Soft deprecate ` the :c:func:`PyEval_GetBuiltins`, :" "c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " @@ -4822,7 +4841,7 @@ msgstr "" "\\ :term:`借用參照 `。(作為 :pep:`667` 一部分的軟性棄" "用。)" -#: ../../whatsnew/3.13.rst:2509 +#: ../../whatsnew/3.13.rst:2525 msgid "" "Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function, which is just " "an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " @@ -4832,7 +4851,7 @@ msgstr "" "c:func:`PyImport_ImportModule` 的別名。(由 Victor Stinner 在 :gh:`105396` 中" "貢獻。)" -#: ../../whatsnew/3.13.rst:2513 +#: ../../whatsnew/3.13.rst:2529 msgid "" ":term:`Soft deprecate ` the :c:func:`PyModule_AddObject` " "function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" @@ -4842,7 +4861,7 @@ msgstr "" "用 :c:func:`PyModule_Add` 或 :c:func:`PyModule_AddObjectRef`。(由 Serhiy " "Storchaka 在 :gh:`86493` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2519 +#: ../../whatsnew/3.13.rst:2535 msgid "" "Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" "macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " @@ -4855,7 +4874,7 @@ msgstr "" "``Py_UNICODE`` 和 ``PY_UNICODE_TYPE`` 只是 :c:type:`!wchar_t` 的別名。(由 " "Victor Stinner 在 :gh:`105156` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2526 +#: ../../whatsnew/3.13.rst:2542 msgid "" "Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" "`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " @@ -5238,56 +5257,56 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.13.rst:2546 +#: ../../whatsnew/3.13.rst:2562 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.13.rst:2548 +#: ../../whatsnew/3.13.rst:2564 msgid "" "``arm64-apple-ios`` and ``arm64-apple-ios-simulator`` are both now :pep:`11` " "tier 3 platforms. (:ref:`PEP 730 ` written and " "implementation contributed by Russell Keith-Magee in :gh:`114099`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2553 +#: ../../whatsnew/3.13.rst:2569 msgid "" "``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" "`11` tier 3 platforms. (:ref:`PEP 738 ` " "written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2558 +#: ../../whatsnew/3.13.rst:2574 msgid "" "``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " "Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2561 +#: ../../whatsnew/3.13.rst:2577 msgid "" "``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " "(Contributed by Brett Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2564 +#: ../../whatsnew/3.13.rst:2580 msgid "" "Building CPython now requires a compiler with support for the C11 atomic " "library, GCC built-in atomic functions, or MSVC interlocked intrinsics." msgstr "" -#: ../../whatsnew/3.13.rst:2567 +#: ../../whatsnew/3.13.rst:2583 msgid "" "Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate the :file:" "`configure` script. (Contributed by Christian Heimes in :gh:`89886` and by " "Victor Stinner in :gh:`112090`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2571 +#: ../../whatsnew/3.13.rst:2587 msgid "" "SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " "module. (Contributed by Erlend Aasland in :gh:`105875`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2575 +#: ../../whatsnew/3.13.rst:2591 msgid "" "CPython now bundles the `mimalloc library`_ by default. It is licensed under " "the MIT license; see :ref:`mimalloc license `. The bundled " @@ -5295,28 +5314,28 @@ msgid "" "Dino Viehland in :gh:`109914`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2583 +#: ../../whatsnew/3.13.rst:2599 msgid "" "The :file:`configure` option :option:`--with-system-libmpdec` now defaults " "to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python " "3.15." msgstr "" -#: ../../whatsnew/3.13.rst:2587 +#: ../../whatsnew/3.13.rst:2603 msgid "" "Python built with :file:`configure` :option:`--with-trace-refs` (tracing " "references) is now ABI compatible with the Python release build and :ref:" "`debug build `. (Contributed by Victor Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2592 +#: ../../whatsnew/3.13.rst:2608 msgid "" "On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " "flags. For example, the free-threaded build generates ``python-3.13t.pc`` " "and the debug build generates ``python-3.13d.pc``." msgstr "" -#: ../../whatsnew/3.13.rst:2596 +#: ../../whatsnew/3.13.rst:2612 msgid "" "The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " "``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." @@ -5326,27 +5345,27 @@ msgid "" "`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2605 +#: ../../whatsnew/3.13.rst:2621 msgid "Porting to Python 3.13" msgstr "移植至 Python 3.13" -#: ../../whatsnew/3.13.rst:2607 +#: ../../whatsnew/3.13.rst:2623 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.13.rst:2611 +#: ../../whatsnew/3.13.rst:2627 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.13.rst:2615 +#: ../../whatsnew/3.13.rst:2631 msgid "" ":ref:`PEP 667 ` introduces several changes to " "the semantics of :func:`locals` and :attr:`f_locals `:" msgstr "" -#: ../../whatsnew/3.13.rst:2618 +#: ../../whatsnew/3.13.rst:2634 msgid "" "Calling :func:`locals` in an :term:`optimized scope` now produces an " "independent snapshot on each call, and hence no longer implicitly updates " @@ -5358,7 +5377,7 @@ msgid "" "scope. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2627 +#: ../../whatsnew/3.13.rst:2643 msgid "" "Calling :func:`locals` from a comprehension at module or class scope " "(including via ``exec`` or ``eval``) once more behaves as if the " @@ -5368,7 +5387,7 @@ msgid "" "implementing :pep:`709`. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2634 +#: ../../whatsnew/3.13.rst:2650 msgid "" "Accessing :attr:`FrameType.f_locals ` in an :term:`optimized " "scope` now returns a write-through proxy rather than a snapshot that gets " @@ -5377,7 +5396,7 @@ msgid "" "of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2640 +#: ../../whatsnew/3.13.rst:2656 msgid "" ":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " "method. The behavior will change in future Python versions. Wrap it in :func:" @@ -5385,14 +5404,14 @@ msgid "" "Serhiy Storchaka in :gh:`121027`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2646 +#: ../../whatsnew/3.13.rst:2662 msgid "" "An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " "to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " "or :exc:`KeyError` on Unix platforms where the password database is empty." msgstr "" -#: ../../whatsnew/3.13.rst:2651 +#: ../../whatsnew/3.13.rst:2667 msgid "" "The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` is now a " "string (``'rb'`` or ``'wb'``) instead of an integer (``1`` or ``2``). The " @@ -5401,13 +5420,13 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2657 +#: ../../whatsnew/3.13.rst:2673 msgid "" ":class:`mailbox.Maildir` now ignores files with a leading dot (``.``). " "(Contributed by Zackery Spytz in :gh:`65559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2660 +#: ../../whatsnew/3.13.rst:2676 msgid "" ":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " "files and directories if a pattern that ends with \"``**``\" is given, " @@ -5415,25 +5434,25 @@ msgid "" "behavior and only match directories." msgstr "" -#: ../../whatsnew/3.13.rst:2665 +#: ../../whatsnew/3.13.rst:2681 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an :func:`!_is_main_interpreter` function. This function takes no arguments " "and returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.13.rst:2670 +#: ../../whatsnew/3.13.rst:2686 msgid "" "Any library or application that provides a custom :mod:`!_thread` module " "must provide :func:`!_is_main_interpreter`, just like the module's other " "\"private\" attributes. (:gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2677 +#: ../../whatsnew/3.13.rst:2693 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.13.rst:2679 +#: ../../whatsnew/3.13.rst:2695 msgid "" "``Python.h`` no longer includes the ```` standard header. It was " "included for the :c:func:`!finite` function which is now provided by the " @@ -5442,7 +5461,7 @@ msgid "" "`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2685 +#: ../../whatsnew/3.13.rst:2701 msgid "" "``Python.h`` no longer includes these standard header files: ````, " "```` and ````. If needed, they should now be " @@ -5453,7 +5472,7 @@ msgid "" "Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2693 +#: ../../whatsnew/3.13.rst:2709 msgid "" "On Windows, ``Python.h`` no longer includes the ```` standard " "header file. If needed, it should now be included explicitly. For example, " @@ -5463,7 +5482,7 @@ msgid "" "(Contributed by Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2700 +#: ../../whatsnew/3.13.rst:2716 msgid "" "If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" "Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" @@ -5471,18 +5490,18 @@ msgid "" "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2705 +#: ../../whatsnew/3.13.rst:2721 msgid "" "The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " "macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." msgstr "" -#: ../../whatsnew/3.13.rst:2709 +#: ../../whatsnew/3.13.rst:2725 msgid "A ``tp_dealloc`` function that has the old macros, such as::" msgstr "有舊巨集的 ``tp_dealloc`` 函式,例如: ::" -#: ../../whatsnew/3.13.rst:2711 +#: ../../whatsnew/3.13.rst:2727 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5502,11 +5521,11 @@ msgstr "" " Py_TRASHCAN_SAFE_END\n" "}" -#: ../../whatsnew/3.13.rst:2720 +#: ../../whatsnew/3.13.rst:2736 msgid "should migrate to the new macros as follows::" msgstr "應該改為使用新的巨集,如下所示: ::" -#: ../../whatsnew/3.13.rst:2722 +#: ../../whatsnew/3.13.rst:2738 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5526,7 +5545,7 @@ msgstr "" " Py_TRASHCAN_END\n" "}" -#: ../../whatsnew/3.13.rst:2731 +#: ../../whatsnew/3.13.rst:2747 msgid "" "Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " "deallocation function it is in. The new macros were added in Python 3.8 and " @@ -5534,13 +5553,13 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2738 +#: ../../whatsnew/3.13.rst:2754 msgid "" ":ref:`PEP 667 ` introduces several changes to " "frame-related functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2741 +#: ../../whatsnew/3.13.rst:2757 msgid "" "The effects of mutating the dictionary returned from :c:func:" "`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " @@ -5554,7 +5573,7 @@ msgid "" "being used, so refer to the deprecation notice on the function for details." msgstr "" -#: ../../whatsnew/3.13.rst:2754 +#: ../../whatsnew/3.13.rst:2770 msgid "" "Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " "returns a write-through proxy rather than a snapshot that gets updated at " @@ -5563,40 +5582,40 @@ msgid "" "`PyEval_GetFrameLocals` API." msgstr "" -#: ../../whatsnew/3.13.rst:2761 +#: ../../whatsnew/3.13.rst:2777 msgid "" ":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " "no longer have any effect. Calling these functions has been redundant since " "Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced." msgstr "" -#: ../../whatsnew/3.13.rst:2766 +#: ../../whatsnew/3.13.rst:2782 msgid "" ":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " "function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" "through proxy for :term:`optimized scopes `." msgstr "" -#: ../../whatsnew/3.13.rst:2770 +#: ../../whatsnew/3.13.rst:2786 msgid "" "Python 3.13 removed many private functions. Some of them can be replaced " "using these alternatives:" msgstr "" -#: ../../whatsnew/3.13.rst:2773 +#: ../../whatsnew/3.13.rst:2789 msgid "``_PyDict_Pop()``: :c:func:`PyDict_Pop` or :c:func:`PyDict_PopString`;" msgstr "" "``_PyDict_Pop()``::c:func:`PyDict_Pop` 或 :c:func:`PyDict_PopString`;" -#: ../../whatsnew/3.13.rst:2774 +#: ../../whatsnew/3.13.rst:2790 msgid "``_PyDict_GetItemWithError()``: :c:func:`PyDict_GetItemRef`;" msgstr "``_PyDict_GetItemWithError()``::c:func:`PyDict_GetItemRef`;" -#: ../../whatsnew/3.13.rst:2775 +#: ../../whatsnew/3.13.rst:2791 msgid "``_PyErr_WriteUnraisableMsg()``: :c:func:`PyErr_FormatUnraisable`;" msgstr "``_PyErr_WriteUnraisableMsg()``::c:func:`PyErr_FormatUnraisable`;" -#: ../../whatsnew/3.13.rst:2776 +#: ../../whatsnew/3.13.rst:2792 msgid "" "``_PyEval_SetTrace()``: :c:func:`PyEval_SetTrace` or :c:func:" "`PyEval_SetTraceAllThreads`;" @@ -5604,43 +5623,43 @@ msgstr "" "``_PyEval_SetTrace()``::c:func:`PyEval_SetTrace` 或 :c:func:" "`PyEval_SetTraceAllThreads`;" -#: ../../whatsnew/3.13.rst:2777 +#: ../../whatsnew/3.13.rst:2793 msgid "``_PyList_Extend()``: :c:func:`PyList_Extend`;" msgstr "``_PyList_Extend()``::c:func:`PyList_Extend`;" -#: ../../whatsnew/3.13.rst:2778 +#: ../../whatsnew/3.13.rst:2794 msgid "``_PyLong_AsInt()``: :c:func:`PyLong_AsInt`;" msgstr "``_PyLong_AsInt()``::c:func:`PyLong_AsInt`;" -#: ../../whatsnew/3.13.rst:2779 +#: ../../whatsnew/3.13.rst:2795 msgid "``_PyMem_RawStrdup()``: ``strdup()``;" msgstr "``_PyMem_RawStrdup()``:``strdup()``;" -#: ../../whatsnew/3.13.rst:2780 +#: ../../whatsnew/3.13.rst:2796 msgid "``_PyMem_Strdup()``: ``strdup()``;" msgstr "``_PyMem_Strdup()``:``strdup()``;" -#: ../../whatsnew/3.13.rst:2781 +#: ../../whatsnew/3.13.rst:2797 msgid "``_PyObject_ClearManagedDict()``: :c:func:`PyObject_ClearManagedDict`;" msgstr "" "``_PyObject_ClearManagedDict()``::c:func:`PyObject_ClearManagedDict`;" -#: ../../whatsnew/3.13.rst:2782 +#: ../../whatsnew/3.13.rst:2798 msgid "``_PyObject_VisitManagedDict()``: :c:func:`PyObject_VisitManagedDict`;" msgstr "" "``_PyObject_VisitManagedDict()``::c:func:`PyObject_VisitManagedDict`;" -#: ../../whatsnew/3.13.rst:2783 +#: ../../whatsnew/3.13.rst:2799 msgid "" "``_PyThreadState_UncheckedGet()``: :c:func:`PyThreadState_GetUnchecked()`;" msgstr "" "``_PyThreadState_UncheckedGet()``::c:func:`PyThreadState_GetUnchecked()`;" -#: ../../whatsnew/3.13.rst:2784 +#: ../../whatsnew/3.13.rst:2800 msgid "``_PyTime_AsSecondsDouble()``: :c:func:`PyTime_AsSecondsDouble`;" msgstr "``_PyTime_AsSecondsDouble()``::c:func:`PyTime_AsSecondsDouble`;" -#: ../../whatsnew/3.13.rst:2785 +#: ../../whatsnew/3.13.rst:2801 msgid "" "``_PyTime_GetMonotonicClock()``: :c:func:`PyTime_Monotonic` or :c:func:" "`PyTime_MonotonicRaw`;" @@ -5648,7 +5667,7 @@ msgstr "" "``_PyTime_GetMonotonicClock()``::c:func:`PyTime_Monotonic` 或 :c:func:" "`PyTime_MonotonicRaw`;" -#: ../../whatsnew/3.13.rst:2786 +#: ../../whatsnew/3.13.rst:2802 msgid "" "``_PyTime_GetPerfCounter()``: :c:func:`PyTime_PerfCounter` or :c:func:" "`PyTime_PerfCounterRaw`;" @@ -5656,7 +5675,7 @@ msgstr "" "``_PyTime_GetPerfCounter()``::c:func:`PyTime_PerfCounter` 或 :c:func:" "`PyTime_PerfCounterRaw`;" -#: ../../whatsnew/3.13.rst:2787 +#: ../../whatsnew/3.13.rst:2803 msgid "" "``_PyTime_GetSystemClock()``: :c:func:`PyTime_Time` or :c:func:" "`PyTime_TimeRaw`;" @@ -5664,27 +5683,27 @@ msgstr "" "``_PyTime_GetSystemClock()``::c:func:`PyTime_Time` 或 :c:func:" "`PyTime_TimeRaw`;" -#: ../../whatsnew/3.13.rst:2788 +#: ../../whatsnew/3.13.rst:2804 msgid "``_PyTime_MAX``: :c:var:`PyTime_MAX`;" msgstr "``_PyTime_MAX``::c:var:`PyTime_MAX`;" -#: ../../whatsnew/3.13.rst:2789 +#: ../../whatsnew/3.13.rst:2805 msgid "``_PyTime_MIN``: :c:var:`PyTime_MIN`;" msgstr "``_PyTime_MIN``::c:var:`PyTime_MIN`;" -#: ../../whatsnew/3.13.rst:2790 +#: ../../whatsnew/3.13.rst:2806 msgid "``_PyTime_t``: :c:type:`PyTime_t`;" msgstr "``_PyTime_t``::c:type:`PyTime_t`;" -#: ../../whatsnew/3.13.rst:2791 +#: ../../whatsnew/3.13.rst:2807 msgid "``_Py_HashPointer()``: :c:func:`Py_HashPointer`;" msgstr "``_Py_HashPointer()``::c:func:`Py_HashPointer`;" -#: ../../whatsnew/3.13.rst:2792 +#: ../../whatsnew/3.13.rst:2808 msgid "``_Py_IsFinalizing()``: :c:func:`Py_IsFinalizing`." msgstr "``_Py_IsFinalizing()``::c:func:`Py_IsFinalizing`。" -#: ../../whatsnew/3.13.rst:2794 +#: ../../whatsnew/3.13.rst:2810 msgid "" "The `pythoncapi-compat project`_ can be used to get most of these new " "functions on Python 3.12 and older." @@ -5692,11 +5711,11 @@ msgstr "" "可以使用 `pythoncapi-compat 專案`_\\ 來在 Python 3.12 及更舊的版本中取用大部" "分的這些新函式。" -#: ../../whatsnew/3.13.rst:2798 +#: ../../whatsnew/3.13.rst:2814 msgid "Regression Test Changes" msgstr "迴歸測試的變更" -#: ../../whatsnew/3.13.rst:2800 +#: ../../whatsnew/3.13.rst:2816 msgid "" "Python built with :file:`configure` :option:`--with-pydebug` now supports a :" "option:`-X presite=package.module <-X>` command-line option. If used, it " @@ -5709,11 +5728,11 @@ msgstr "" "該在解譯器生命週期的早期階段、在執行 ``site.py`` 之前被引入的模組。(由 " "Łukasz Langa 在 :gh:`110769` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2808 +#: ../../whatsnew/3.13.rst:2824 msgid "Notable changes in 3.13.1" msgstr "Python 3.13.1 中顯著的變更" -#: ../../whatsnew/3.13.rst:2813 +#: ../../whatsnew/3.13.rst:2829 msgid "" "The previously undocumented special function :func:`sys.getobjects`, which " "only exists in specialized builds of Python, may now return objects from " From 580ff2b8ec996dd4a72234debdb0ea6df155c6a0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 22 May 2025 00:17:55 +0000 Subject: [PATCH 11/14] sync with cpython 5ecc39e9 --- c-api/typeobj.po | 1907 +++++++++++++++++++++++----------------------- library/io.po | 416 +++++----- 2 files changed, 1172 insertions(+), 1151 deletions(-) diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 3ffb4c871b..37d6e77099 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-14 00:15+0000\n" +"POT-Creation-Date: 2025-05-22 00:16+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-" @@ -45,8 +45,8 @@ msgstr "" #: ../../c-api/typeobj.rst:23 msgid "" "In addition to the following quick reference, the :ref:`typedef-examples` " -"section provides at-a-glance insight into the meaning and use " -"of :c:type:`PyTypeObject`." +"section provides at-a-glance insight into the meaning and use of :c:type:" +"`PyTypeObject`." msgstr "" #: ../../c-api/typeobj.rst:29 @@ -128,7 +128,7 @@ msgstr ":c:member:`~PyTypeObject.tp_basicsize`" #: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:46 #: ../../c-api/typeobj.rst:48 ../../c-api/typeobj.rst:52 #: ../../c-api/typeobj.rst:99 ../../c-api/typeobj.rst:120 -#: ../../c-api/typeobj.rst:416 +#: ../../c-api/typeobj.rst:417 msgid ":c:type:`Py_ssize_t`" msgstr ":c:type:`Py_ssize_t`" @@ -141,7 +141,7 @@ msgid ":c:member:`~PyTypeObject.tp_dealloc`" msgstr ":c:member:`~PyTypeObject.tp_dealloc`" #: ../../c-api/typeobj.rst:50 ../../c-api/typeobj.rst:142 -#: ../../c-api/typeobj.rst:146 ../../c-api/typeobj.rst:346 +#: ../../c-api/typeobj.rst:146 ../../c-api/typeobj.rst:347 msgid ":c:type:`destructor`" msgstr ":c:type:`destructor`" @@ -153,7 +153,7 @@ msgstr ":c:member:`~PyTypeObject.tp_vectorcall_offset`" msgid "(:c:member:`~PyTypeObject.tp_getattr`)" msgstr "(:c:member:`~PyTypeObject.tp_getattr`)" -#: ../../c-api/typeobj.rst:54 ../../c-api/typeobj.rst:370 +#: ../../c-api/typeobj.rst:54 ../../c-api/typeobj.rst:371 msgid ":c:type:`getattrfunc`" msgstr ":c:type:`getattrfunc`" @@ -172,7 +172,7 @@ msgstr "G" msgid "(:c:member:`~PyTypeObject.tp_setattr`)" msgstr "(:c:member:`~PyTypeObject.tp_setattr`)" -#: ../../c-api/typeobj.rst:57 ../../c-api/typeobj.rst:375 +#: ../../c-api/typeobj.rst:57 ../../c-api/typeobj.rst:376 msgid ":c:type:`setattrfunc`" msgstr ":c:type:`setattrfunc`" @@ -190,6 +190,7 @@ msgstr ":c:type:`PyAsyncMethods` *" #: ../../c-api/typeobj.rst:60 ../../c-api/typeobj.rst:64 #: ../../c-api/typeobj.rst:66 ../../c-api/typeobj.rst:68 +#: ../../c-api/typeobj.rst:82 msgid ":ref:`sub-slots`" msgstr ":ref:`sub-slots`" @@ -204,7 +205,7 @@ msgid ":c:member:`~PyTypeObject.tp_repr`" msgstr ":c:member:`~PyTypeObject.tp_repr`" #: ../../c-api/typeobj.rst:62 ../../c-api/typeobj.rst:74 -#: ../../c-api/typeobj.rst:368 +#: ../../c-api/typeobj.rst:369 msgid ":c:type:`reprfunc`" msgstr ":c:type:`reprfunc`" @@ -240,7 +241,7 @@ msgstr ":c:type:`PyMappingMethods` *" msgid ":c:member:`~PyTypeObject.tp_hash`" msgstr ":c:member:`~PyTypeObject.tp_hash`" -#: ../../c-api/typeobj.rst:70 ../../c-api/typeobj.rst:404 +#: ../../c-api/typeobj.rst:70 ../../c-api/typeobj.rst:405 msgid ":c:type:`hashfunc`" msgstr ":c:type:`hashfunc`" @@ -253,7 +254,7 @@ msgid ":c:member:`~PyTypeObject.tp_call`" msgstr ":c:member:`~PyTypeObject.tp_call`" #: ../../c-api/typeobj.rst:72 ../../c-api/typeobj.rst:237 -#: ../../c-api/typeobj.rst:240 ../../c-api/typeobj.rst:440 +#: ../../c-api/typeobj.rst:240 ../../c-api/typeobj.rst:441 msgid ":c:type:`ternaryfunc`" msgstr ":c:type:`ternaryfunc`" @@ -273,7 +274,7 @@ msgstr "__str__" msgid ":c:member:`~PyTypeObject.tp_getattro`" msgstr ":c:member:`~PyTypeObject.tp_getattro`" -#: ../../c-api/typeobj.rst:76 ../../c-api/typeobj.rst:381 +#: ../../c-api/typeobj.rst:76 ../../c-api/typeobj.rst:382 msgid ":c:type:`getattrofunc`" msgstr ":c:type:`getattrofunc`" @@ -281,7 +282,7 @@ msgstr ":c:type:`getattrofunc`" msgid ":c:member:`~PyTypeObject.tp_setattro`" msgstr ":c:member:`~PyTypeObject.tp_setattro`" -#: ../../c-api/typeobj.rst:79 ../../c-api/typeobj.rst:386 +#: ../../c-api/typeobj.rst:79 ../../c-api/typeobj.rst:387 msgid ":c:type:`setattrofunc`" msgstr ":c:type:`setattrofunc`" @@ -320,7 +321,7 @@ msgstr "__doc__" msgid ":c:member:`~PyTypeObject.tp_traverse`" msgstr ":c:member:`~PyTypeObject.tp_traverse`" -#: ../../c-api/typeobj.rst:88 ../../c-api/typeobj.rst:350 +#: ../../c-api/typeobj.rst:88 ../../c-api/typeobj.rst:351 msgid ":c:type:`traverseproc`" msgstr ":c:type:`traverseproc`" @@ -329,7 +330,7 @@ msgid ":c:member:`~PyTypeObject.tp_clear`" msgstr ":c:member:`~PyTypeObject.tp_clear`" #: ../../c-api/typeobj.rst:90 ../../c-api/typeobj.rst:130 -#: ../../c-api/typeobj.rst:248 ../../c-api/typeobj.rst:429 +#: ../../c-api/typeobj.rst:248 ../../c-api/typeobj.rst:430 msgid ":c:type:`inquiry`" msgstr ":c:type:`inquiry`" @@ -337,7 +338,7 @@ msgstr ":c:type:`inquiry`" msgid ":c:member:`~PyTypeObject.tp_richcompare`" msgstr ":c:member:`~PyTypeObject.tp_richcompare`" -#: ../../c-api/typeobj.rst:92 ../../c-api/typeobj.rst:406 +#: ../../c-api/typeobj.rst:92 ../../c-api/typeobj.rst:407 msgid ":c:type:`richcmpfunc`" msgstr ":c:type:`richcmpfunc`" @@ -353,7 +354,7 @@ msgstr "(:c:member:`~PyTypeObject.tp_weaklistoffset`)" msgid ":c:member:`~PyTypeObject.tp_iter`" msgstr ":c:member:`~PyTypeObject.tp_iter`" -#: ../../c-api/typeobj.rst:101 ../../c-api/typeobj.rst:412 +#: ../../c-api/typeobj.rst:101 ../../c-api/typeobj.rst:413 msgid ":c:type:`getiterfunc`" msgstr ":c:type:`getiterfunc`" @@ -365,7 +366,7 @@ msgstr "__iter__" msgid ":c:member:`~PyTypeObject.tp_iternext`" msgstr ":c:member:`~PyTypeObject.tp_iternext`" -#: ../../c-api/typeobj.rst:103 ../../c-api/typeobj.rst:414 +#: ../../c-api/typeobj.rst:103 ../../c-api/typeobj.rst:415 msgid ":c:type:`iternextfunc`" msgstr ":c:type:`iternextfunc`" @@ -416,15 +417,15 @@ msgstr ":c:member:`~PyTypeObject.tp_dict`" #: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:113 #: ../../c-api/typeobj.rst:132 ../../c-api/typeobj.rst:134 #: ../../c-api/typeobj.rst:136 ../../c-api/typeobj.rst:140 -#: ../../c-api/typeobj.rst:341 ../../c-api/typeobj.rst:346 -#: ../../c-api/typeobj.rst:356 ../../c-api/typeobj.rst:368 -#: ../../c-api/typeobj.rst:370 ../../c-api/typeobj.rst:381 -#: ../../c-api/typeobj.rst:392 ../../c-api/typeobj.rst:404 -#: ../../c-api/typeobj.rst:406 ../../c-api/typeobj.rst:412 -#: ../../c-api/typeobj.rst:414 ../../c-api/typeobj.rst:416 -#: ../../c-api/typeobj.rst:429 ../../c-api/typeobj.rst:431 -#: ../../c-api/typeobj.rst:435 ../../c-api/typeobj.rst:440 -#: ../../c-api/typeobj.rst:446 +#: ../../c-api/typeobj.rst:342 ../../c-api/typeobj.rst:347 +#: ../../c-api/typeobj.rst:357 ../../c-api/typeobj.rst:369 +#: ../../c-api/typeobj.rst:371 ../../c-api/typeobj.rst:382 +#: ../../c-api/typeobj.rst:393 ../../c-api/typeobj.rst:405 +#: ../../c-api/typeobj.rst:407 ../../c-api/typeobj.rst:413 +#: ../../c-api/typeobj.rst:415 ../../c-api/typeobj.rst:417 +#: ../../c-api/typeobj.rst:430 ../../c-api/typeobj.rst:432 +#: ../../c-api/typeobj.rst:436 ../../c-api/typeobj.rst:441 +#: ../../c-api/typeobj.rst:447 msgid ":c:type:`PyObject` *" msgstr ":c:type:`PyObject` *" @@ -436,7 +437,7 @@ msgstr "__dict__" msgid ":c:member:`~PyTypeObject.tp_descr_get`" msgstr ":c:member:`~PyTypeObject.tp_descr_get`" -#: ../../c-api/typeobj.rst:115 ../../c-api/typeobj.rst:392 +#: ../../c-api/typeobj.rst:115 ../../c-api/typeobj.rst:393 msgid ":c:type:`descrgetfunc`" msgstr ":c:type:`descrgetfunc`" @@ -448,7 +449,7 @@ msgstr "__get__" msgid ":c:member:`~PyTypeObject.tp_descr_set`" msgstr ":c:member:`~PyTypeObject.tp_descr_set`" -#: ../../c-api/typeobj.rst:117 ../../c-api/typeobj.rst:398 +#: ../../c-api/typeobj.rst:117 ../../c-api/typeobj.rst:399 msgid ":c:type:`descrsetfunc`" msgstr ":c:type:`descrsetfunc`" @@ -464,7 +465,7 @@ msgstr "(:c:member:`~PyTypeObject.tp_dictoffset`)" msgid ":c:member:`~PyTypeObject.tp_init`" msgstr ":c:member:`~PyTypeObject.tp_init`" -#: ../../c-api/typeobj.rst:122 ../../c-api/typeobj.rst:362 +#: ../../c-api/typeobj.rst:122 ../../c-api/typeobj.rst:363 msgid ":c:type:`initproc`" msgstr ":c:type:`initproc`" @@ -476,7 +477,7 @@ msgstr "__init__" msgid ":c:member:`~PyTypeObject.tp_alloc`" msgstr ":c:member:`~PyTypeObject.tp_alloc`" -#: ../../c-api/typeobj.rst:124 ../../c-api/typeobj.rst:341 +#: ../../c-api/typeobj.rst:124 ../../c-api/typeobj.rst:342 msgid ":c:type:`allocfunc`" msgstr ":c:type:`allocfunc`" @@ -484,7 +485,7 @@ msgstr ":c:type:`allocfunc`" msgid ":c:member:`~PyTypeObject.tp_new`" msgstr ":c:member:`~PyTypeObject.tp_new`" -#: ../../c-api/typeobj.rst:126 ../../c-api/typeobj.rst:356 +#: ../../c-api/typeobj.rst:126 ../../c-api/typeobj.rst:357 msgid ":c:type:`newfunc`" msgstr ":c:type:`newfunc`" @@ -496,7 +497,7 @@ msgstr "__new__" msgid ":c:member:`~PyTypeObject.tp_free`" msgstr ":c:member:`~PyTypeObject.tp_free`" -#: ../../c-api/typeobj.rst:128 ../../c-api/typeobj.rst:348 +#: ../../c-api/typeobj.rst:128 ../../c-api/typeobj.rst:349 msgid ":c:type:`freefunc`" msgstr ":c:type:`freefunc`" @@ -533,7 +534,7 @@ msgid "[:c:member:`~PyTypeObject.tp_subclasses`]" msgstr "[:c:member:`~PyTypeObject.tp_subclasses`]" #: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:138 -#: ../../c-api/typeobj.rst:279 ../../c-api/typeobj.rst:348 +#: ../../c-api/typeobj.rst:279 ../../c-api/typeobj.rst:349 msgid "void *" msgstr "void *" @@ -667,7 +668,7 @@ msgstr ":c:member:`~PyAsyncMethods.am_await`" #: ../../c-api/typeobj.rst:244 ../../c-api/typeobj.rst:246 #: ../../c-api/typeobj.rst:250 ../../c-api/typeobj.rst:277 #: ../../c-api/typeobj.rst:281 ../../c-api/typeobj.rst:291 -#: ../../c-api/typeobj.rst:431 +#: ../../c-api/typeobj.rst:432 msgid ":c:type:`unaryfunc`" msgstr ":c:type:`unaryfunc`" @@ -717,7 +718,7 @@ msgstr ":c:member:`~PyNumberMethods.nb_add`" #: ../../c-api/typeobj.rst:289 ../../c-api/typeobj.rst:293 #: ../../c-api/typeobj.rst:296 ../../c-api/typeobj.rst:302 #: ../../c-api/typeobj.rst:311 ../../c-api/typeobj.rst:322 -#: ../../c-api/typeobj.rst:435 +#: ../../c-api/typeobj.rst:436 msgid ":c:type:`binaryfunc`" msgstr ":c:type:`binaryfunc`" @@ -1006,7 +1007,7 @@ msgid ":c:member:`~PyMappingMethods.mp_length`" msgstr ":c:member:`~PyMappingMethods.mp_length`" #: ../../c-api/typeobj.rst:300 ../../c-api/typeobj.rst:309 -#: ../../c-api/typeobj.rst:416 +#: ../../c-api/typeobj.rst:417 msgid ":c:type:`lenfunc`" msgstr ":c:type:`lenfunc`" @@ -1026,7 +1027,7 @@ msgstr "__getitem__" msgid ":c:member:`~PyMappingMethods.mp_ass_subscript`" msgstr ":c:member:`~PyMappingMethods.mp_ass_subscript`" -#: ../../c-api/typeobj.rst:304 ../../c-api/typeobj.rst:462 +#: ../../c-api/typeobj.rst:304 ../../c-api/typeobj.rst:463 msgid ":c:type:`objobjargproc`" msgstr ":c:type:`objobjargproc`" @@ -1051,7 +1052,7 @@ msgid ":c:member:`~PySequenceMethods.sq_repeat`" msgstr ":c:member:`~PySequenceMethods.sq_repeat`" #: ../../c-api/typeobj.rst:313 ../../c-api/typeobj.rst:315 -#: ../../c-api/typeobj.rst:324 ../../c-api/typeobj.rst:446 +#: ../../c-api/typeobj.rst:324 ../../c-api/typeobj.rst:447 msgid ":c:type:`ssizeargfunc`" msgstr ":c:type:`ssizeargfunc`" @@ -1067,7 +1068,7 @@ msgstr ":c:member:`~PySequenceMethods.sq_item`" msgid ":c:member:`~PySequenceMethods.sq_ass_item`" msgstr ":c:member:`~PySequenceMethods.sq_ass_item`" -#: ../../c-api/typeobj.rst:317 ../../c-api/typeobj.rst:451 +#: ../../c-api/typeobj.rst:317 ../../c-api/typeobj.rst:452 msgid ":c:type:`ssizeobjargproc`" msgstr ":c:type:`ssizeobjargproc`" @@ -1079,7 +1080,7 @@ msgstr "__setitem__ __delitem__" msgid ":c:member:`~PySequenceMethods.sq_contains`" msgstr ":c:member:`~PySequenceMethods.sq_contains`" -#: ../../c-api/typeobj.rst:320 ../../c-api/typeobj.rst:457 +#: ../../c-api/typeobj.rst:320 ../../c-api/typeobj.rst:458 msgid ":c:type:`objobjproc`" msgstr ":c:type:`objobjproc`" @@ -1103,6 +1104,11 @@ msgstr ":c:member:`~PyBufferProcs.bf_getbuffer`" msgid ":c:func:`getbufferproc`" msgstr ":c:func:`getbufferproc`" +#: ../../c-api/typeobj.rst:328 +#, fuzzy +msgid "__buffer__" +msgstr "__iter__" + #: ../../c-api/typeobj.rst:330 msgid ":c:member:`~PyBufferProcs.bf_releasebuffer`" msgstr ":c:member:`~PyBufferProcs.bf_releasebuffer`" @@ -1111,24 +1117,28 @@ msgstr ":c:member:`~PyBufferProcs.bf_releasebuffer`" msgid ":c:func:`releasebufferproc`" msgstr ":c:func:`releasebufferproc`" -#: ../../c-api/typeobj.rst:336 +#: ../../c-api/typeobj.rst:330 +msgid "__release_\\ buffer\\__" +msgstr "" + +#: ../../c-api/typeobj.rst:337 msgid "slot typedefs" msgstr "" -#: ../../c-api/typeobj.rst:339 +#: ../../c-api/typeobj.rst:340 msgid "typedef" msgstr "typedef" -#: ../../c-api/typeobj.rst:339 +#: ../../c-api/typeobj.rst:340 msgid "Parameter Types" msgstr "" -#: ../../c-api/typeobj.rst:339 +#: ../../c-api/typeobj.rst:340 msgid "Return Type" msgstr "" -#: ../../c-api/typeobj.rst:346 ../../c-api/typeobj.rst:348 -#: ../../c-api/typeobj.rst:424 +#: ../../c-api/typeobj.rst:347 ../../c-api/typeobj.rst:349 +#: ../../c-api/typeobj.rst:425 msgid "void" msgstr "void" @@ -1136,20 +1146,20 @@ msgstr "void" msgid ":c:type:`visitproc`" msgstr ":c:type:`visitproc`" -#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:350 -#: ../../c-api/typeobj.rst:362 ../../c-api/typeobj.rst:375 -#: ../../c-api/typeobj.rst:386 ../../c-api/typeobj.rst:398 -#: ../../c-api/typeobj.rst:418 ../../c-api/typeobj.rst:429 -#: ../../c-api/typeobj.rst:451 ../../c-api/typeobj.rst:457 -#: ../../c-api/typeobj.rst:462 +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:351 +#: ../../c-api/typeobj.rst:363 ../../c-api/typeobj.rst:376 +#: ../../c-api/typeobj.rst:387 ../../c-api/typeobj.rst:399 +#: ../../c-api/typeobj.rst:419 ../../c-api/typeobj.rst:430 +#: ../../c-api/typeobj.rst:452 ../../c-api/typeobj.rst:458 +#: ../../c-api/typeobj.rst:463 msgid "int" msgstr "int" -#: ../../c-api/typeobj.rst:404 +#: ../../c-api/typeobj.rst:405 msgid "Py_hash_t" msgstr "Py_hash_t" -#: ../../c-api/typeobj.rst:418 +#: ../../c-api/typeobj.rst:419 msgid ":c:type:`getbufferproc`" msgstr ":c:type:`getbufferproc`" @@ -1157,26 +1167,26 @@ msgstr ":c:type:`getbufferproc`" msgid ":c:type:`Py_buffer` *" msgstr ":c:type:`Py_buffer` *" -#: ../../c-api/typeobj.rst:424 +#: ../../c-api/typeobj.rst:425 msgid ":c:type:`releasebufferproc`" msgstr ":c:type:`releasebufferproc`" -#: ../../c-api/typeobj.rst:469 +#: ../../c-api/typeobj.rst:470 msgid "See :ref:`slot-typedefs` below for more detail." msgstr "更多細節請見下方的 :ref:`slot-typedefs`。" -#: ../../c-api/typeobj.rst:473 +#: ../../c-api/typeobj.rst:474 msgid "PyTypeObject Definition" msgstr "" -#: ../../c-api/typeobj.rst:475 +#: ../../c-api/typeobj.rst:476 msgid "" -"The structure definition for :c:type:`PyTypeObject` can be found " -"in :file:`Include/cpython/object.h`. For convenience of reference, this " -"repeats the definition found there:" +"The structure definition for :c:type:`PyTypeObject` can be found in :file:" +"`Include/cpython/object.h`. For convenience of reference, this repeats the " +"definition found there:" msgstr "" -#: ../../c-api/typeobj.rst:481 +#: ../../c-api/typeobj.rst:482 msgid "" "typedef struct _typeobject {\n" " PyObject_VAR_HEAD\n" @@ -1266,72 +1276,71 @@ msgid "" "} PyTypeObject;\n" msgstr "" -#: ../../c-api/typeobj.rst:485 +#: ../../c-api/typeobj.rst:486 msgid "PyObject Slots" msgstr "" -#: ../../c-api/typeobj.rst:487 +#: ../../c-api/typeobj.rst:488 msgid "" -"The type object structure extends the :c:type:`PyVarObject` structure. " -"The :c:member:`~PyVarObject.ob_size` field is used for dynamic types " -"(created by :c:func:`!type_new`, usually called from a class statement). " -"Note that :c:data:`PyType_Type` (the metatype) " -"initializes :c:member:`~PyTypeObject.tp_itemsize`, which means that its " -"instances (i.e. type objects) *must* have " +"The type object structure extends the :c:type:`PyVarObject` structure. The :" +"c:member:`~PyVarObject.ob_size` field is used for dynamic types (created by :" +"c:func:`!type_new`, usually called from a class statement). Note that :c:" +"data:`PyType_Type` (the metatype) initializes :c:member:`~PyTypeObject." +"tp_itemsize`, which means that its instances (i.e. type objects) *must* have " "the :c:member:`~PyVarObject.ob_size` field." msgstr "" -#: ../../c-api/typeobj.rst:496 +#: ../../c-api/typeobj.rst:497 msgid "" "This is the type object's reference count, initialized to ``1`` by the " "``PyObject_HEAD_INIT`` macro. Note that for :ref:`statically allocated type " -"objects `, the type's instances (objects " -"whose :c:member:`~PyObject.ob_type` points back to the type) do *not* count " -"as references. But for :ref:`dynamically allocated type objects `, the instances *do* count as references." -msgstr "" - -#: ../../c-api/typeobj.rst:503 ../../c-api/typeobj.rst:526 -#: ../../c-api/typeobj.rst:543 ../../c-api/typeobj.rst:587 -#: ../../c-api/typeobj.rst:665 ../../c-api/typeobj.rst:741 -#: ../../c-api/typeobj.rst:782 ../../c-api/typeobj.rst:799 -#: ../../c-api/typeobj.rst:816 ../../c-api/typeobj.rst:834 -#: ../../c-api/typeobj.rst:858 ../../c-api/typeobj.rst:875 -#: ../../c-api/typeobj.rst:887 ../../c-api/typeobj.rst:899 -#: ../../c-api/typeobj.rst:932 ../../c-api/typeobj.rst:954 -#: ../../c-api/typeobj.rst:974 ../../c-api/typeobj.rst:995 -#: ../../c-api/typeobj.rst:1021 ../../c-api/typeobj.rst:1040 -#: ../../c-api/typeobj.rst:1056 ../../c-api/typeobj.rst:1095 -#: ../../c-api/typeobj.rst:1106 ../../c-api/typeobj.rst:1116 -#: ../../c-api/typeobj.rst:1126 ../../c-api/typeobj.rst:1140 -#: ../../c-api/typeobj.rst:1158 ../../c-api/typeobj.rst:1181 -#: ../../c-api/typeobj.rst:1199 ../../c-api/typeobj.rst:1212 -#: ../../c-api/typeobj.rst:1234 ../../c-api/typeobj.rst:1278 -#: ../../c-api/typeobj.rst:1299 ../../c-api/typeobj.rst:1318 -#: ../../c-api/typeobj.rst:1348 ../../c-api/typeobj.rst:1370 -#: ../../c-api/typeobj.rst:1396 ../../c-api/typeobj.rst:1481 -#: ../../c-api/typeobj.rst:1555 ../../c-api/typeobj.rst:1616 -#: ../../c-api/typeobj.rst:1652 ../../c-api/typeobj.rst:1677 -#: ../../c-api/typeobj.rst:1700 ../../c-api/typeobj.rst:1713 -#: ../../c-api/typeobj.rst:1728 ../../c-api/typeobj.rst:1742 -#: ../../c-api/typeobj.rst:1772 ../../c-api/typeobj.rst:1804 -#: ../../c-api/typeobj.rst:1830 ../../c-api/typeobj.rst:1848 -#: ../../c-api/typeobj.rst:1877 ../../c-api/typeobj.rst:1921 -#: ../../c-api/typeobj.rst:1938 ../../c-api/typeobj.rst:1979 -#: ../../c-api/typeobj.rst:2001 ../../c-api/typeobj.rst:2033 -#: ../../c-api/typeobj.rst:2061 ../../c-api/typeobj.rst:2074 -#: ../../c-api/typeobj.rst:2084 ../../c-api/typeobj.rst:2101 -#: ../../c-api/typeobj.rst:2118 ../../c-api/typeobj.rst:2132 -#: ../../c-api/typeobj.rst:2165 ../../c-api/typeobj.rst:2188 +"objects `, the type's instances (objects whose :c:member:" +"`~PyObject.ob_type` points back to the type) do *not* count as references. " +"But for :ref:`dynamically allocated type objects `, the " +"instances *do* count as references." +msgstr "" + +#: ../../c-api/typeobj.rst:504 ../../c-api/typeobj.rst:527 +#: ../../c-api/typeobj.rst:544 ../../c-api/typeobj.rst:588 +#: ../../c-api/typeobj.rst:666 ../../c-api/typeobj.rst:742 +#: ../../c-api/typeobj.rst:783 ../../c-api/typeobj.rst:800 +#: ../../c-api/typeobj.rst:817 ../../c-api/typeobj.rst:835 +#: ../../c-api/typeobj.rst:859 ../../c-api/typeobj.rst:876 +#: ../../c-api/typeobj.rst:888 ../../c-api/typeobj.rst:900 +#: ../../c-api/typeobj.rst:933 ../../c-api/typeobj.rst:955 +#: ../../c-api/typeobj.rst:975 ../../c-api/typeobj.rst:996 +#: ../../c-api/typeobj.rst:1022 ../../c-api/typeobj.rst:1041 +#: ../../c-api/typeobj.rst:1057 ../../c-api/typeobj.rst:1096 +#: ../../c-api/typeobj.rst:1107 ../../c-api/typeobj.rst:1117 +#: ../../c-api/typeobj.rst:1127 ../../c-api/typeobj.rst:1141 +#: ../../c-api/typeobj.rst:1159 ../../c-api/typeobj.rst:1182 +#: ../../c-api/typeobj.rst:1200 ../../c-api/typeobj.rst:1213 +#: ../../c-api/typeobj.rst:1235 ../../c-api/typeobj.rst:1279 +#: ../../c-api/typeobj.rst:1300 ../../c-api/typeobj.rst:1319 +#: ../../c-api/typeobj.rst:1349 ../../c-api/typeobj.rst:1371 +#: ../../c-api/typeobj.rst:1397 ../../c-api/typeobj.rst:1482 +#: ../../c-api/typeobj.rst:1556 ../../c-api/typeobj.rst:1617 +#: ../../c-api/typeobj.rst:1653 ../../c-api/typeobj.rst:1678 +#: ../../c-api/typeobj.rst:1701 ../../c-api/typeobj.rst:1714 +#: ../../c-api/typeobj.rst:1729 ../../c-api/typeobj.rst:1743 +#: ../../c-api/typeobj.rst:1773 ../../c-api/typeobj.rst:1805 +#: ../../c-api/typeobj.rst:1831 ../../c-api/typeobj.rst:1849 +#: ../../c-api/typeobj.rst:1878 ../../c-api/typeobj.rst:1922 +#: ../../c-api/typeobj.rst:1939 ../../c-api/typeobj.rst:1980 +#: ../../c-api/typeobj.rst:2002 ../../c-api/typeobj.rst:2034 +#: ../../c-api/typeobj.rst:2062 ../../c-api/typeobj.rst:2075 +#: ../../c-api/typeobj.rst:2085 ../../c-api/typeobj.rst:2102 +#: ../../c-api/typeobj.rst:2119 ../../c-api/typeobj.rst:2133 +#: ../../c-api/typeobj.rst:2166 ../../c-api/typeobj.rst:2189 msgid "**Inheritance:**" msgstr "" -#: ../../c-api/typeobj.rst:505 ../../c-api/typeobj.rst:545 -#: ../../c-api/typeobj.rst:589 +#: ../../c-api/typeobj.rst:506 ../../c-api/typeobj.rst:546 +#: ../../c-api/typeobj.rst:590 msgid "This field is not inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:510 +#: ../../c-api/typeobj.rst:511 msgid "" "This is the type's type, in other words its metatype. It is initialized by " "the argument to the ``PyObject_HEAD_INIT`` macro, and its value should " @@ -1343,78 +1352,76 @@ msgid "" "doing anything else. This is typically done like this::" msgstr "" -#: ../../c-api/typeobj.rst:519 +#: ../../c-api/typeobj.rst:520 msgid "Foo_Type.ob_type = &PyType_Type;" msgstr "Foo_Type.ob_type = &PyType_Type;" -#: ../../c-api/typeobj.rst:521 +#: ../../c-api/typeobj.rst:522 msgid "" -"This should be done before any instances of the type are " -"created. :c:func:`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is " -"``NULL``, and if so, initializes it to the :c:member:`~PyObject.ob_type` " -"field of the base class. :c:func:`PyType_Ready` will not change this field " -"if it is non-zero." +"This should be done before any instances of the type are created. :c:func:" +"`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is ``NULL``, and if " +"so, initializes it to the :c:member:`~PyObject.ob_type` field of the base " +"class. :c:func:`PyType_Ready` will not change this field if it is non-zero." msgstr "" -#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:743 -#: ../../c-api/typeobj.rst:860 ../../c-api/typeobj.rst:956 -#: ../../c-api/typeobj.rst:976 ../../c-api/typeobj.rst:1679 -#: ../../c-api/typeobj.rst:1702 ../../c-api/typeobj.rst:1832 -#: ../../c-api/typeobj.rst:1850 ../../c-api/typeobj.rst:1923 -#: ../../c-api/typeobj.rst:2035 ../../c-api/typeobj.rst:2167 +#: ../../c-api/typeobj.rst:529 ../../c-api/typeobj.rst:744 +#: ../../c-api/typeobj.rst:861 ../../c-api/typeobj.rst:957 +#: ../../c-api/typeobj.rst:977 ../../c-api/typeobj.rst:1680 +#: ../../c-api/typeobj.rst:1703 ../../c-api/typeobj.rst:1833 +#: ../../c-api/typeobj.rst:1851 ../../c-api/typeobj.rst:1924 +#: ../../c-api/typeobj.rst:2036 ../../c-api/typeobj.rst:2168 msgid "This field is inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:532 +#: ../../c-api/typeobj.rst:533 msgid "PyVarObject Slots" msgstr "" -#: ../../c-api/typeobj.rst:536 +#: ../../c-api/typeobj.rst:537 msgid "" "For :ref:`statically allocated type objects `, this should be " "initialized to zero. For :ref:`dynamically allocated type objects `, this field has a special internal meaning." msgstr "" -#: ../../c-api/typeobj.rst:540 +#: ../../c-api/typeobj.rst:541 msgid "" -"This field should be accessed using the :c:func:`Py_SIZE()` " -"and :c:func:`Py_SET_SIZE()` macros." +"This field should be accessed using the :c:func:`Py_SIZE()` and :c:func:" +"`Py_SET_SIZE()` macros." msgstr "" -#: ../../c-api/typeobj.rst:549 +#: ../../c-api/typeobj.rst:550 msgid "PyTypeObject Slots" msgstr "" -#: ../../c-api/typeobj.rst:551 +#: ../../c-api/typeobj.rst:552 msgid "" "Each slot has a section describing inheritance. If :c:func:`PyType_Ready` " "may set a value when the field is set to ``NULL`` then there will also be a " -"\"Default\" section. (Note that many fields set " -"on :c:data:`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as " -"defaults.)" +"\"Default\" section. (Note that many fields set on :c:data:" +"`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as defaults.)" msgstr "" -#: ../../c-api/typeobj.rst:558 +#: ../../c-api/typeobj.rst:559 msgid "" "Pointer to a NUL-terminated string containing the name of the type. For " "types that are accessible as module globals, the string should be the full " "module name, followed by a dot, followed by the type name; for built-in " "types, it should be just the type name. If the module is a submodule of a " "package, the full package name is part of the full module name. For " -"example, a type named :class:`!T` defined in module :mod:`!M` in " -"subpackage :mod:`!Q` in package :mod:`!P` should have " -"the :c:member:`~PyTypeObject.tp_name` initializer ``\"P.Q.M.T\"``." +"example, a type named :class:`!T` defined in module :mod:`!M` in subpackage :" +"mod:`!Q` in package :mod:`!P` should have the :c:member:`~PyTypeObject." +"tp_name` initializer ``\"P.Q.M.T\"``." msgstr "" -#: ../../c-api/typeobj.rst:566 +#: ../../c-api/typeobj.rst:567 msgid "" "For :ref:`dynamically allocated type objects `, this should just " "be the type name, and the module name explicitly stored in the type dict as " "the value for key ``'__module__'``." msgstr "" -#: ../../c-api/typeobj.rst:571 +#: ../../c-api/typeobj.rst:572 msgid "" "For :ref:`statically allocated type objects `, the *tp_name* " "field should contain a dot. Everything before the last dot is made " @@ -1422,115 +1429,114 @@ msgid "" "the last dot is made accessible as the :attr:`~type.__name__` attribute." msgstr "" -#: ../../c-api/typeobj.rst:577 +#: ../../c-api/typeobj.rst:578 msgid "" "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " -"made accessible as the :attr:`~type.__name__` attribute, and " -"the :attr:`~type.__module__` attribute is undefined (unless explicitly set " -"in the dictionary, as explained above). This means your type will be " -"impossible to pickle. Additionally, it will not be listed in module " -"documentations created with pydoc." +"made accessible as the :attr:`~type.__name__` attribute, and the :attr:" +"`~type.__module__` attribute is undefined (unless explicitly set in the " +"dictionary, as explained above). This means your type will be impossible to " +"pickle. Additionally, it will not be listed in module documentations " +"created with pydoc." msgstr "" -#: ../../c-api/typeobj.rst:583 +#: ../../c-api/typeobj.rst:584 msgid "" -"This field must not be ``NULL``. It is the only required field " -"in :c:func:`PyTypeObject` (other than " -"potentially :c:member:`~PyTypeObject.tp_itemsize`)." +"This field must not be ``NULL``. It is the only required field in :c:func:" +"`PyTypeObject` (other than potentially :c:member:`~PyTypeObject." +"tp_itemsize`)." msgstr "" -#: ../../c-api/typeobj.rst:595 +#: ../../c-api/typeobj.rst:596 msgid "" "These fields allow calculating the size in bytes of instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:597 +#: ../../c-api/typeobj.rst:598 msgid "" -"There are two kinds of types: types with fixed-length instances have a " -"zero :c:member:`!tp_itemsize` field, types with variable-length instances " -"have a non-zero :c:member:`!tp_itemsize` field. For a type with fixed-" -"length instances, all instances have the same size, given in :c:member:`!" -"tp_basicsize`. (Exceptions to this rule can be made " -"using :c:func:`PyUnstable_Object_GC_NewWithExtraData`.)" +"There are two kinds of types: types with fixed-length instances have a zero :" +"c:member:`!tp_itemsize` field, types with variable-length instances have a " +"non-zero :c:member:`!tp_itemsize` field. For a type with fixed-length " +"instances, all instances have the same size, given in :c:member:`!" +"tp_basicsize`. (Exceptions to this rule can be made using :c:func:" +"`PyUnstable_Object_GC_NewWithExtraData`.)" msgstr "" -#: ../../c-api/typeobj.rst:604 +#: ../../c-api/typeobj.rst:605 msgid "" -"For a type with variable-length instances, the instances must have " -"an :c:member:`~PyVarObject.ob_size` field, and the instance size " -"is :c:member:`!tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N " -"is the \"length\" of the object." +"For a type with variable-length instances, the instances must have an :c:" +"member:`~PyVarObject.ob_size` field, and the instance size is :c:member:`!" +"tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N is the " +"\"length\" of the object." msgstr "" -#: ../../c-api/typeobj.rst:609 +#: ../../c-api/typeobj.rst:610 msgid "" "Functions like :c:func:`PyObject_NewVar` will take the value of N as an " "argument, and store in the instance's :c:member:`~PyVarObject.ob_size` " "field. Note that the :c:member:`~PyVarObject.ob_size` field may later be " "used for other purposes. For example, :py:type:`int` instances use the bits " "of :c:member:`~PyVarObject.ob_size` in an implementation-defined way; the " -"underlying storage and its size should be accessed " -"using :c:func:`PyLong_Export`." +"underlying storage and its size should be accessed using :c:func:" +"`PyLong_Export`." msgstr "" -#: ../../c-api/typeobj.rst:619 +#: ../../c-api/typeobj.rst:620 msgid "" -"The :c:member:`~PyVarObject.ob_size` field should be accessed using " -"the :c:func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." +"The :c:member:`~PyVarObject.ob_size` field should be accessed using the :c:" +"func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." msgstr "" -#: ../../c-api/typeobj.rst:622 +#: ../../c-api/typeobj.rst:623 msgid "" "Also, the presence of an :c:member:`~PyVarObject.ob_size` field in the " "instance layout doesn't mean that the instance structure is variable-length. " "For example, the :py:type:`list` type has fixed-length instances, yet those " -"instances have a :c:member:`~PyVarObject.ob_size` field. (As " -"with :py:type:`int`, avoid reading lists' :c:member:`!ob_size` directly. " -"Call :c:func:`PyList_Size` instead.)" +"instances have a :c:member:`~PyVarObject.ob_size` field. (As with :py:type:" +"`int`, avoid reading lists' :c:member:`!ob_size` directly. Call :c:func:" +"`PyList_Size` instead.)" msgstr "" -#: ../../c-api/typeobj.rst:629 +#: ../../c-api/typeobj.rst:630 msgid "" -"The :c:member:`!tp_basicsize` includes size needed for data of the " -"type's :c:member:`~PyTypeObject.tp_base`, plus any extra data needed by each " -"instance." +"The :c:member:`!tp_basicsize` includes size needed for data of the type's :c:" +"member:`~PyTypeObject.tp_base`, plus any extra data needed by each instance." msgstr "" -#: ../../c-api/typeobj.rst:633 +#: ../../c-api/typeobj.rst:634 msgid "" "The correct way to set :c:member:`!tp_basicsize` is to use the ``sizeof`` " "operator on the struct used to declare the instance layout. This struct must " -"include the struct used to declare the base type. In other " -"words, :c:member:`!tp_basicsize` must be greater than or equal to the " -"base's :c:member:`!tp_basicsize`." +"include the struct used to declare the base type. In other words, :c:member:" +"`!tp_basicsize` must be greater than or equal to the base's :c:member:`!" +"tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:639 +#: ../../c-api/typeobj.rst:640 msgid "" "Since every type is a subtype of :py:type:`object`, this struct must " -"include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on " -"whether :c:member:`~PyVarObject.ob_size` should be included). These are " -"usually defined by the macro :c:macro:`PyObject_HEAD` " -"or :c:macro:`PyObject_VAR_HEAD`, respectively." +"include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on whether :c:" +"member:`~PyVarObject.ob_size` should be included). These are usually defined " +"by the macro :c:macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD`, " +"respectively." msgstr "" -#: ../../c-api/typeobj.rst:645 +#: ../../c-api/typeobj.rst:646 msgid "" "The basic size does not include the GC header size, as that header is not " "part of :c:macro:`PyObject_HEAD`." msgstr "" -#: ../../c-api/typeobj.rst:648 +#: ../../c-api/typeobj.rst:649 msgid "" -"For cases where struct used to declare the base type is unknown, " -"see :c:member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." +"For cases where struct used to declare the base type is unknown, see :c:" +"member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:651 +#: ../../c-api/typeobj.rst:652 msgid "Notes about alignment:" msgstr "" -#: ../../c-api/typeobj.rst:653 +#: ../../c-api/typeobj.rst:654 msgid "" ":c:member:`!tp_basicsize` must be a multiple of ``_Alignof(PyObject)``. When " "using ``sizeof`` on a ``struct`` that includes :c:macro:`PyObject_HEAD`, as " @@ -1539,7 +1545,7 @@ msgid "" "you." msgstr "" -#: ../../c-api/typeobj.rst:658 +#: ../../c-api/typeobj.rst:659 msgid "" "If the variable items require a particular alignment, :c:member:`!" "tp_basicsize` and :c:member:`!tp_itemsize` must each be a multiple of that " @@ -1547,14 +1553,14 @@ msgid "" "your responsibility that both fields are a multiple of ``_Alignof(double)``." msgstr "" -#: ../../c-api/typeobj.rst:667 +#: ../../c-api/typeobj.rst:668 msgid "" "These fields are inherited separately by subtypes. (That is, if the field is " "set to zero, :c:func:`PyType_Ready` will copy the value from the base type, " "indicating that the instances do not need additional storage.)" msgstr "" -#: ../../c-api/typeobj.rst:672 +#: ../../c-api/typeobj.rst:673 msgid "" "If the base type has a non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is " "generally not safe to set :c:member:`~PyTypeObject.tp_itemsize` to a " @@ -1562,7 +1568,7 @@ msgid "" "implementation of the base type)." msgstr "" -#: ../../c-api/typeobj.rst:679 +#: ../../c-api/typeobj.rst:680 msgid "" "A pointer to the instance destructor function. This function must be " "defined unless the type guarantees that its instances will never be " @@ -1570,38 +1576,36 @@ msgid "" "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:683 +#: ../../c-api/typeobj.rst:684 msgid "void tp_dealloc(PyObject *self);" msgstr "void tp_dealloc(PyObject *self);" -#: ../../c-api/typeobj.rst:685 -msgid "" -"The destructor function is called by the :c:func:`Py_DECREF` " -"and :c:func:`Py_XDECREF` macros when the new reference count is zero. At " -"this point, the instance is still in existence, but there are no references " -"to it. The destructor function should free all references which the " -"instance owns, free all memory buffers owned by the instance (using the " -"freeing function corresponding to the allocation function used to allocate " -"the buffer), and call the type's :c:member:`~PyTypeObject.tp_free` " -"function. If the type is not subtypable (doesn't have " -"the :c:macro:`Py_TPFLAGS_BASETYPE` flag bit set), it is permissible to call " -"the object deallocator directly instead of " +#: ../../c-api/typeobj.rst:686 +msgid "" +"The destructor function is called by the :c:func:`Py_DECREF` and :c:func:" +"`Py_XDECREF` macros when the new reference count is zero. At this point, " +"the instance is still in existence, but there are no references to it. The " +"destructor function should free all references which the instance owns, free " +"all memory buffers owned by the instance (using the freeing function " +"corresponding to the allocation function used to allocate the buffer), and " +"call the type's :c:member:`~PyTypeObject.tp_free` function. If the type is " +"not subtypable (doesn't have the :c:macro:`Py_TPFLAGS_BASETYPE` flag bit " +"set), it is permissible to call the object deallocator directly instead of " "via :c:member:`~PyTypeObject.tp_free`. The object deallocator should be the " "one used to allocate the instance; this is normally :c:func:`PyObject_Del` " -"if the instance was allocated using :c:macro:`PyObject_New` " -"or :c:macro:`PyObject_NewVar`, or :c:func:`PyObject_GC_Del` if the instance " -"was allocated using :c:macro:`PyObject_GC_New` " -"or :c:macro:`PyObject_GC_NewVar`." +"if the instance was allocated using :c:macro:`PyObject_New` or :c:macro:" +"`PyObject_NewVar`, or :c:func:`PyObject_GC_Del` if the instance was " +"allocated using :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`." msgstr "" -#: ../../c-api/typeobj.rst:700 +#: ../../c-api/typeobj.rst:701 msgid "" -"If the type supports garbage collection (has " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit set), the destructor should " -"call :c:func:`PyObject_GC_UnTrack` before clearing any member fields." +"If the type supports garbage collection (has the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag bit set), the destructor should call :c:func:" +"`PyObject_GC_UnTrack` before clearing any member fields." msgstr "" -#: ../../c-api/typeobj.rst:704 +#: ../../c-api/typeobj.rst:705 msgid "" "static void foo_dealloc(foo_object *self) {\n" " PyObject_GC_UnTrack(self);\n" @@ -1615,15 +1619,15 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *)self);\n" "}" -#: ../../c-api/typeobj.rst:712 +#: ../../c-api/typeobj.rst:713 msgid "" "Finally, if the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " -"deallocator should release the owned reference to its type object " -"(via :c:func:`Py_DECREF`) after calling the type deallocator. In order to " -"avoid dangling pointers, the recommended way to achieve this is:" +"deallocator should release the owned reference to its type object (via :c:" +"func:`Py_DECREF`) after calling the type deallocator. In order to avoid " +"dangling pointers, the recommended way to achieve this is:" msgstr "" -#: ../../c-api/typeobj.rst:718 +#: ../../c-api/typeobj.rst:719 msgid "" "static void foo_dealloc(foo_object *self) {\n" " PyTypeObject *tp = Py_TYPE(self);\n" @@ -1633,7 +1637,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:729 +#: ../../c-api/typeobj.rst:730 msgid "" "In a garbage collected Python, :c:member:`!tp_dealloc` may be called from " "any Python thread, not just the thread which created the object (if the " @@ -1642,69 +1646,68 @@ msgid "" "calls, since the thread on which :c:member:`!tp_dealloc` is called will own " "the Global Interpreter Lock (GIL). However, if the object being destroyed " "in turn destroys objects from some other C or C++ library, care should be " -"taken to ensure that destroying those objects on the thread which " -"called :c:member:`!tp_dealloc` will not violate any assumptions of the " -"library." +"taken to ensure that destroying those objects on the thread which called :c:" +"member:`!tp_dealloc` will not violate any assumptions of the library." msgstr "" -#: ../../c-api/typeobj.rst:748 +#: ../../c-api/typeobj.rst:749 msgid "" "An optional offset to a per-instance function that implements calling the " "object using the :ref:`vectorcall protocol `, a more efficient " "alternative of the simpler :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:753 +#: ../../c-api/typeobj.rst:754 msgid "" "This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is " "set. If so, this must be a positive integer containing the offset in the " "instance of a :c:type:`vectorcallfunc` pointer." msgstr "" -#: ../../c-api/typeobj.rst:757 +#: ../../c-api/typeobj.rst:758 msgid "" "The *vectorcallfunc* pointer may be ``NULL``, in which case the instance " "behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the " "instance falls back to :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:761 +#: ../../c-api/typeobj.rst:762 msgid "" -"Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also " -"set :c:member:`~PyTypeObject.tp_call` and make sure its behaviour is " -"consistent with the *vectorcallfunc* function. This can be done by setting " -"*tp_call* to :c:func:`PyVectorcall_Call`." +"Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:" +"`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the " +"*vectorcallfunc* function. This can be done by setting *tp_call* to :c:func:" +"`PyVectorcall_Call`." msgstr "" -#: ../../c-api/typeobj.rst:768 +#: ../../c-api/typeobj.rst:769 msgid "" "Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was " "used for printing to a file. In Python 3.0 to 3.7, it was unused." msgstr "" -#: ../../c-api/typeobj.rst:774 +#: ../../c-api/typeobj.rst:775 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " -"` to implement the vectorcall protocol. When a user " -"sets :attr:`~object.__call__` in Python code, only *tp_call* is updated, " -"likely making it inconsistent with the vectorcall function. Since 3.12, " -"setting ``__call__`` will disable vectorcall optimization by clearing " -"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag." +"` to implement the vectorcall protocol. When a user sets :attr:" +"`~object.__call__` in Python code, only *tp_call* is updated, likely making " +"it inconsistent with the vectorcall function. Since 3.12, setting " +"``__call__`` will disable vectorcall optimization by clearing the :c:macro:" +"`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" -#: ../../c-api/typeobj.rst:784 +#: ../../c-api/typeobj.rst:785 msgid "" -"This field is always inherited. However, " -"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If " -"it's not set, then the subclass won't use :ref:`vectorcall `, " -"except when :c:func:`PyVectorcall_Call` is explicitly called." +"This field is always inherited. However, the :c:macro:" +"`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " +"then the subclass won't use :ref:`vectorcall `, except when :c:" +"func:`PyVectorcall_Call` is explicitly called." msgstr "" -#: ../../c-api/typeobj.rst:793 +#: ../../c-api/typeobj.rst:794 msgid "An optional pointer to the get-attribute-string function." msgstr "" -#: ../../c-api/typeobj.rst:795 +#: ../../c-api/typeobj.rst:796 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, " @@ -1712,28 +1715,29 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:801 ../../c-api/typeobj.rst:997 -msgid "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject.tp_getattro`" +#: ../../c-api/typeobj.rst:802 ../../c-api/typeobj.rst:998 +msgid "" +"Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." +"tp_getattro`" msgstr "" -"群" -"組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject.tp_getattro`" +"群組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject." +"tp_getattro`" -#: ../../c-api/typeobj.rst:803 +#: ../../c-api/typeobj.rst:804 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits " -"both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` " -"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." +"tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:810 ../../c-api/typeobj.rst:1010 +#: ../../c-api/typeobj.rst:811 ../../c-api/typeobj.rst:1011 msgid "" "An optional pointer to the function for setting and deleting attributes." msgstr "" -#: ../../c-api/typeobj.rst:812 +#: ../../c-api/typeobj.rst:813 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, " @@ -1741,54 +1745,55 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:818 ../../c-api/typeobj.rst:1023 -msgid "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject.tp_setattro`" +#: ../../c-api/typeobj.rst:819 ../../c-api/typeobj.rst:1024 +msgid "" +"Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." +"tp_setattro`" msgstr "" -"群" -"組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject.tp_setattro`" +"群組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject." +"tp_setattro`" -#: ../../c-api/typeobj.rst:820 +#: ../../c-api/typeobj.rst:821 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits " -"both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` " -"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." +"tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:827 +#: ../../c-api/typeobj.rst:828 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement :term:`awaitable` and :term:`asynchronous iterator` " "protocols at the C-level. See :ref:`async-structs` for details." msgstr "" -#: ../../c-api/typeobj.rst:831 +#: ../../c-api/typeobj.rst:832 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." msgstr "" -#: ../../c-api/typeobj.rst:836 +#: ../../c-api/typeobj.rst:837 msgid "" "The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:844 +#: ../../c-api/typeobj.rst:845 msgid "" -"An optional pointer to a function that implements the built-in " -"function :func:`repr`." +"An optional pointer to a function that implements the built-in function :" +"func:`repr`." msgstr "" -#: ../../c-api/typeobj.rst:847 +#: ../../c-api/typeobj.rst:848 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" msgstr "" -#: ../../c-api/typeobj.rst:849 +#: ../../c-api/typeobj.rst:850 msgid "PyObject *tp_repr(PyObject *self);" msgstr "PyObject *tp_repr(PyObject *self);" -#: ../../c-api/typeobj.rst:851 +#: ../../c-api/typeobj.rst:852 msgid "" "The function must return a string or a Unicode object. Ideally, this " "function should return a string that, when passed to :func:`eval`, given a " @@ -1797,152 +1802,153 @@ msgid "" "``'>'`` from which both the type and the value of the object can be deduced." msgstr "" -#: ../../c-api/typeobj.rst:862 ../../c-api/typeobj.rst:941 -#: ../../c-api/typeobj.rst:978 ../../c-api/typeobj.rst:1003 -#: ../../c-api/typeobj.rst:1029 ../../c-api/typeobj.rst:1070 -#: ../../c-api/typeobj.rst:1625 ../../c-api/typeobj.rst:1659 -#: ../../c-api/typeobj.rst:1776 ../../c-api/typeobj.rst:1809 -#: ../../c-api/typeobj.rst:1884 ../../c-api/typeobj.rst:1925 -#: ../../c-api/typeobj.rst:1943 ../../c-api/typeobj.rst:1985 -#: ../../c-api/typeobj.rst:2006 ../../c-api/typeobj.rst:2037 +#: ../../c-api/typeobj.rst:863 ../../c-api/typeobj.rst:942 +#: ../../c-api/typeobj.rst:979 ../../c-api/typeobj.rst:1004 +#: ../../c-api/typeobj.rst:1030 ../../c-api/typeobj.rst:1071 +#: ../../c-api/typeobj.rst:1626 ../../c-api/typeobj.rst:1660 +#: ../../c-api/typeobj.rst:1777 ../../c-api/typeobj.rst:1810 +#: ../../c-api/typeobj.rst:1885 ../../c-api/typeobj.rst:1926 +#: ../../c-api/typeobj.rst:1944 ../../c-api/typeobj.rst:1986 +#: ../../c-api/typeobj.rst:2007 ../../c-api/typeobj.rst:2038 msgid "**Default:**" msgstr "**預設:**" -#: ../../c-api/typeobj.rst:864 +#: ../../c-api/typeobj.rst:865 msgid "" "When this field is not set, a string of the form ``<%s object at %p>`` is " "returned, where ``%s`` is replaced by the type name, and ``%p`` by the " "object's memory address." msgstr "" -#: ../../c-api/typeobj.rst:871 +#: ../../c-api/typeobj.rst:872 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the number protocol. These fields are documented " "in :ref:`number-structs`." msgstr "" -#: ../../c-api/typeobj.rst:877 +#: ../../c-api/typeobj.rst:878 msgid "" "The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:883 +#: ../../c-api/typeobj.rst:884 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the sequence protocol. These fields are documented " "in :ref:`sequence-structs`." msgstr "" -#: ../../c-api/typeobj.rst:889 +#: ../../c-api/typeobj.rst:890 msgid "" "The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:895 +#: ../../c-api/typeobj.rst:896 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the mapping protocol. These fields are documented " "in :ref:`mapping-structs`." msgstr "" -#: ../../c-api/typeobj.rst:901 +#: ../../c-api/typeobj.rst:902 msgid "" "The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:909 +#: ../../c-api/typeobj.rst:910 msgid "" -"An optional pointer to a function that implements the built-in " -"function :func:`hash`." +"An optional pointer to a function that implements the built-in function :" +"func:`hash`." msgstr "" -#: ../../c-api/typeobj.rst:912 +#: ../../c-api/typeobj.rst:913 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" msgstr "" -#: ../../c-api/typeobj.rst:914 +#: ../../c-api/typeobj.rst:915 msgid "Py_hash_t tp_hash(PyObject *);" msgstr "Py_hash_t tp_hash(PyObject *);" -#: ../../c-api/typeobj.rst:916 +#: ../../c-api/typeobj.rst:917 msgid "" "The value ``-1`` should not be returned as a normal return value; when an " "error occurs during the computation of the hash value, the function should " "set an exception and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:920 +#: ../../c-api/typeobj.rst:921 msgid "" "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " -"is not set), an attempt to take the hash of the object " -"raises :exc:`TypeError`. This is the same as setting it " -"to :c:func:`PyObject_HashNotImplemented`." +"is not set), an attempt to take the hash of the object raises :exc:" +"`TypeError`. This is the same as setting it to :c:func:" +"`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:924 +#: ../../c-api/typeobj.rst:925 msgid "" "This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to " "block inheritance of the hash method from a parent type. This is interpreted " "as the equivalent of ``__hash__ = None`` at the Python level, causing " "``isinstance(o, collections.Hashable)`` to correctly return ``False``. Note " "that the converse is also true - setting ``__hash__ = None`` on a class at " -"the Python level will result in the ``tp_hash`` slot being set " -"to :c:func:`PyObject_HashNotImplemented`." +"the Python level will result in the ``tp_hash`` slot being set to :c:func:" +"`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:934 ../../c-api/typeobj.rst:1618 -msgid "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject.tp_richcompare`" +#: ../../c-api/typeobj.rst:935 ../../c-api/typeobj.rst:1619 +msgid "" +"Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." +"tp_richcompare`" msgstr "" -"群" -"組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject.tp_richcompare`" +"群組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject." +"tp_richcompare`" -#: ../../c-api/typeobj.rst:936 +#: ../../c-api/typeobj.rst:937 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_richcompare`: a subtype inherits both " -"of :c:member:`~PyTypeObject.tp_richcompare` " -"and :c:member:`~PyTypeObject.tp_hash`, when the " -"subtype's :c:member:`~PyTypeObject.tp_richcompare` " -"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." +"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash`, when the subtype's :c:" +"member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` " +"are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:943 +#: ../../c-api/typeobj.rst:944 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." msgstr "" -#: ../../c-api/typeobj.rst:948 +#: ../../c-api/typeobj.rst:949 msgid "" "An optional pointer to a function that implements calling the object. This " "should be ``NULL`` if the object is not callable. The signature is the same " "as for :c:func:`PyObject_Call`::" msgstr "" -#: ../../c-api/typeobj.rst:952 +#: ../../c-api/typeobj.rst:953 msgid "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" msgstr "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" -#: ../../c-api/typeobj.rst:961 +#: ../../c-api/typeobj.rst:962 msgid "" -"An optional pointer to a function that implements the built-in " -"operation :func:`str`. (Note that :class:`str` is a type now, " -"and :func:`str` calls the constructor for that type. This constructor " -"calls :c:func:`PyObject_Str` to do the actual work, " -"and :c:func:`PyObject_Str` will call this handler.)" +"An optional pointer to a function that implements the built-in operation :" +"func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " +"the constructor for that type. This constructor calls :c:func:" +"`PyObject_Str` to do the actual work, and :c:func:`PyObject_Str` will call " +"this handler.)" msgstr "" -#: ../../c-api/typeobj.rst:966 +#: ../../c-api/typeobj.rst:967 msgid "The signature is the same as for :c:func:`PyObject_Str`::" msgstr "" -#: ../../c-api/typeobj.rst:968 +#: ../../c-api/typeobj.rst:969 msgid "PyObject *tp_str(PyObject *self);" msgstr "PyObject *tp_str(PyObject *self);" -#: ../../c-api/typeobj.rst:970 +#: ../../c-api/typeobj.rst:971 msgid "" "The function must return a string or a Unicode object. It should be a " "\"friendly\" string representation of the object, as this is the " @@ -1950,101 +1956,99 @@ msgid "" "function." msgstr "" -#: ../../c-api/typeobj.rst:980 +#: ../../c-api/typeobj.rst:981 msgid "" "When this field is not set, :c:func:`PyObject_Repr` is called to return a " "string representation." msgstr "" -#: ../../c-api/typeobj.rst:986 +#: ../../c-api/typeobj.rst:987 msgid "An optional pointer to the get-attribute function." msgstr "" -#: ../../c-api/typeobj.rst:988 +#: ../../c-api/typeobj.rst:989 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:990 +#: ../../c-api/typeobj.rst:991 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" msgstr "PyObject *tp_getattro(PyObject *self, PyObject *attr);" -#: ../../c-api/typeobj.rst:992 +#: ../../c-api/typeobj.rst:993 msgid "" -"It is usually convenient to set this field " -"to :c:func:`PyObject_GenericGetAttr`, which implements the normal way of " -"looking for object attributes." +"It is usually convenient to set this field to :c:func:" +"`PyObject_GenericGetAttr`, which implements the normal way of looking for " +"object attributes." msgstr "" -#: ../../c-api/typeobj.rst:999 +#: ../../c-api/typeobj.rst:1000 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_getattr`: a subtype inherits " -"both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` " -"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." +"tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1005 +#: ../../c-api/typeobj.rst:1006 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1012 +#: ../../c-api/typeobj.rst:1013 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:1014 +#: ../../c-api/typeobj.rst:1015 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" msgstr "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" -#: ../../c-api/typeobj.rst:1016 +#: ../../c-api/typeobj.rst:1017 msgid "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " -"supported. It is usually convenient to set this field " -"to :c:func:`PyObject_GenericSetAttr`, which implements the normal way of " -"setting object attributes." +"supported. It is usually convenient to set this field to :c:func:" +"`PyObject_GenericSetAttr`, which implements the normal way of setting object " +"attributes." msgstr "" -#: ../../c-api/typeobj.rst:1025 +#: ../../c-api/typeobj.rst:1026 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_setattr`: a subtype inherits " -"both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` " -"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." +"tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1031 +#: ../../c-api/typeobj.rst:1032 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1036 +#: ../../c-api/typeobj.rst:1037 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the buffer interface. These fields are documented " "in :ref:`buffer-structs`." msgstr "" -#: ../../c-api/typeobj.rst:1042 +#: ../../c-api/typeobj.rst:1043 msgid "" "The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:1048 +#: ../../c-api/typeobj.rst:1049 msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " -"fields in the type object (or in the extension structures referenced " -"via :c:member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject.tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, " -"and :c:member:`~PyTypeObject.tp_as_buffer`) that were historically not " -"always present are valid; if such a flag bit is clear, the type fields it " -"guards must not be accessed and must be considered to have a zero or " -"``NULL`` value instead." +"fields in the type object (or in the extension structures referenced via :c:" +"member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject." +"tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, and :c:member:" +"`~PyTypeObject.tp_as_buffer`) that were historically not always present are " +"valid; if such a flag bit is clear, the type fields it guards must not be " +"accessed and must be considered to have a zero or ``NULL`` value instead." msgstr "" -#: ../../c-api/typeobj.rst:1058 +#: ../../c-api/typeobj.rst:1059 msgid "" "Inheritance of this field is complicated. Most flag bits are inherited " "individually, i.e. if the base type has a flag bit set, the subtype inherits " @@ -2053,14 +2057,14 @@ msgid "" "type's value of the flag bit is copied into the subtype together with a " "pointer to the extension structure. The :c:macro:`Py_TPFLAGS_HAVE_GC` flag " "bit is inherited together with the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " -"the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " -"``NULL`` values. .. XXX are most flag bits *really* inherited individually?" +"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and the :c:member:" +"`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields in " +"the subtype exist and have ``NULL`` values. .. XXX are most flag bits " +"*really* inherited individually?" msgstr "" -#: ../../c-api/typeobj.rst:1072 +#: ../../c-api/typeobj.rst:1073 msgid "" ":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``." @@ -2068,20 +2072,20 @@ msgstr "" ":c:data:`PyBaseObject_Type` 使用 ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``。" -#: ../../c-api/typeobj.rst:1075 +#: ../../c-api/typeobj.rst:1076 msgid "**Bit Masks:**" msgstr "" -#: ../../c-api/typeobj.rst:1079 +#: ../../c-api/typeobj.rst:1080 msgid "" "The following bit masks are currently defined; these can be ORed together " -"using the ``|`` operator to form the value of " -"the :c:member:`~PyTypeObject.tp_flags` field. The " -"macro :c:func:`PyType_HasFeature` takes a type and a flags value, *tp* and " -"*f*, and checks whether ``tp->tp_flags & f`` is non-zero." +"using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." +"tp_flags` field. The macro :c:func:`PyType_HasFeature` takes a type and a " +"flags value, *tp* and *f*, and checks whether ``tp->tp_flags & f`` is non-" +"zero." msgstr "" -#: ../../c-api/typeobj.rst:1086 +#: ../../c-api/typeobj.rst:1087 msgid "" "This bit is set when the type object itself is allocated on the heap, for " "example, types created dynamically using :c:func:`PyType_FromSpec`. In this " @@ -2089,257 +2093,255 @@ msgid "" "a reference to the type, and the type object is INCREF'ed when a new " "instance is created, and DECREF'ed when an instance is destroyed (this does " "not apply to instances of subtypes; only the type referenced by the " -"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should " -"also :ref:`support garbage collection ` as they " -"can form a reference cycle with their own module object." +"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should also :ref:" +"`support garbage collection ` as they can form a " +"reference cycle with their own module object." msgstr "" -#: ../../c-api/typeobj.rst:1097 ../../c-api/typeobj.rst:1108 -#: ../../c-api/typeobj.rst:1118 ../../c-api/typeobj.rst:1128 -#: ../../c-api/typeobj.rst:1160 +#: ../../c-api/typeobj.rst:1098 ../../c-api/typeobj.rst:1109 +#: ../../c-api/typeobj.rst:1119 ../../c-api/typeobj.rst:1129 +#: ../../c-api/typeobj.rst:1161 msgid "???" msgstr "???" -#: ../../c-api/typeobj.rst:1102 +#: ../../c-api/typeobj.rst:1103 msgid "" "This bit is set when the type can be used as the base type of another type. " "If this bit is clear, the type cannot be subtyped (similar to a \"final\" " "class in Java)." msgstr "" -#: ../../c-api/typeobj.rst:1113 +#: ../../c-api/typeobj.rst:1114 msgid "" -"This bit is set when the type object has been fully initialized " -"by :c:func:`PyType_Ready`." +"This bit is set when the type object has been fully initialized by :c:func:" +"`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1123 +#: ../../c-api/typeobj.rst:1124 msgid "" "This bit is set while :c:func:`PyType_Ready` is in the process of " "initializing the type object." msgstr "" -#: ../../c-api/typeobj.rst:1133 +#: ../../c-api/typeobj.rst:1134 msgid "" "This bit is set when the object supports garbage collection. If this bit is " "set, instances must be created using :c:macro:`PyObject_GC_New` and " -"destroyed using :c:func:`PyObject_GC_Del`. More information in " -"section :ref:`supporting-cycle-detection`. This bit also implies that the " -"GC-related fields :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` are present in the type object." +"destroyed using :c:func:`PyObject_GC_Del`. More information in section :ref:" +"`supporting-cycle-detection`. This bit also implies that the GC-related " +"fields :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject." +"tp_clear` are present in the type object." msgstr "" -#: ../../c-api/typeobj.rst:1142 ../../c-api/typeobj.rst:1483 -#: ../../c-api/typeobj.rst:1557 -msgid "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject.tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" +#: ../../c-api/typeobj.rst:1143 ../../c-api/typeobj.rst:1484 +#: ../../c-api/typeobj.rst:1558 +msgid "" +"Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." +"tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" -#: ../../c-api/typeobj.rst:1144 +#: ../../c-api/typeobj.rst:1145 msgid "" -"The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with " -"the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " -"the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " -"``NULL`` values." +"The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:" +"member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` " +"fields, i.e. if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the " +"subtype and the :c:member:`~PyTypeObject.tp_traverse` and :c:member:" +"`~PyTypeObject.tp_clear` fields in the subtype exist and have ``NULL`` " +"values." msgstr "" -#: ../../c-api/typeobj.rst:1154 +#: ../../c-api/typeobj.rst:1155 msgid "" "This is a bitmask of all the bits that pertain to the existence of certain " "fields in the type object and its extension structures. Currently, it " "includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" -#: ../../c-api/typeobj.rst:1165 +#: ../../c-api/typeobj.rst:1166 msgid "This bit indicates that objects behave like unbound methods." msgstr "" -#: ../../c-api/typeobj.rst:1167 +#: ../../c-api/typeobj.rst:1168 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" -#: ../../c-api/typeobj.rst:1169 +#: ../../c-api/typeobj.rst:1170 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1172 +#: ../../c-api/typeobj.rst:1173 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1175 +#: ../../c-api/typeobj.rst:1176 msgid "" -"This flag enables an optimization for typical method calls like " -"``obj.meth()``: it avoids creating a temporary \"bound method\" object for " -"``obj.meth``." +"This flag enables an optimization for typical method calls like ``obj." +"meth()``: it avoids creating a temporary \"bound method\" object for ``obj." +"meth``." msgstr "" -#: ../../c-api/typeobj.rst:1183 +#: ../../c-api/typeobj.rst:1184 msgid "" -"This flag is never inherited by types without " -"the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it " -"is inherited whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." +"This flag is never inherited by types without the :c:macro:" +"`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " +"whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1189 +#: ../../c-api/typeobj.rst:1190 msgid "" "This bit indicates that instances of the class have a `~object.__dict__` " "attribute, and that the space for the dictionary is managed by the VM." msgstr "" -#: ../../c-api/typeobj.rst:1192 +#: ../../c-api/typeobj.rst:1193 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." msgstr "" -#: ../../c-api/typeobj.rst:1194 +#: ../../c-api/typeobj.rst:1195 msgid "" "The type traverse function must call :c:func:`PyObject_VisitManagedDict` and " "its clear function must call :c:func:`PyObject_ClearManagedDict`." msgstr "" -#: ../../c-api/typeobj.rst:1201 +#: ../../c-api/typeobj.rst:1202 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` " "field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1207 +#: ../../c-api/typeobj.rst:1208 msgid "" "This bit indicates that instances of the class should be weakly " "referenceable." msgstr "" -#: ../../c-api/typeobj.rst:1214 +#: ../../c-api/typeobj.rst:1215 msgid "" -"This flag is inherited unless " -"the :c:member:`~PyTypeObject.tp_weaklistoffset` field is set in a superclass." +"This flag is inherited unless the :c:member:`~PyTypeObject." +"tp_weaklistoffset` field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1220 +#: ../../c-api/typeobj.rst:1221 msgid "" -"Only usable with variable-size types, i.e. ones with non-" -"zero :c:member:`~PyTypeObject.tp_itemsize`." +"Only usable with variable-size types, i.e. ones with non-zero :c:member:" +"`~PyTypeObject.tp_itemsize`." msgstr "" -#: ../../c-api/typeobj.rst:1223 +#: ../../c-api/typeobj.rst:1224 msgid "" "Indicates that the variable-sized portion of an instance of this type is at " "the end of the instance's memory area, at an offset of ``Py_TYPE(obj)-" ">tp_basicsize`` (which may be different in each subclass)." msgstr "" -#: ../../c-api/typeobj.rst:1228 +#: ../../c-api/typeobj.rst:1229 msgid "" "When setting this flag, be sure that all superclasses either use this memory " "layout, or are not variable-sized. Python does not check this." msgstr "" -#: ../../c-api/typeobj.rst:1236 +#: ../../c-api/typeobj.rst:1237 msgid "This flag is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1250 +#: ../../c-api/typeobj.rst:1251 msgid "" "These flags are used by functions such as :c:func:`PyLong_Check` to quickly " "determine if a type is a subclass of a built-in type; such specific checks " "are faster than a generic check, like :c:func:`PyObject_IsInstance`. Custom " -"types that inherit from built-ins should have " -"their :c:member:`~PyTypeObject.tp_flags` set appropriately, or the code that " -"interacts with such types will behave differently depending on what kind of " -"check is used." +"types that inherit from built-ins should have their :c:member:`~PyTypeObject." +"tp_flags` set appropriately, or the code that interacts with such types will " +"behave differently depending on what kind of check is used." msgstr "" -#: ../../c-api/typeobj.rst:1261 +#: ../../c-api/typeobj.rst:1262 msgid "" "This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is " "present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1266 +#: ../../c-api/typeobj.rst:1267 msgid "" -"This flag isn't necessary anymore, as the interpreter assumes " -"the :c:member:`~PyTypeObject.tp_finalize` slot is always present in the type " -"structure." +"This flag isn't necessary anymore, as the interpreter assumes the :c:member:" +"`~PyTypeObject.tp_finalize` slot is always present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1274 +#: ../../c-api/typeobj.rst:1275 msgid "" "This bit is set when the class implements the :ref:`vectorcall protocol " "`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " "details." msgstr "" -#: ../../c-api/typeobj.rst:1280 +#: ../../c-api/typeobj.rst:1281 msgid "" "This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" -#: ../../c-api/typeobj.rst:1287 +#: ../../c-api/typeobj.rst:1288 msgid "" -"This flag is now removed from a class when the " -"class's :py:meth:`~object.__call__` method is reassigned." +"This flag is now removed from a class when the class's :py:meth:`~object." +"__call__` method is reassigned." msgstr "" -#: ../../c-api/typeobj.rst:1290 +#: ../../c-api/typeobj.rst:1291 msgid "This flag can now be inherited by mutable classes." msgstr "" -#: ../../c-api/typeobj.rst:1294 +#: ../../c-api/typeobj.rst:1295 msgid "" "This bit is set for type objects that are immutable: type attributes cannot " "be set nor deleted." msgstr "" -#: ../../c-api/typeobj.rst:1296 +#: ../../c-api/typeobj.rst:1297 msgid "" ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " "`." msgstr "" -#: ../../c-api/typeobj.rst:1301 +#: ../../c-api/typeobj.rst:1302 msgid "This flag is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:1307 +#: ../../c-api/typeobj.rst:1308 msgid "" -"Disallow creating instances of the type: " -"set :c:member:`~PyTypeObject.tp_new` to NULL and don't create the " -"``__new__`` key in the type dictionary." +"Disallow creating instances of the type: set :c:member:`~PyTypeObject." +"tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." msgstr "" -#: ../../c-api/typeobj.rst:1311 +#: ../../c-api/typeobj.rst:1312 msgid "" "The flag must be set before creating the type, not after. For example, it " "must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" -#: ../../c-api/typeobj.rst:1314 +#: ../../c-api/typeobj.rst:1315 msgid "" -"The flag is set automatically on :ref:`static types ` " -"if :c:member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` " -"and :c:member:`~PyTypeObject.tp_new` is NULL." +"The flag is set automatically on :ref:`static types ` if :c:" +"member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" +"member:`~PyTypeObject.tp_new` is NULL." msgstr "" -#: ../../c-api/typeobj.rst:1320 +#: ../../c-api/typeobj.rst:1321 msgid "" "This flag is not inherited. However, subclasses will not be instantiable " "unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is " "only possible via the C API)." msgstr "" -#: ../../c-api/typeobj.rst:1327 +#: ../../c-api/typeobj.rst:1328 msgid "" "To disallow instantiating a class directly but allow instantiating its " "subclasses (e.g. for an :term:`abstract base class`), do not use this flag. " "Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1338 +#: ../../c-api/typeobj.rst:1339 msgid "" "This bit indicates that instances of the class may match mapping patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2347,23 +2349,23 @@ msgid "" "unset when registering :class:`collections.abc.Sequence`." msgstr "" -#: ../../c-api/typeobj.rst:1345 ../../c-api/typeobj.rst:1367 +#: ../../c-api/typeobj.rst:1346 ../../c-api/typeobj.rst:1368 msgid "" ":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are " "mutually exclusive; it is an error to enable both flags simultaneously." msgstr "" -#: ../../c-api/typeobj.rst:1350 +#: ../../c-api/typeobj.rst:1351 msgid "" -"This flag is inherited by types that do not already " -"set :c:macro:`Py_TPFLAGS_SEQUENCE`." +"This flag is inherited by types that do not already set :c:macro:" +"`Py_TPFLAGS_SEQUENCE`." msgstr "" -#: ../../c-api/typeobj.rst:1353 ../../c-api/typeobj.rst:1375 +#: ../../c-api/typeobj.rst:1354 ../../c-api/typeobj.rst:1376 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../c-api/typeobj.rst:1360 +#: ../../c-api/typeobj.rst:1361 msgid "" "This bit indicates that instances of the class may match sequence patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2371,63 +2373,63 @@ msgid "" "unset when registering :class:`collections.abc.Mapping`." msgstr "" -#: ../../c-api/typeobj.rst:1372 +#: ../../c-api/typeobj.rst:1373 msgid "" -"This flag is inherited by types that do not already " -"set :c:macro:`Py_TPFLAGS_MAPPING`." +"This flag is inherited by types that do not already set :c:macro:" +"`Py_TPFLAGS_MAPPING`." msgstr "" -#: ../../c-api/typeobj.rst:1382 +#: ../../c-api/typeobj.rst:1383 msgid "" "Internal. Do not set or unset this flag. To indicate that a class has " "changed call :c:func:`PyType_Modified`" msgstr "" -#: ../../c-api/typeobj.rst:1386 +#: ../../c-api/typeobj.rst:1387 msgid "" "This flag is present in header files, but is not be used. It will be removed " "in a future version of CPython" msgstr "" -#: ../../c-api/typeobj.rst:1392 +#: ../../c-api/typeobj.rst:1393 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " "this type object. This is exposed as the :attr:`~type.__doc__` attribute on " "the type and instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:1398 +#: ../../c-api/typeobj.rst:1399 msgid "This field is *not* inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:1403 +#: ../../c-api/typeobj.rst:1404 msgid "" "An optional pointer to a traversal function for the garbage collector. This " "is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1406 +#: ../../c-api/typeobj.rst:1407 msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "int tp_traverse(PyObject *self, visitproc visit, void *arg);" -#: ../../c-api/typeobj.rst:1408 ../../c-api/typeobj.rst:1552 +#: ../../c-api/typeobj.rst:1409 ../../c-api/typeobj.rst:1553 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1411 +#: ../../c-api/typeobj.rst:1412 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " -"collector to detect reference cycles. A typical implementation of " -"a :c:member:`~PyTypeObject.tp_traverse` function simply " -"calls :c:func:`Py_VISIT` on each of the instance's members that are Python " -"objects that the instance owns. For example, this is function :c:func:`!" -"local_traverse` from the :mod:`!_thread` extension module::" +"collector to detect reference cycles. A typical implementation of a :c:" +"member:`~PyTypeObject.tp_traverse` function simply calls :c:func:`Py_VISIT` " +"on each of the instance's members that are Python objects that the instance " +"owns. For example, this is function :c:func:`!local_traverse` from the :mod:" +"`!_thread` extension module::" msgstr "" -#: ../../c-api/typeobj.rst:1417 +#: ../../c-api/typeobj.rst:1418 msgid "" "static int\n" "local_traverse(localobject *self, visitproc visit, void *arg)\n" @@ -2447,7 +2449,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1426 +#: ../../c-api/typeobj.rst:1427 msgid "" "Note that :c:func:`Py_VISIT` is called only on those members that can " "participate in reference cycles. Although there is also a ``self->key`` " @@ -2455,29 +2457,29 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../c-api/typeobj.rst:1430 +#: ../../c-api/typeobj.rst:1431 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -#: ../../c-api/typeobj.rst:1434 +#: ../../c-api/typeobj.rst:1435 msgid "" "Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" msgstr "" -#: ../../c-api/typeobj.rst:1436 +#: ../../c-api/typeobj.rst:1437 msgid "Py_VISIT(Py_TYPE(self));" msgstr "Py_VISIT(Py_TYPE(self));" -#: ../../c-api/typeobj.rst:1438 +#: ../../c-api/typeobj.rst:1439 msgid "" "It is only needed since Python 3.9. To support Python 3.8 and older, this " "line must be conditional::" msgstr "" -#: ../../c-api/typeobj.rst:1441 +#: ../../c-api/typeobj.rst:1442 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " Py_VISIT(Py_TYPE(self));\n" @@ -2487,18 +2489,18 @@ msgstr "" " Py_VISIT(Py_TYPE(self));\n" "#endif" -#: ../../c-api/typeobj.rst:1445 +#: ../../c-api/typeobj.rst:1446 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " -"the :c:member:`~PyTypeObject.tp_flags` field, the traverse function must " -"call :c:func:`PyObject_VisitManagedDict` like this::" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" +"`PyObject_VisitManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1449 +#: ../../c-api/typeobj.rst:1450 msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" msgstr "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" -#: ../../c-api/typeobj.rst:1452 +#: ../../c-api/typeobj.rst:1453 msgid "" "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " "that the instance *owns* (by having :term:`strong references ` hold a reference to " -"their type. Their traversal function must therefore either " -"visit :c:func:`Py_TYPE(self) `, or delegate this responsibility by " -"calling ``tp_traverse`` of another heap-allocated type (such as a heap-" -"allocated superclass). If they do not, the type object may not be garbage-" -"collected." +"their type. Their traversal function must therefore either visit :c:func:" +"`Py_TYPE(self) `, or delegate this responsibility by calling " +"``tp_traverse`` of another heap-allocated type (such as a heap-allocated " +"superclass). If they do not, the type object may not be garbage-collected." msgstr "" -#: ../../c-api/typeobj.rst:1476 +#: ../../c-api/typeobj.rst:1477 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1485 +#: ../../c-api/typeobj.rst:1486 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_clear` and " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag " -"bit, :c:member:`~PyTypeObject.tp_traverse`, " -"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " -"if they are all zero in the subtype." +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" +"member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " +"are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1493 +#: ../../c-api/typeobj.rst:1494 msgid "" "An optional pointer to a clear function for the garbage collector. This is " "only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1496 +#: ../../c-api/typeobj.rst:1497 msgid "int tp_clear(PyObject *);" msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1498 +#: ../../c-api/typeobj.rst:1499 msgid "" "The :c:member:`~PyTypeObject.tp_clear` member function is used to break " "reference cycles in cyclic garbage detected by the garbage collector. Taken " @@ -2565,14 +2564,13 @@ msgid "" "doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For example, " "the tuple type does not implement a :c:member:`~PyTypeObject.tp_clear` " "function, because it's possible to prove that no reference cycle can be " -"composed entirely of tuples. Therefore " -"the :c:member:`~PyTypeObject.tp_clear` functions of other types must be " -"sufficient to break any cycle containing a tuple. This isn't immediately " -"obvious, and there's rarely a good reason to avoid " -"implementing :c:member:`~PyTypeObject.tp_clear`." +"composed entirely of tuples. Therefore the :c:member:`~PyTypeObject." +"tp_clear` functions of other types must be sufficient to break any cycle " +"containing a tuple. This isn't immediately obvious, and there's rarely a " +"good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1508 +#: ../../c-api/typeobj.rst:1509 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2580,7 +2578,7 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1512 +#: ../../c-api/typeobj.rst:1513 msgid "" "static int\n" "local_clear(localobject *self)\n" @@ -2602,12 +2600,12 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1522 +#: ../../c-api/typeobj.rst:1523 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " -"delicate: the reference to the contained object must not be released " -"(via :c:func:`Py_DECREF`) until after the pointer to the contained object is " -"set to ``NULL``. This is because releasing the reference may cause the " +"delicate: the reference to the contained object must not be released (via :" +"c:func:`Py_DECREF`) until after the pointer to the contained object is set " +"to ``NULL``. This is because releasing the reference may cause the " "contained object to become trash, triggering a chain of reclamation activity " "that may include invoking arbitrary Python code (due to finalizers, or " "weakref callbacks, associated with the contained object). If it's possible " @@ -2617,18 +2615,18 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1534 +#: ../../c-api/typeobj.rst:1535 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " -"the :c:member:`~PyTypeObject.tp_flags` field, the traverse function must " -"call :c:func:`PyObject_ClearManagedDict` like this::" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" +"`PyObject_ClearManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1538 +#: ../../c-api/typeobj.rst:1539 msgid "PyObject_ClearManagedDict((PyObject*)self);" msgstr "PyObject_ClearManagedDict((PyObject*)self);" -#: ../../c-api/typeobj.rst:1540 +#: ../../c-api/typeobj.rst:1541 msgid "" "Note that :c:member:`~PyTypeObject.tp_clear` is not *always* called before " "an instance is deallocated. For example, when reference counting is enough " @@ -2636,7 +2634,7 @@ msgid "" "is not involved and :c:member:`~PyTypeObject.tp_dealloc` is called directly." msgstr "" -#: ../../c-api/typeobj.rst:1546 +#: ../../c-api/typeobj.rst:1547 msgid "" "Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break " "reference cycles, it's not necessary to clear contained objects like Python " @@ -2646,32 +2644,30 @@ msgid "" "invoke :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1559 +#: ../../c-api/typeobj.rst:1560 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_traverse` and " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag " -"bit, :c:member:`~PyTypeObject.tp_traverse`, " -"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " -"if they are all zero in the subtype." +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" +"c:member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " +"are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1567 +#: ../../c-api/typeobj.rst:1568 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1569 +#: ../../c-api/typeobj.rst:1570 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1571 +#: ../../c-api/typeobj.rst:1572 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: ../../c-api/typeobj.rst:1574 +#: ../../c-api/typeobj.rst:1575 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2679,51 +2675,50 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1579 +#: ../../c-api/typeobj.rst:1580 msgid "" -"The following constants are defined to be used as the third argument " -"for :c:member:`~PyTypeObject.tp_richcompare` and " -"for :c:func:`PyObject_RichCompare`:" +"The following constants are defined to be used as the third argument for :c:" +"member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" msgstr "" -#: ../../c-api/typeobj.rst:1585 +#: ../../c-api/typeobj.rst:1586 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1585 +#: ../../c-api/typeobj.rst:1586 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1587 +#: ../../c-api/typeobj.rst:1588 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1589 +#: ../../c-api/typeobj.rst:1590 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1591 +#: ../../c-api/typeobj.rst:1592 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1593 +#: ../../c-api/typeobj.rst:1594 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1595 +#: ../../c-api/typeobj.rst:1596 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1597 +#: ../../c-api/typeobj.rst:1598 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1600 +#: ../../c-api/typeobj.rst:1601 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1604 +#: ../../c-api/typeobj.rst:1605 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -2731,62 +2726,60 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1610 +#: ../../c-api/typeobj.rst:1611 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: ../../c-api/typeobj.rst:1612 +#: ../../c-api/typeobj.rst:1613 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1620 +#: ../../c-api/typeobj.rst:1621 msgid "" -"This field is inherited by subtypes together " -"with :c:member:`~PyTypeObject.tp_hash`: a subtype " -"inherits :c:member:`~PyTypeObject.tp_richcompare` " -"and :c:member:`~PyTypeObject.tp_hash` when the " -"subtype's :c:member:`~PyTypeObject.tp_richcompare` " -"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." +"This field is inherited by subtypes together with :c:member:`~PyTypeObject." +"tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" +"member:`~PyTypeObject.tp_hash` when the subtype's :c:member:`~PyTypeObject." +"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1627 +#: ../../c-api/typeobj.rst:1628 msgid "" -":c:data:`PyBaseObject_Type` provides " -"a :c:member:`~PyTypeObject.tp_richcompare` implementation, which may be " -"inherited. However, if only :c:member:`~PyTypeObject.tp_hash` is defined, " -"not even the inherited function is used and instances of the type will not " -"be able to participate in any comparisons." +":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." +"tp_richcompare` implementation, which may be inherited. However, if only :c:" +"member:`~PyTypeObject.tp_hash` is defined, not even the inherited function " +"is used and instances of the type will not be able to participate in any " +"comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1636 +#: ../../c-api/typeobj.rst:1637 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1639 +#: ../../c-api/typeobj.rst:1640 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " "weak reference list head (ignoring the GC header, if present); this offset " "is used by :c:func:`PyObject_ClearWeakRefs` and the ``PyWeakref_*`` " -"functions. The instance structure needs to include a field of " -"type :c:expr:`PyObject*` which is initialized to ``NULL``." +"functions. The instance structure needs to include a field of type :c:expr:" +"`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1646 +#: ../../c-api/typeobj.rst:1647 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1649 +#: ../../c-api/typeobj.rst:1650 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1654 +#: ../../c-api/typeobj.rst:1655 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -2795,116 +2788,115 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1661 +#: ../../c-api/typeobj.rst:1662 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in " -"the :c:member:`~PyTypeObject.tp_flags` field, " -"then :c:member:`~PyTypeObject.tp_weaklistoffset` will be set to a negative " -"value, to indicate that it is unsafe to use this field." +"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." +"tp_weaklistoffset` will be set to a negative value, to indicate that it is " +"unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1669 +#: ../../c-api/typeobj.rst:1670 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " -"object. Its presence normally signals that the instances of this type " -"are :term:`iterable` (although sequences may be iterable without this " -"function)." +"object. Its presence normally signals that the instances of this type are :" +"term:`iterable` (although sequences may be iterable without this function)." msgstr "" -#: ../../c-api/typeobj.rst:1673 +#: ../../c-api/typeobj.rst:1674 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1675 +#: ../../c-api/typeobj.rst:1676 msgid "PyObject *tp_iter(PyObject *self);" msgstr "PyObject *tp_iter(PyObject *self);" -#: ../../c-api/typeobj.rst:1684 +#: ../../c-api/typeobj.rst:1685 msgid "" -"An optional pointer to a function that returns the next item in " -"an :term:`iterator`. The signature is::" +"An optional pointer to a function that returns the next item in an :term:" +"`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1687 +#: ../../c-api/typeobj.rst:1688 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "PyObject *tp_iternext(PyObject *self);" -#: ../../c-api/typeobj.rst:1689 +#: ../../c-api/typeobj.rst:1690 msgid "" -"When the iterator is exhausted, it must return ``NULL``; " -"a :exc:`StopIteration` exception may or may not be set. When another error " -"occurs, it must return ``NULL`` too. Its presence signals that the " -"instances of this type are iterators." +"When the iterator is exhausted, it must return ``NULL``; a :exc:" +"`StopIteration` exception may or may not be set. When another error occurs, " +"it must return ``NULL`` too. Its presence signals that the instances of " +"this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1694 +#: ../../c-api/typeobj.rst:1695 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: ../../c-api/typeobj.rst:1698 +#: ../../c-api/typeobj.rst:1699 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1707 +#: ../../c-api/typeobj.rst:1708 msgid "" -"An optional pointer to a static ``NULL``-terminated array " -"of :c:type:`PyMethodDef` structures, declaring regular methods of this type." +"An optional pointer to a static ``NULL``-terminated array of :c:type:" +"`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: ../../c-api/typeobj.rst:1710 +#: ../../c-api/typeobj.rst:1711 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1715 +#: ../../c-api/typeobj.rst:1716 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1721 +#: ../../c-api/typeobj.rst:1722 msgid "" -"An optional pointer to a static ``NULL``-terminated array " -"of :c:type:`PyMemberDef` structures, declaring regular data members (fields " -"or slots) of instances of this type." +"An optional pointer to a static ``NULL``-terminated array of :c:type:" +"`PyMemberDef` structures, declaring regular data members (fields or slots) " +"of instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1725 +#: ../../c-api/typeobj.rst:1726 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1730 +#: ../../c-api/typeobj.rst:1731 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1736 +#: ../../c-api/typeobj.rst:1737 msgid "" -"An optional pointer to a static ``NULL``-terminated array " -"of :c:type:`PyGetSetDef` structures, declaring computed attributes of " -"instances of this type." +"An optional pointer to a static ``NULL``-terminated array of :c:type:" +"`PyGetSetDef` structures, declaring computed attributes of instances of this " +"type." msgstr "" -#: ../../c-api/typeobj.rst:1739 +#: ../../c-api/typeobj.rst:1740 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1744 +#: ../../c-api/typeobj.rst:1745 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1750 +#: ../../c-api/typeobj.rst:1751 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -2912,7 +2904,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1758 +#: ../../c-api/typeobj.rst:1759 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -2920,176 +2912,173 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1763 +#: ../../c-api/typeobj.rst:1764 msgid "" -"However, the unary '&' operator applied to a non-static variable " -"like :c:data:`PyBaseObject_Type` is not required to produce an address " -"constant. Compilers may support this (gcc does), MSVC does not. Both " -"compilers are strictly standard conforming in this particular behavior." +"However, the unary '&' operator applied to a non-static variable like :c:" +"data:`PyBaseObject_Type` is not required to produce an address constant. " +"Compilers may support this (gcc does), MSVC does not. Both compilers are " +"strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1769 +#: ../../c-api/typeobj.rst:1770 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1774 +#: ../../c-api/typeobj.rst:1775 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1778 +#: ../../c-api/typeobj.rst:1779 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1784 +#: ../../c-api/typeobj.rst:1785 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1786 +#: ../../c-api/typeobj.rst:1787 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " "attributes for the type. Once :c:func:`PyType_Ready` has initialized the " "type, extra attributes for the type may be added to this dictionary only if " -"they don't correspond to overloaded operations " -"(like :meth:`~object.__add__`). Once initialization for the type has " -"finished, this field should be treated as read-only." +"they don't correspond to overloaded operations (like :meth:`~object." +"__add__`). Once initialization for the type has finished, this field should " +"be treated as read-only." msgstr "" -#: ../../c-api/typeobj.rst:1794 +#: ../../c-api/typeobj.rst:1795 msgid "" -"Some types may not store their dictionary in this slot. " -"Use :c:func:`PyType_GetDict` to retrieve the dictionary for an arbitrary " -"type." +"Some types may not store their dictionary in this slot. Use :c:func:" +"`PyType_GetDict` to retrieve the dictionary for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1800 +#: ../../c-api/typeobj.rst:1801 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " -"Instead, the dict for such types is stored on ``PyInterpreterState``. " -"Use :c:func:`PyType_GetDict` to get the dict for an arbitrary type." +"Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" +"func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1806 +#: ../../c-api/typeobj.rst:1807 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1811 +#: ../../c-api/typeobj.rst:1812 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:1816 +#: ../../c-api/typeobj.rst:1817 msgid "" -"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise " -"modify :c:member:`~PyTypeObject.tp_dict` with the dictionary C-API." +"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" +"member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: ../../c-api/typeobj.rst:1822 +#: ../../c-api/typeobj.rst:1823 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:1824 ../../c-api/typeobj.rst:1840 -#: ../../c-api/typeobj.rst:1904 ../../c-api/typeobj.rst:1934 -#: ../../c-api/typeobj.rst:1958 +#: ../../c-api/typeobj.rst:1825 ../../c-api/typeobj.rst:1841 +#: ../../c-api/typeobj.rst:1905 ../../c-api/typeobj.rst:1935 +#: ../../c-api/typeobj.rst:1959 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1826 +#: ../../c-api/typeobj.rst:1827 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" -#: ../../c-api/typeobj.rst:1837 +#: ../../c-api/typeobj.rst:1838 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:1842 +#: ../../c-api/typeobj.rst:1843 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" msgstr "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" -#: ../../c-api/typeobj.rst:1844 +#: ../../c-api/typeobj.rst:1845 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:1855 +#: ../../c-api/typeobj.rst:1856 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1858 +#: ../../c-api/typeobj.rst:1859 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " -"of the type of the instance variable dictionary; this offset is used " -"by :c:func:`PyObject_GenericGetAttr`." +"of the type of the instance variable dictionary; this offset is used by :c:" +"func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1863 +#: ../../c-api/typeobj.rst:1864 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1866 +#: ../../c-api/typeobj.rst:1867 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: ../../c-api/typeobj.rst:1868 +#: ../../c-api/typeobj.rst:1869 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" -"only. To get the pointer to the dictionary " -"call :c:func:`PyObject_GenericGetDict`. " -"Calling :c:func:`PyObject_GenericGetDict` may need to allocate memory for " -"the dictionary, so it is may be more efficient to " -"call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." +"only. To get the pointer to the dictionary call :c:func:" +"`PyObject_GenericGetDict`. Calling :c:func:`PyObject_GenericGetDict` may " +"need to allocate memory for the dictionary, so it is may be more efficient " +"to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:1874 +#: ../../c-api/typeobj.rst:1875 msgid "" -"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit " -"and :c:member:`~PyTypeObject.tp_dictoffset`." +"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit and :c:" +"member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1879 +#: ../../c-api/typeobj.rst:1880 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " -"at the previous offset. To properly support inheritance, " -"use :c:macro:`Py_TPFLAGS_MANAGED_DICT`." +"at the previous offset. To properly support inheritance, use :c:macro:" +"`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: ../../c-api/typeobj.rst:1886 +#: ../../c-api/typeobj.rst:1887 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" -#: ../../c-api/typeobj.rst:1889 +#: ../../c-api/typeobj.rst:1890 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " -"the :c:member:`~PyTypeObject.tp_flags` field, " -"then :c:member:`~PyTypeObject.tp_dictoffset` will be set to ``-1``, to " -"indicate that it is unsafe to use this field." +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " +"will be set to ``-1``, to indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1897 +#: ../../c-api/typeobj.rst:1898 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:1899 +#: ../../c-api/typeobj.rst:1900 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -3097,112 +3086,110 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:1906 +#: ../../c-api/typeobj.rst:1907 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1908 +#: ../../c-api/typeobj.rst:1909 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " -"arguments represent positional and keyword arguments of the call " -"to :meth:`~object.__init__`." +"arguments represent positional and keyword arguments of the call to :meth:" +"`~object.__init__`." msgstr "" -#: ../../c-api/typeobj.rst:1912 +#: ../../c-api/typeobj.rst:1913 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " -"when an instance is created normally by calling its type, after the " -"type's :c:member:`~PyTypeObject.tp_new` function has returned an instance of " -"the type. If the :c:member:`~PyTypeObject.tp_new` function returns an " -"instance of some other type that is not a subtype of the original type, " -"no :c:member:`~PyTypeObject.tp_init` function is called; " -"if :c:member:`~PyTypeObject.tp_new` returns an instance of a subtype of the " -"original type, the subtype's :c:member:`~PyTypeObject.tp_init` is called." +"when an instance is created normally by calling its type, after the type's :" +"c:member:`~PyTypeObject.tp_new` function has returned an instance of the " +"type. If the :c:member:`~PyTypeObject.tp_new` function returns an instance " +"of some other type that is not a subtype of the original type, no :c:member:" +"`~PyTypeObject.tp_init` function is called; if :c:member:`~PyTypeObject." +"tp_new` returns an instance of a subtype of the original type, the " +"subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:1919 +#: ../../c-api/typeobj.rst:1920 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:1927 +#: ../../c-api/typeobj.rst:1928 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:1932 +#: ../../c-api/typeobj.rst:1933 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:1936 +#: ../../c-api/typeobj.rst:1937 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:1940 +#: ../../c-api/typeobj.rst:1941 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)." msgstr "" -#: ../../c-api/typeobj.rst:1945 +#: ../../c-api/typeobj.rst:1946 msgid "" -"For dynamic subtypes, this field is always set " -"to :c:func:`PyType_GenericAlloc`, to force a standard heap allocation " -"strategy." +"For dynamic subtypes, this field is always set to :c:func:" +"`PyType_GenericAlloc`, to force a standard heap allocation strategy." msgstr "" -#: ../../c-api/typeobj.rst:1949 +#: ../../c-api/typeobj.rst:1950 msgid "" -"For static subtypes, :c:data:`PyBaseObject_Type` " -"uses :c:func:`PyType_GenericAlloc`. That is the recommended value for all " -"statically defined types." +"For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:" +"`PyType_GenericAlloc`. That is the recommended value for all statically " +"defined types." msgstr "" -#: ../../c-api/typeobj.rst:1956 +#: ../../c-api/typeobj.rst:1957 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:1960 +#: ../../c-api/typeobj.rst:1961 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1962 +#: ../../c-api/typeobj.rst:1963 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " -"to the type. Note that *subtype* doesn't have to equal the type " -"whose :c:member:`~PyTypeObject.tp_new` function is called; it may be a " -"subtype of that type (but not an unrelated type)." +"to the type. Note that *subtype* doesn't have to equal the type whose :c:" +"member:`~PyTypeObject.tp_new` function is called; it may be a subtype of " +"that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:1968 +#: ../../c-api/typeobj.rst:1969 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " "only as much further initialization as is absolutely necessary. " "Initialization that can safely be ignored or repeated should be placed in " "the :c:member:`~PyTypeObject.tp_init` handler. A good rule of thumb is that " -"for immutable types, all initialization should take place " -"in :c:member:`~PyTypeObject.tp_new`, while for mutable types, most " -"initialization should be deferred to :c:member:`~PyTypeObject.tp_init`." +"for immutable types, all initialization should take place in :c:member:" +"`~PyTypeObject.tp_new`, while for mutable types, most initialization should " +"be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:1976 +#: ../../c-api/typeobj.rst:1977 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:1981 +#: ../../c-api/typeobj.rst:1982 msgid "" -"This field is inherited by subtypes, except it is not inherited " -"by :ref:`static types ` " -"whose :c:member:`~PyTypeObject.tp_base` is ``NULL`` or " -"``&PyBaseObject_Type``." +"This field is inherited by subtypes, except it is not inherited by :ref:" +"`static types ` whose :c:member:`~PyTypeObject.tp_base` is " +"``NULL`` or ``&PyBaseObject_Type``." msgstr "" -#: ../../c-api/typeobj.rst:1987 +#: ../../c-api/typeobj.rst:1988 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -3210,142 +3197,142 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:1995 +#: ../../c-api/typeobj.rst:1996 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1997 +#: ../../c-api/typeobj.rst:1998 msgid "void tp_free(void *self);" msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:1999 +#: ../../c-api/typeobj.rst:2000 msgid "" -"An initializer that is compatible with this signature " -"is :c:func:`PyObject_Free`." +"An initializer that is compatible with this signature is :c:func:" +"`PyObject_Free`." msgstr "" -#: ../../c-api/typeobj.rst:2003 +#: ../../c-api/typeobj.rst:2004 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)" msgstr "" -#: ../../c-api/typeobj.rst:2008 +#: ../../c-api/typeobj.rst:2009 msgid "" -"In dynamic subtypes, this field is set to a deallocator suitable to " -"match :c:func:`PyType_GenericAlloc` and the value of " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit." +"In dynamic subtypes, this field is set to a deallocator suitable to match :c:" +"func:`PyType_GenericAlloc` and the value of the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag bit." msgstr "" -#: ../../c-api/typeobj.rst:2012 +#: ../../c-api/typeobj.rst:2013 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Del`." msgstr "" -#: ../../c-api/typeobj.rst:2017 +#: ../../c-api/typeobj.rst:2018 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:2019 +#: ../../c-api/typeobj.rst:2020 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " -"type's :c:member:`~PyTypeObject.tp_flags` field, and check " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture " -"of statically and dynamically allocated instances, and the statically " -"allocated instances are not collectible. Such types should define this " -"function; it should return ``1`` for a collectible instance, and ``0`` for a " -"non-collectible instance. The signature is::" +"type's :c:member:`~PyTypeObject.tp_flags` field, and check the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture of statically " +"and dynamically allocated instances, and the statically allocated instances " +"are not collectible. Such types should define this function; it should " +"return ``1`` for a collectible instance, and ``0`` for a non-collectible " +"instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2027 +#: ../../c-api/typeobj.rst:2028 msgid "int tp_is_gc(PyObject *self);" msgstr "int tp_is_gc(PyObject *self);" -#: ../../c-api/typeobj.rst:2029 +#: ../../c-api/typeobj.rst:2030 msgid "" -"(The only example of this are types themselves. The " -"metatype, :c:data:`PyType_Type`, defines this function to distinguish " -"between statically and :ref:`dynamically allocated types `.)" +"(The only example of this are types themselves. The metatype, :c:data:" +"`PyType_Type`, defines this function to distinguish between statically and :" +"ref:`dynamically allocated types `.)" msgstr "" -#: ../../c-api/typeobj.rst:2039 +#: ../../c-api/typeobj.rst:2040 msgid "" -"This slot has no default. If this field is " -"``NULL``, :c:macro:`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." +"This slot has no default. If this field is ``NULL``, :c:macro:" +"`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: ../../c-api/typeobj.rst:2045 +#: ../../c-api/typeobj.rst:2046 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:2047 ../../c-api/typeobj.rst:2071 +#: ../../c-api/typeobj.rst:2048 ../../c-api/typeobj.rst:2072 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized `." msgstr "" -#: ../../c-api/typeobj.rst:2050 +#: ../../c-api/typeobj.rst:2051 msgid "" "For dynamically created classes, the ``Py_tp_bases`` :c:type:`slot " -"` can be used instead of the *bases* argument " -"of :c:func:`PyType_FromSpecWithBases`. The argument form is preferred." +"` can be used instead of the *bases* argument of :c:func:" +"`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:2057 +#: ../../c-api/typeobj.rst:2058 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" -#: ../../c-api/typeobj.rst:2063 ../../c-api/typeobj.rst:2086 -#: ../../c-api/typeobj.rst:2103 ../../c-api/typeobj.rst:2120 -#: ../../c-api/typeobj.rst:2134 +#: ../../c-api/typeobj.rst:2064 ../../c-api/typeobj.rst:2087 +#: ../../c-api/typeobj.rst:2104 ../../c-api/typeobj.rst:2121 +#: ../../c-api/typeobj.rst:2135 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:2068 +#: ../../c-api/typeobj.rst:2069 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: ../../c-api/typeobj.rst:2076 +#: ../../c-api/typeobj.rst:2077 msgid "" -"This field is not inherited; it is calculated fresh " -"by :c:func:`PyType_Ready`." +"This field is not inherited; it is calculated fresh by :c:func:" +"`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2082 +#: ../../c-api/typeobj.rst:2083 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2091 +#: ../../c-api/typeobj.rst:2092 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: ../../c-api/typeobj.rst:2093 +#: ../../c-api/typeobj.rst:2094 msgid "" -"To get a list of subclasses, call the Python " -"method :py:meth:`~type.__subclasses__`." +"To get a list of subclasses, call the Python method :py:meth:`~type." +"__subclasses__`." msgstr "" -#: ../../c-api/typeobj.rst:2098 +#: ../../c-api/typeobj.rst:2099 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" -#: ../../c-api/typeobj.rst:2108 +#: ../../c-api/typeobj.rst:2109 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2113 +#: ../../c-api/typeobj.rst:2114 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " @@ -3353,25 +3340,25 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: ../../c-api/typeobj.rst:2125 +#: ../../c-api/typeobj.rst:2126 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" -#: ../../c-api/typeobj.rst:2130 +#: ../../c-api/typeobj.rst:2131 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2139 +#: ../../c-api/typeobj.rst:2140 msgid "" "An optional pointer to an instance finalization function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2141 +#: ../../c-api/typeobj.rst:2142 msgid "void tp_finalize(PyObject *self);" msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2143 +#: ../../c-api/typeobj.rst:2144 msgid "" "If :c:member:`~PyTypeObject.tp_finalize` is set, the interpreter calls it " "once when finalizing an instance. It is called either from the garbage " @@ -3381,14 +3368,14 @@ msgid "" "object in a sane state." msgstr "" -#: ../../c-api/typeobj.rst:2150 +#: ../../c-api/typeobj.rst:2151 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should not mutate the current " "exception status; therefore, a recommended way to write a non-trivial " "finalizer is::" msgstr "" -#: ../../c-api/typeobj.rst:2153 +#: ../../c-api/typeobj.rst:2154 msgid "" "static void\n" "local_finalize(PyObject *self)\n" @@ -3403,114 +3390,114 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:2173 +#: ../../c-api/typeobj.rst:2174 msgid "" -"Before version 3.8 it was necessary to set " -"the :c:macro:`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to " -"be used. This is no longer required." +"Before version 3.8 it was necessary to set the :c:macro:" +"`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " +"This is no longer required." msgstr "" -#: ../../c-api/typeobj.rst:2177 +#: ../../c-api/typeobj.rst:2178 msgid "\"Safe object finalization\" (:pep:`442`)" msgstr "" -#: ../../c-api/typeobj.rst:2182 +#: ../../c-api/typeobj.rst:2183 msgid "" "Vectorcall function to use for calls of this type object. In other words, it " "is used to implement :ref:`vectorcall ` for ``type.__call__``. " -"If ``tp_vectorcall`` is ``NULL``, the default call implementation " -"using :meth:`~object.__new__` and :meth:`~object.__init__` is used." +"If ``tp_vectorcall`` is ``NULL``, the default call implementation using :" +"meth:`~object.__new__` and :meth:`~object.__init__` is used." msgstr "" -#: ../../c-api/typeobj.rst:2190 +#: ../../c-api/typeobj.rst:2191 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2192 +#: ../../c-api/typeobj.rst:2193 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2197 +#: ../../c-api/typeobj.rst:2198 msgid "Internal. Do not use." msgstr "" -#: ../../c-api/typeobj.rst:2205 +#: ../../c-api/typeobj.rst:2206 msgid "Static Types" msgstr "" -#: ../../c-api/typeobj.rst:2207 +#: ../../c-api/typeobj.rst:2208 msgid "" -"Traditionally, types defined in C code are *static*, that is, a " -"static :c:type:`PyTypeObject` structure is defined directly in code and " -"initialized using :c:func:`PyType_Ready`." +"Traditionally, types defined in C code are *static*, that is, a static :c:" +"type:`PyTypeObject` structure is defined directly in code and initialized " +"using :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2211 +#: ../../c-api/typeobj.rst:2212 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2213 +#: ../../c-api/typeobj.rst:2214 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2215 +#: ../../c-api/typeobj.rst:2216 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: ../../c-api/typeobj.rst:2217 +#: ../../c-api/typeobj.rst:2218 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2221 +#: ../../c-api/typeobj.rst:2222 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" -#: ../../c-api/typeobj.rst:2229 +#: ../../c-api/typeobj.rst:2230 msgid "Heap Types" msgstr "" -#: ../../c-api/typeobj.rst:2231 +#: ../../c-api/typeobj.rst:2232 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " -"created by Python's ``class`` statement. Heap types have " -"the :c:macro:`Py_TPFLAGS_HEAPTYPE` flag set." +"created by Python's ``class`` statement. Heap types have the :c:macro:" +"`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2236 +#: ../../c-api/typeobj.rst:2237 msgid "" -"This is done by filling a :c:type:`PyType_Spec` structure and " -"calling :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:`PyType_FromModuleAndSpec`, " -"or :c:func:`PyType_FromMetaclass`." +"This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" +"func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" +"`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:2244 +#: ../../c-api/typeobj.rst:2245 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2251 +#: ../../c-api/typeobj.rst:2252 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: ../../c-api/typeobj.rst:2257 ../../c-api/typeobj.rst:2581 +#: ../../c-api/typeobj.rst:2258 ../../c-api/typeobj.rst:2582 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2259 +#: ../../c-api/typeobj.rst:2260 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -3598,7 +3585,7 @@ msgstr "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" -#: ../../c-api/typeobj.rst:2304 +#: ../../c-api/typeobj.rst:2305 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -3608,82 +3595,81 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2313 +#: ../../c-api/typeobj.rst:2314 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" -#: ../../c-api/typeobj.rst:2358 +#: ../../c-api/typeobj.rst:2359 msgid "Mapping Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2365 +#: ../../c-api/typeobj.rst:2366 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: ../../c-api/typeobj.rst:2370 +#: ../../c-api/typeobj.rst:2371 msgid "" -"This function is used by :c:func:`PyMapping_Size` " -"and :c:func:`PyObject_Size`, and has the same signature. This slot may be " -"set to ``NULL`` if the object has no defined length." +"This function is used by :c:func:`PyMapping_Size` and :c:func:" +"`PyObject_Size`, and has the same signature. This slot may be set to " +"``NULL`` if the object has no defined length." msgstr "" -#: ../../c-api/typeobj.rst:2376 +#: ../../c-api/typeobj.rst:2377 msgid "" -"This function is used by :c:func:`PyObject_GetItem` " -"and :c:func:`PySequence_GetSlice`, and has the same signature as :c:func:`!" -"PyObject_GetItem`. This slot must be filled for " -"the :c:func:`PyMapping_Check` function to return ``1``, it can be ``NULL`` " -"otherwise." +"This function is used by :c:func:`PyObject_GetItem` and :c:func:" +"`PySequence_GetSlice`, and has the same signature as :c:func:`!" +"PyObject_GetItem`. This slot must be filled for the :c:func:" +"`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2384 +#: ../../c-api/typeobj.rst:2385 msgid "" -"This function is used " -"by :c:func:`PyObject_SetItem`, :c:func:`PyObject_DelItem`, :c:func:`PySequence_SetSlice` " -"and :c:func:`PySequence_DelSlice`. It has the same signature as :c:func:`!" +"This function is used by :c:func:`PyObject_SetItem`, :c:func:" +"`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" +"`PySequence_DelSlice`. It has the same signature as :c:func:`!" "PyObject_SetItem`, but *v* can also be set to ``NULL`` to delete an item. " "If this slot is ``NULL``, the object does not support item assignment and " "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2395 +#: ../../c-api/typeobj.rst:2396 msgid "Sequence Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2402 +#: ../../c-api/typeobj.rst:2403 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2407 +#: ../../c-api/typeobj.rst:2408 msgid "" -"This function is used by :c:func:`PySequence_Size` " -"and :c:func:`PyObject_Size`, and has the same signature. It is also used " -"for handling negative indices via the :c:member:`~PySequenceMethods.sq_item` " -"and the :c:member:`~PySequenceMethods.sq_ass_item` slots." +"This function is used by :c:func:`PySequence_Size` and :c:func:" +"`PyObject_Size`, and has the same signature. It is also used for handling " +"negative indices via the :c:member:`~PySequenceMethods.sq_item` and the :c:" +"member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2414 +#: ../../c-api/typeobj.rst:2415 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2420 +#: ../../c-api/typeobj.rst:2421 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2426 +#: ../../c-api/typeobj.rst:2427 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -3692,43 +3678,42 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2432 +#: ../../c-api/typeobj.rst:2433 msgid "" -"Negative indexes are handled as follows: if " -"the :c:member:`~PySequenceMethods.sq_length` slot is filled, it is called " -"and the sequence length is used to compute a positive index which is passed " -"to :c:member:`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is " -"``NULL``, the index is passed as is to the function." +"Negative indexes are handled as follows: if the :c:member:" +"`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " +"length is used to compute a positive index which is passed to :c:member:" +"`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is ``NULL``, the " +"index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2439 +#: ../../c-api/typeobj.rst:2440 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " -"signature. It is also used by :c:func:`PyObject_SetItem` " -"and :c:func:`PyObject_DelItem`, after trying the item assignment and " -"deletion via the :c:member:`~PyMappingMethods.mp_ass_subscript` slot. This " -"slot may be left to ``NULL`` if the object does not support item assignment " -"and deletion." +"signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" +"`PyObject_DelItem`, after trying the item assignment and deletion via the :c:" +"member:`~PyMappingMethods.mp_ass_subscript` slot. This slot may be left to " +"``NULL`` if the object does not support item assignment and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2448 +#: ../../c-api/typeobj.rst:2449 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: ../../c-api/typeobj.rst:2455 +#: ../../c-api/typeobj.rst:2456 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " "may be left to ``NULL``, in this case :c:func:`!PySequence_InPlaceConcat` " "will fall back to :c:func:`PySequence_Concat`. It is also used by the " -"augmented assignment ``+=``, after trying numeric in-place addition via " -"the :c:member:`~PyNumberMethods.nb_inplace_add` slot." +"augmented assignment ``+=``, after trying numeric in-place addition via the :" +"c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2464 +#: ../../c-api/typeobj.rst:2465 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3738,76 +3723,76 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2475 +#: ../../c-api/typeobj.rst:2476 msgid "Buffer Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2483 +#: ../../c-api/typeobj.rst:2484 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol `. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: ../../c-api/typeobj.rst:2489 ../../c-api/typeobj.rst:2538 -#: ../../c-api/typeobj.rst:2592 ../../c-api/typeobj.rst:2603 -#: ../../c-api/typeobj.rst:2615 ../../c-api/typeobj.rst:2625 +#: ../../c-api/typeobj.rst:2490 ../../c-api/typeobj.rst:2539 +#: ../../c-api/typeobj.rst:2593 ../../c-api/typeobj.rst:2604 +#: ../../c-api/typeobj.rst:2616 ../../c-api/typeobj.rst:2626 msgid "The signature of this function is::" msgstr "" -#: ../../c-api/typeobj.rst:2491 +#: ../../c-api/typeobj.rst:2492 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" -#: ../../c-api/typeobj.rst:2493 +#: ../../c-api/typeobj.rst:2494 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: ../../c-api/typeobj.rst:2497 +#: ../../c-api/typeobj.rst:2498 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 :c:" +"expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:2500 +#: ../../c-api/typeobj.rst:2501 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:2502 +#: ../../c-api/typeobj.rst:2503 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2504 +#: ../../c-api/typeobj.rst:2505 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:2506 +#: ../../c-api/typeobj.rst:2507 msgid "Return ``0``." msgstr "回傳 ``0``。" -#: ../../c-api/typeobj.rst:2508 +#: ../../c-api/typeobj.rst:2509 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:2511 +#: ../../c-api/typeobj.rst:2512 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 :c:" +"expr:`view->obj` to a new reference to itself." msgstr "" -#: ../../c-api/typeobj.rst:2514 +#: ../../c-api/typeobj.rst:2515 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." msgstr "" -#: ../../c-api/typeobj.rst:2518 +#: ../../c-api/typeobj.rst:2519 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -3815,31 +3800,32 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:2523 +#: ../../c-api/typeobj.rst:2524 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " -"exporter and must remain valid until there are no consumers " -"left. :c:member:`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides`, :c:member:`~Py_buffer.suboffsets` " -"and :c:member:`~Py_buffer.internal` are read-only for the consumer." +"exporter and must remain valid until there are no consumers left. :c:member:" +"`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer." +"strides`, :c:member:`~Py_buffer.suboffsets` and :c:member:`~Py_buffer." +"internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:2530 +#: ../../c-api/typeobj.rst:2531 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: ../../c-api/typeobj.rst:2533 +#: ../../c-api/typeobj.rst:2534 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:2540 +#: ../../c-api/typeobj.rst:2541 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "void (PyObject *exporter, Py_buffer *view);" -#: ../../c-api/typeobj.rst:2542 +#: ../../c-api/typeobj.rst:2543 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -3847,15 +3833,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:2547 +#: ../../c-api/typeobj.rst:2548 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2549 +#: ../../c-api/typeobj.rst:2550 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:2551 +#: ../../c-api/typeobj.rst:2552 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -3863,30 +3849,30 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:2557 +#: ../../c-api/typeobj.rst:2558 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: ../../c-api/typeobj.rst:2562 +#: ../../c-api/typeobj.rst:2563 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:2570 +#: ../../c-api/typeobj.rst:2571 msgid "Async Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2578 +#: ../../c-api/typeobj.rst:2579 msgid "" -"This structure holds pointers to the functions required to " -"implement :term:`awaitable` and :term:`asynchronous iterator` objects." +"This structure holds pointers to the functions required to implement :term:" +"`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:2583 +#: ../../c-api/typeobj.rst:2584 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -3902,150 +3888,149 @@ msgstr "" " sendfunc am_send;\n" "} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:2594 +#: ../../c-api/typeobj.rst:2595 msgid "PyObject *am_await(PyObject *self);" msgstr "" -#: ../../c-api/typeobj.rst:2596 +#: ../../c-api/typeobj.rst:2597 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: ../../c-api/typeobj.rst:2599 +#: ../../c-api/typeobj.rst:2600 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:2605 +#: ../../c-api/typeobj.rst:2606 msgid "PyObject *am_aiter(PyObject *self);" msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:2607 +#: ../../c-api/typeobj.rst:2608 msgid "" -"Must return an :term:`asynchronous iterator` object. " -"See :meth:`~object.__anext__` for details." +"Must return an :term:`asynchronous iterator` object. See :meth:`~object." +"__anext__` for details." msgstr "" -#: ../../c-api/typeobj.rst:2610 +#: ../../c-api/typeobj.rst:2611 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:2617 +#: ../../c-api/typeobj.rst:2618 msgid "PyObject *am_anext(PyObject *self);" msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:2619 +#: ../../c-api/typeobj.rst:2620 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2627 +#: ../../c-api/typeobj.rst:2628 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:2629 +#: ../../c-api/typeobj.rst:2630 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2638 +#: ../../c-api/typeobj.rst:2639 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:2642 +#: ../../c-api/typeobj.rst:2643 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " "length for the instance, suitably aligned, and initialized to zeros, but " -"with :c:member:`~PyObject.ob_refcnt` set to ``1`` " -"and :c:member:`~PyObject.ob_type` set to the type argument. If the " -"type's :c:member:`~PyTypeObject.tp_itemsize` is non-zero, the " -"object's :c:member:`~PyVarObject.ob_size` field should be initialized to " -"*nitems* and the length of the allocated memory block should be " -"``tp_basicsize + nitems*tp_itemsize``, rounded up to a multiple of " -"``sizeof(void*)``; otherwise, *nitems* is not used and the length of the " -"block should be :c:member:`~PyTypeObject.tp_basicsize`." +"with :c:member:`~PyObject.ob_refcnt` set to ``1`` and :c:member:`~PyObject." +"ob_type` set to the type argument. If the type's :c:member:`~PyTypeObject." +"tp_itemsize` is non-zero, the object's :c:member:`~PyVarObject.ob_size` " +"field should be initialized to *nitems* and the length of the allocated " +"memory block should be ``tp_basicsize + nitems*tp_itemsize``, rounded up to " +"a multiple of ``sizeof(void*)``; otherwise, *nitems* is not used and the " +"length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:2652 +#: ../../c-api/typeobj.rst:2653 msgid "" "This function should not do any other instance initialization, not even to " -"allocate additional memory; that should be done " -"by :c:member:`~PyTypeObject.tp_new`." +"allocate additional memory; that should be done by :c:member:`~PyTypeObject." +"tp_new`." msgstr "" -#: ../../c-api/typeobj.rst:2659 +#: ../../c-api/typeobj.rst:2660 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:2663 +#: ../../c-api/typeobj.rst:2664 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:2667 +#: ../../c-api/typeobj.rst:2668 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:2671 +#: ../../c-api/typeobj.rst:2672 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:2675 ../../c-api/typeobj.rst:2684 +#: ../../c-api/typeobj.rst:2676 ../../c-api/typeobj.rst:2685 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:2679 ../../c-api/typeobj.rst:2690 +#: ../../c-api/typeobj.rst:2680 ../../c-api/typeobj.rst:2691 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: ../../c-api/typeobj.rst:2686 +#: ../../c-api/typeobj.rst:2687 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:2693 +#: ../../c-api/typeobj.rst:2694 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:2697 +#: ../../c-api/typeobj.rst:2698 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:2701 +#: ../../c-api/typeobj.rst:2702 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:2705 +#: ../../c-api/typeobj.rst:2706 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:2709 +#: ../../c-api/typeobj.rst:2710 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:2713 +#: ../../c-api/typeobj.rst:2714 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:2717 +#: ../../c-api/typeobj.rst:2718 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:2731 +#: ../../c-api/typeobj.rst:2732 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:2747 +#: ../../c-api/typeobj.rst:2748 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:2749 +#: ../../c-api/typeobj.rst:2750 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -4053,11 +4038,11 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:2754 +#: ../../c-api/typeobj.rst:2755 msgid "A basic :ref:`static type `::" msgstr "" -#: ../../c-api/typeobj.rst:2756 +#: ../../c-api/typeobj.rst:2757 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4075,13 +4060,13 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2771 +#: ../../c-api/typeobj.rst:2772 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:2774 +#: ../../c-api/typeobj.rst:2775 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4165,11 +4150,11 @@ msgstr "" " myobj_new, /* tp_new */\n" "};" -#: ../../c-api/typeobj.rst:2815 +#: ../../c-api/typeobj.rst:2816 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:2817 +#: ../../c-api/typeobj.rst:2818 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4195,14 +4180,14 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2840 +#: ../../c-api/typeobj.rst:2841 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " -"instances (e.g. uses a separate factory func) " -"using :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" +"instances (e.g. uses a separate factory func) using :c:macro:" +"`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: ../../c-api/typeobj.rst:2844 +#: ../../c-api/typeobj.rst:2845 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4220,12 +4205,12 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2859 +#: ../../c-api/typeobj.rst:2860 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:2861 +#: ../../c-api/typeobj.rst:2862 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4245,13 +4230,13 @@ msgstr "" " .tp_name = \"mymod.MyObject\",\n" "};" -#: ../../c-api/typeobj.rst:2870 +#: ../../c-api/typeobj.rst:2871 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" -#: ../../c-api/typeobj.rst:2872 +#: ../../c-api/typeobj.rst:2873 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" @@ -4277,14 +4262,14 @@ msgstr "" " .tp_itemsize = sizeof(char *),\n" "};" -#: ../../c-api/typeobj.rst:842 ../../c-api/typeobj.rst:907 +#: ../../c-api/typeobj.rst:843 ../../c-api/typeobj.rst:908 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/typeobj.rst:842 +#: ../../c-api/typeobj.rst:843 msgid "repr" msgstr "repr" -#: ../../c-api/typeobj.rst:907 +#: ../../c-api/typeobj.rst:908 msgid "hash" msgstr "hash(雜湊)" diff --git a/library/io.po b/library/io.po index e4f192af21..05efc2d964 100644 --- a/library/io.po +++ b/library/io.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-21 00:17+0000\n" +"POT-Creation-Date: 2025-05-22 00:16+0000\n" "PO-Revision-Date: 2023-12-08 00:08+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -77,7 +77,7 @@ msgstr "" "原本會引發 :exc:`IOError` 的操作,現在將改成引發 :exc:`OSError`。因為 :exc:" "`IOError` 現在是 :exc:`OSError` 的別名。" -#: ../../library/io.rst:51 ../../library/io.rst:855 ../../library/io.rst:1151 +#: ../../library/io.rst:51 ../../library/io.rst:862 ../../library/io.rst:1158 msgid "Text I/O" msgstr "文字 I/O" @@ -118,7 +118,7 @@ msgid "" "`TextIOBase`." msgstr "文字資料串流 API 的詳細說明在 :class:`TextIOBase` 文件當中。" -#: ../../library/io.rst:72 ../../library/io.rst:1139 +#: ../../library/io.rst:72 ../../library/io.rst:1146 msgid "Binary I/O" msgstr "二進位 (Binary) I/O" @@ -778,7 +778,7 @@ msgid "" "negative" msgstr ":data:`os.SEEK_END` 或 ``2`` -- 串流的結尾;*offset* 通常是負數" -#: ../../library/io.rst:420 ../../library/io.rst:931 +#: ../../library/io.rst:420 ../../library/io.rst:938 msgid "The :data:`!SEEK_*` constants." msgstr ":data:`!SEEK_*` 常數。" @@ -931,34 +931,31 @@ msgid "" msgstr "支援某種緩衝的二進位串流的基底類別。它繼承自 :class:`IOBase`。" #: ../../library/io.rst:524 +#, fuzzy msgid "" "The main difference with :class:`RawIOBase` is that methods :meth:`read`, :" "meth:`readinto` and :meth:`write` will try (respectively) to read as much " -"input as requested or to consume all given output, at the expense of making " -"perhaps more than one system call." +"input as requested or to emit all provided data." msgstr "" "與 :class:`RawIOBase` 的主要差異在於,:meth:`read`、:meth:`readinto` 及 :" "meth:`write` 方法將分別嘗試讀取所請求的盡可能多的輸入,或消耗所有給定的輸出," "即使可能需要進行多於一次的系統呼叫。" -#: ../../library/io.rst:529 +#: ../../library/io.rst:528 msgid "" -"In addition, those methods can raise :exc:`BlockingIOError` if the " -"underlying raw stream is in non-blocking mode and cannot take or give enough " -"data; unlike their :class:`RawIOBase` counterparts, they will never return " -"``None``." +"In addition, if the underlying raw stream is in non-blocking mode, when the " +"system returns would block :meth:`write` will raise :exc:`BlockingIOError` " +"with :attr:`BlockingIOError.characters_written` and :meth:`read` will return " +"data read so far or ``None`` if no data is available." msgstr "" -"此外,如果底層的原始串流處於非阻塞模式且無法提供或接收足夠的資料,這些方法可" -"能會引發 :exc:`BlockingIOError` 例外;與 :class:`RawIOBase` 不同之處在於,它" -"們永遠不會回傳 ``None``。" -#: ../../library/io.rst:534 +#: ../../library/io.rst:533 msgid "" "Besides, the :meth:`read` method does not have a default implementation that " "defers to :meth:`readinto`." msgstr "此外,:meth:`read` 方法不存在一個遵從 :meth:`readinto` 的預設實作。" -#: ../../library/io.rst:537 +#: ../../library/io.rst:536 msgid "" "A typical :class:`BufferedIOBase` implementation should not inherit from a :" "class:`RawIOBase` implementation, but wrap one, like :class:`BufferedWriter` " @@ -968,7 +965,7 @@ msgstr "" "實作,而是應該改用包裝的方式,像 :class:`BufferedWriter` 和 :class:" "`BufferedReader` 那樣的作法。" -#: ../../library/io.rst:541 +#: ../../library/io.rst:540 msgid "" ":class:`BufferedIOBase` provides or overrides these data attributes and " "methods in addition to those from :class:`IOBase`:" @@ -976,7 +973,7 @@ msgstr "" ":class:`BufferedIOBase` 除了提供或覆寫來自 :class:`IOBase` 的資料屬性和方法以" "外,還包含了這些:" -#: ../../library/io.rst:546 +#: ../../library/io.rst:545 msgid "" "The underlying raw stream (a :class:`RawIOBase` instance) that :class:" "`BufferedIOBase` deals with. This is not part of the :class:" @@ -985,16 +982,16 @@ msgstr "" "底層的原始串流(一個 :class:`RawIOBase` 實例),:class:`BufferedIOBase` 處理" "的對象。這不是 :class:`BufferedIOBase` API 的一部分,且在某些實作可能不存在。" -#: ../../library/io.rst:552 +#: ../../library/io.rst:551 msgid "Separate the underlying raw stream from the buffer and return it." msgstr "將底層的原始串流從緩衝區中分離出來,並回傳它。" -#: ../../library/io.rst:554 +#: ../../library/io.rst:553 msgid "" "After the raw stream has been detached, the buffer is in an unusable state." msgstr "在原始串流被分離後,緩衝區處於一個不可用的狀態。" -#: ../../library/io.rst:557 +#: ../../library/io.rst:556 msgid "" "Some buffers, like :class:`BytesIO`, do not have the concept of a single raw " "stream to return from this method. They raise :exc:`UnsupportedOperation`." @@ -1002,56 +999,50 @@ msgstr "" "某些緩衝區,如 :class:`BytesIO`,沒有單一原始串流的概念可從此方法回傳。它們會" "引發 :exc:`UnsupportedOperation`。" -#: ../../library/io.rst:565 +#: ../../library/io.rst:564 +#, fuzzy msgid "" -"Read and return up to *size* bytes. If the argument is omitted, ``None``, " -"or negative, data is read and returned until EOF is reached. An empty :" -"class:`bytes` object is returned if the stream is already at EOF." +"Read and return up to *size* bytes. If the argument is omitted, ``None``, or " +"negative read as much as possible." msgstr "" "讀取並回傳最多 *size* 個位元組。如果引數被省略、為 ``None`` 或為負值,將讀取" "並回傳資料直到達到 EOF 為止。如果串流已經處於 EOF,則回傳一個空的 :class:" "`bytes` 物件。" -#: ../../library/io.rst:569 +#: ../../library/io.rst:567 msgid "" -"If the argument is positive, and the underlying raw stream is not " -"interactive, multiple raw reads may be issued to satisfy the byte count " -"(unless EOF is reached first). But for interactive raw streams, at most one " -"raw read will be issued, and a short result does not imply that EOF is " -"imminent." +"Fewer bytes may be returned than requested. An empty :class:`bytes` object " +"is returned if the stream is already at EOF. More than one read may be made " +"and calls may be retried if specific errors are encountered, see :meth:`os." +"read` and :pep:`475` for more details. Less than size bytes being returned " +"does not imply that EOF is imminent." msgstr "" -"如果引數為正數,且底層原始串流不是互動式的,可能會發出多次原始讀取來滿足位元" -"組數量(除非首先達到 EOF)。但對於互動式原始串流,最多只會發出一次原始讀取," -"且短少的資料不表示 EOF 即將到來。" -#: ../../library/io.rst:575 ../../library/io.rst:598 ../../library/io.rst:608 +#: ../../library/io.rst:573 msgid "" -"A :exc:`BlockingIOError` is raised if the underlying raw stream is in non " -"blocking-mode, and has no data available at the moment." +"When reading as much as possible the default implementation will use ``raw." +"readall`` if available (which should implement :meth:`RawIOBase.readall`), " +"otherwise will read in a loop until read returns ``None``, an empty :class:" +"`bytes`, or a non-retryable error. For most streams this is to EOF, but for " +"non-blocking streams more data may become available." msgstr "" -"如果底層原始串流處於非阻塞模式,且目前沒有可用資料,則會引發 :exc:" -"`BlockingIOError`。" -#: ../../library/io.rst:580 +#: ../../library/io.rst:582 ../../library/io.rst:595 msgid "" -"Read and return up to *size* bytes, with at most one call to the underlying " -"raw stream's :meth:`~RawIOBase.read` (or :meth:`~RawIOBase.readinto`) " -"method. This can be useful if you are implementing your own buffering on " -"top of a :class:`BufferedIOBase` object." +"When the underlying raw stream is non-blocking, implementations may either " +"raise :exc:`BlockingIOError` or return ``None`` if no data is available. :" +"mod:`io` implementations return ``None``." msgstr "" -"讀取並回傳最多 *size* 個位元組,最多呼叫一次底層原始串流的 :meth:`~RawIOBase." -"read` (或 :meth:`~RawIOBase.readinto`) 方法。如果你正在 :class:" -"`BufferedIOBase` 物件之上實作自己的緩衝區,這可能會很有用。" -#: ../../library/io.rst:586 +#: ../../library/io.rst:588 msgid "" -"If *size* is ``-1`` (the default), an arbitrary number of bytes are returned " -"(more than zero unless EOF is reached)." +"Read and return up to *size* bytes, calling :meth:`~RawIOBase.readinto` " +"which may retry if :py:const:`~errno.EINTR` is encountered per :pep:`475`. " +"If *size* is ``-1`` or not provided, the implementation will choose an " +"arbitrary value for *size*." msgstr "" -"如果 *size* 為 ``-1`` (預設值),則會回傳任意數量的位元組(除非達到 EOF,否" -"則會超過零)。" -#: ../../library/io.rst:591 +#: ../../library/io.rst:601 msgid "" "Read bytes into a pre-allocated, writable :term:`bytes-like object` *b* and " "return the number of bytes read. For example, *b* might be a :class:" @@ -1060,7 +1051,7 @@ msgstr "" "讀取位元組到一個預先分配的、可寫的 :term:`bytes-like object` *b* 當中,並回傳" "讀取的位元組數量。例如,*b* 可能是一個 :class:`bytearray`。" -#: ../../library/io.rst:595 +#: ../../library/io.rst:605 msgid "" "Like :meth:`read`, multiple reads may be issued to the underlying raw " "stream, unless the latter is interactive." @@ -1068,7 +1059,15 @@ msgstr "" "類似於 :meth:`read`,除非後者是互動式的,否則可能會對底層原始串流發出多次讀" "取。" -#: ../../library/io.rst:603 +#: ../../library/io.rst:608 ../../library/io.rst:618 +msgid "" +"A :exc:`BlockingIOError` is raised if the underlying raw stream is in non " +"blocking-mode, and has no data available at the moment." +msgstr "" +"如果底層原始串流處於非阻塞模式,且目前沒有可用資料,則會引發 :exc:" +"`BlockingIOError`。" + +#: ../../library/io.rst:613 msgid "" "Read bytes into a pre-allocated, writable :term:`bytes-like object` *b*, " "using at most one call to the underlying raw stream's :meth:`~RawIOBase." @@ -1079,7 +1078,7 @@ msgstr "" "一次底層原始串流的 :meth:`~RawIOBase.read` (或 :meth:`~RawIOBase.readinto`)" "方法。此方法回傳讀取的位元組數量。" -#: ../../library/io.rst:615 +#: ../../library/io.rst:625 msgid "" "Write the given :term:`bytes-like object`, *b*, and return the number of " "bytes written (always equal to the length of *b* in bytes, since if the " @@ -1092,7 +1091,7 @@ msgstr "" "實作,這些位元組可能會立即寫入底層串流,或出於性能和延遲的緣故而被留在緩衝區" "當中。" -#: ../../library/io.rst:622 +#: ../../library/io.rst:632 msgid "" "When in non-blocking mode, a :exc:`BlockingIOError` is raised if the data " "needed to be written to the raw stream but it couldn't accept all the data " @@ -1101,7 +1100,7 @@ msgstr "" "當處於非阻塞模式時,如果需要將資料寫入原始串流,但它無法接受所有資料而不阻" "塞,則會引發 :exc:`BlockingIOError`。" -#: ../../library/io.rst:626 +#: ../../library/io.rst:636 msgid "" "The caller may release or mutate *b* after this method returns, so the " "implementation should only access *b* during the method call." @@ -1109,11 +1108,11 @@ msgstr "" "呼叫者可以在此方法回傳後釋放或變更 *b*,因此實作應該僅在方法呼叫期間存取 " "*b*。" -#: ../../library/io.rst:631 +#: ../../library/io.rst:641 msgid "Raw File I/O" msgstr "原始檔案 I/O" -#: ../../library/io.rst:635 +#: ../../library/io.rst:645 msgid "" "A raw binary stream representing an OS-level file containing bytes data. It " "inherits from :class:`RawIOBase`." @@ -1121,11 +1120,11 @@ msgstr "" "一個代表包含位元組資料的 OS 層級檔案的原始二進制串流。它繼承自 :class:" "`RawIOBase`。" -#: ../../library/io.rst:638 +#: ../../library/io.rst:648 msgid "The *name* can be one of two things:" msgstr "*name* 可以是兩種事物之一:" -#: ../../library/io.rst:640 +#: ../../library/io.rst:650 msgid "" "a character string or :class:`bytes` object representing the path to the " "file which will be opened. In this case closefd must be ``True`` (the " @@ -1134,7 +1133,7 @@ msgstr "" "代表將要打開的檔案路徑的一個字元串或 :class:`bytes` 物件。在這種情況下," "closefd 必須是 ``True`` (預設值),否則將引發錯誤。" -#: ../../library/io.rst:643 +#: ../../library/io.rst:653 msgid "" "an integer representing the number of an existing OS-level file descriptor " "to which the resulting :class:`FileIO` object will give access. When the " @@ -1142,7 +1141,7 @@ msgid "" "set to ``False``." msgstr "" -#: ../../library/io.rst:648 +#: ../../library/io.rst:658 msgid "" "The *mode* can be ``'r'``, ``'w'``, ``'x'`` or ``'a'`` for reading " "(default), writing, exclusive creation or appending. The file will be " @@ -1153,14 +1152,14 @@ msgid "" "``'+'`` to the mode to allow simultaneous reading and writing." msgstr "" -#: ../../library/io.rst:656 +#: ../../library/io.rst:666 msgid "" "The :meth:`~RawIOBase.read` (when called with a positive argument), :meth:" "`~RawIOBase.readinto` and :meth:`~RawIOBase.write` methods on this class " "will only make one system call." msgstr "" -#: ../../library/io.rst:660 +#: ../../library/io.rst:670 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -1169,77 +1168,77 @@ msgid "" "similar to passing ``None``)." msgstr "" -#: ../../library/io.rst:666 +#: ../../library/io.rst:676 msgid "The newly created file is :ref:`non-inheritable `." msgstr "" -#: ../../library/io.rst:668 +#: ../../library/io.rst:678 msgid "" "See the :func:`open` built-in function for examples on using the *opener* " "parameter." msgstr "" -#: ../../library/io.rst:671 +#: ../../library/io.rst:681 msgid "The *opener* parameter was added. The ``'x'`` mode was added." msgstr "" -#: ../../library/io.rst:675 +#: ../../library/io.rst:685 msgid "The file is now non-inheritable." msgstr "" -#: ../../library/io.rst:678 +#: ../../library/io.rst:688 msgid "" ":class:`FileIO` provides these data attributes in addition to those from :" "class:`RawIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:683 +#: ../../library/io.rst:693 msgid "The mode as given in the constructor." msgstr "" -#: ../../library/io.rst:687 +#: ../../library/io.rst:697 msgid "" "The file name. This is the file descriptor of the file when no name is " "given in the constructor." msgstr "" -#: ../../library/io.rst:692 +#: ../../library/io.rst:702 msgid "Buffered Streams" msgstr "" -#: ../../library/io.rst:694 +#: ../../library/io.rst:704 msgid "" "Buffered I/O streams provide a higher-level interface to an I/O device than " "raw I/O does." msgstr "" -#: ../../library/io.rst:699 +#: ../../library/io.rst:709 msgid "" "A binary stream using an in-memory bytes buffer. It inherits from :class:" "`BufferedIOBase`. The buffer is discarded when the :meth:`~IOBase.close` " "method is called." msgstr "" -#: ../../library/io.rst:703 +#: ../../library/io.rst:713 msgid "" "The optional argument *initial_bytes* is a :term:`bytes-like object` that " "contains initial data." msgstr "" -#: ../../library/io.rst:706 +#: ../../library/io.rst:716 msgid "" ":class:`BytesIO` provides or overrides these methods in addition to those " "from :class:`BufferedIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:711 +#: ../../library/io.rst:721 msgid "" "Return a readable and writable view over the contents of the buffer without " "copying them. Also, mutating the view will transparently update the " "contents of the buffer::" msgstr "" -#: ../../library/io.rst:715 +#: ../../library/io.rst:725 msgid "" ">>> b = io.BytesIO(b\"abcdef\")\n" ">>> view = b.getbuffer()\n" @@ -1253,213 +1252,212 @@ msgstr "" ">>> b.getvalue()\n" "b'ab56ef'" -#: ../../library/io.rst:722 +#: ../../library/io.rst:732 msgid "" "As long as the view exists, the :class:`BytesIO` object cannot be resized or " "closed." msgstr "" -#: ../../library/io.rst:729 +#: ../../library/io.rst:739 msgid "Return :class:`bytes` containing the entire contents of the buffer." msgstr "" -#: ../../library/io.rst:734 +#: ../../library/io.rst:744 msgid "In :class:`BytesIO`, this is the same as :meth:`~BufferedIOBase.read`." msgstr "" -#: ../../library/io.rst:736 ../../library/io.rst:779 +#: ../../library/io.rst:746 ../../library/io.rst:786 msgid "The *size* argument is now optional." msgstr "" -#: ../../library/io.rst:741 +#: ../../library/io.rst:751 msgid "" "In :class:`BytesIO`, this is the same as :meth:`~BufferedIOBase.readinto`." msgstr "" -#: ../../library/io.rst:747 +#: ../../library/io.rst:757 msgid "" "A buffered binary stream providing higher-level access to a readable, non " "seekable :class:`RawIOBase` raw binary stream. It inherits from :class:" "`BufferedIOBase`." msgstr "" -#: ../../library/io.rst:751 +#: ../../library/io.rst:761 msgid "" "When reading data from this object, a larger amount of data may be requested " "from the underlying raw stream, and kept in an internal buffer. The buffered " "data can then be returned directly on subsequent reads." msgstr "" -#: ../../library/io.rst:755 +#: ../../library/io.rst:765 msgid "" "The constructor creates a :class:`BufferedReader` for the given readable " "*raw* stream and *buffer_size*. If *buffer_size* is omitted, :data:" "`DEFAULT_BUFFER_SIZE` is used." msgstr "" -#: ../../library/io.rst:759 +#: ../../library/io.rst:769 msgid "" ":class:`BufferedReader` provides or overrides these methods in addition to " "those from :class:`BufferedIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:764 +#: ../../library/io.rst:774 msgid "" -"Return bytes from the stream without advancing the position. At most one " -"single read on the raw stream is done to satisfy the call. The number of " -"bytes returned may be less or more than requested." +"Return bytes from the stream without advancing the position. The number of " +"bytes returned may be less or more than requested. If the underlying raw " +"stream is non-blocking and the operation would block, returns empty bytes." msgstr "" -#: ../../library/io.rst:770 +#: ../../library/io.rst:780 msgid "" -"Read and return *size* bytes, or if *size* is not given or negative, until " -"EOF or if the read call would block in non-blocking mode." +"In :class:`BufferedReader` this is the same as :meth:`io.BufferedIOBase.read`" msgstr "" -#: ../../library/io.rst:775 +#: ../../library/io.rst:784 msgid "" -"Read and return up to *size* bytes with only one call on the raw stream. If " -"at least one byte is buffered, only buffered bytes are returned. Otherwise, " -"one raw stream read call is made." +"In :class:`BufferedReader` this is the same as :meth:`io.BufferedIOBase." +"read1`" msgstr "" -#: ../../library/io.rst:785 +#: ../../library/io.rst:792 msgid "" "A buffered binary stream providing higher-level access to a writeable, non " "seekable :class:`RawIOBase` raw binary stream. It inherits from :class:" "`BufferedIOBase`." msgstr "" -#: ../../library/io.rst:789 +#: ../../library/io.rst:796 msgid "" "When writing to this object, data is normally placed into an internal " "buffer. The buffer will be written out to the underlying :class:`RawIOBase` " "object under various conditions, including:" msgstr "" -#: ../../library/io.rst:793 +#: ../../library/io.rst:800 msgid "when the buffer gets too small for all pending data;" msgstr "" -#: ../../library/io.rst:794 +#: ../../library/io.rst:801 msgid "when :meth:`flush` is called;" msgstr "" -#: ../../library/io.rst:795 +#: ../../library/io.rst:802 msgid "" "when a :meth:`~IOBase.seek` is requested (for :class:`BufferedRandom` " "objects);" msgstr "" -#: ../../library/io.rst:796 +#: ../../library/io.rst:803 msgid "when the :class:`BufferedWriter` object is closed or destroyed." msgstr "" -#: ../../library/io.rst:798 +#: ../../library/io.rst:805 msgid "" "The constructor creates a :class:`BufferedWriter` for the given writeable " "*raw* stream. If the *buffer_size* is not given, it defaults to :data:" "`DEFAULT_BUFFER_SIZE`." msgstr "" -#: ../../library/io.rst:802 +#: ../../library/io.rst:809 msgid "" ":class:`BufferedWriter` provides or overrides these methods in addition to " "those from :class:`BufferedIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:807 +#: ../../library/io.rst:814 msgid "" "Force bytes held in the buffer into the raw stream. A :exc:" "`BlockingIOError` should be raised if the raw stream blocks." msgstr "" -#: ../../library/io.rst:812 +#: ../../library/io.rst:819 msgid "" "Write the :term:`bytes-like object`, *b*, and return the number of bytes " -"written. When in non-blocking mode, a :exc:`BlockingIOError` is raised if " -"the buffer needs to be written out but the raw stream blocks." +"written. When in non-blocking mode, a :exc:`BlockingIOError` with :attr:" +"`BlockingIOError.characters_written` set is raised if the buffer needs to be " +"written out but the raw stream blocks." msgstr "" -#: ../../library/io.rst:820 +#: ../../library/io.rst:827 msgid "" "A buffered binary stream providing higher-level access to a seekable :class:" "`RawIOBase` raw binary stream. It inherits from :class:`BufferedReader` " "and :class:`BufferedWriter`." msgstr "" -#: ../../library/io.rst:824 +#: ../../library/io.rst:831 msgid "" "The constructor creates a reader and writer for a seekable raw stream, given " "in the first argument. If the *buffer_size* is omitted it defaults to :data:" "`DEFAULT_BUFFER_SIZE`." msgstr "" -#: ../../library/io.rst:828 +#: ../../library/io.rst:835 msgid "" ":class:`BufferedRandom` is capable of anything :class:`BufferedReader` or :" "class:`BufferedWriter` can do. In addition, :meth:`~IOBase.seek` and :meth:" "`~IOBase.tell` are guaranteed to be implemented." msgstr "" -#: ../../library/io.rst:835 +#: ../../library/io.rst:842 msgid "" "A buffered binary stream providing higher-level access to two non seekable :" "class:`RawIOBase` raw binary streams---one readable, the other writeable. It " "inherits from :class:`BufferedIOBase`." msgstr "" -#: ../../library/io.rst:839 +#: ../../library/io.rst:846 msgid "" "*reader* and *writer* are :class:`RawIOBase` objects that are readable and " "writeable respectively. If the *buffer_size* is omitted it defaults to :" "data:`DEFAULT_BUFFER_SIZE`." msgstr "" -#: ../../library/io.rst:843 +#: ../../library/io.rst:850 msgid "" ":class:`BufferedRWPair` implements all of :class:`BufferedIOBase`\\'s " "methods except for :meth:`~BufferedIOBase.detach`, which raises :exc:" "`UnsupportedOperation`." msgstr "" -#: ../../library/io.rst:849 +#: ../../library/io.rst:856 msgid "" ":class:`BufferedRWPair` does not attempt to synchronize accesses to its " "underlying raw streams. You should not pass it the same object as reader " "and writer; use :class:`BufferedRandom` instead." msgstr "" -#: ../../library/io.rst:859 +#: ../../library/io.rst:866 msgid "" "Base class for text streams. This class provides a character and line based " "interface to stream I/O. It inherits from :class:`IOBase`." msgstr "" -#: ../../library/io.rst:862 +#: ../../library/io.rst:869 msgid "" ":class:`TextIOBase` provides or overrides these data attributes and methods " "in addition to those from :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:867 +#: ../../library/io.rst:874 msgid "" "The name of the encoding used to decode the stream's bytes into strings, and " "to encode strings into bytes." msgstr "" -#: ../../library/io.rst:872 +#: ../../library/io.rst:879 msgid "The error setting of the decoder or encoder." msgstr "" -#: ../../library/io.rst:876 +#: ../../library/io.rst:883 msgid "" "A string, a tuple of strings, or ``None``, indicating the newlines " "translated so far. Depending on the implementation and the initial " "constructor flags, this may not be available." msgstr "" -#: ../../library/io.rst:882 +#: ../../library/io.rst:889 #, fuzzy msgid "" "The underlying binary buffer (a :class:`BufferedIOBase` or :class:" @@ -1469,90 +1467,90 @@ msgstr "" "底層的原始串流(一個 :class:`RawIOBase` 實例),:class:`BufferedIOBase` 處理" "的對象。這不是 :class:`BufferedIOBase` API 的一部分,且在某些實作可能不存在。" -#: ../../library/io.rst:889 +#: ../../library/io.rst:896 msgid "" "Separate the underlying binary buffer from the :class:`TextIOBase` and " "return it." msgstr "" -#: ../../library/io.rst:892 +#: ../../library/io.rst:899 msgid "" "After the underlying buffer has been detached, the :class:`TextIOBase` is in " "an unusable state." msgstr "" -#: ../../library/io.rst:895 +#: ../../library/io.rst:902 msgid "" "Some :class:`TextIOBase` implementations, like :class:`StringIO`, may not " "have the concept of an underlying buffer and calling this method will raise :" "exc:`UnsupportedOperation`." msgstr "" -#: ../../library/io.rst:903 +#: ../../library/io.rst:910 msgid "" "Read and return at most *size* characters from the stream as a single :class:" "`str`. If *size* is negative or ``None``, reads until EOF." msgstr "" -#: ../../library/io.rst:908 +#: ../../library/io.rst:915 msgid "" "Read until newline or EOF and return a single :class:`str`. If the stream " "is already at EOF, an empty string is returned." msgstr "" -#: ../../library/io.rst:911 +#: ../../library/io.rst:918 msgid "If *size* is specified, at most *size* characters will be read." msgstr "" -#: ../../library/io.rst:915 +#: ../../library/io.rst:922 msgid "" "Change the stream position to the given *offset*. Behaviour depends on the " "*whence* parameter. The default value for *whence* is :data:`!SEEK_SET`." msgstr "" -#: ../../library/io.rst:919 +#: ../../library/io.rst:926 msgid "" ":data:`!SEEK_SET` or ``0``: seek from the start of the stream (the default); " "*offset* must either be a number returned by :meth:`TextIOBase.tell`, or " "zero. Any other *offset* value produces undefined behaviour." msgstr "" -#: ../../library/io.rst:923 +#: ../../library/io.rst:930 msgid "" ":data:`!SEEK_CUR` or ``1``: \"seek\" to the current position; *offset* must " "be zero, which is a no-operation (all other values are unsupported)." msgstr "" -#: ../../library/io.rst:926 +#: ../../library/io.rst:933 msgid "" ":data:`!SEEK_END` or ``2``: seek to the end of the stream; *offset* must be " "zero (all other values are unsupported)." msgstr "" -#: ../../library/io.rst:929 +#: ../../library/io.rst:936 msgid "Return the new absolute position as an opaque number." msgstr "" -#: ../../library/io.rst:936 +#: ../../library/io.rst:943 msgid "" "Return the current stream position as an opaque number. The number does not " "usually represent a number of bytes in the underlying binary storage." msgstr "" -#: ../../library/io.rst:942 +#: ../../library/io.rst:949 msgid "" "Write the string *s* to the stream and return the number of characters " "written." msgstr "" -#: ../../library/io.rst:949 +#: ../../library/io.rst:956 msgid "" "A buffered text stream providing higher-level access to a :class:" "`BufferedIOBase` buffered binary stream. It inherits from :class:" "`TextIOBase`." msgstr "" -#: ../../library/io.rst:953 +#: ../../library/io.rst:960 msgid "" "*encoding* gives the name of the encoding that the stream will be decoded or " "encoded with. In :ref:`UTF-8 Mode `, this defaults to UTF-8. " @@ -1561,7 +1559,7 @@ msgid "" "explicitly. See :ref:`io-text-encoding` for more information." msgstr "" -#: ../../library/io.rst:959 +#: ../../library/io.rst:966 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled. Pass ``'strict'`` to raise a :exc:`ValueError` " @@ -1576,13 +1574,13 @@ msgid "" "that has been registered with :func:`codecs.register_error` is also valid." msgstr "" -#: ../../library/io.rst:975 +#: ../../library/io.rst:982 msgid "" "*newline* controls how line endings are handled. It can be ``None``, " "``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as follows:" msgstr "" -#: ../../library/io.rst:978 +#: ../../library/io.rst:985 msgid "" "When reading input from the stream, if *newline* is ``None``, :term:" "`universal newlines` mode is enabled. Lines in the input can end in " @@ -1594,7 +1592,7 @@ msgid "" "returned to the caller untranslated." msgstr "" -#: ../../library/io.rst:987 +#: ../../library/io.rst:994 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -1603,13 +1601,13 @@ msgid "" "characters written are translated to the given string." msgstr "" -#: ../../library/io.rst:993 +#: ../../library/io.rst:1000 msgid "" "If *line_buffering* is ``True``, :meth:`~IOBase.flush` is implied when a " "call to write contains a newline character or a carriage return." msgstr "" -#: ../../library/io.rst:996 +#: ../../library/io.rst:1003 msgid "" "If *write_through* is ``True``, calls to :meth:`~BufferedIOBase.write` are " "guaranteed not to be buffered: any data written on the :class:" @@ -1617,11 +1615,11 @@ msgid "" "*buffer*." msgstr "" -#: ../../library/io.rst:1000 +#: ../../library/io.rst:1007 msgid "The *write_through* argument has been added." msgstr "" -#: ../../library/io.rst:1003 +#: ../../library/io.rst:1010 msgid "" "The default *encoding* is now ``locale.getpreferredencoding(False)`` instead " "of ``locale.getpreferredencoding()``. Don't change temporary the locale " @@ -1629,108 +1627,108 @@ msgid "" "instead of the user preferred encoding." msgstr "" -#: ../../library/io.rst:1009 +#: ../../library/io.rst:1016 msgid "" "The *encoding* argument now supports the ``\"locale\"`` dummy encoding name." msgstr "" -#: ../../library/io.rst:1012 +#: ../../library/io.rst:1019 msgid "" ":class:`TextIOWrapper` provides these data attributes and methods in " "addition to those from :class:`TextIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:1017 +#: ../../library/io.rst:1024 msgid "Whether line buffering is enabled." msgstr "" -#: ../../library/io.rst:1021 +#: ../../library/io.rst:1028 msgid "Whether writes are passed immediately to the underlying binary buffer." msgstr "" -#: ../../library/io.rst:1029 +#: ../../library/io.rst:1036 msgid "" "Reconfigure this text stream using new settings for *encoding*, *errors*, " "*newline*, *line_buffering* and *write_through*." msgstr "" -#: ../../library/io.rst:1032 +#: ../../library/io.rst:1039 msgid "" "Parameters not specified keep current settings, except ``errors='strict'`` " "is used when *encoding* is specified but *errors* is not specified." msgstr "" -#: ../../library/io.rst:1036 +#: ../../library/io.rst:1043 msgid "" "It is not possible to change the encoding or newline if some data has " "already been read from the stream. On the other hand, changing encoding " "after write is possible." msgstr "" -#: ../../library/io.rst:1040 +#: ../../library/io.rst:1047 msgid "" "This method does an implicit stream flush before setting the new parameters." msgstr "" -#: ../../library/io.rst:1045 +#: ../../library/io.rst:1052 msgid "The method supports ``encoding=\"locale\"`` option." msgstr "" -#: ../../library/io.rst:1050 +#: ../../library/io.rst:1057 msgid "" "Set the stream position. Return the new stream position as an :class:`int`." msgstr "" -#: ../../library/io.rst:1053 +#: ../../library/io.rst:1060 msgid "" "Four operations are supported, given by the following argument combinations:" msgstr "" -#: ../../library/io.rst:1056 +#: ../../library/io.rst:1063 msgid "``seek(0, SEEK_SET)``: Rewind to the start of the stream." msgstr "" -#: ../../library/io.rst:1057 +#: ../../library/io.rst:1064 msgid "" "``seek(cookie, SEEK_SET)``: Restore a previous position; *cookie* **must " "be** a number returned by :meth:`tell`." msgstr "" -#: ../../library/io.rst:1059 +#: ../../library/io.rst:1066 msgid "``seek(0, SEEK_END)``: Fast-forward to the end of the stream." msgstr "" -#: ../../library/io.rst:1060 +#: ../../library/io.rst:1067 msgid "``seek(0, SEEK_CUR)``: Leave the current stream position unchanged." msgstr "" -#: ../../library/io.rst:1062 +#: ../../library/io.rst:1069 msgid "Any other argument combinations are invalid, and may raise exceptions." msgstr "" -#: ../../library/io.rst:1067 +#: ../../library/io.rst:1074 msgid ":data:`os.SEEK_SET`, :data:`os.SEEK_CUR`, and :data:`os.SEEK_END`." msgstr "" -#: ../../library/io.rst:1071 +#: ../../library/io.rst:1078 msgid "" "Return the stream position as an opaque number. The return value of :meth:`!" "tell` can be given as input to :meth:`seek`, to restore a previous stream " "position." msgstr "" -#: ../../library/io.rst:1078 +#: ../../library/io.rst:1085 msgid "" "A text stream using an in-memory text buffer. It inherits from :class:" "`TextIOBase`." msgstr "" -#: ../../library/io.rst:1081 +#: ../../library/io.rst:1088 msgid "" "The text buffer is discarded when the :meth:`~IOBase.close` method is called." msgstr "" -#: ../../library/io.rst:1084 +#: ../../library/io.rst:1091 msgid "" "The initial value of the buffer can be set by providing *initial_value*. If " "newline translation is enabled, newlines will be encoded as if by :meth:" @@ -1742,31 +1740,31 @@ msgid "" "at the end of the buffer." msgstr "" -#: ../../library/io.rst:1093 +#: ../../library/io.rst:1100 msgid "" "The *newline* argument works like that of :class:`TextIOWrapper`, except " "that when writing output to the stream, if *newline* is ``None``, newlines " "are written as ``\\n`` on all platforms." msgstr "" -#: ../../library/io.rst:1097 +#: ../../library/io.rst:1104 msgid "" ":class:`StringIO` provides this method in addition to those from :class:" "`TextIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:1102 +#: ../../library/io.rst:1109 msgid "" "Return a :class:`str` containing the entire contents of the buffer. Newlines " "are decoded as if by :meth:`~TextIOBase.read`, although the stream position " "is not changed." msgstr "" -#: ../../library/io.rst:1106 +#: ../../library/io.rst:1113 msgid "Example usage::" msgstr "使用範例: ::" -#: ../../library/io.rst:1108 +#: ../../library/io.rst:1115 msgid "" "import io\n" "\n" @@ -1783,23 +1781,23 @@ msgid "" "output.close()" msgstr "" -#: ../../library/io.rst:1128 +#: ../../library/io.rst:1135 msgid "" "A helper codec that decodes newlines for :term:`universal newlines` mode. It " "inherits from :class:`codecs.IncrementalDecoder`." msgstr "" -#: ../../library/io.rst:1133 +#: ../../library/io.rst:1140 msgid "Performance" msgstr "" -#: ../../library/io.rst:1135 +#: ../../library/io.rst:1142 msgid "" "This section discusses the performance of the provided concrete I/O " "implementations." msgstr "" -#: ../../library/io.rst:1141 +#: ../../library/io.rst:1148 msgid "" "By reading and writing only large chunks of data even when the user asks for " "a single byte, buffered I/O hides any inefficiency in calling and executing " @@ -1812,7 +1810,7 @@ msgid "" "data." msgstr "" -#: ../../library/io.rst:1153 +#: ../../library/io.rst:1160 msgid "" "Text I/O over a binary storage (such as a file) is significantly slower than " "binary I/O over the same storage, because it requires conversions between " @@ -1822,24 +1820,24 @@ msgid "" "the reconstruction algorithm used." msgstr "" -#: ../../library/io.rst:1160 +#: ../../library/io.rst:1167 msgid "" ":class:`StringIO`, however, is a native in-memory unicode container and will " "exhibit similar speed to :class:`BytesIO`." msgstr "" -#: ../../library/io.rst:1164 +#: ../../library/io.rst:1171 msgid "Multi-threading" msgstr "" -#: ../../library/io.rst:1166 +#: ../../library/io.rst:1173 msgid "" ":class:`FileIO` objects are thread-safe to the extent that the operating " "system calls (such as :manpage:`read(2)` under Unix) they wrap are thread-" "safe too." msgstr "" -#: ../../library/io.rst:1169 +#: ../../library/io.rst:1176 msgid "" "Binary buffered objects (instances of :class:`BufferedReader`, :class:" "`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) " @@ -1847,15 +1845,15 @@ msgid "" "them from multiple threads at once." msgstr "" -#: ../../library/io.rst:1174 +#: ../../library/io.rst:1181 msgid ":class:`TextIOWrapper` objects are not thread-safe." msgstr "" -#: ../../library/io.rst:1177 +#: ../../library/io.rst:1184 msgid "Reentrancy" msgstr "" -#: ../../library/io.rst:1179 +#: ../../library/io.rst:1186 msgid "" "Binary buffered objects (instances of :class:`BufferedReader`, :class:" "`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) are " @@ -1866,7 +1864,7 @@ msgid "" "from entering the buffered object." msgstr "" -#: ../../library/io.rst:1187 +#: ../../library/io.rst:1194 msgid "" "The above implicitly extends to text files, since the :func:`open` function " "will wrap a buffered object inside a :class:`TextIOWrapper`. This includes " @@ -1882,14 +1880,52 @@ msgstr "file object(檔案物件)" msgid "io module" msgstr "io 模組" -#: ../../library/io.rst:972 ../../library/io.rst:1123 +#: ../../library/io.rst:979 ../../library/io.rst:1130 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/io.rst:972 +#: ../../library/io.rst:979 msgid "io.TextIOWrapper class" msgstr "io.TextIOWrapper 類別" -#: ../../library/io.rst:1123 +#: ../../library/io.rst:1130 msgid "io.IncrementalNewlineDecoder class" msgstr "io.IncrementalNewlineDecoder 類別" + +#~ msgid "" +#~ "In addition, those methods can raise :exc:`BlockingIOError` if the " +#~ "underlying raw stream is in non-blocking mode and cannot take or give " +#~ "enough data; unlike their :class:`RawIOBase` counterparts, they will " +#~ "never return ``None``." +#~ msgstr "" +#~ "此外,如果底層的原始串流處於非阻塞模式且無法提供或接收足夠的資料,這些方法" +#~ "可能會引發 :exc:`BlockingIOError` 例外;與 :class:`RawIOBase` 不同之處在" +#~ "於,它們永遠不會回傳 ``None``。" + +#~ msgid "" +#~ "If the argument is positive, and the underlying raw stream is not " +#~ "interactive, multiple raw reads may be issued to satisfy the byte count " +#~ "(unless EOF is reached first). But for interactive raw streams, at most " +#~ "one raw read will be issued, and a short result does not imply that EOF " +#~ "is imminent." +#~ msgstr "" +#~ "如果引數為正數,且底層原始串流不是互動式的,可能會發出多次原始讀取來滿足位" +#~ "元組數量(除非首先達到 EOF)。但對於互動式原始串流,最多只會發出一次原始讀" +#~ "取,且短少的資料不表示 EOF 即將到來。" + +#~ msgid "" +#~ "Read and return up to *size* bytes, with at most one call to the " +#~ "underlying raw stream's :meth:`~RawIOBase.read` (or :meth:`~RawIOBase." +#~ "readinto`) method. This can be useful if you are implementing your own " +#~ "buffering on top of a :class:`BufferedIOBase` object." +#~ msgstr "" +#~ "讀取並回傳最多 *size* 個位元組,最多呼叫一次底層原始串流的 :meth:" +#~ "`~RawIOBase.read` (或 :meth:`~RawIOBase.readinto`) 方法。如果你正在 :" +#~ "class:`BufferedIOBase` 物件之上實作自己的緩衝區,這可能會很有用。" + +#~ msgid "" +#~ "If *size* is ``-1`` (the default), an arbitrary number of bytes are " +#~ "returned (more than zero unless EOF is reached)." +#~ msgstr "" +#~ "如果 *size* 為 ``-1`` (預設值),則會回傳任意數量的位元組(除非達到 EOF," +#~ "否則會超過零)。" From 3025a9322579ae1911871f95cf9e4072117f678a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 23 May 2025 00:16:56 +0000 Subject: [PATCH 12/14] sync with cpython b2126530 --- sphinx.po | 32 +++++++++++++++++++++----------- tutorial/index.po | 26 +++++++++++++++++--------- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/sphinx.po b/sphinx.po index 5303cc5cfd..7d43495493 100644 --- a/sphinx.po +++ b/sphinx.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-16 00:15+0000\n" +"POT-Creation-Date: 2025-05-23 00:15+0000\n" "PO-Revision-Date: 2023-03-15 10:19+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,15 +29,18 @@ msgid "In development" msgstr "開發中" #: ../../tools/templates/customsourcelink.html:3 -msgid "This Page" +#, fuzzy +msgid "This page" msgstr "此頁面" #: ../../tools/templates/customsourcelink.html:5 -msgid "Report a Bug" +#, fuzzy +msgid "Report a bug" msgstr "回報錯誤" #: ../../tools/templates/customsourcelink.html:8 -msgid "Show Source" +#, fuzzy +msgid "Show source" msgstr "顯示原始碼" #: ../../tools/templates/download.html:2 @@ -46,7 +49,8 @@ msgid "Download" msgstr "下載" #: ../../tools/templates/download.html:30 -msgid "Download Python %(dl_version)s Documentation" +#, fuzzy +msgid "Download Python %(dl_version)s documentation" msgstr "下載 Python %(dl_version)s 說明文件" #: ../../tools/templates/download.html:32 @@ -458,7 +462,8 @@ msgid "Reporting issues" msgstr "回報問題" #: ../../tools/templates/indexcontent.html:75 -msgid "Contributing to Docs" +#, fuzzy +msgid "Contributing to docs" msgstr "貢獻說明文件" #: ../../tools/templates/indexcontent.html:76 @@ -494,23 +499,28 @@ msgid "Other resources" msgstr "其他資源" #: ../../tools/templates/indexsidebar.html:12 -msgid "PEP Index" +#, fuzzy +msgid "PEP index" msgstr "PEP 索引" #: ../../tools/templates/indexsidebar.html:13 -msgid "Beginner's Guide" +#, fuzzy +msgid "Beginner's guide" msgstr "初學者指南" #: ../../tools/templates/indexsidebar.html:14 -msgid "Book List" +#, fuzzy +msgid "Book list" msgstr "推薦書單" #: ../../tools/templates/indexsidebar.html:15 -msgid "Audio/Visual Talks" +#, fuzzy +msgid "Audio/visual talks" msgstr "音訊/視訊演講" #: ../../tools/templates/indexsidebar.html:16 -msgid "Python Developer’s Guide" +#, fuzzy +msgid "Python developer’s guide" msgstr "Python 開發者指南" #: ../../tools/templates/layout.html:6 diff --git a/tutorial/index.po b/tutorial/index.po index 1ed8787fa7..94270df262 100644 --- a/tutorial/index.po +++ b/tutorial/index.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-26 16:47+0000\n" +"POT-Creation-Date: 2025-05-23 00:15+0000\n" "PO-Revision-Date: 2018-06-17 11:39+0000\n" "Last-Translator: Ching-Hao Liu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,6 +27,12 @@ msgstr "Python 教學" #: ../../tutorial/index.rst:7 msgid "" +"This tutorial is designed for *programmers* that are new to the Python " +"language, **not** *beginners* who are new to programming." +msgstr "" + +#: ../../tutorial/index.rst:11 +msgid "" "Python is an easy to learn, powerful programming language. It has efficient " "high-level data structures and a simple but effective approach to object-" "oriented programming. Python's elegant syntax and dynamic typing, together " @@ -37,7 +43,7 @@ msgstr "" "效的方法去實現物件導向程式設計。Python 優雅的語法和動態型別,結合其直譯特性," "使它成為眾多領域和大多數平臺上,撰寫腳本和快速開發應用程式的理想語言。" -#: ../../tutorial/index.rst:13 +#: ../../tutorial/index.rst:17 msgid "" "The Python interpreter and the extensive standard library are freely " "available in source or binary form for all major platforms from the Python " @@ -51,7 +57,7 @@ msgstr "" "程式與工具、以及額外說明文件,有興趣的使用者,可在官網上找到相關的發行版本與" "連結網址。" -#: ../../tutorial/index.rst:19 +#: ../../tutorial/index.rst:23 msgid "" "The Python interpreter is easily extended with new functions and data types " "implemented in C or C++ (or other languages callable from C). Python is also " @@ -61,18 +67,20 @@ msgstr "" "增功能函式及資料型別。同時,對可讓使用者自製功能的應用程式來說,Python 也適合" "作為其擴充用介面語言 (extension language)。" -#: ../../tutorial/index.rst:23 +#: ../../tutorial/index.rst:27 +#, fuzzy msgid "" "This tutorial introduces the reader informally to the basic concepts and " -"features of the Python language and system. It helps to have a Python " -"interpreter handy for hands-on experience, but all examples are self-" +"features of the Python language and system. Be aware that it expects you to " +"have a basic understanding of programming in general. It helps to have a " +"Python interpreter handy for hands-on experience, but all examples are self-" "contained, so the tutorial can be read off-line as well." msgstr "" "這份教學將簡介 Python 語言與系統的基本概念及功能。除了閱讀之外、實際用 " "Python 直譯器寫程式跑範例,將有助於學習。但如果只用讀的,也是可行的學習方式," "因為所有範例的內容皆獨立且完整。" -#: ../../tutorial/index.rst:28 +#: ../../tutorial/index.rst:33 msgid "" "For a description of standard objects and modules, see :ref:`library-" "index`. :ref:`reference-index` gives a more formal definition of the " @@ -84,7 +92,7 @@ msgstr "" "伸套件 (extensions) 的讀者,請閱讀 :ref:`extending-index` 和 :ref:`c-api-" "index` 。此外,市面上也能找到更深入的 Python 學習書。" -#: ../../tutorial/index.rst:33 +#: ../../tutorial/index.rst:38 msgid "" "This tutorial does not attempt to be comprehensive and cover every single " "feature, or even every commonly used feature. Instead, it introduces many of " @@ -98,6 +106,6 @@ msgstr "" "語言的特色與風格。讀完教學後,你將有能力閱讀和撰寫 Python 模組與程式,也做好" "進一步學習 :ref:`library-index` 中各類型的 Python 函式庫模組的準備。" -#: ../../tutorial/index.rst:40 +#: ../../tutorial/index.rst:45 msgid "The :ref:`glossary` is also worth going through." msgstr ":ref:`glossary` 頁面也值得細讀。" From 1938944f908dde90fd3ae16f2c141af73650e931 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 24 May 2025 00:16:35 +0000 Subject: [PATCH 13/14] sync with cpython e4c4eccc --- howto/free-threading-python.po | 4 +- howto/isolating-extensions.po | 194 ++-- library/stdtypes.po | 1920 ++++++++++++++++---------------- 3 files changed, 1079 insertions(+), 1039 deletions(-) diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po index 2d43d4ae62..bd0f017038 100644 --- a/howto/free-threading-python.po +++ b/howto/free-threading-python.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-05-24 00:15+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-" @@ -65,7 +65,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:34 msgid "" "For information on other platforms, see the `Installing a Free-Threaded " -"Python `_, a " +"Python `_, a " "community-maintained installation guide for installing free-threaded Python." msgstr "" diff --git a/howto/isolating-extensions.po b/howto/isolating-extensions.po index 9399fe584b..5292d00d73 100644 --- a/howto/isolating-extensions.po +++ b/howto/isolating-extensions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-05-24 00:15+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-" @@ -336,33 +336,49 @@ msgstr "" #: ../../howto/isolating-extensions.rst:218 msgid "" +"// A process-wide flag\n" "static int loaded = 0;\n" "\n" +"// Mutex to provide thread safety (only needed for free-threaded Python)\n" +"static PyMutex modinit_mutex = {0};\n" +"\n" "static int\n" "exec_module(PyObject* module)\n" "{\n" +" PyMutex_Lock(&modinit_mutex);\n" " if (loaded) {\n" +" PyMutex_Unlock(&modinit_mutex);\n" " PyErr_SetString(PyExc_ImportError,\n" " \"cannot load module more than once per process\");\n" " return -1;\n" " }\n" " loaded = 1;\n" +" PyMutex_Unlock(&modinit_mutex);\n" " // ... rest of initialization\n" "}" msgstr "" -#: ../../howto/isolating-extensions.rst:234 +#: ../../howto/isolating-extensions.rst:240 +msgid "" +"If your module's :c:member:`PyModuleDef.m_clear` function is able to prepare " +"for future re-initialization, it should clear the ``loaded`` flag. In this " +"case, your module won't support multiple instances existing *concurrently*, " +"but it will, for example, support being loaded after Python runtime shutdown " +"(:c:func:`Py_FinalizeEx`) and re-initialization (:c:func:`Py_Initialize`)." +msgstr "" + +#: ../../howto/isolating-extensions.rst:249 msgid "Module State Access from Functions" msgstr "" -#: ../../howto/isolating-extensions.rst:236 +#: ../../howto/isolating-extensions.rst:251 msgid "" "Accessing the state from module-level functions is straightforward. " "Functions get the module object as their first argument; for extracting the " "state, you can use ``PyModule_GetState``::" msgstr "" -#: ../../howto/isolating-extensions.rst:240 +#: ../../howto/isolating-extensions.rst:255 msgid "" "static PyObject *\n" "func(PyObject *module, PyObject *args)\n" @@ -375,25 +391,25 @@ msgid "" "}" msgstr "" -#: ../../howto/isolating-extensions.rst:251 +#: ../../howto/isolating-extensions.rst:266 msgid "" "``PyModule_GetState`` may return ``NULL`` without setting an exception if " "there is no module state, i.e. ``PyModuleDef.m_size`` was zero. In your own " "module, you're in control of ``m_size``, so this is easy to prevent." msgstr "" -#: ../../howto/isolating-extensions.rst:258 +#: ../../howto/isolating-extensions.rst:273 msgid "Heap Types" msgstr "" -#: ../../howto/isolating-extensions.rst:260 +#: ../../howto/isolating-extensions.rst:275 msgid "" "Traditionally, types defined in C code are *static*; that is, ``static " "PyTypeObject`` structures defined directly in code and initialized using " "``PyType_Ready()``." msgstr "" -#: ../../howto/isolating-extensions.rst:264 +#: ../../howto/isolating-extensions.rst:279 msgid "" "Such types are necessarily shared across the process. Sharing them between " "module objects requires paying attention to any state they own or access. To " @@ -401,7 +417,7 @@ msgid "" "for example, you can't set ``str.myattribute = 123``." msgstr "" -#: ../../howto/isolating-extensions.rst:270 +#: ../../howto/isolating-extensions.rst:285 msgid "" "Sharing truly immutable objects between interpreters is fine, as long as " "they don't provide access to mutable objects. However, in CPython, every " @@ -411,7 +427,7 @@ msgid "" "process-wide GIL." msgstr "" -#: ../../howto/isolating-extensions.rst:277 +#: ../../howto/isolating-extensions.rst:292 msgid "" "Because they are immutable and process-global, static types cannot access " "\"their\" module state. If any method of such a type requires access to " @@ -420,15 +436,15 @@ msgid "" "Python's ``class`` statement." msgstr "" -#: ../../howto/isolating-extensions.rst:284 +#: ../../howto/isolating-extensions.rst:299 msgid "For new modules, using heap types by default is a good rule of thumb." msgstr "" -#: ../../howto/isolating-extensions.rst:288 +#: ../../howto/isolating-extensions.rst:303 msgid "Changing Static Types to Heap Types" msgstr "" -#: ../../howto/isolating-extensions.rst:290 +#: ../../howto/isolating-extensions.rst:305 msgid "" "Static types can be converted to heap types, but note that the heap type API " "was not designed for \"lossless\" conversion from static types—that is, " @@ -438,101 +454,101 @@ msgid "" "slots). Always test the details that are important to you." msgstr "" -#: ../../howto/isolating-extensions.rst:299 +#: ../../howto/isolating-extensions.rst:314 msgid "" "Watch out for the following two points in particular (but note that this is " "not a comprehensive list):" msgstr "" -#: ../../howto/isolating-extensions.rst:302 +#: ../../howto/isolating-extensions.rst:317 msgid "" "Unlike static types, heap type objects are mutable by default. Use the :c:" "macro:`Py_TPFLAGS_IMMUTABLETYPE` flag to prevent mutability." msgstr "" -#: ../../howto/isolating-extensions.rst:304 +#: ../../howto/isolating-extensions.rst:319 msgid "" "Heap types inherit :c:member:`~PyTypeObject.tp_new` by default, so it may " "become possible to instantiate them from Python code. You can prevent this " "with the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag." msgstr "" -#: ../../howto/isolating-extensions.rst:310 +#: ../../howto/isolating-extensions.rst:325 msgid "Defining Heap Types" msgstr "" -#: ../../howto/isolating-extensions.rst:312 +#: ../../howto/isolating-extensions.rst:327 msgid "" "Heap types can be created by filling a :c:struct:`PyType_Spec` structure, a " "description or \"blueprint\" of a class, and calling :c:func:" "`PyType_FromModuleAndSpec` to construct a new class object." msgstr "" -#: ../../howto/isolating-extensions.rst:317 +#: ../../howto/isolating-extensions.rst:332 msgid "" "Other functions, like :c:func:`PyType_FromSpec`, can also create heap types, " "but :c:func:`PyType_FromModuleAndSpec` associates the module with the class, " "allowing access to the module state from methods." msgstr "" -#: ../../howto/isolating-extensions.rst:321 +#: ../../howto/isolating-extensions.rst:336 msgid "" "The class should generally be stored in *both* the module state (for safe " "access from C) and the module's ``__dict__`` (for access from Python code)." msgstr "" -#: ../../howto/isolating-extensions.rst:327 +#: ../../howto/isolating-extensions.rst:342 msgid "Garbage-Collection Protocol" msgstr "" -#: ../../howto/isolating-extensions.rst:329 +#: ../../howto/isolating-extensions.rst:344 msgid "" "Instances of heap types hold a reference to their type. This ensures that " "the type isn't destroyed before all its instances are, but may result in " "reference cycles that need to be broken by the garbage collector." msgstr "" -#: ../../howto/isolating-extensions.rst:334 +#: ../../howto/isolating-extensions.rst:349 msgid "" "To avoid memory leaks, instances of heap types must implement the garbage " "collection protocol. That is, heap types should:" msgstr "" -#: ../../howto/isolating-extensions.rst:338 +#: ../../howto/isolating-extensions.rst:353 msgid "Have the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" -#: ../../howto/isolating-extensions.rst:339 +#: ../../howto/isolating-extensions.rst:354 msgid "" "Define a traverse function using ``Py_tp_traverse``, which visits the type " "(e.g. using ``Py_VISIT(Py_TYPE(self))``)." msgstr "" -#: ../../howto/isolating-extensions.rst:342 +#: ../../howto/isolating-extensions.rst:357 msgid "" "Please refer to the documentation of :c:macro:`Py_TPFLAGS_HAVE_GC` and :c:" "member:`~PyTypeObject.tp_traverse` for additional considerations." msgstr "" -#: ../../howto/isolating-extensions.rst:346 +#: ../../howto/isolating-extensions.rst:361 msgid "" "The API for defining heap types grew organically, leaving it somewhat " "awkward to use in its current state. The following sections will guide you " "through common issues." msgstr "" -#: ../../howto/isolating-extensions.rst:352 +#: ../../howto/isolating-extensions.rst:367 msgid "``tp_traverse`` in Python 3.8 and lower" msgstr "" -#: ../../howto/isolating-extensions.rst:354 +#: ../../howto/isolating-extensions.rst:369 msgid "" "The requirement to visit the type from ``tp_traverse`` was added in Python " "3.9. If you support Python 3.8 and lower, the traverse function must *not* " "visit the type, so it must be more complicated::" msgstr "" -#: ../../howto/isolating-extensions.rst:358 +#: ../../howto/isolating-extensions.rst:373 msgid "" "static int my_traverse(PyObject *self, visitproc visit, void *arg)\n" "{\n" @@ -550,27 +566,27 @@ msgstr "" " return 0;\n" "}" -#: ../../howto/isolating-extensions.rst:366 +#: ../../howto/isolating-extensions.rst:381 msgid "" "Unfortunately, :c:data:`Py_Version` was only added in Python 3.11. As a " "replacement, use:" msgstr "" -#: ../../howto/isolating-extensions.rst:369 +#: ../../howto/isolating-extensions.rst:384 msgid ":c:macro:`PY_VERSION_HEX`, if not using the stable ABI, or" msgstr "" -#: ../../howto/isolating-extensions.rst:370 +#: ../../howto/isolating-extensions.rst:385 msgid "" ":py:data:`sys.version_info` (via :c:func:`PySys_GetObject` and :c:func:" "`PyArg_ParseTuple`)." msgstr "" -#: ../../howto/isolating-extensions.rst:375 +#: ../../howto/isolating-extensions.rst:390 msgid "Delegating ``tp_traverse``" msgstr "" -#: ../../howto/isolating-extensions.rst:377 +#: ../../howto/isolating-extensions.rst:392 msgid "" "If your traverse function delegates to the :c:member:`~PyTypeObject." "tp_traverse` of its base class (or another type), ensure that " @@ -578,19 +594,19 @@ msgid "" "expected to visit the type in ``tp_traverse``." msgstr "" -#: ../../howto/isolating-extensions.rst:382 +#: ../../howto/isolating-extensions.rst:397 msgid "For example, if your traverse function includes::" msgstr "" -#: ../../howto/isolating-extensions.rst:384 +#: ../../howto/isolating-extensions.rst:399 msgid "base->tp_traverse(self, visit, arg)" msgstr "base->tp_traverse(self, visit, arg)" -#: ../../howto/isolating-extensions.rst:386 +#: ../../howto/isolating-extensions.rst:401 msgid "...and ``base`` may be a static type, then it should also include::" msgstr "" -#: ../../howto/isolating-extensions.rst:388 +#: ../../howto/isolating-extensions.rst:403 msgid "" "if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {\n" " // a heap type's tp_traverse already visited Py_TYPE(self)\n" @@ -601,38 +617,38 @@ msgid "" "}" msgstr "" -#: ../../howto/isolating-extensions.rst:396 +#: ../../howto/isolating-extensions.rst:411 msgid "" "It is not necessary to handle the type's reference count in :c:member:" "`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../howto/isolating-extensions.rst:401 +#: ../../howto/isolating-extensions.rst:416 msgid "Defining ``tp_dealloc``" msgstr "" -#: ../../howto/isolating-extensions.rst:403 +#: ../../howto/isolating-extensions.rst:418 msgid "" "If your type has a custom :c:member:`~PyTypeObject.tp_dealloc` function, it " "needs to:" msgstr "" -#: ../../howto/isolating-extensions.rst:406 +#: ../../howto/isolating-extensions.rst:421 msgid "" "call :c:func:`PyObject_GC_UnTrack` before any fields are invalidated, and" msgstr "" -#: ../../howto/isolating-extensions.rst:407 +#: ../../howto/isolating-extensions.rst:422 msgid "decrement the reference count of the type." msgstr "" -#: ../../howto/isolating-extensions.rst:409 +#: ../../howto/isolating-extensions.rst:424 msgid "" "To keep the type valid while ``tp_free`` is called, the type's refcount " "needs to be decremented *after* the instance is deallocated. For example::" msgstr "" -#: ../../howto/isolating-extensions.rst:412 +#: ../../howto/isolating-extensions.rst:427 msgid "" "static void my_dealloc(PyObject *self)\n" "{\n" @@ -652,57 +668,57 @@ msgstr "" " Py_DECREF(type);\n" "}" -#: ../../howto/isolating-extensions.rst:421 +#: ../../howto/isolating-extensions.rst:436 msgid "" "The default ``tp_dealloc`` function does this, so if your type does *not* " "override ``tp_dealloc`` you don't need to add it." msgstr "" -#: ../../howto/isolating-extensions.rst:427 +#: ../../howto/isolating-extensions.rst:442 msgid "Not overriding ``tp_free``" msgstr "" -#: ../../howto/isolating-extensions.rst:429 +#: ../../howto/isolating-extensions.rst:444 msgid "" "The :c:member:`~PyTypeObject.tp_free` slot of a heap type must be set to :c:" "func:`PyObject_GC_Del`. This is the default; do not override it." msgstr "" -#: ../../howto/isolating-extensions.rst:435 +#: ../../howto/isolating-extensions.rst:450 msgid "Avoiding ``PyObject_New``" msgstr "" -#: ../../howto/isolating-extensions.rst:437 +#: ../../howto/isolating-extensions.rst:452 msgid "GC-tracked objects need to be allocated using GC-aware functions." msgstr "" -#: ../../howto/isolating-extensions.rst:439 +#: ../../howto/isolating-extensions.rst:454 msgid "If you use use :c:func:`PyObject_New` or :c:func:`PyObject_NewVar`:" msgstr "" -#: ../../howto/isolating-extensions.rst:441 +#: ../../howto/isolating-extensions.rst:456 msgid "" "Get and call type's :c:member:`~PyTypeObject.tp_alloc` slot, if possible. " "That is, replace ``TYPE *o = PyObject_New(TYPE, typeobj)`` with::" msgstr "" -#: ../../howto/isolating-extensions.rst:444 +#: ../../howto/isolating-extensions.rst:459 msgid "TYPE *o = typeobj->tp_alloc(typeobj, 0);" msgstr "TYPE *o = typeobj->tp_alloc(typeobj, 0);" -#: ../../howto/isolating-extensions.rst:446 +#: ../../howto/isolating-extensions.rst:461 msgid "" "Replace ``o = PyObject_NewVar(TYPE, typeobj, size)`` with the same, but use " "size instead of the 0." msgstr "" -#: ../../howto/isolating-extensions.rst:449 +#: ../../howto/isolating-extensions.rst:464 msgid "" "If the above is not possible (e.g. inside a custom ``tp_alloc``), call :c:" "func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar`::" msgstr "" -#: ../../howto/isolating-extensions.rst:452 +#: ../../howto/isolating-extensions.rst:467 msgid "" "TYPE *o = PyObject_GC_New(TYPE, typeobj);\n" "\n" @@ -712,24 +728,24 @@ msgstr "" "\n" "TYPE *o = PyObject_GC_NewVar(TYPE, typeobj, size);" -#: ../../howto/isolating-extensions.rst:458 +#: ../../howto/isolating-extensions.rst:473 msgid "Module State Access from Classes" msgstr "" -#: ../../howto/isolating-extensions.rst:460 +#: ../../howto/isolating-extensions.rst:475 msgid "" "If you have a type object defined with :c:func:`PyType_FromModuleAndSpec`, " "you can call :c:func:`PyType_GetModule` to get the associated module, and " "then :c:func:`PyModule_GetState` to get the module's state." msgstr "" -#: ../../howto/isolating-extensions.rst:464 +#: ../../howto/isolating-extensions.rst:479 msgid "" "To save a some tedious error-handling boilerplate code, you can combine " "these two steps with :c:func:`PyType_GetModuleState`, resulting in::" msgstr "" -#: ../../howto/isolating-extensions.rst:467 +#: ../../howto/isolating-extensions.rst:482 msgid "" "my_struct *state = (my_struct*)PyType_GetModuleState(type);\n" "if (state == NULL) {\n" @@ -741,11 +757,11 @@ msgstr "" " return NULL;\n" "}" -#: ../../howto/isolating-extensions.rst:474 +#: ../../howto/isolating-extensions.rst:489 msgid "Module State Access from Regular Methods" msgstr "" -#: ../../howto/isolating-extensions.rst:476 +#: ../../howto/isolating-extensions.rst:491 msgid "" "Accessing the module-level state from methods of a class is somewhat more " "complicated, but is possible thanks to API introduced in Python 3.9. To get " @@ -753,27 +769,27 @@ msgid "" "module state from it." msgstr "" -#: ../../howto/isolating-extensions.rst:481 +#: ../../howto/isolating-extensions.rst:496 msgid "" "The largest roadblock is getting *the class a method was defined in*, or " "that method's \"defining class\" for short. The defining class can have a " "reference to the module it is part of." msgstr "" -#: ../../howto/isolating-extensions.rst:485 +#: ../../howto/isolating-extensions.rst:500 msgid "" "Do not confuse the defining class with ``Py_TYPE(self)``. If the method is " "called on a *subclass* of your type, ``Py_TYPE(self)`` will refer to that " "subclass, which may be defined in different module than yours." msgstr "" -#: ../../howto/isolating-extensions.rst:490 +#: ../../howto/isolating-extensions.rst:505 msgid "" "The following Python code can illustrate the concept. ``Base." "get_defining_class`` returns ``Base`` even if ``type(self) == Sub``:" msgstr "" -#: ../../howto/isolating-extensions.rst:494 +#: ../../howto/isolating-extensions.rst:509 msgid "" "class Base:\n" " def get_type_of_self(self):\n" @@ -795,7 +811,7 @@ msgstr "" "class Sub(Base):\n" " pass" -#: ../../howto/isolating-extensions.rst:506 +#: ../../howto/isolating-extensions.rst:521 msgid "" "For a method to get its \"defining class\", it must use the :ref:" "`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `__." msgstr "" -#: ../../howto/isolating-extensions.rst:617 +#: ../../howto/isolating-extensions.rst:632 msgid "Per-Class Scope" msgstr "" -#: ../../howto/isolating-extensions.rst:619 +#: ../../howto/isolating-extensions.rst:634 msgid "" "It is currently (as of Python 3.11) not possible to attach state to " "individual *types* without relying on CPython implementation details (which " @@ -946,11 +962,11 @@ msgid "" "per-class scope)." msgstr "" -#: ../../howto/isolating-extensions.rst:626 +#: ../../howto/isolating-extensions.rst:641 msgid "Lossless Conversion to Heap Types" msgstr "" -#: ../../howto/isolating-extensions.rst:628 +#: ../../howto/isolating-extensions.rst:643 msgid "" "The heap type API was not designed for \"lossless\" conversion from static " "types; that is, creating a type that works exactly like a given static type." diff --git a/library/stdtypes.po b/library/stdtypes.po index 388ffc8bc0..fb293bbd0d 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-16 00:15+0000\n" +"POT-Creation-Date: 2025-05-24 00:15+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-" @@ -135,8 +135,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276 #: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965 -#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2590 -#: ../../library/stdtypes.rst:3809 +#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2606 +#: ../../library/stdtypes.rst:3825 msgid "Notes" msgstr "註解" @@ -150,7 +150,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:967 #: ../../library/stdtypes.rst:970 ../../library/stdtypes.rst:1181 -#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:2612 ../../library/stdtypes.rst:3831 msgid "\\(1)" msgstr "\\(1)" @@ -164,8 +164,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:289 #: ../../library/stdtypes.rst:309 ../../library/stdtypes.rst:1209 -#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:2602 -#: ../../library/stdtypes.rst:3819 ../../library/stdtypes.rst:3821 +#: ../../library/stdtypes.rst:2616 ../../library/stdtypes.rst:2618 +#: ../../library/stdtypes.rst:3835 ../../library/stdtypes.rst:3837 msgid "\\(2)" msgstr "\\(2)" @@ -178,18 +178,18 @@ msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" #: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:979 -#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2604 -#: ../../library/stdtypes.rst:2606 ../../library/stdtypes.rst:2608 -#: ../../library/stdtypes.rst:2610 ../../library/stdtypes.rst:3823 -#: ../../library/stdtypes.rst:3825 ../../library/stdtypes.rst:3827 -#: ../../library/stdtypes.rst:3829 +#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2620 +#: ../../library/stdtypes.rst:2622 ../../library/stdtypes.rst:2624 +#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3839 +#: ../../library/stdtypes.rst:3841 ../../library/stdtypes.rst:3843 +#: ../../library/stdtypes.rst:3845 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:320 #: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:1016 -#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2636 -#: ../../library/stdtypes.rst:3859 +#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2652 +#: ../../library/stdtypes.rst:3875 msgid "Notes:" msgstr "註解:" @@ -236,9 +236,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2422 -#: ../../library/stdtypes.rst:2567 ../../library/stdtypes.rst:2590 -#: ../../library/stdtypes.rst:3786 ../../library/stdtypes.rst:3809 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2438 +#: ../../library/stdtypes.rst:2583 ../../library/stdtypes.rst:2606 +#: ../../library/stdtypes.rst:3802 ../../library/stdtypes.rst:3825 msgid "Meaning" msgstr "含義" @@ -559,7 +559,7 @@ msgid "" msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" #: ../../library/stdtypes.rst:302 ../../library/stdtypes.rst:1202 -#: ../../library/stdtypes.rst:2598 ../../library/stdtypes.rst:3846 +#: ../../library/stdtypes.rst:2614 ../../library/stdtypes.rst:3862 msgid "\\(6)" msgstr "\\(6)" @@ -597,9 +597,9 @@ msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313 #: ../../library/stdtypes.rst:1191 ../../library/stdtypes.rst:1194 -#: ../../library/stdtypes.rst:2623 ../../library/stdtypes.rst:2626 -#: ../../library/stdtypes.rst:2629 ../../library/stdtypes.rst:3842 -#: ../../library/stdtypes.rst:3849 +#: ../../library/stdtypes.rst:2639 ../../library/stdtypes.rst:2642 +#: ../../library/stdtypes.rst:2645 ../../library/stdtypes.rst:3858 +#: ../../library/stdtypes.rst:3865 msgid "\\(5)" msgstr "\\(5)" @@ -758,8 +758,8 @@ msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:418 ../../library/stdtypes.rst:421 #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:2612 ../../library/stdtypes.rst:2616 -#: ../../library/stdtypes.rst:3831 ../../library/stdtypes.rst:3835 +#: ../../library/stdtypes.rst:2628 ../../library/stdtypes.rst:2632 +#: ../../library/stdtypes.rst:3847 ../../library/stdtypes.rst:3851 msgid "\\(4)" msgstr "\\(4)" @@ -1684,7 +1684,7 @@ msgid "" "before index *j*)" msgstr "" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3817 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3833 msgid "\\(8)" msgstr "\\(8)" @@ -2599,33 +2599,57 @@ msgstr "" msgid "" "Return centered 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)``." +"returned if *width* is less than or equal to ``len(s)``. For example::" msgstr "" -#: ../../library/stdtypes.rst:1661 +#: ../../library/stdtypes.rst:1657 +msgid "" +">>> 'Python'.center(10)\n" +"' Python '\n" +">>> 'Python'.center(10, '-')\n" +"'--Python--'\n" +">>> 'Python'.center(4)\n" +"'Python'" +msgstr "" + +#: ../../library/stdtypes.rst:1667 msgid "" "Return the number of non-overlapping occurrences of substring *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:1665 +#: ../../library/stdtypes.rst:1671 msgid "" "If *sub* is empty, returns the number of empty strings between characters " -"which is the length of the string plus one." +"which is the length of the string plus one. For example::" msgstr "" -#: ../../library/stdtypes.rst:1671 +#: ../../library/stdtypes.rst:1674 +msgid "" +">>> 'spam, spam, spam'.count('spam')\n" +"3\n" +">>> 'spam, spam, spam'.count('spam', 5)\n" +"2\n" +">>> 'spam, spam, spam'.count('spam', 5, 10)\n" +"1\n" +">>> 'spam, spam, spam'.count('eggs')\n" +"0\n" +">>> 'spam, spam, spam'.count('')\n" +"17" +msgstr "" + +#: ../../library/stdtypes.rst:1687 msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2982 +#: ../../library/stdtypes.rst:1689 ../../library/stdtypes.rst:2998 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." msgstr "" -#: ../../library/stdtypes.rst:1676 +#: ../../library/stdtypes.rst:1692 msgid "" "*errors* controls how encoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -2634,24 +2658,24 @@ msgid "" "register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:1683 +#: ../../library/stdtypes.rst:1699 msgid "" "For performance reasons, the value of *errors* is not checked for validity " "unless an encoding error actually occurs, :ref:`devmode` is enabled or a :" "ref:`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:3001 +#: ../../library/stdtypes.rst:1704 ../../library/stdtypes.rst:3017 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:3004 +#: ../../library/stdtypes.rst:1707 ../../library/stdtypes.rst:3020 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." msgstr "" -#: ../../library/stdtypes.rst:1698 +#: ../../library/stdtypes.rst:1714 msgid "" "Return ``True`` if the string ends with the specified *suffix*, otherwise " "return ``False``. *suffix* can also be a tuple of suffixes to look for. " @@ -2659,7 +2683,7 @@ msgid "" "*end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:1706 +#: ../../library/stdtypes.rst:1722 msgid "" "Return a copy of the string where all tab characters are replaced by one or " "more spaces, depending on the current column and the given tab size. Tab " @@ -2675,21 +2699,21 @@ msgid "" "printed." msgstr "" -#: ../../library/stdtypes.rst:1727 +#: ../../library/stdtypes.rst:1743 msgid "" "Return the lowest index in the string where substring *sub* is found within " "the slice ``s[start:end]``. Optional arguments *start* and *end* are " "interpreted as in slice notation. Return ``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:1733 +#: ../../library/stdtypes.rst:1749 msgid "" "The :meth:`~str.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:1737 +#: ../../library/stdtypes.rst:1753 msgid "" ">>> 'Py' in 'Python'\n" "True" @@ -2697,7 +2721,7 @@ msgstr "" ">>> 'Py' in 'Python'\n" "True" -#: ../../library/stdtypes.rst:1743 +#: ../../library/stdtypes.rst:1759 msgid "" "Perform a string formatting operation. The string on which this method is " "called can contain literal text or replacement fields delimited by braces " @@ -2707,13 +2731,13 @@ msgid "" "the corresponding argument." msgstr "" -#: ../../library/stdtypes.rst:1753 +#: ../../library/stdtypes.rst:1769 msgid "" "See :ref:`formatstrings` for a description of the various formatting options " "that can be specified in format strings." msgstr "" -#: ../../library/stdtypes.rst:1757 +#: ../../library/stdtypes.rst:1773 msgid "" "When formatting a number (:class:`int`, :class:`float`, :class:`complex`, :" "class:`decimal.Decimal` and subclasses) with the ``n`` type (ex: ``'{:n}'." @@ -2724,26 +2748,26 @@ msgid "" "This temporary change affects other threads." msgstr "" -#: ../../library/stdtypes.rst:1766 +#: ../../library/stdtypes.rst:1782 msgid "" "When formatting a number with the ``n`` type, the function sets temporarily " "the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` locale in some cases." msgstr "" -#: ../../library/stdtypes.rst:1774 +#: ../../library/stdtypes.rst:1790 msgid "" "Similar to ``str.format(**mapping)``, except that ``mapping`` is used " "directly and not copied to a :class:`dict`. This is useful if for example " "``mapping`` is a dict subclass:" msgstr "" -#: ../../library/stdtypes.rst:1790 +#: ../../library/stdtypes.rst:1806 msgid "" "Like :meth:`~str.find`, but raise :exc:`ValueError` when the substring is " "not found." msgstr "" -#: ../../library/stdtypes.rst:1796 +#: ../../library/stdtypes.rst:1812 msgid "" "Return ``True`` if all characters in the string are alphanumeric and there " "is at least one character, ``False`` otherwise. A character ``c`` is " @@ -2751,7 +2775,7 @@ msgid "" "isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." msgstr "" -#: ../../library/stdtypes.rst:1804 +#: ../../library/stdtypes.rst:1820 msgid "" "Return ``True`` if all characters in the string are alphabetic and there is " "at least one character, ``False`` otherwise. Alphabetic characters are " @@ -2763,14 +2787,14 @@ msgid "" "pdf>`_." msgstr "" -#: ../../library/stdtypes.rst:1815 +#: ../../library/stdtypes.rst:1831 msgid "" "Return ``True`` if the string is empty or all characters in the string are " "ASCII, ``False`` otherwise. ASCII characters have code points in the range " "U+0000-U+007F." msgstr "" -#: ../../library/stdtypes.rst:1824 +#: ../../library/stdtypes.rst:1840 msgid "" "Return ``True`` if all characters in the string are decimal characters and " "there is at least one character, ``False`` otherwise. Decimal characters are " @@ -2779,7 +2803,7 @@ msgid "" "General Category \"Nd\"." msgstr "" -#: ../../library/stdtypes.rst:1834 +#: ../../library/stdtypes.rst:1850 msgid "" "Return ``True`` if all characters in the string are digits and there is at " "least one character, ``False`` otherwise. Digits include decimal characters " @@ -2789,23 +2813,23 @@ msgid "" "property value Numeric_Type=Digit or Numeric_Type=Decimal." msgstr "" -#: ../../library/stdtypes.rst:1844 +#: ../../library/stdtypes.rst:1860 msgid "" "Return ``True`` if the string is a valid identifier according to the " "language definition, section :ref:`identifiers`." msgstr "" -#: ../../library/stdtypes.rst:1847 +#: ../../library/stdtypes.rst:1863 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:1850 +#: ../../library/stdtypes.rst:1866 msgid "Example: ::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:1853 +#: ../../library/stdtypes.rst:1869 msgid "" ">>> from keyword import iskeyword\n" "\n" @@ -2821,13 +2845,13 @@ msgstr "" ">>> 'def'.isidentifier(), iskeyword('def')\n" "(True, True)" -#: ../../library/stdtypes.rst:1863 +#: ../../library/stdtypes.rst:1879 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:1869 +#: ../../library/stdtypes.rst:1885 msgid "" "Return ``True`` if all characters in the string are numeric characters, and " "there is at least one character, ``False`` otherwise. Numeric characters " @@ -2837,13 +2861,13 @@ msgid "" "Numeric_Type=Decimal or Numeric_Type=Numeric." msgstr "" -#: ../../library/stdtypes.rst:1879 +#: ../../library/stdtypes.rst:1895 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:1882 +#: ../../library/stdtypes.rst:1898 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 " @@ -2851,7 +2875,7 @@ msgid "" "written to :data:`sys.stdout` or :data:`sys.stderr`." msgstr "" -#: ../../library/stdtypes.rst:1887 +#: ../../library/stdtypes.rst:1903 msgid "" "The printable characters are those which in the Unicode character database " "(see :mod:`unicodedata`) have a general category in group Letter, Mark, " @@ -2860,20 +2884,20 @@ msgid "" "C), except the ASCII space." msgstr "" -#: ../../library/stdtypes.rst:1896 +#: ../../library/stdtypes.rst:1912 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:1899 +#: ../../library/stdtypes.rst:1915 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:1907 +#: ../../library/stdtypes.rst:1923 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 " @@ -2881,13 +2905,13 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:1914 +#: ../../library/stdtypes.rst:1930 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:1932 +#: ../../library/stdtypes.rst:1948 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 " @@ -2895,27 +2919,27 @@ msgid "" "elements is the string providing this method." msgstr "" -#: ../../library/stdtypes.rst:1940 +#: ../../library/stdtypes.rst:1956 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:1947 +#: ../../library/stdtypes.rst:1963 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase." msgstr "" -#: ../../library/stdtypes.rst:1950 +#: ../../library/stdtypes.rst:1966 msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:1957 +#: ../../library/stdtypes.rst:1973 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 " @@ -2924,7 +2948,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:1962 +#: ../../library/stdtypes.rst:1978 msgid "" ">>> ' spacious '.lstrip()\n" "'spacious '\n" @@ -2936,13 +2960,13 @@ msgstr "" ">>> 'www.example.com'.lstrip('cmowz.')\n" "'example.com'" -#: ../../library/stdtypes.rst:1967 +#: ../../library/stdtypes.rst:1983 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:1970 +#: ../../library/stdtypes.rst:1986 msgid "" ">>> 'Arthur: three!'.lstrip('Arthur: ')\n" "'ee!'\n" @@ -2954,13 +2978,13 @@ msgstr "" ">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" "'three!'" -#: ../../library/stdtypes.rst:1978 +#: ../../library/stdtypes.rst:1994 msgid "" "This static method returns a translation table usable for :meth:`str." "translate`." msgstr "" -#: ../../library/stdtypes.rst:1980 +#: ../../library/stdtypes.rst:1996 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, " @@ -2968,7 +2992,7 @@ msgid "" "converted to ordinals." msgstr "" -#: ../../library/stdtypes.rst:1985 +#: ../../library/stdtypes.rst:2001 msgid "" "If there are two arguments, they must be strings of equal length, and in the " "resulting dictionary, each character in x will be mapped to the character at " @@ -2976,7 +3000,7 @@ msgid "" "whose characters will be mapped to ``None`` in the result." msgstr "" -#: ../../library/stdtypes.rst:1993 +#: ../../library/stdtypes.rst:2009 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 " @@ -2984,13 +3008,13 @@ msgid "" "containing the string itself, followed by two empty strings." msgstr "" -#: ../../library/stdtypes.rst:2001 +#: ../../library/stdtypes.rst:2017 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:2005 +#: ../../library/stdtypes.rst:2021 msgid "" ">>> 'TestHook'.removeprefix('Test')\n" "'Hook'\n" @@ -3002,14 +3026,14 @@ msgstr "" ">>> 'BaseTestCase'.removeprefix('Test')\n" "'BaseTestCase'" -#: ../../library/stdtypes.rst:2015 +#: ../../library/stdtypes.rst:2031 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:2019 +#: ../../library/stdtypes.rst:2035 msgid "" ">>> 'MiscTests'.removesuffix('Tests')\n" "'Misc'\n" @@ -3021,7 +3045,7 @@ msgstr "" ">>> 'TmpDirMixin'.removesuffix('Tests')\n" "'TmpDirMixin'" -#: ../../library/stdtypes.rst:2029 +#: ../../library/stdtypes.rst:2045 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 " @@ -3029,31 +3053,31 @@ msgid "" "replaced." msgstr "" -#: ../../library/stdtypes.rst:2033 +#: ../../library/stdtypes.rst:2049 msgid "*count* is now supported as a keyword argument." msgstr "*count* 現在作為關鍵字引數被支援。" -#: ../../library/stdtypes.rst:2039 +#: ../../library/stdtypes.rst:2055 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* " "and *end* are interpreted as in slice notation. Return ``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2046 +#: ../../library/stdtypes.rst:2062 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" -#: ../../library/stdtypes.rst:2052 +#: ../../library/stdtypes.rst:2068 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:2059 +#: ../../library/stdtypes.rst:2075 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 " @@ -3061,7 +3085,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2067 +#: ../../library/stdtypes.rst:2083 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 " @@ -3070,7 +3094,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2076 +#: ../../library/stdtypes.rst:2092 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 " @@ -3079,7 +3103,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2081 +#: ../../library/stdtypes.rst:2097 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -3091,13 +3115,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2086 +#: ../../library/stdtypes.rst:2102 msgid "" "See :meth:`str.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:2089 +#: ../../library/stdtypes.rst:2105 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -3109,7 +3133,7 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2096 +#: ../../library/stdtypes.rst:2112 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, " @@ -3118,7 +3142,7 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2102 +#: ../../library/stdtypes.rst:2118 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " @@ -3128,20 +3152,20 @@ msgid "" "``['']``." msgstr "" -#: ../../library/stdtypes.rst:2109 ../../library/stdtypes.rst:2127 -#: ../../library/stdtypes.rst:2139 ../../library/stdtypes.rst:2191 -#: ../../library/stdtypes.rst:2259 ../../library/stdtypes.rst:2327 -#: ../../library/stdtypes.rst:3319 ../../library/stdtypes.rst:3337 -#: ../../library/stdtypes.rst:3428 ../../library/stdtypes.rst:3444 -#: ../../library/stdtypes.rst:3469 ../../library/stdtypes.rst:3483 -#: ../../library/stdtypes.rst:3511 ../../library/stdtypes.rst:3525 -#: ../../library/stdtypes.rst:3543 ../../library/stdtypes.rst:3570 -#: ../../library/stdtypes.rst:3593 ../../library/stdtypes.rst:3620 -#: ../../library/stdtypes.rst:3662 ../../library/stdtypes.rst:3686 +#: ../../library/stdtypes.rst:2125 ../../library/stdtypes.rst:2143 +#: ../../library/stdtypes.rst:2155 ../../library/stdtypes.rst:2207 +#: ../../library/stdtypes.rst:2275 ../../library/stdtypes.rst:2343 +#: ../../library/stdtypes.rst:3335 ../../library/stdtypes.rst:3353 +#: ../../library/stdtypes.rst:3444 ../../library/stdtypes.rst:3460 +#: ../../library/stdtypes.rst:3485 ../../library/stdtypes.rst:3499 +#: ../../library/stdtypes.rst:3527 ../../library/stdtypes.rst:3541 +#: ../../library/stdtypes.rst:3559 ../../library/stdtypes.rst:3586 +#: ../../library/stdtypes.rst:3609 ../../library/stdtypes.rst:3636 +#: ../../library/stdtypes.rst:3678 ../../library/stdtypes.rst:3702 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2111 +#: ../../library/stdtypes.rst:2127 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -3161,7 +3185,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2120 +#: ../../library/stdtypes.rst:2136 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, " @@ -3171,7 +3195,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2129 +#: ../../library/stdtypes.rst:2145 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -3187,13 +3211,13 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2136 +#: ../../library/stdtypes.rst:2152 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:2141 +#: ../../library/stdtypes.rst:2157 msgid "" ">>> \"\".split(None, 0)\n" "[]\n" @@ -3203,120 +3227,120 @@ msgid "" "['foo ']" msgstr "" -#: ../../library/stdtypes.rst:2154 +#: ../../library/stdtypes.rst:2170 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:2158 +#: ../../library/stdtypes.rst:2174 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2162 +#: ../../library/stdtypes.rst:2178 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2162 +#: ../../library/stdtypes.rst:2178 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2164 +#: ../../library/stdtypes.rst:2180 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2164 +#: ../../library/stdtypes.rst:2180 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2166 +#: ../../library/stdtypes.rst:2182 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2166 +#: ../../library/stdtypes.rst:2182 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2168 +#: ../../library/stdtypes.rst:2184 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2168 +#: ../../library/stdtypes.rst:2184 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2170 +#: ../../library/stdtypes.rst:2186 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2170 +#: ../../library/stdtypes.rst:2186 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2172 +#: ../../library/stdtypes.rst:2188 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2172 +#: ../../library/stdtypes.rst:2188 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2174 +#: ../../library/stdtypes.rst:2190 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2174 +#: ../../library/stdtypes.rst:2190 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2176 +#: ../../library/stdtypes.rst:2192 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2176 +#: ../../library/stdtypes.rst:2192 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2178 +#: ../../library/stdtypes.rst:2194 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2178 +#: ../../library/stdtypes.rst:2194 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2180 +#: ../../library/stdtypes.rst:2196 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2180 +#: ../../library/stdtypes.rst:2196 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2182 +#: ../../library/stdtypes.rst:2198 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2182 +#: ../../library/stdtypes.rst:2198 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2184 +#: ../../library/stdtypes.rst:2200 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2184 +#: ../../library/stdtypes.rst:2200 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2189 +#: ../../library/stdtypes.rst:2205 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2193 +#: ../../library/stdtypes.rst:2209 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -3328,14 +3352,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:2198 +#: ../../library/stdtypes.rst:2214 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:2202 +#: ../../library/stdtypes.rst:2218 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -3347,11 +3371,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2207 +#: ../../library/stdtypes.rst:2223 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2209 +#: ../../library/stdtypes.rst:2225 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -3363,7 +3387,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2217 +#: ../../library/stdtypes.rst:2233 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -3371,7 +3395,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2225 +#: ../../library/stdtypes.rst:2241 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 " @@ -3380,7 +3404,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2231 +#: ../../library/stdtypes.rst:2247 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -3392,7 +3416,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2236 +#: ../../library/stdtypes.rst:2252 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -3400,7 +3424,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2242 +#: ../../library/stdtypes.rst:2258 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -3410,20 +3434,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2249 +#: ../../library/stdtypes.rst:2265 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " "and vice versa. Note that it is not necessarily true that ``s.swapcase()." "swapcase() == s``." msgstr "" -#: ../../library/stdtypes.rst:2256 +#: ../../library/stdtypes.rst:2272 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:2261 +#: ../../library/stdtypes.rst:2277 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -3431,7 +3455,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2264 ../../library/stdtypes.rst:3630 +#: ../../library/stdtypes.rst:2280 ../../library/stdtypes.rst:3646 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 " @@ -3439,7 +3463,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2269 +#: ../../library/stdtypes.rst:2285 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -3447,19 +3471,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2272 +#: ../../library/stdtypes.rst:2288 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2275 +#: ../../library/stdtypes.rst:2291 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2278 +#: ../../library/stdtypes.rst:2294 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -3479,7 +3503,7 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2290 +#: ../../library/stdtypes.rst:2306 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 " @@ -3491,19 +3515,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2299 +#: ../../library/stdtypes.rst:2315 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2302 +#: ../../library/stdtypes.rst:2318 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2308 +#: ../../library/stdtypes.rst:2324 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`` " @@ -3512,14 +3536,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2314 +#: ../../library/stdtypes.rst:2330 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2321 +#: ../../library/stdtypes.rst:2337 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 " @@ -3527,7 +3551,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2329 +#: ../../library/stdtypes.rst:2345 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -3539,27 +3563,27 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2350 +#: ../../library/stdtypes.rst:2366 msgid "Formatted String Literals (f-strings)" msgstr "" -#: ../../library/stdtypes.rst:2353 +#: ../../library/stdtypes.rst:2369 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" -#: ../../library/stdtypes.rst:2356 +#: ../../library/stdtypes.rst:2372 msgid "Added the debugging operator (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2358 +#: ../../library/stdtypes.rst:2374 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../library/stdtypes.rst:2362 +#: ../../library/stdtypes.rst:2378 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 " @@ -3569,7 +3593,7 @@ msgid "" "into regular :class:`str` objects. For example:" msgstr "" -#: ../../library/stdtypes.rst:2370 +#: ../../library/stdtypes.rst:2386 msgid "" ">>> who = 'nobody'\n" ">>> nationality = 'Spanish'\n" @@ -3581,11 +3605,11 @@ msgstr "" ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" "'Nobody expects the Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2377 +#: ../../library/stdtypes.rst:2393 msgid "It is also possible to use a multi line f-string:" msgstr "" -#: ../../library/stdtypes.rst:2379 +#: ../../library/stdtypes.rst:2395 msgid "" ">>> f'''This is a string\n" "... on two lines'''\n" @@ -3595,13 +3619,13 @@ msgstr "" "... on two lines'''\n" "'This is a string\\non two lines'" -#: ../../library/stdtypes.rst:2385 +#: ../../library/stdtypes.rst:2401 msgid "" "A single opening curly bracket, ``'{'``, marks a *replacement field* that " "can contain any Python expression:" msgstr "" -#: ../../library/stdtypes.rst:2388 +#: ../../library/stdtypes.rst:2404 msgid "" ">>> nationality = 'Spanish'\n" ">>> f'The {nationality} Inquisition!'\n" @@ -3611,11 +3635,11 @@ msgstr "" ">>> f'The {nationality} Inquisition!'\n" "'The Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2394 +#: ../../library/stdtypes.rst:2410 msgid "To include a literal ``{`` or ``}``, use a double bracket:" msgstr "" -#: ../../library/stdtypes.rst:2396 +#: ../../library/stdtypes.rst:2412 msgid "" ">>> x = 42\n" ">>> f'{{x}} is {x}'\n" @@ -3625,12 +3649,12 @@ msgstr "" ">>> f'{{x}} is {x}'\n" "'{x} is 42'" -#: ../../library/stdtypes.rst:2402 +#: ../../library/stdtypes.rst:2418 msgid "" "Functions can also be used, and :ref:`format specifiers `:" msgstr "" -#: ../../library/stdtypes.rst:2404 +#: ../../library/stdtypes.rst:2420 msgid "" ">>> from math import sqrt\n" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" @@ -3640,11 +3664,11 @@ msgstr "" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" "'√2 ≈ 1.41421'" -#: ../../library/stdtypes.rst:2410 +#: ../../library/stdtypes.rst:2426 msgid "Any non-string expression is converted using :func:`str`, by default:" msgstr "" -#: ../../library/stdtypes.rst:2412 +#: ../../library/stdtypes.rst:2428 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)}'\n" @@ -3654,46 +3678,46 @@ msgstr "" ">>> f'{Fraction(1, 3)}'\n" "'1/3'" -#: ../../library/stdtypes.rst:2418 +#: ../../library/stdtypes.rst:2434 msgid "" "To use an explicit conversion, use the ``!`` (exclamation mark) operator, " "followed by any of the valid formats, which are:" msgstr "" -#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:2590 -#: ../../library/stdtypes.rst:3809 +#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:2606 +#: ../../library/stdtypes.rst:3825 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:2424 +#: ../../library/stdtypes.rst:2440 msgid "``!a``" msgstr "``!a``" -#: ../../library/stdtypes.rst:2424 +#: ../../library/stdtypes.rst:2440 msgid ":func:`ascii`" msgstr ":func:`ascii`" -#: ../../library/stdtypes.rst:2425 +#: ../../library/stdtypes.rst:2441 msgid "``!r``" msgstr "``!r``" -#: ../../library/stdtypes.rst:2425 +#: ../../library/stdtypes.rst:2441 msgid ":func:`repr`" msgstr ":func:`repr`" -#: ../../library/stdtypes.rst:2426 +#: ../../library/stdtypes.rst:2442 msgid "``!s``" msgstr "``!s``" -#: ../../library/stdtypes.rst:2426 +#: ../../library/stdtypes.rst:2442 msgid ":func:`str`" msgstr ":func:`str`" -#: ../../library/stdtypes.rst:2429 +#: ../../library/stdtypes.rst:2445 msgid "For example:" msgstr "舉例來說:" -#: ../../library/stdtypes.rst:2431 +#: ../../library/stdtypes.rst:2447 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)!s}'\n" @@ -3713,7 +3737,7 @@ msgstr "" ">>> print(f'{question!a}')\n" "'\\xbfD\\xf3nde est\\xe1 el Presidente?'" -#: ../../library/stdtypes.rst:2442 +#: ../../library/stdtypes.rst:2458 msgid "" "While debugging it may be helpful to see both the expression and its value, " "by using the equals sign (``=``) after the expression. This preserves spaces " @@ -3721,7 +3745,7 @@ msgid "" "debugging operator uses the :func:`repr` (``!r``) conversion. For example:" msgstr "" -#: ../../library/stdtypes.rst:2448 +#: ../../library/stdtypes.rst:2464 msgid "" ">>> from fractions import Fraction\n" ">>> calculation = Fraction(1, 3)\n" @@ -3741,7 +3765,7 @@ msgstr "" ">>> f'{calculation = !s}'\n" "'calculation = 1/3'" -#: ../../library/stdtypes.rst:2459 +#: ../../library/stdtypes.rst:2475 msgid "" "Once the output has been evaluated, it can be formatted using a :ref:`format " "specifier ` following a colon (``':'``). After the expression " @@ -3751,7 +3775,7 @@ msgid "" "used as the final value for the replacement field. For example:" msgstr "" -#: ../../library/stdtypes.rst:2467 +#: ../../library/stdtypes.rst:2483 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 7):.6f}'\n" @@ -3760,11 +3784,11 @@ msgid "" "'___+1/7___'" msgstr "" -#: ../../library/stdtypes.rst:2479 +#: ../../library/stdtypes.rst:2495 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2492 +#: ../../library/stdtypes.rst:2508 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 " @@ -3775,7 +3799,7 @@ msgid "" "or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2500 +#: ../../library/stdtypes.rst:2516 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -3785,13 +3809,13 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:2507 +#: ../../library/stdtypes.rst:2523 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." msgstr "" -#: ../../library/stdtypes.rst:2512 +#: ../../library/stdtypes.rst:2528 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 " @@ -3799,36 +3823,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2522 ../../library/stdtypes.rst:3741 +#: ../../library/stdtypes.rst:2538 ../../library/stdtypes.rst:3757 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2525 ../../library/stdtypes.rst:3744 +#: ../../library/stdtypes.rst:2541 ../../library/stdtypes.rst:3760 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2527 ../../library/stdtypes.rst:3746 +#: ../../library/stdtypes.rst:2543 ../../library/stdtypes.rst:3762 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2530 ../../library/stdtypes.rst:3749 +#: ../../library/stdtypes.rst:2546 ../../library/stdtypes.rst:3765 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2533 ../../library/stdtypes.rst:3752 +#: ../../library/stdtypes.rst:2549 ../../library/stdtypes.rst:3768 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:2537 ../../library/stdtypes.rst:3756 +#: ../../library/stdtypes.rst:2553 ../../library/stdtypes.rst:3772 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -3836,15 +3860,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2542 ../../library/stdtypes.rst:3761 +#: ../../library/stdtypes.rst:2558 ../../library/stdtypes.rst:3777 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2544 ../../library/stdtypes.rst:3763 +#: ../../library/stdtypes.rst:2560 ../../library/stdtypes.rst:3779 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2546 +#: ../../library/stdtypes.rst:2562 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 " @@ -3852,275 +3876,275 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2555 ../../library/stdtypes.rst:3774 +#: ../../library/stdtypes.rst:2571 ../../library/stdtypes.rst:3790 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2558 ../../library/stdtypes.rst:3777 +#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:3793 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2567 ../../library/stdtypes.rst:3786 +#: ../../library/stdtypes.rst:2583 ../../library/stdtypes.rst:3802 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2569 ../../library/stdtypes.rst:3788 +#: ../../library/stdtypes.rst:2585 ../../library/stdtypes.rst:3804 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2569 ../../library/stdtypes.rst:3788 +#: ../../library/stdtypes.rst:2585 ../../library/stdtypes.rst:3804 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2572 ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:2588 ../../library/stdtypes.rst:3807 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2572 ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:2588 ../../library/stdtypes.rst:3807 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:3793 +#: ../../library/stdtypes.rst:2590 ../../library/stdtypes.rst:3809 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:3793 +#: ../../library/stdtypes.rst:2590 ../../library/stdtypes.rst:3809 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2577 ../../library/stdtypes.rst:3796 +#: ../../library/stdtypes.rst:2593 ../../library/stdtypes.rst:3812 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2577 ../../library/stdtypes.rst:3796 +#: ../../library/stdtypes.rst:2593 ../../library/stdtypes.rst:3812 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2580 ../../library/stdtypes.rst:3799 +#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:3815 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2580 ../../library/stdtypes.rst:3799 +#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:3815 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3803 +#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:3819 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:2587 ../../library/stdtypes.rst:3806 +#: ../../library/stdtypes.rst:2603 ../../library/stdtypes.rst:3822 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:3811 +#: ../../library/stdtypes.rst:2608 ../../library/stdtypes.rst:3827 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:2594 -#: ../../library/stdtypes.rst:3811 ../../library/stdtypes.rst:3813 +#: ../../library/stdtypes.rst:2608 ../../library/stdtypes.rst:2610 +#: ../../library/stdtypes.rst:3827 ../../library/stdtypes.rst:3829 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:3813 +#: ../../library/stdtypes.rst:2610 ../../library/stdtypes.rst:3829 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:2612 ../../library/stdtypes.rst:3831 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:2612 ../../library/stdtypes.rst:3831 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2598 ../../library/stdtypes.rst:3817 +#: ../../library/stdtypes.rst:2614 ../../library/stdtypes.rst:3833 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2598 ../../library/stdtypes.rst:3817 +#: ../../library/stdtypes.rst:2614 ../../library/stdtypes.rst:3833 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:3819 +#: ../../library/stdtypes.rst:2616 ../../library/stdtypes.rst:3835 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:3819 +#: ../../library/stdtypes.rst:2616 ../../library/stdtypes.rst:3835 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2602 ../../library/stdtypes.rst:3821 +#: ../../library/stdtypes.rst:2618 ../../library/stdtypes.rst:3837 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2602 ../../library/stdtypes.rst:3821 +#: ../../library/stdtypes.rst:2618 ../../library/stdtypes.rst:3837 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2604 ../../library/stdtypes.rst:3823 +#: ../../library/stdtypes.rst:2620 ../../library/stdtypes.rst:3839 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2604 ../../library/stdtypes.rst:3823 +#: ../../library/stdtypes.rst:2620 ../../library/stdtypes.rst:3839 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2606 ../../library/stdtypes.rst:3825 +#: ../../library/stdtypes.rst:2622 ../../library/stdtypes.rst:3841 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2606 ../../library/stdtypes.rst:3825 +#: ../../library/stdtypes.rst:2622 ../../library/stdtypes.rst:3841 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2608 ../../library/stdtypes.rst:3827 +#: ../../library/stdtypes.rst:2624 ../../library/stdtypes.rst:3843 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2608 ../../library/stdtypes.rst:2610 -#: ../../library/stdtypes.rst:3827 ../../library/stdtypes.rst:3829 +#: ../../library/stdtypes.rst:2624 ../../library/stdtypes.rst:2626 +#: ../../library/stdtypes.rst:3843 ../../library/stdtypes.rst:3845 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2610 ../../library/stdtypes.rst:3829 +#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3845 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2612 ../../library/stdtypes.rst:3831 +#: ../../library/stdtypes.rst:2628 ../../library/stdtypes.rst:3847 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2612 ../../library/stdtypes.rst:3831 +#: ../../library/stdtypes.rst:2628 ../../library/stdtypes.rst:3847 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:2616 ../../library/stdtypes.rst:3835 +#: ../../library/stdtypes.rst:2632 ../../library/stdtypes.rst:3851 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2616 ../../library/stdtypes.rst:3835 +#: ../../library/stdtypes.rst:2632 ../../library/stdtypes.rst:3851 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:2620 ../../library/stdtypes.rst:3839 +#: ../../library/stdtypes.rst:2636 ../../library/stdtypes.rst:3855 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2620 +#: ../../library/stdtypes.rst:2636 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2623 ../../library/stdtypes.rst:3852 +#: ../../library/stdtypes.rst:2639 ../../library/stdtypes.rst:3868 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2623 +#: ../../library/stdtypes.rst:2639 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3846 +#: ../../library/stdtypes.rst:2642 ../../library/stdtypes.rst:3862 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2626 +#: ../../library/stdtypes.rst:2642 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2629 ../../library/stdtypes.rst:3849 +#: ../../library/stdtypes.rst:2645 ../../library/stdtypes.rst:3865 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2629 +#: ../../library/stdtypes.rst:2645 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2632 ../../library/stdtypes.rst:3855 +#: ../../library/stdtypes.rst:2648 ../../library/stdtypes.rst:3871 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2632 ../../library/stdtypes.rst:3855 +#: ../../library/stdtypes.rst:2648 ../../library/stdtypes.rst:3871 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2639 ../../library/stdtypes.rst:3862 +#: ../../library/stdtypes.rst:2655 ../../library/stdtypes.rst:3878 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2643 ../../library/stdtypes.rst:3866 +#: ../../library/stdtypes.rst:2659 ../../library/stdtypes.rst:3882 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:2647 ../../library/stdtypes.rst:3870 +#: ../../library/stdtypes.rst:2663 ../../library/stdtypes.rst:3886 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2650 ../../library/stdtypes.rst:3873 +#: ../../library/stdtypes.rst:2666 ../../library/stdtypes.rst:3889 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2654 ../../library/stdtypes.rst:3877 +#: ../../library/stdtypes.rst:2670 ../../library/stdtypes.rst:3893 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:2657 ../../library/stdtypes.rst:3880 +#: ../../library/stdtypes.rst:2673 ../../library/stdtypes.rst:3896 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:3884 +#: ../../library/stdtypes.rst:2677 ../../library/stdtypes.rst:3900 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2664 ../../library/stdtypes.rst:3893 +#: ../../library/stdtypes.rst:2680 ../../library/stdtypes.rst:3909 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2666 +#: ../../library/stdtypes.rst:2682 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:2671 +#: ../../library/stdtypes.rst:2687 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2682 +#: ../../library/stdtypes.rst:2698 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2690 +#: ../../library/stdtypes.rst:2706 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 :" @@ -4128,17 +4152,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2695 +#: ../../library/stdtypes.rst:2711 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:2701 +#: ../../library/stdtypes.rst:2717 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2705 +#: ../../library/stdtypes.rst:2721 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -4146,40 +4170,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2712 +#: ../../library/stdtypes.rst:2728 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:2715 +#: ../../library/stdtypes.rst:2731 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2716 +#: ../../library/stdtypes.rst:2732 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2717 +#: ../../library/stdtypes.rst:2733 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2719 +#: ../../library/stdtypes.rst:2735 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:2723 +#: ../../library/stdtypes.rst:2739 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:2727 +#: ../../library/stdtypes.rst:2743 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -4192,29 +4216,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2737 +#: ../../library/stdtypes.rst:2753 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2740 +#: ../../library/stdtypes.rst:2756 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2741 +#: ../../library/stdtypes.rst:2757 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2742 +#: ../../library/stdtypes.rst:2758 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2744 +#: ../../library/stdtypes.rst:2760 msgid "Also see the :ref:`bytes ` built-in." msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:2746 +#: ../../library/stdtypes.rst:2762 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4222,32 +4246,32 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2768 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:2759 +#: ../../library/stdtypes.rst:2775 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:2763 +#: ../../library/stdtypes.rst:2779 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2784 ../../library/stdtypes.rst:2869 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:2774 +#: ../../library/stdtypes.rst:2790 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, " @@ -4256,13 +4280,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2807 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:2795 +#: ../../library/stdtypes.rst:2811 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 " @@ -4270,58 +4294,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2800 +#: ../../library/stdtypes.rst:2816 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:2808 +#: ../../library/stdtypes.rst:2824 msgid "Bytearray Objects" msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:2812 +#: ../../library/stdtypes.rst:2828 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:2817 +#: ../../library/stdtypes.rst:2833 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:2820 +#: ../../library/stdtypes.rst:2836 msgid "Creating an empty instance: ``bytearray()``" msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:2821 +#: ../../library/stdtypes.rst:2837 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:2822 +#: ../../library/stdtypes.rst:2838 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2823 +#: ../../library/stdtypes.rst:2839 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:2825 +#: ../../library/stdtypes.rst:2841 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:2829 +#: ../../library/stdtypes.rst:2845 msgid "Also see the :ref:`bytearray ` built-in." msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2847 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4329,33 +4353,33 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:2837 +#: ../../library/stdtypes.rst:2853 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:2844 +#: ../../library/stdtypes.rst:2860 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:2848 +#: ../../library/stdtypes.rst:2864 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2861 +#: ../../library/stdtypes.rst:2877 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:2866 +#: ../../library/stdtypes.rst:2882 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 " @@ -4363,7 +4387,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2871 +#: ../../library/stdtypes.rst:2887 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -4371,11 +4395,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2880 +#: ../../library/stdtypes.rst:2896 msgid "Bytes and Bytearray Operations" msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:2885 +#: ../../library/stdtypes.rst:2901 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -4384,14 +4408,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2909 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:2897 +#: ../../library/stdtypes.rst:2913 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -4399,11 +4423,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:2900 +#: ../../library/stdtypes.rst:2916 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:2902 +#: ../../library/stdtypes.rst:2918 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -4411,60 +4435,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:2905 +#: ../../library/stdtypes.rst:2921 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:2910 +#: ../../library/stdtypes.rst:2926 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:2913 +#: ../../library/stdtypes.rst:2929 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:2919 +#: ../../library/stdtypes.rst:2935 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:2923 ../../library/stdtypes.rst:3028 -#: ../../library/stdtypes.rst:3050 ../../library/stdtypes.rst:3116 -#: ../../library/stdtypes.rst:3129 +#: ../../library/stdtypes.rst:2939 ../../library/stdtypes.rst:3044 +#: ../../library/stdtypes.rst:3066 ../../library/stdtypes.rst:3132 +#: ../../library/stdtypes.rst:3145 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:2926 +#: ../../library/stdtypes.rst:2942 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:2929 ../../library/stdtypes.rst:3040 -#: ../../library/stdtypes.rst:3053 ../../library/stdtypes.rst:3119 -#: ../../library/stdtypes.rst:3132 +#: ../../library/stdtypes.rst:2945 ../../library/stdtypes.rst:3056 +#: ../../library/stdtypes.rst:3069 ../../library/stdtypes.rst:3135 +#: ../../library/stdtypes.rst:3148 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:2936 +#: ../../library/stdtypes.rst:2952 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:2940 +#: ../../library/stdtypes.rst:2956 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -4476,32 +4500,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:2945 +#: ../../library/stdtypes.rst:2961 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" -#: ../../library/stdtypes.rst:2949 ../../library/stdtypes.rst:2971 -#: ../../library/stdtypes.rst:3104 ../../library/stdtypes.rst:3197 -#: ../../library/stdtypes.rst:3211 ../../library/stdtypes.rst:3242 -#: ../../library/stdtypes.rst:3256 ../../library/stdtypes.rst:3298 -#: ../../library/stdtypes.rst:3369 ../../library/stdtypes.rst:3387 -#: ../../library/stdtypes.rst:3415 ../../library/stdtypes.rst:3554 -#: ../../library/stdtypes.rst:3609 ../../library/stdtypes.rst:3652 -#: ../../library/stdtypes.rst:3673 ../../library/stdtypes.rst:3695 -#: ../../library/stdtypes.rst:3897 +#: ../../library/stdtypes.rst:2965 ../../library/stdtypes.rst:2987 +#: ../../library/stdtypes.rst:3120 ../../library/stdtypes.rst:3213 +#: ../../library/stdtypes.rst:3227 ../../library/stdtypes.rst:3258 +#: ../../library/stdtypes.rst:3272 ../../library/stdtypes.rst:3314 +#: ../../library/stdtypes.rst:3385 ../../library/stdtypes.rst:3403 +#: ../../library/stdtypes.rst:3431 ../../library/stdtypes.rst:3570 +#: ../../library/stdtypes.rst:3625 ../../library/stdtypes.rst:3668 +#: ../../library/stdtypes.rst:3689 ../../library/stdtypes.rst:3711 +#: ../../library/stdtypes.rst:3913 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:2958 +#: ../../library/stdtypes.rst:2974 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:2962 +#: ../../library/stdtypes.rst:2978 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -4513,15 +4537,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:2967 +#: ../../library/stdtypes.rst:2983 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2980 +#: ../../library/stdtypes.rst:2996 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:2985 +#: ../../library/stdtypes.rst:3001 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -4529,21 +4553,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:2991 +#: ../../library/stdtypes.rst:3007 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:2997 +#: ../../library/stdtypes.rst:3013 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:3012 +#: ../../library/stdtypes.rst:3028 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -4551,11 +4575,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3017 +#: ../../library/stdtypes.rst:3033 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3023 +#: ../../library/stdtypes.rst:3039 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 " @@ -4563,14 +4587,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3033 +#: ../../library/stdtypes.rst:3049 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:3037 +#: ../../library/stdtypes.rst:3053 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -4578,13 +4602,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:3047 +#: ../../library/stdtypes.rst:3063 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:3060 +#: ../../library/stdtypes.rst:3076 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 " @@ -4594,7 +4618,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:3071 +#: ../../library/stdtypes.rst:3087 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 " @@ -4602,7 +4626,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:3082 +#: ../../library/stdtypes.rst:3098 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 " @@ -4611,24 +4635,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:3089 ../../library/stdtypes.rst:3146 +#: ../../library/stdtypes.rst:3105 ../../library/stdtypes.rst:3162 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3095 +#: ../../library/stdtypes.rst:3111 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:3099 +#: ../../library/stdtypes.rst:3115 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3111 +#: ../../library/stdtypes.rst:3127 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -4636,13 +4660,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:3126 +#: ../../library/stdtypes.rst:3142 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3139 +#: ../../library/stdtypes.rst:3155 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 " @@ -4651,7 +4675,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:3152 +#: ../../library/stdtypes.rst:3168 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -4659,11 +4683,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3157 +#: ../../library/stdtypes.rst:3173 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3163 +#: ../../library/stdtypes.rst:3179 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 " @@ -4671,18 +4695,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3168 +#: ../../library/stdtypes.rst:3184 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3171 +#: ../../library/stdtypes.rst:3187 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3174 +#: ../../library/stdtypes.rst:3190 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -4690,11 +4714,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3177 +#: ../../library/stdtypes.rst:3193 msgid "*delete* is now supported as a keyword argument." msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3181 +#: ../../library/stdtypes.rst:3197 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 " @@ -4703,7 +4727,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3190 +#: ../../library/stdtypes.rst:3206 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). " @@ -4711,7 +4735,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3204 +#: ../../library/stdtypes.rst:3220 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). " @@ -4719,7 +4743,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3218 +#: ../../library/stdtypes.rst:3234 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4729,7 +4753,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3225 +#: ../../library/stdtypes.rst:3241 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -4741,14 +4765,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3230 +#: ../../library/stdtypes.rst:3246 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:3235 +#: ../../library/stdtypes.rst:3251 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -4760,7 +4784,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3249 +#: ../../library/stdtypes.rst:3265 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). " @@ -4768,7 +4792,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3263 +#: ../../library/stdtypes.rst:3279 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 " @@ -4778,7 +4802,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3274 +#: ../../library/stdtypes.rst:3290 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4788,7 +4812,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3281 +#: ../../library/stdtypes.rst:3297 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -4800,14 +4824,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3286 +#: ../../library/stdtypes.rst:3302 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:3291 +#: ../../library/stdtypes.rst:3307 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -4819,7 +4843,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3305 +#: ../../library/stdtypes.rst:3321 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 " @@ -4828,7 +4852,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3311 +#: ../../library/stdtypes.rst:3327 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',')`` " @@ -4839,7 +4863,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3321 +#: ../../library/stdtypes.rst:3337 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -4859,7 +4883,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3330 +#: ../../library/stdtypes.rst:3346 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 " @@ -4869,7 +4893,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3340 +#: ../../library/stdtypes.rst:3356 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -4885,7 +4909,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3351 +#: ../../library/stdtypes.rst:3367 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *chars* argument is a binary sequence specifying the set of " @@ -4895,7 +4919,7 @@ msgid "" "a prefix or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3359 +#: ../../library/stdtypes.rst:3375 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -4907,13 +4931,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3364 +#: ../../library/stdtypes.rst:3380 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3373 +#: ../../library/stdtypes.rst:3389 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 " @@ -4921,14 +4945,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3381 +#: ../../library/stdtypes.rst:3397 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:3394 +#: ../../library/stdtypes.rst:3410 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 " @@ -4944,7 +4968,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3408 +#: ../../library/stdtypes.rst:3424 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -4956,7 +4980,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3422 +#: ../../library/stdtypes.rst:3438 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -4965,7 +4989,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3430 +#: ../../library/stdtypes.rst:3446 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -4977,7 +5001,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3439 +#: ../../library/stdtypes.rst:3455 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -4985,7 +5009,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3446 +#: ../../library/stdtypes.rst:3462 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -4997,20 +5021,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3455 +#: ../../library/stdtypes.rst:3471 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:3465 +#: ../../library/stdtypes.rst:3481 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:3471 +#: ../../library/stdtypes.rst:3487 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -5022,13 +5046,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3480 +#: ../../library/stdtypes.rst:3496 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:3485 +#: ../../library/stdtypes.rst:3501 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -5040,16 +5064,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3490 ../../library/stdtypes.rst:3532 -#: ../../library/stdtypes.rst:3548 ../../library/stdtypes.rst:3598 -#: ../../library/stdtypes.rst:3667 +#: ../../library/stdtypes.rst:3506 ../../library/stdtypes.rst:3548 +#: ../../library/stdtypes.rst:3564 ../../library/stdtypes.rst:3614 +#: ../../library/stdtypes.rst:3683 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:3498 +#: ../../library/stdtypes.rst:3514 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -5057,14 +5081,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3507 +#: ../../library/stdtypes.rst:3523 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:3513 +#: ../../library/stdtypes.rst:3529 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -5076,14 +5100,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3522 +#: ../../library/stdtypes.rst:3538 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:3527 +#: ../../library/stdtypes.rst:3543 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -5095,13 +5119,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3540 +#: ../../library/stdtypes.rst:3556 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3545 +#: ../../library/stdtypes.rst:3561 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -5109,7 +5133,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3565 +#: ../../library/stdtypes.rst:3581 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 " @@ -5117,7 +5141,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3572 +#: ../../library/stdtypes.rst:3588 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -5129,14 +5153,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:3577 +#: ../../library/stdtypes.rst:3593 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:3581 +#: ../../library/stdtypes.rst:3597 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -5148,13 +5172,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3590 +#: ../../library/stdtypes.rst:3606 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:3595 +#: ../../library/stdtypes.rst:3611 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -5162,7 +5186,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3602 +#: ../../library/stdtypes.rst:3618 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -5170,14 +5194,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3616 +#: ../../library/stdtypes.rst:3632 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:3622 +#: ../../library/stdtypes.rst:3638 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -5185,7 +5209,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3625 +#: ../../library/stdtypes.rst:3641 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -5193,7 +5217,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3635 +#: ../../library/stdtypes.rst:3651 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -5201,12 +5225,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:3638 +#: ../../library/stdtypes.rst:3654 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3640 +#: ../../library/stdtypes.rst:3656 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -5228,13 +5252,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:3675 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3664 +#: ../../library/stdtypes.rst:3680 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -5242,7 +5266,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3680 +#: ../../library/stdtypes.rst:3696 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 " @@ -5251,7 +5275,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:3704 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5263,11 +5287,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:3702 +#: ../../library/stdtypes.rst:3718 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:3719 +#: ../../library/stdtypes.rst:3735 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 " @@ -5275,7 +5299,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:3724 +#: ../../library/stdtypes.rst:3740 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -5285,7 +5309,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:3731 +#: ../../library/stdtypes.rst:3747 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 " @@ -5293,7 +5317,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3765 +#: ../../library/stdtypes.rst:3781 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 " @@ -5301,73 +5325,73 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3839 +#: ../../library/stdtypes.rst:3855 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:3842 +#: ../../library/stdtypes.rst:3858 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:3842 +#: ../../library/stdtypes.rst:3858 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:3846 +#: ../../library/stdtypes.rst:3862 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3849 +#: ../../library/stdtypes.rst:3865 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:3852 +#: ../../library/stdtypes.rst:3868 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3852 +#: ../../library/stdtypes.rst:3868 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:3887 +#: ../../library/stdtypes.rst:3903 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3890 +#: ../../library/stdtypes.rst:3906 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3902 +#: ../../library/stdtypes.rst:3918 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:3909 +#: ../../library/stdtypes.rst:3925 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:3911 +#: ../../library/stdtypes.rst:3927 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:3917 +#: ../../library/stdtypes.rst:3933 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:3921 +#: ../../library/stdtypes.rst:3937 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 " @@ -5375,32 +5399,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:3926 +#: ../../library/stdtypes.rst:3942 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:3930 +#: ../../library/stdtypes.rst:3946 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:3933 +#: ../../library/stdtypes.rst:3949 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:3936 +#: ../../library/stdtypes.rst:3952 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:3939 +#: ../../library/stdtypes.rst:3955 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -5422,7 +5446,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:3949 +#: ../../library/stdtypes.rst:3965 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 " @@ -5433,11 +5457,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:3958 +#: ../../library/stdtypes.rst:3974 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:3960 +#: ../../library/stdtypes.rst:3976 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -5459,13 +5483,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:3970 +#: ../../library/stdtypes.rst:3986 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:3973 +#: ../../library/stdtypes.rst:3989 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -5505,14 +5529,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:3991 +#: ../../library/stdtypes.rst:4007 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:3995 +#: ../../library/stdtypes.rst:4011 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -5530,40 +5554,40 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:4003 +#: ../../library/stdtypes.rst:4019 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:4007 +#: ../../library/stdtypes.rst:4023 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:4011 +#: ../../library/stdtypes.rst:4027 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:4014 +#: ../../library/stdtypes.rst:4030 msgid ":class:`memoryview` has several methods:" msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:4018 +#: ../../library/stdtypes.rst:4034 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:4022 +#: ../../library/stdtypes.rst:4038 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:4025 +#: ../../library/stdtypes.rst:4041 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -5597,14 +5621,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:4041 +#: ../../library/stdtypes.rst:4057 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:4045 +#: ../../library/stdtypes.rst:4061 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -5630,25 +5654,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:4057 +#: ../../library/stdtypes.rst:4073 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:4060 +#: ../../library/stdtypes.rst:4076 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:4066 +#: ../../library/stdtypes.rst:4082 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:4069 +#: ../../library/stdtypes.rst:4085 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -5662,7 +5686,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:4075 +#: ../../library/stdtypes.rst:4091 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -5670,7 +5694,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:4080 +#: ../../library/stdtypes.rst:4096 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' " @@ -5679,13 +5703,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:4089 +#: ../../library/stdtypes.rst:4105 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:4092 +#: ../../library/stdtypes.rst:4108 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -5695,18 +5719,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:4098 +#: ../../library/stdtypes.rst:4114 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:4105 +#: ../../library/stdtypes.rst:4121 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:4107 +#: ../../library/stdtypes.rst:4123 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -5724,19 +5748,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:4115 +#: ../../library/stdtypes.rst:4131 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:4122 +#: ../../library/stdtypes.rst:4138 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:4125 +#: ../../library/stdtypes.rst:4141 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -5762,7 +5786,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:4141 +#: ../../library/stdtypes.rst:4157 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 :" @@ -5771,14 +5795,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:4147 +#: ../../library/stdtypes.rst:4163 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:4151 +#: ../../library/stdtypes.rst:4167 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -5794,13 +5818,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:4174 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4161 +#: ../../library/stdtypes.rst:4177 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -5820,7 +5844,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4174 +#: ../../library/stdtypes.rst:4190 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 " @@ -5829,7 +5853,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4180 +#: ../../library/stdtypes.rst:4196 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 " @@ -5837,11 +5861,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4186 +#: ../../library/stdtypes.rst:4202 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4188 +#: ../../library/stdtypes.rst:4204 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -5885,11 +5909,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4209 +#: ../../library/stdtypes.rst:4225 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4211 +#: ../../library/stdtypes.rst:4227 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -5913,11 +5937,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4222 +#: ../../library/stdtypes.rst:4238 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4224 +#: ../../library/stdtypes.rst:4240 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -5967,11 +5991,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4248 +#: ../../library/stdtypes.rst:4264 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4250 +#: ../../library/stdtypes.rst:4266 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -5993,19 +6017,19 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4262 +#: ../../library/stdtypes.rst:4278 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4265 +#: ../../library/stdtypes.rst:4281 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4269 +#: ../../library/stdtypes.rst:4285 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4271 +#: ../../library/stdtypes.rst:4287 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -6017,14 +6041,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4280 +#: ../../library/stdtypes.rst:4296 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:4284 +#: ../../library/stdtypes.rst:4300 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -6056,11 +6080,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4299 +#: ../../library/stdtypes.rst:4315 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4301 +#: ../../library/stdtypes.rst:4317 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -6084,11 +6108,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4316 +#: ../../library/stdtypes.rst:4332 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4320 +#: ../../library/stdtypes.rst:4336 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 " @@ -6096,17 +6120,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4325 +#: ../../library/stdtypes.rst:4341 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:4331 +#: ../../library/stdtypes.rst:4347 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4333 +#: ../../library/stdtypes.rst:4349 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -6126,49 +6150,49 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4344 +#: ../../library/stdtypes.rst:4360 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4349 +#: ../../library/stdtypes.rst:4365 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:4352 ../../library/stdtypes.rst:4360 +#: ../../library/stdtypes.rst:4368 ../../library/stdtypes.rst:4376 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4357 +#: ../../library/stdtypes.rst:4373 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:4365 +#: ../../library/stdtypes.rst:4381 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:4385 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4375 +#: ../../library/stdtypes.rst:4391 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4381 +#: ../../library/stdtypes.rst:4397 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4389 +#: ../../library/stdtypes.rst:4405 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4393 +#: ../../library/stdtypes.rst:4409 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -6178,7 +6202,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4400 +#: ../../library/stdtypes.rst:4416 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 " @@ -6186,7 +6210,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4405 +#: ../../library/stdtypes.rst:4421 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -6198,18 +6222,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:4413 +#: ../../library/stdtypes.rst:4429 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:4417 +#: ../../library/stdtypes.rst:4433 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4422 +#: ../../library/stdtypes.rst:4438 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 " @@ -6217,92 +6241,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4428 +#: ../../library/stdtypes.rst:4444 msgid "Sets can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4430 +#: ../../library/stdtypes.rst:4446 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4431 +#: ../../library/stdtypes.rst:4447 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4432 +#: ../../library/stdtypes.rst:4448 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4434 +#: ../../library/stdtypes.rst:4450 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4439 +#: ../../library/stdtypes.rst:4455 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4443 +#: ../../library/stdtypes.rst:4459 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4447 +#: ../../library/stdtypes.rst:4463 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4451 +#: ../../library/stdtypes.rst:4467 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:4457 +#: ../../library/stdtypes.rst:4473 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4461 +#: ../../library/stdtypes.rst:4477 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4467 +#: ../../library/stdtypes.rst:4483 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4471 +#: ../../library/stdtypes.rst:4487 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4477 +#: ../../library/stdtypes.rst:4493 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4482 +#: ../../library/stdtypes.rst:4498 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4487 +#: ../../library/stdtypes.rst:4503 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4492 +#: ../../library/stdtypes.rst:4508 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4496 +#: ../../library/stdtypes.rst:4512 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4499 +#: ../../library/stdtypes.rst:4515 msgid "" "Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" "meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" @@ -6312,7 +6336,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4506 +#: ../../library/stdtypes.rst:4522 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 " @@ -6322,14 +6346,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4513 +#: ../../library/stdtypes.rst:4529 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:4517 +#: ../../library/stdtypes.rst:4533 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 " @@ -6337,71 +6361,71 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4522 +#: ../../library/stdtypes.rst:4538 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:4525 +#: ../../library/stdtypes.rst:4541 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4527 +#: ../../library/stdtypes.rst:4543 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:4531 +#: ../../library/stdtypes.rst:4547 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4537 +#: ../../library/stdtypes.rst:4553 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4542 +#: ../../library/stdtypes.rst:4558 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4547 +#: ../../library/stdtypes.rst:4563 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4552 +#: ../../library/stdtypes.rst:4568 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4556 +#: ../../library/stdtypes.rst:4572 msgid "Add element *elem* to the set." msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:4560 +#: ../../library/stdtypes.rst:4576 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4565 +#: ../../library/stdtypes.rst:4581 msgid "Remove element *elem* from the set if it is present." msgstr "如果 *elem* 存在於集合中則將其移除。" -#: ../../library/stdtypes.rst:4569 +#: ../../library/stdtypes.rst:4585 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4574 +#: ../../library/stdtypes.rst:4590 msgid "Remove all elements from the set." msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:4577 +#: ../../library/stdtypes.rst:4593 msgid "" "Note, the non-operator versions of the :meth:`update`, :meth:" "`intersection_update`, :meth:`difference_update`, and :meth:" @@ -6409,18 +6433,18 @@ msgid "" "argument." msgstr "" -#: ../../library/stdtypes.rst:4582 +#: ../../library/stdtypes.rst:4598 msgid "" "Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" "`remove`, and :meth:`discard` methods may be a set. To support searching " "for an equivalent frozenset, a temporary one is created from *elem*." msgstr "" -#: ../../library/stdtypes.rst:4591 +#: ../../library/stdtypes.rst:4607 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4601 +#: ../../library/stdtypes.rst:4617 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -6429,7 +6453,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4607 +#: ../../library/stdtypes.rst:4623 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -6438,33 +6462,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4618 +#: ../../library/stdtypes.rst:4634 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4621 +#: ../../library/stdtypes.rst:4637 msgid "Dictionaries can be created by several means:" msgstr "字典可以用數種方式建立:" -#: ../../library/stdtypes.rst:4623 +#: ../../library/stdtypes.rst:4639 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:4625 +#: ../../library/stdtypes.rst:4641 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4626 +#: ../../library/stdtypes.rst:4642 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4629 +#: ../../library/stdtypes.rst:4645 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 " @@ -6477,7 +6501,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4639 +#: ../../library/stdtypes.rst:4655 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 " @@ -6485,13 +6509,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4644 ../../library/stdtypes.rst:4662 +#: ../../library/stdtypes.rst:4660 ../../library/stdtypes.rst:4678 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:4647 +#: ../../library/stdtypes.rst:4663 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -6500,7 +6524,7 @@ msgid "" "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:4669 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -6520,13 +6544,13 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:4665 +#: ../../library/stdtypes.rst:4681 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:4668 +#: ../../library/stdtypes.rst:4684 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6558,33 +6582,33 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4683 +#: ../../library/stdtypes.rst:4699 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4687 +#: ../../library/stdtypes.rst:4703 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4692 +#: ../../library/stdtypes.rst:4708 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4696 +#: ../../library/stdtypes.rst:4712 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4700 +#: ../../library/stdtypes.rst:4716 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4705 +#: ../../library/stdtypes.rst:4721 msgid "" "If a subclass of dict defines a method :meth:`__missing__` and *key* is not " "present, the ``d[key]`` operation calls that method with the key *key* as " @@ -6595,7 +6619,7 @@ msgid "" "an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4713 +#: ../../library/stdtypes.rst:4729 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -6619,51 +6643,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:4724 +#: ../../library/stdtypes.rst:4740 msgid "" "The example above shows part of the implementation of :class:`collections." "Counter`. A different ``__missing__`` method is used by :class:`collections." "defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:4730 +#: ../../library/stdtypes.rst:4746 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:4734 +#: ../../library/stdtypes.rst:4750 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:4739 +#: ../../library/stdtypes.rst:4755 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:4743 +#: ../../library/stdtypes.rst:4759 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:4747 +#: ../../library/stdtypes.rst:4763 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4752 +#: ../../library/stdtypes.rst:4768 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:4756 +#: ../../library/stdtypes.rst:4772 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4760 +#: ../../library/stdtypes.rst:4776 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4762 +#: ../../library/stdtypes.rst:4778 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 " @@ -6672,70 +6696,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4770 +#: ../../library/stdtypes.rst:4786 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:4776 +#: ../../library/stdtypes.rst:4792 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4781 +#: ../../library/stdtypes.rst:4797 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4786 +#: ../../library/stdtypes.rst:4802 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:4792 +#: ../../library/stdtypes.rst:4808 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:4795 +#: ../../library/stdtypes.rst:4811 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:4799 +#: ../../library/stdtypes.rst:4815 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4805 +#: ../../library/stdtypes.rst:4821 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4812 +#: ../../library/stdtypes.rst:4828 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:4818 +#: ../../library/stdtypes.rst:4834 msgid "" "Update the dictionary with the key/value pairs from *other*, overwriting " "existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4821 +#: ../../library/stdtypes.rst:4837 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -6744,20 +6768,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4845 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4832 +#: ../../library/stdtypes.rst:4848 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:4836 +#: ../../library/stdtypes.rst:4852 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -6767,25 +6791,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:4842 +#: ../../library/stdtypes.rst:4858 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:4850 +#: ../../library/stdtypes.rst:4866 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:4856 +#: ../../library/stdtypes.rst:4872 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4858 +#: ../../library/stdtypes.rst:4874 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6807,21 +6831,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:4868 +#: ../../library/stdtypes.rst:4884 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4873 +#: ../../library/stdtypes.rst:4889 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4880 +#: ../../library/stdtypes.rst:4896 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4882 +#: ../../library/stdtypes.rst:4898 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 " @@ -6829,23 +6853,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4887 +#: ../../library/stdtypes.rst:4903 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4892 +#: ../../library/stdtypes.rst:4908 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4896 +#: ../../library/stdtypes.rst:4912 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4899 +#: ../../library/stdtypes.rst:4915 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -6853,39 +6877,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4904 +#: ../../library/stdtypes.rst:4920 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:4907 +#: ../../library/stdtypes.rst:4923 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4912 +#: ../../library/stdtypes.rst:4928 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:4917 +#: ../../library/stdtypes.rst:4933 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:4920 +#: ../../library/stdtypes.rst:4936 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4925 +#: ../../library/stdtypes.rst:4941 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4930 +#: ../../library/stdtypes.rst:4946 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 " @@ -6899,11 +6923,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:4942 +#: ../../library/stdtypes.rst:4958 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4944 +#: ../../library/stdtypes.rst:4960 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -6944,11 +6968,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:4986 +#: ../../library/stdtypes.rst:5002 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:4993 +#: ../../library/stdtypes.rst:5009 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 " @@ -6959,7 +6983,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:5001 +#: ../../library/stdtypes.rst:5017 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 " @@ -6970,7 +6994,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:5006 +#: ../../library/stdtypes.rst:5022 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -6979,7 +7003,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:5010 +#: ../../library/stdtypes.rst:5026 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 " @@ -6993,7 +7017,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5020 +#: ../../library/stdtypes.rst:5036 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -7005,7 +7029,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5025 +#: ../../library/stdtypes.rst:5041 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -7020,7 +7044,7 @@ msgstr "" "(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" "的任何例外。" -#: ../../library/stdtypes.rst:5032 +#: ../../library/stdtypes.rst:5048 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -7032,7 +7056,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" "`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5038 +#: ../../library/stdtypes.rst:5054 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -7044,7 +7068,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5044 +#: ../../library/stdtypes.rst:5060 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -7059,7 +7083,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:5067 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 " @@ -7071,7 +7095,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5059 +#: ../../library/stdtypes.rst:5075 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -7079,7 +7103,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5064 +#: ../../library/stdtypes.rst:5080 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -7087,11 +7111,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5071 +#: ../../library/stdtypes.rst:5087 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5077 +#: ../../library/stdtypes.rst:5093 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -7107,7 +7131,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5087 +#: ../../library/stdtypes.rst:5103 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -7115,7 +7139,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5090 +#: ../../library/stdtypes.rst:5106 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -7123,7 +7147,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5093 +#: ../../library/stdtypes.rst:5109 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 " @@ -7135,7 +7159,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5099 +#: ../../library/stdtypes.rst:5115 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 " @@ -7147,7 +7171,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5105 +#: ../../library/stdtypes.rst:5121 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 " @@ -7159,7 +7183,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5111 +#: ../../library/stdtypes.rst:5127 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." @@ -7172,7 +7196,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5117 +#: ../../library/stdtypes.rst:5133 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -7181,7 +7205,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:5123 +#: ../../library/stdtypes.rst:5139 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -7191,7 +7215,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:5128 +#: ../../library/stdtypes.rst:5144 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -7199,7 +7223,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5131 +#: ../../library/stdtypes.rst:5147 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 " @@ -7210,7 +7234,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5136 +#: ../../library/stdtypes.rst:5152 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -7218,7 +7242,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5139 +#: ../../library/stdtypes.rst:5155 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -7226,7 +7250,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5142 +#: ../../library/stdtypes.rst:5158 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -7238,7 +7262,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5147 +#: ../../library/stdtypes.rst:5163 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7250,7 +7274,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5153 +#: ../../library/stdtypes.rst:5169 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7260,13 +7284,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5157 +#: ../../library/stdtypes.rst:5173 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5160 +#: ../../library/stdtypes.rst:5176 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7284,13 +7308,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5168 +#: ../../library/stdtypes.rst:5184 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5170 +#: ../../library/stdtypes.rst:5186 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7304,7 +7328,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5176 +#: ../../library/stdtypes.rst:5192 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -7312,7 +7336,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5179 +#: ../../library/stdtypes.rst:5195 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7324,7 +7348,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5184 +#: ../../library/stdtypes.rst:5200 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -7334,7 +7358,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5188 +#: ../../library/stdtypes.rst:5204 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7346,253 +7370,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5195 +#: ../../library/stdtypes.rst:5211 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5197 +#: ../../library/stdtypes.rst:5213 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5200 +#: ../../library/stdtypes.rst:5216 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5201 +#: ../../library/stdtypes.rst:5217 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5202 +#: ../../library/stdtypes.rst:5218 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5203 +#: ../../library/stdtypes.rst:5219 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5204 +#: ../../library/stdtypes.rst:5220 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5205 +#: ../../library/stdtypes.rst:5221 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5206 +#: ../../library/stdtypes.rst:5222 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5207 +#: ../../library/stdtypes.rst:5223 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5224 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5209 +#: ../../library/stdtypes.rst:5225 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5210 +#: ../../library/stdtypes.rst:5226 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5211 +#: ../../library/stdtypes.rst:5227 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5212 +#: ../../library/stdtypes.rst:5228 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5213 +#: ../../library/stdtypes.rst:5229 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5214 +#: ../../library/stdtypes.rst:5230 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5215 +#: ../../library/stdtypes.rst:5231 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5216 +#: ../../library/stdtypes.rst:5232 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5217 +#: ../../library/stdtypes.rst:5233 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5218 +#: ../../library/stdtypes.rst:5234 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5219 +#: ../../library/stdtypes.rst:5235 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5220 +#: ../../library/stdtypes.rst:5236 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5221 +#: ../../library/stdtypes.rst:5237 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5222 +#: ../../library/stdtypes.rst:5238 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5223 +#: ../../library/stdtypes.rst:5239 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5224 +#: ../../library/stdtypes.rst:5240 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5225 +#: ../../library/stdtypes.rst:5241 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5226 +#: ../../library/stdtypes.rst:5242 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5227 +#: ../../library/stdtypes.rst:5243 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5228 +#: ../../library/stdtypes.rst:5244 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5229 +#: ../../library/stdtypes.rst:5245 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5230 +#: ../../library/stdtypes.rst:5246 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5231 +#: ../../library/stdtypes.rst:5247 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5232 +#: ../../library/stdtypes.rst:5248 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5233 +#: ../../library/stdtypes.rst:5249 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5234 +#: ../../library/stdtypes.rst:5250 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5235 +#: ../../library/stdtypes.rst:5251 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5236 +#: ../../library/stdtypes.rst:5252 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5237 +#: ../../library/stdtypes.rst:5253 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5238 +#: ../../library/stdtypes.rst:5254 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5239 +#: ../../library/stdtypes.rst:5255 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5240 +#: ../../library/stdtypes.rst:5256 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5241 +#: ../../library/stdtypes.rst:5257 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5242 +#: ../../library/stdtypes.rst:5258 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5243 +#: ../../library/stdtypes.rst:5259 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5244 +#: ../../library/stdtypes.rst:5260 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5245 +#: ../../library/stdtypes.rst:5261 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5246 +#: ../../library/stdtypes.rst:5262 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5247 +#: ../../library/stdtypes.rst:5263 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5248 +#: ../../library/stdtypes.rst:5264 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5249 +#: ../../library/stdtypes.rst:5265 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5250 +#: ../../library/stdtypes.rst:5266 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5251 +#: ../../library/stdtypes.rst:5267 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5252 +#: ../../library/stdtypes.rst:5268 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5253 +#: ../../library/stdtypes.rst:5269 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5254 +#: ../../library/stdtypes.rst:5270 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5255 +#: ../../library/stdtypes.rst:5271 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5260 +#: ../../library/stdtypes.rst:5276 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5262 +#: ../../library/stdtypes.rst:5278 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5266 +#: ../../library/stdtypes.rst:5282 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5268 +#: ../../library/stdtypes.rst:5284 msgid "" ">>> list[int].__origin__\n" "" @@ -7600,7 +7624,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5274 +#: ../../library/stdtypes.rst:5290 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 " @@ -7609,7 +7633,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5278 +#: ../../library/stdtypes.rst:5294 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -7617,7 +7641,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5284 +#: ../../library/stdtypes.rst:5300 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -7625,7 +7649,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5287 +#: ../../library/stdtypes.rst:5303 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -7639,7 +7663,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5295 +#: ../../library/stdtypes.rst:5311 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -7649,7 +7673,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5302 +#: ../../library/stdtypes.rst:5318 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -7657,19 +7681,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5310 +#: ../../library/stdtypes.rst:5326 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5311 +#: ../../library/stdtypes.rst:5327 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5313 +#: ../../library/stdtypes.rst:5329 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5314 +#: ../../library/stdtypes.rst:5330 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -7678,7 +7702,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5318 +#: ../../library/stdtypes.rst:5334 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -7686,18 +7710,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5319 +#: ../../library/stdtypes.rst:5335 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:5328 +#: ../../library/stdtypes.rst:5344 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5334 +#: ../../library/stdtypes.rst:5350 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -7710,7 +7734,7 @@ msgstr "" "釋 (type annotation) `。與 :data:`typing.Union` 相比,聯合型別運" "算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5341 +#: ../../library/stdtypes.rst:5357 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 " @@ -7721,7 +7745,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5346 +#: ../../library/stdtypes.rst:5362 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -7729,7 +7753,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5351 +#: ../../library/stdtypes.rst:5367 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 " @@ -7742,58 +7766,58 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5359 +#: ../../library/stdtypes.rst:5375 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5361 +#: ../../library/stdtypes.rst:5377 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5363 +#: ../../library/stdtypes.rst:5379 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5381 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5367 +#: ../../library/stdtypes.rst:5383 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5369 +#: ../../library/stdtypes.rst:5385 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5371 +#: ../../library/stdtypes.rst:5387 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5373 +#: ../../library/stdtypes.rst:5389 msgid "It is compatible with :data:`typing.Union`::" msgstr "它與 :data:`typing.Union` 相容: ::" -#: ../../library/stdtypes.rst:5375 +#: ../../library/stdtypes.rst:5391 msgid "int | str == typing.Union[int, str]" msgstr "int | str == typing.Union[int, str]" -#: ../../library/stdtypes.rst:5377 +#: ../../library/stdtypes.rst:5393 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5379 +#: ../../library/stdtypes.rst:5395 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5384 +#: ../../library/stdtypes.rst:5400 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5387 +#: ../../library/stdtypes.rst:5403 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -7801,14 +7825,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5390 +#: ../../library/stdtypes.rst:5406 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5393 +#: ../../library/stdtypes.rst:5409 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -7818,7 +7842,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5400 +#: ../../library/stdtypes.rst:5416 msgid "" "The user-exposed type for the union object can be accessed from :data:`types." "UnionType` and used for :func:`isinstance` checks. An object cannot be " @@ -7827,7 +7851,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." "UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別來實例化: ::" -#: ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:5420 msgid "" ">>> import types\n" ">>> isinstance(int | str, types.UnionType)\n" @@ -7845,7 +7869,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'types.UnionType' instances" -#: ../../library/stdtypes.rst:5413 +#: ../../library/stdtypes.rst:5429 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 " @@ -7854,7 +7878,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5417 +#: ../../library/stdtypes.rst:5433 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -7880,25 +7904,25 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5433 +#: ../../library/stdtypes.rst:5449 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5441 +#: ../../library/stdtypes.rst:5457 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:5443 +#: ../../library/stdtypes.rst:5459 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5450 +#: ../../library/stdtypes.rst:5466 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5452 +#: ../../library/stdtypes.rst:5468 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 " @@ -7909,7 +7933,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5459 +#: ../../library/stdtypes.rst:5475 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -7920,32 +7944,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5467 +#: ../../library/stdtypes.rst:5483 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5475 +#: ../../library/stdtypes.rst:5491 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:5477 +#: ../../library/stdtypes.rst:5493 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:5483 +#: ../../library/stdtypes.rst:5499 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5485 +#: ../../library/stdtypes.rst:5501 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:5488 +#: ../../library/stdtypes.rst:5504 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -7953,15 +7977,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5492 +#: ../../library/stdtypes.rst:5508 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5498 +#: ../../library/stdtypes.rst:5514 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:5502 +#: ../../library/stdtypes.rst:5518 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -7969,7 +7993,7 @@ msgid "" "Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5507 +#: ../../library/stdtypes.rst:5523 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:" @@ -7982,7 +8006,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5518 +#: ../../library/stdtypes.rst:5534 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -7993,7 +8017,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5526 +#: ../../library/stdtypes.rst:5542 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -8021,15 +8045,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5541 +#: ../../library/stdtypes.rst:5557 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5549 +#: ../../library/stdtypes.rst:5565 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5555 +#: ../../library/stdtypes.rst:5571 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -8039,7 +8063,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5562 +#: ../../library/stdtypes.rst:5578 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -8048,21 +8072,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5569 +#: ../../library/stdtypes.rst:5585 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:5572 +#: ../../library/stdtypes.rst:5588 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5578 +#: ../../library/stdtypes.rst:5594 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5584 +#: ../../library/stdtypes.rst:5600 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 " @@ -8070,30 +8094,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5589 +#: ../../library/stdtypes.rst:5605 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5595 +#: ../../library/stdtypes.rst:5611 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5597 +#: ../../library/stdtypes.rst:5613 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:5601 +#: ../../library/stdtypes.rst:5617 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5608 +#: ../../library/stdtypes.rst:5624 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5610 +#: ../../library/stdtypes.rst:5626 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " "no special operations. There is exactly one ellipsis object, named :const:" @@ -8101,15 +8125,15 @@ msgid "" "`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5615 +#: ../../library/stdtypes.rst:5631 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5621 +#: ../../library/stdtypes.rst:5637 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5623 +#: ../../library/stdtypes.rst:5639 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 " @@ -8117,64 +8141,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5644 msgid "It is written as :code:`NotImplemented`." msgstr "" -#: ../../library/stdtypes.rst:5634 +#: ../../library/stdtypes.rst:5650 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:5636 +#: ../../library/stdtypes.rst:5652 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5644 +#: ../../library/stdtypes.rst:5660 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5646 +#: ../../library/stdtypes.rst:5662 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:5653 +#: ../../library/stdtypes.rst:5669 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5659 +#: ../../library/stdtypes.rst:5675 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5667 +#: ../../library/stdtypes.rst:5683 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5672 +#: ../../library/stdtypes.rst:5688 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5677 +#: ../../library/stdtypes.rst:5693 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:5687 +#: ../../library/stdtypes.rst:5703 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5689 +#: ../../library/stdtypes.rst:5705 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 " @@ -8182,7 +8206,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5694 +#: ../../library/stdtypes.rst:5710 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 " @@ -8192,24 +8216,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5701 +#: ../../library/stdtypes.rst:5717 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5703 +#: ../../library/stdtypes.rst:5719 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:5707 +#: ../../library/stdtypes.rst:5723 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5709 +#: ../../library/stdtypes.rst:5725 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8233,7 +8257,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5729 +#: ../../library/stdtypes.rst:5745 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -8241,11 +8265,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5734 +#: ../../library/stdtypes.rst:5750 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5736 +#: ../../library/stdtypes.rst:5752 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8263,84 +8287,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:5749 +#: ../../library/stdtypes.rst:5765 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5751 +#: ../../library/stdtypes.rst:5767 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5754 +#: ../../library/stdtypes.rst:5770 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5755 +#: ../../library/stdtypes.rst:5771 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5756 +#: ../../library/stdtypes.rst:5772 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5757 +#: ../../library/stdtypes.rst:5773 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5758 +#: ../../library/stdtypes.rst:5774 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5761 +#: ../../library/stdtypes.rst:5777 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5763 +#: ../../library/stdtypes.rst:5779 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5764 +#: ../../library/stdtypes.rst:5780 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5765 +#: ../../library/stdtypes.rst:5781 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5766 +#: ../../library/stdtypes.rst:5782 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5767 +#: ../../library/stdtypes.rst:5783 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5768 +#: ../../library/stdtypes.rst:5784 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5771 +#: ../../library/stdtypes.rst:5787 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5773 +#: ../../library/stdtypes.rst:5789 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:5776 +#: ../../library/stdtypes.rst:5792 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:5779 +#: ../../library/stdtypes.rst:5795 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8348,7 +8372,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5781 +#: ../../library/stdtypes.rst:5797 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 " @@ -8357,38 +8381,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:5787 +#: ../../library/stdtypes.rst:5803 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5790 +#: ../../library/stdtypes.rst:5806 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:5794 +#: ../../library/stdtypes.rst:5810 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5796 +#: ../../library/stdtypes.rst:5812 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5798 +#: ../../library/stdtypes.rst:5814 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:5805 +#: ../../library/stdtypes.rst:5821 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 " @@ -8400,7 +8424,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5814 +#: ../../library/stdtypes.rst:5830 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 " @@ -8408,11 +8432,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5820 +#: ../../library/stdtypes.rst:5836 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5822 +#: ../../library/stdtypes.rst:5838 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 " @@ -8420,11 +8444,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5827 +#: ../../library/stdtypes.rst:5843 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5829 +#: ../../library/stdtypes.rst:5845 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8446,38 +8470,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:5839 +#: ../../library/stdtypes.rst:5855 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5843 +#: ../../library/stdtypes.rst:5859 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5844 +#: ../../library/stdtypes.rst:5860 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5847 +#: ../../library/stdtypes.rst:5863 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5850 +#: ../../library/stdtypes.rst:5866 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5852 +#: ../../library/stdtypes.rst:5868 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:5855 +#: ../../library/stdtypes.rst:5871 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -8490,13 +8514,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:316 #: ../../library/stdtypes.rst:393 ../../library/stdtypes.rst:950 #: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:1139 -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4593 -#: ../../library/stdtypes.rst:5580 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4609 +#: ../../library/stdtypes.rst:5596 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4593 +#: ../../library/stdtypes.rst:4609 msgid "statement" msgstr "statement(陳述式)" @@ -8618,11 +8642,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:1260 #: ../../library/stdtypes.rst:1339 ../../library/stdtypes.rst:1383 #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1540 -#: ../../library/stdtypes.rst:2684 ../../library/stdtypes.rst:2703 -#: ../../library/stdtypes.rst:2810 ../../library/stdtypes.rst:4391 -#: ../../library/stdtypes.rst:4593 ../../library/stdtypes.rst:5073 -#: ../../library/stdtypes.rst:5330 ../../library/stdtypes.rst:5500 -#: ../../library/stdtypes.rst:5544 +#: ../../library/stdtypes.rst:2700 ../../library/stdtypes.rst:2719 +#: ../../library/stdtypes.rst:2826 ../../library/stdtypes.rst:4407 +#: ../../library/stdtypes.rst:4609 ../../library/stdtypes.rst:5089 +#: ../../library/stdtypes.rst:5346 ../../library/stdtypes.rst:5516 +#: ../../library/stdtypes.rst:5560 msgid "object" msgstr "object(物件)" @@ -8714,9 +8738,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:950 -#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4593 -#: ../../library/stdtypes.rst:5551 ../../library/stdtypes.rst:5565 -#: ../../library/stdtypes.rst:5580 +#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4609 +#: ../../library/stdtypes.rst:5567 ../../library/stdtypes.rst:5581 +#: ../../library/stdtypes.rst:5596 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -8732,8 +8756,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2560 -#: ../../library/stdtypes.rst:3779 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2576 +#: ../../library/stdtypes.rst:3795 msgid "+ (plus)" msgstr "+ (加號)" @@ -8745,13 +8769,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2560 -#: ../../library/stdtypes.rst:3779 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2576 +#: ../../library/stdtypes.rst:3795 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2517 -#: ../../library/stdtypes.rst:3736 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2533 +#: ../../library/stdtypes.rst:3752 msgid "* (asterisk)" msgstr "* (星號)" @@ -8763,8 +8787,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2481 -#: ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2497 +#: ../../library/stdtypes.rst:3720 msgid "% (percent)" msgstr "% (百分號)" @@ -8774,7 +8798,7 @@ msgstr "**" #: ../../library/stdtypes.rst:316 ../../library/stdtypes.rst:393 #: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4593 +#: ../../library/stdtypes.rst:4609 msgid "operations on" msgstr "operations on(操作於)" @@ -8783,7 +8807,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1606 -#: ../../library/stdtypes.rst:2684 ../../library/stdtypes.rst:5580 +#: ../../library/stdtypes.rst:2700 ../../library/stdtypes.rst:5596 msgid "module" msgstr "模組" @@ -8851,7 +8875,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4988 +#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:5004 msgid "protocol" msgstr "protocol(協定)" @@ -8877,7 +8901,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4593 +#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4609 msgid "len" msgstr "len" @@ -8954,14 +8978,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2684 -#: ../../library/stdtypes.rst:2810 ../../library/stdtypes.rst:2882 -#: ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2700 +#: ../../library/stdtypes.rst:2826 ../../library/stdtypes.rst:2898 +#: ../../library/stdtypes.rst:3720 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4593 -#: ../../library/stdtypes.rst:5330 ../../library/stdtypes.rst:5580 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4609 +#: ../../library/stdtypes.rst:5346 ../../library/stdtypes.rst:5596 msgid "type" msgstr "type(型別)" @@ -8969,7 +8993,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4593 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4609 msgid "del" msgstr "del" @@ -9010,8 +9034,8 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1553 -#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2335 -#: ../../library/stdtypes.rst:2481 +#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2351 +#: ../../library/stdtypes.rst:2497 msgid "string" msgstr "string(字串)" @@ -9032,17 +9056,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2676 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2692 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2684 -#: ../../library/stdtypes.rst:2703 ../../library/stdtypes.rst:2882 -#: ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2700 +#: ../../library/stdtypes.rst:2719 ../../library/stdtypes.rst:2898 +#: ../../library/stdtypes.rst:3720 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2882 +#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2898 msgid "methods" msgstr "methods(方法)" @@ -9050,239 +9074,239 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2149 ../../library/stdtypes.rst:3558 +#: ../../library/stdtypes.rst:2165 ../../library/stdtypes.rst:3574 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2149 +#: ../../library/stdtypes.rst:2165 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "! formatted string literal" msgstr "! formatted string literals(! 格式化字串常數)" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "formatted string literals" msgstr "formatted string literals(格式化字串常數)" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "! f-string" msgstr "! f-string(! f 字串)" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "! (exclamation mark)" msgstr "! (驚嘆號)" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "= (equals)" msgstr "= (等號)" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2351 msgid "for help in debugging using string literals" msgstr "" -#: ../../library/stdtypes.rst:2481 +#: ../../library/stdtypes.rst:2497 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2481 +#: ../../library/stdtypes.rst:2497 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2481 +#: ../../library/stdtypes.rst:2497 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2481 +#: ../../library/stdtypes.rst:2497 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2481 ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:2497 ../../library/stdtypes.rst:3720 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2481 ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:2497 ../../library/stdtypes.rst:3720 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2517 ../../library/stdtypes.rst:3736 +#: ../../library/stdtypes.rst:2533 ../../library/stdtypes.rst:3752 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2517 ../../library/stdtypes.rst:2560 -#: ../../library/stdtypes.rst:3736 ../../library/stdtypes.rst:3779 +#: ../../library/stdtypes.rst:2533 ../../library/stdtypes.rst:2576 +#: ../../library/stdtypes.rst:3752 ../../library/stdtypes.rst:3795 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2517 ../../library/stdtypes.rst:3736 +#: ../../library/stdtypes.rst:2533 ../../library/stdtypes.rst:3752 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2560 ../../library/stdtypes.rst:3779 +#: ../../library/stdtypes.rst:2576 ../../library/stdtypes.rst:3795 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2560 ../../library/stdtypes.rst:3779 +#: ../../library/stdtypes.rst:2576 ../../library/stdtypes.rst:3795 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2676 +#: ../../library/stdtypes.rst:2692 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2684 +#: ../../library/stdtypes.rst:2700 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2684 +#: ../../library/stdtypes.rst:2700 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3558 +#: ../../library/stdtypes.rst:3574 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3558 +#: ../../library/stdtypes.rst:3574 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:3720 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:3720 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:3720 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:3720 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4391 +#: ../../library/stdtypes.rst:4407 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4593 +#: ../../library/stdtypes.rst:4609 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4593 +#: ../../library/stdtypes.rst:4609 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:4703 +#: ../../library/stdtypes.rst:4719 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:4988 +#: ../../library/stdtypes.rst:5004 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:4988 +#: ../../library/stdtypes.rst:5004 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:4988 +#: ../../library/stdtypes.rst:5004 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5077 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5077 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5089 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5089 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5089 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5330 +#: ../../library/stdtypes.rst:5346 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5330 +#: ../../library/stdtypes.rst:5346 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5500 +#: ../../library/stdtypes.rst:5516 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5544 +#: ../../library/stdtypes.rst:5560 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5544 +#: ../../library/stdtypes.rst:5560 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5551 +#: ../../library/stdtypes.rst:5567 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5551 +#: ../../library/stdtypes.rst:5567 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5565 +#: ../../library/stdtypes.rst:5581 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5565 +#: ../../library/stdtypes.rst:5581 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5620 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5620 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" From 99350d0a1d34bbe96e7d916dff14ca48f7b08f69 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 25 May 2025 00:19:59 +0000 Subject: [PATCH 14/14] sync with cpython 698bf972 --- howto/free-threading-extensions.po | 6 +++--- library/multiprocessing.po | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/howto/free-threading-extensions.po b/howto/free-threading-extensions.po index 83e6596e5d..cdc3eb6298 100644 --- a/howto/free-threading-extensions.po +++ b/howto/free-threading-extensions.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-05-25 00:18+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-" @@ -424,8 +424,8 @@ msgstr "" #: ../../howto/free-threading-extensions.rst:250 msgid "" "`pypa/cibuildwheel `_ supports the " -"free-threaded build if you set `CIBW_FREE_THREADED_SUPPORT `_." +"free-threaded build if you set `CIBW_ENABLE to cpython-freethreading " +"`_." msgstr "" #: ../../howto/free-threading-extensions.rst:255 diff --git a/library/multiprocessing.po b/library/multiprocessing.po index 810572ad3d..c0a4fe1be3 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" +"POT-Creation-Date: 2025-05-25 00:18+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1605,7 +1605,7 @@ msgstr "" #: ../../library/multiprocessing.rst:1044 msgid "" "Add support for when a program which uses :mod:`multiprocessing` has been " -"frozen to produce a Windows executable. (Has been tested with **py2exe**, " +"frozen to produce an executable. (Has been tested with **py2exe**, " "**PyInstaller** and **cx_Freeze**.)" msgstr "" @@ -1643,10 +1643,10 @@ msgstr "" #: ../../library/multiprocessing.rst:1063 msgid "" -"Calling ``freeze_support()`` has no effect when invoked on any operating " -"system other than Windows. In addition, if the module is being run normally " -"by the Python interpreter on Windows (the program has not been frozen), then " -"``freeze_support()`` has no effect." +"Calling ``freeze_support()`` has no effect when the start method is not " +"*spawn*. In addition, if the module is being run normally by the Python " +"interpreter (the program has not been frozen), then ``freeze_support()`` has " +"no effect." msgstr "" #: ../../library/multiprocessing.rst:1070