diff --git a/c-api/cell.po b/c-api/cell.po index e78cab4a30..2f91c7b625 100644 --- a/c-api/cell.po +++ b/c-api/cell.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2024-07-10 00:04+0000\n" "PO-Revision-Date: 2022-10-16 15:33+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -68,10 +68,14 @@ msgid "" msgstr "建立並回傳一個包含 *ob* 的新 cell 物件。參數可以為 ``NULL``。" #: ../../c-api/cell.rst:42 -msgid "Return the contents of the cell *cell*." -msgstr "回傳 cell 內容中的 *cell*。" +msgid "" +"Return the contents of the cell *cell*, which can be ``NULL``. If *cell* is " +"not a cell object, returns ``NULL`` with an exception set." +msgstr "" +"回傳 cell 物件 *cell* 的內容,其可能為 ``NULL``。如果 *cell* 不是一個 cell 物" +"件,則將回傳 ``NULL`` 並設定例外。" -#: ../../c-api/cell.rst:47 +#: ../../c-api/cell.rst:48 msgid "" "Return the contents of the cell *cell*, but without checking that *cell* is " "non-``NULL`` and a cell object." @@ -79,18 +83,24 @@ msgstr "" "回傳 cell 物件 *cell* 的內容,但是不檢查 *cell* 是否非 ``NULL`` 並且為一個 " "cell 物件。" -#: ../../c-api/cell.rst:53 +#: ../../c-api/cell.rst:54 msgid "" "Set the contents of the cell object *cell* to *value*. This releases the " "reference to any current content of the cell. *value* may be ``NULL``. " -"*cell* must be non-``NULL``; if it is not a cell object, ``-1`` will be " -"returned. On success, ``0`` will be returned." +"*cell* must be non-``NULL``." msgstr "" "將 cell 物件 *cell* 的內容設為 *value*。這將釋放任何對 cell 物件當前內容的參" -"照。*value* 可以為 ``NULL``。*cell* 必須不為 ``NULL``;如果它不是一個 cell 物" -"件則將回傳 ``-1``。如果設定成功則將回傳 ``0``。" +"照。*value* 可以為 ``NULL``。*cell* 必須不為 ``NULL``。" + +#: ../../c-api/cell.rst:58 +msgid "" +"On success, return ``0``. If *cell* is not a cell object, set an exception " +"and return ``-1``." +msgstr "" +"在成功時回傳 ``0``。如果 *cell* 不是一個 cell 物件,則將設定例外並回傳 " +"``-1``。" -#: ../../c-api/cell.rst:61 +#: ../../c-api/cell.rst:64 msgid "" "Sets the value of the cell object *cell* to *value*. No reference counts " "are adjusted, and no checks are made for safety; *cell* must be non-``NULL`` " diff --git a/c-api/complex.po b/c-api/complex.po index a5e17cbf91..704d02b7b6 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 00:03+0000\n" +"POT-Creation-Date: 2024-07-18 00:03+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -52,43 +52,47 @@ msgid "" "The C structure which corresponds to the value portion of a Python complex " "number object. Most of the functions for dealing with complex number " "objects use structures of this type as input or output values, as " -"appropriate. It is defined as::" +"appropriate." msgstr "" "相對於 Python 複數物件之數值部分的 C 結構。大多數處理複數物件的函式根據需求會" -"使用這種型別的結構作為輸入或輸出值。它定義為: ::" +"使用這種型別的結構作為輸入或輸出值。" -#: ../../c-api/complex.rst:39 +#: ../../c-api/complex.rst:33 +msgid "The structure is defined as::" +msgstr "該結構被定義為: ::" + +#: ../../c-api/complex.rst:43 msgid "" "Return the sum of two complex numbers, using the C :c:type:`Py_complex` " "representation." msgstr "以 C 的 :c:type:`Py_complex` 表示形式來回傳兩個複數之和。" -#: ../../c-api/complex.rst:45 +#: ../../c-api/complex.rst:49 msgid "" "Return the difference between two complex numbers, using the C :c:type:" "`Py_complex` representation." msgstr "以 C 的 :c:type:`Py_complex` 表示形式來回傳兩個複數間的差。" -#: ../../c-api/complex.rst:51 +#: ../../c-api/complex.rst:55 msgid "" "Return the negation of the complex number *num*, using the C :c:type:" "`Py_complex` representation." msgstr "" "以 C 的 :c:type:`Py_complex` 表示形式來回傳複數 *num* 的相反數 (negation)。" -#: ../../c-api/complex.rst:57 +#: ../../c-api/complex.rst:61 msgid "" "Return the product of two complex numbers, using the C :c:type:`Py_complex` " "representation." msgstr "以 C 的 :c:type:`Py_complex` 表示形式來回傳兩個複數的乘積。" -#: ../../c-api/complex.rst:63 +#: ../../c-api/complex.rst:67 msgid "" "Return the quotient of two complex numbers, using the C :c:type:`Py_complex` " "representation." msgstr "以 C 的 :c:type:`Py_complex` 表示形式來回傳兩個複數的商。" -#: ../../c-api/complex.rst:66 +#: ../../c-api/complex.rst:70 msgid "" "If *divisor* is null, this method returns zero and sets :c:data:`errno` to :" "c:macro:`!EDOM`." @@ -96,14 +100,14 @@ msgstr "" "如果 *divisor* 為 null,則此方法會回傳零並將 :c:data:`errno` 設定為 :c:macro:" "`!EDOM`。" -#: ../../c-api/complex.rst:72 +#: ../../c-api/complex.rst:76 msgid "" "Return the exponentiation of *num* by *exp*, using the C :c:type:" "`Py_complex` representation." msgstr "" "以 C 的 :c:type:`Py_complex` 表示形式來回傳 *num* 的 *exp* 次方的結果。" -#: ../../c-api/complex.rst:75 +#: ../../c-api/complex.rst:79 msgid "" "If *num* is null and *exp* is not a positive real number, this method " "returns zero and sets :c:data:`errno` to :c:macro:`!EDOM`." @@ -111,16 +115,16 @@ msgstr "" "如果 *num* 為 null 且 *exp* 不是正實數,則此方法會回傳零並將 :c:data:`errno` " "設定為 :c:macro:`!EDOM`。" -#: ../../c-api/complex.rst:80 +#: ../../c-api/complex.rst:84 msgid "Complex Numbers as Python Objects" msgstr "作為 Python 物件的複數" -#: ../../c-api/complex.rst:85 +#: ../../c-api/complex.rst:89 msgid "" "This subtype of :c:type:`PyObject` represents a Python complex number object." msgstr "這個 :c:type:`PyObject` 的子型別代表一個 Python 複數物件。" -#: ../../c-api/complex.rst:90 +#: ../../c-api/complex.rst:94 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python complex number " "type. It is the same object as :class:`complex` in the Python layer." @@ -128,7 +132,7 @@ msgstr "" "這個 :c:type:`PyTypeObject` 的實例代表 Python 複數型別。它與 Python 層中的 :" "class:`complex` 是同一個物件。" -#: ../../c-api/complex.rst:96 +#: ../../c-api/complex.rst:100 msgid "" "Return true if its argument is a :c:type:`PyComplexObject` or a subtype of :" "c:type:`PyComplexObject`. This function always succeeds." @@ -136,7 +140,7 @@ msgstr "" "如果其引數是一個 :c:type:`PyComplexObject` 或者是 :c:type:`PyComplexObject` " "的子型別,則會回傳 true。這個函式不會失敗。" -#: ../../c-api/complex.rst:102 +#: ../../c-api/complex.rst:106 msgid "" "Return true if its argument is a :c:type:`PyComplexObject`, but not a " "subtype of :c:type:`PyComplexObject`. This function always succeeds." @@ -144,44 +148,65 @@ msgstr "" "如果其引數是一個 :c:type:`PyComplexObject`,但不是 :c:type:`PyComplexObject` " "的子型別,則會回傳 true。這個函式不會失敗。" -#: ../../c-api/complex.rst:108 +#: ../../c-api/complex.rst:112 msgid "" "Create a new Python complex number object from a C :c:type:`Py_complex` " -"value." -msgstr "從 C 的 :c:type:`Py_complex` 值建立一個新的 Python 複數物件。" - -#: ../../c-api/complex.rst:113 -msgid "Return a new :c:type:`PyComplexObject` object from *real* and *imag*." -msgstr "從 *real* 和 *imag* 回傳一個新的 :c:type:`PyComplexObject` 物件。" +"value. Return ``NULL`` with an exception set on error." +msgstr "" +"從 C 的 :c:type:`Py_complex` 值建立一個新的 Python 複數物件。在錯誤時回傳 " +"``NULL`` 並設定例外。" #: ../../c-api/complex.rst:118 +msgid "" +"Return a new :c:type:`PyComplexObject` object from *real* and *imag*. Return " +"``NULL`` with an exception set on error." +msgstr "" +"從 *real* 和 *imag* 回傳一個新的 :c:type:`PyComplexObject` 物件。在錯誤時回" +"傳 ``NULL`` 並設定例外。" + +#: ../../c-api/complex.rst:124 msgid "Return the real part of *op* as a C :c:expr:`double`." msgstr "以 C 的 :c:expr:`double` 形式回傳 *op* 的實部。" -#: ../../c-api/complex.rst:123 +#: ../../c-api/complex.rst:126 +msgid "" +"Upon failure, this method returns ``-1.0`` with an exception set, so one " +"should call :c:func:`PyErr_Occurred` to check for errors." +msgstr "" +"失敗時,此方法回傳 ``-1.0`` 並設定例外,因此應該呼叫 :c:func:" +"`PyErr_Occurred` 來檢查錯誤。" + +#: ../../c-api/complex.rst:132 msgid "Return the imaginary part of *op* as a C :c:expr:`double`." msgstr "將 *op* 的虛部作為 C 的 :c:expr:`double` 回傳。" -#: ../../c-api/complex.rst:128 +#: ../../c-api/complex.rst:137 msgid "Return the :c:type:`Py_complex` value of the complex number *op*." msgstr "回傳複數 *op* 的 :c:type:`Py_complex` 值。" -#: ../../c-api/complex.rst:130 +#: ../../c-api/complex.rst:139 msgid "" "If *op* is not a Python complex number object but has a :meth:`~object." "__complex__` method, this method will first be called to convert *op* to a " "Python complex number object. If :meth:`!__complex__` is not defined then " "it falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " -"defined then it falls back to :meth:`~object.__index__`. Upon failure, this " -"method returns ``-1.0`` as a real value." +"defined then it falls back to :meth:`~object.__index__`." msgstr "" "如果 *op* 不是 Python 複數物件,但有一個 :meth:`~object.__complex__` 方法,則" "首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" "未定義,那麼它會回退到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未" -"定義,則它將繼續回退為 :meth:`~object.__index__`。失敗時,此方法回傳 " -"``-1.0`` 作為實部值。" +"定義,則它將繼續回退為 :meth:`~object.__index__`。" -#: ../../c-api/complex.rst:137 +#: ../../c-api/complex.rst:145 +msgid "" +"Upon failure, this method returns :c:type:`Py_complex` with :c:member:" +"`~Py_complex.real` set to ``-1.0`` and with an exception set, so one should " +"call :c:func:`PyErr_Occurred` to check for errors." +msgstr "" +"失敗時,此方法回傳 :c:type:`Py_complex` 並將 :c:member:`~Py_complex.real` 設" +"為 ``-1.0``,並設定例外,因此應該呼叫 :c:func:`PyErr_Occurred` 來檢查錯誤。" + +#: ../../c-api/complex.rst:149 msgid "Use :meth:`~object.__index__` if available." msgstr "如果可用則使用 :meth:`~object.__index__`。" diff --git a/c-api/init.po b/c-api/init.po index 17b5138a1d..c4201abdb6 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-16 00:03+0000\n" +"POT-Creation-Date: 2024-06-22 00:03+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-" @@ -568,12 +568,24 @@ msgid "" "`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). Normally " -"the return value is ``0``. If there were errors during finalization " +"second time (without calling :c:func:`Py_Initialize` again first)." +msgstr "" + +#: ../../c-api/init.rst:393 +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." +msgstr "" + +#: ../../c-api/init.rst:398 +msgid "" +"Normally the return value is ``0``. If there were errors during finalization " "(flushing buffered data), ``-1`` is returned." msgstr "" -#: ../../c-api/init.rst:395 +#: ../../c-api/init.rst:402 msgid "" "This function is provided for a number of reasons. An embedding application " "might want to restart Python without having to restart the application " @@ -584,7 +596,7 @@ msgid "" "Python before exiting from the application." msgstr "" -#: ../../c-api/init.rst:403 +#: ../../c-api/init.rst:410 msgid "" "**Bugs and caveats:** The destruction of modules and objects in modules is " "done in random order; this may cause destructors (:meth:`~object.__del__` " @@ -599,7 +611,7 @@ msgid "" "more than once." msgstr "" -#: ../../c-api/init.rst:414 +#: ../../c-api/init.rst:421 msgid "" "Raises an :ref:`auditing event ` ``cpython." "_PySys_ClearAuditHooks`` with no arguments." @@ -607,68 +619,68 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "_PySys_ClearAuditHooks``。" -#: ../../c-api/init.rst:420 +#: ../../c-api/init.rst:427 msgid "" "This is a backwards-compatible version of :c:func:`Py_FinalizeEx` that " "disregards the return value." msgstr "" -#: ../../c-api/init.rst:425 +#: ../../c-api/init.rst:432 msgid "Process-wide parameters" msgstr "" -#: ../../c-api/init.rst:435 +#: ../../c-api/init.rst:442 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "stdio_encoding` and :c:member:`PyConfig.stdio_errors` should be used " "instead, see :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:440 +#: ../../c-api/init.rst:447 msgid "" "This function should be called before :c:func:`Py_Initialize`, if it is " "called at all. It specifies which encoding and error handling to use with " "standard IO, with the same meanings as in :func:`str.encode`." msgstr "" -#: ../../c-api/init.rst:444 +#: ../../c-api/init.rst:451 msgid "" "It overrides :envvar:`PYTHONIOENCODING` values, and allows embedding code to " "control IO encoding when the environment variable does not work." msgstr "" -#: ../../c-api/init.rst:447 +#: ../../c-api/init.rst:454 msgid "" "*encoding* and/or *errors* may be ``NULL`` to use :envvar:`PYTHONIOENCODING` " "and/or default values (depending on other settings)." msgstr "" -#: ../../c-api/init.rst:451 +#: ../../c-api/init.rst:458 msgid "" "Note that :data:`sys.stderr` always uses the \"backslashreplace\" error " "handler, regardless of this (or any other) setting." msgstr "" -#: ../../c-api/init.rst:454 +#: ../../c-api/init.rst:461 msgid "" "If :c:func:`Py_FinalizeEx` is called, this function will need to be called " "again in order to affect subsequent calls to :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:457 +#: ../../c-api/init.rst:464 msgid "" "Returns ``0`` if successful, a nonzero value on error (e.g. calling after " "the interpreter has already been initialized)." msgstr "" -#: ../../c-api/init.rst:472 +#: ../../c-api/init.rst:479 msgid "" "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:476 +#: ../../c-api/init.rst:483 msgid "" "This function should be called before :c:func:`Py_Initialize` is called for " "the first time, if it is called at all. It tells the interpreter the value " @@ -682,32 +694,32 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:487 +#: ../../c-api/init.rst:494 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" "`wchar_t *` string." msgstr "" -#: ../../c-api/init.rst:497 +#: ../../c-api/init.rst:504 msgid "" "Return the program name set with :c:func:`Py_SetProgramName`, or the " "default. The returned string points into static storage; the caller should " "not modify its value." msgstr "" -#: ../../c-api/init.rst:501 ../../c-api/init.rst:520 ../../c-api/init.rst:561 -#: ../../c-api/init.rst:580 ../../c-api/init.rst:604 ../../c-api/init.rst:827 +#: ../../c-api/init.rst:508 ../../c-api/init.rst:527 ../../c-api/init.rst:568 +#: ../../c-api/init.rst:587 ../../c-api/init.rst:611 ../../c-api/init.rst:834 msgid "" "This function should not be called before :c:func:`Py_Initialize`, otherwise " "it returns ``NULL``." msgstr "此函式不應該在 :c:func:`Py_Initialize` 之前呼叫,否則會回傳 ``NULL``。" -#: ../../c-api/init.rst:504 ../../c-api/init.rst:523 ../../c-api/init.rst:564 -#: ../../c-api/init.rst:583 ../../c-api/init.rst:609 ../../c-api/init.rst:830 +#: ../../c-api/init.rst:511 ../../c-api/init.rst:530 ../../c-api/init.rst:571 +#: ../../c-api/init.rst:590 ../../c-api/init.rst:616 ../../c-api/init.rst:837 msgid "It now returns ``NULL`` if called before :c:func:`Py_Initialize`." msgstr "如果在 :c:func:`Py_Initialize` 之前呼叫,現在會回傳 ``NULL``。" -#: ../../c-api/init.rst:510 +#: ../../c-api/init.rst:517 msgid "" "Return the *prefix* for installed platform-independent files. This is " "derived through a number of complicated rules from the program name set " @@ -721,7 +733,7 @@ msgid "" "also the next function." msgstr "" -#: ../../c-api/init.rst:529 +#: ../../c-api/init.rst:536 msgid "" "Return the *exec-prefix* for installed platform-*dependent* files. This is " "derived through a number of complicated rules from the program name set " @@ -735,7 +747,7 @@ msgid "" "on Unix." msgstr "" -#: ../../c-api/init.rst:539 +#: ../../c-api/init.rst:546 msgid "" "Background: The exec-prefix differs from the prefix when platform dependent " "files (such as executables and shared libraries) are installed in a " @@ -744,7 +756,7 @@ msgid "" "independent may be installed in :file:`/usr/local`." msgstr "" -#: ../../c-api/init.rst:545 +#: ../../c-api/init.rst:552 msgid "" "Generally speaking, a platform is a combination of hardware and software " "families, e.g. Sparc machines running the Solaris 2.x operating system are " @@ -758,7 +770,7 @@ msgid "" "independent from the Python version by which they were compiled!)." msgstr "" -#: ../../c-api/init.rst:556 +#: ../../c-api/init.rst:563 msgid "" "System administrators will know how to configure the :program:`mount` or :" "program:`automount` programs to share :file:`/usr/local` between platforms " @@ -766,7 +778,7 @@ msgid "" "platform." msgstr "" -#: ../../c-api/init.rst:574 +#: ../../c-api/init.rst:581 msgid "" "Return the full program name of the Python executable; this is computed as " "a side-effect of deriving the default module search path from the program " @@ -775,7 +787,7 @@ msgid "" "available to Python code as ``sys.executable``." msgstr "" -#: ../../c-api/init.rst:594 +#: ../../c-api/init.rst:601 msgid "" "Return the default module search path; this is computed from the program " "name (set by :c:func:`Py_SetProgramName` above) and some environment " @@ -788,7 +800,7 @@ msgid "" "for loading modules." msgstr "" -#: ../../c-api/init.rst:620 +#: ../../c-api/init.rst:627 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "module_search_paths` and :c:member:`PyConfig.module_search_paths_set` should " @@ -796,7 +808,7 @@ msgid "" "config>`." msgstr "" -#: ../../c-api/init.rst:625 +#: ../../c-api/init.rst:632 msgid "" "Set the default module search path. If this function is called before :c:" "func:`Py_Initialize`, then :c:func:`Py_GetPath` won't attempt to compute a " @@ -807,7 +819,7 @@ msgid "" "on Windows." msgstr "" -#: ../../c-api/init.rst:633 +#: ../../c-api/init.rst:640 msgid "" "This also causes :data:`sys.executable` to be set to the program full path " "(see :c:func:`Py_GetProgramFullPath`) and for :data:`sys.prefix` and :data:" @@ -815,32 +827,32 @@ msgid "" "required after calling :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:638 ../../c-api/init.rst:753 ../../c-api/init.rst:789 -#: ../../c-api/init.rst:815 +#: ../../c-api/init.rst:645 ../../c-api/init.rst:760 ../../c-api/init.rst:796 +#: ../../c-api/init.rst:822 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" "`wchar_*` string." msgstr "" -#: ../../c-api/init.rst:641 +#: ../../c-api/init.rst:648 msgid "" "The path argument is copied internally, so the caller may free it after the " "call completes." msgstr "" -#: ../../c-api/init.rst:644 +#: ../../c-api/init.rst:651 msgid "" "The program full path is now used for :data:`sys.executable`, instead of the " "program name." msgstr "" -#: ../../c-api/init.rst:653 +#: ../../c-api/init.rst:660 msgid "" "Return the version of this Python interpreter. This is a string that looks " "something like ::" msgstr "" -#: ../../c-api/init.rst:660 +#: ../../c-api/init.rst:667 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 " @@ -849,11 +861,11 @@ msgid "" "version`." msgstr "" -#: ../../c-api/init.rst:665 +#: ../../c-api/init.rst:672 msgid "See also the :c:var:`Py_Version` constant." msgstr "" -#: ../../c-api/init.rst:672 +#: ../../c-api/init.rst:679 msgid "" "Return the platform identifier for the current platform. On Unix, this is " "formed from the \"official\" name of the operating system, converted to " @@ -864,42 +876,42 @@ msgid "" "available to Python code as ``sys.platform``." msgstr "" -#: ../../c-api/init.rst:683 +#: ../../c-api/init.rst:690 msgid "" "Return the official copyright string for the current Python version, for " "example" msgstr "" -#: ../../c-api/init.rst:685 +#: ../../c-api/init.rst:692 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" -#: ../../c-api/init.rst:689 +#: ../../c-api/init.rst:696 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as ``sys.copyright``." msgstr "" -#: ../../c-api/init.rst:695 +#: ../../c-api/init.rst:702 msgid "" "Return an indication of the compiler used to build the current Python " "version, in square brackets, for example::" msgstr "" -#: ../../c-api/init.rst:702 ../../c-api/init.rst:716 +#: ../../c-api/init.rst:709 ../../c-api/init.rst:723 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as part of the variable " "``sys.version``." msgstr "" -#: ../../c-api/init.rst:709 +#: ../../c-api/init.rst:716 msgid "" "Return information about the sequence number and build date and time of the " "current Python interpreter instance, for example ::" msgstr "" -#: ../../c-api/init.rst:728 +#: ../../c-api/init.rst:735 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " @@ -907,7 +919,7 @@ msgid "" "config>`." msgstr "" -#: ../../c-api/init.rst:733 +#: ../../c-api/init.rst:740 msgid "" "Set :data:`sys.argv` based on *argc* and *argv*. These parameters are " "similar to those passed to the program's :c:func:`main` function with the " @@ -918,80 +930,80 @@ msgid "" "fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -#: ../../c-api/init.rst:741 +#: ../../c-api/init.rst:748 msgid "" "If *updatepath* is zero, this is all the function does. If *updatepath* is " "non-zero, the function also modifies :data:`sys.path` according to the " "following algorithm:" msgstr "" -#: ../../c-api/init.rst:745 +#: ../../c-api/init.rst:752 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`." msgstr "" -#: ../../c-api/init.rst:748 +#: ../../c-api/init.rst:755 msgid "" "Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an " "existing file name), an empty string is prepended to :data:`sys.path`, which " "is the same as prepending the current working directory (``\".\"``)." msgstr "" -#: ../../c-api/init.rst:756 ../../c-api/init.rst:792 +#: ../../c-api/init.rst:763 ../../c-api/init.rst:799 msgid "" "See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " "members of the :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:760 +#: ../../c-api/init.rst:767 msgid "" "It is recommended that applications embedding the Python interpreter for " "purposes other than executing a single script pass ``0`` as *updatepath*, " "and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." msgstr "" -#: ../../c-api/init.rst:765 +#: ../../c-api/init.rst:772 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::" msgstr "" -#: ../../c-api/init.rst:781 +#: ../../c-api/init.rst:788 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 `." msgstr "" -#: ../../c-api/init.rst:785 +#: ../../c-api/init.rst:792 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`." msgstr "" -#: ../../c-api/init.rst:795 +#: ../../c-api/init.rst:802 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -#: ../../c-api/init.rst:802 +#: ../../c-api/init.rst:809 msgid "" "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:806 +#: ../../c-api/init.rst:813 msgid "" "Set the default \"home\" directory, that is, the location of the standard " "Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument " "string." msgstr "" -#: ../../c-api/init.rst:810 +#: ../../c-api/init.rst:817 msgid "" "The argument should point to a zero-terminated character string in static " "storage whose contents will not change for the duration of the program's " @@ -999,18 +1011,18 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:823 +#: ../../c-api/init.rst:830 msgid "" "Return the default \"home\", that is, the value set by a previous call to :c:" "func:`Py_SetPythonHome`, or the value of the :envvar:`PYTHONHOME` " "environment variable if it is set." msgstr "" -#: ../../c-api/init.rst:837 +#: ../../c-api/init.rst:844 msgid "Thread State and the Global Interpreter Lock" msgstr "" -#: ../../c-api/init.rst:844 +#: ../../c-api/init.rst:851 msgid "" "The Python interpreter is not fully thread-safe. In order to support multi-" "threaded Python programs, there's a global lock, called the :term:`global " @@ -1022,7 +1034,7 @@ msgid "" "once instead of twice." msgstr "" -#: ../../c-api/init.rst:854 +#: ../../c-api/init.rst:861 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 " @@ -1032,7 +1044,7 @@ msgid "" "a file, so that other Python threads can run in the meantime." msgstr "" -#: ../../c-api/init.rst:864 +#: ../../c-api/init.rst:871 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " "inside a data structure called :c:type:`PyThreadState`. There's also one " @@ -1040,32 +1052,32 @@ msgid "" "retrieved using :c:func:`PyThreadState_Get`." msgstr "" -#: ../../c-api/init.rst:870 +#: ../../c-api/init.rst:877 msgid "Releasing the GIL from extension code" msgstr "" -#: ../../c-api/init.rst:872 +#: ../../c-api/init.rst:879 msgid "" "Most extension code manipulating the :term:`GIL` has the following simple " "structure::" msgstr "" -#: ../../c-api/init.rst:881 +#: ../../c-api/init.rst:888 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" -#: ../../c-api/init.rst:891 +#: ../../c-api/init.rst:898 msgid "" "The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a " "hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the " "block." msgstr "" -#: ../../c-api/init.rst:895 +#: ../../c-api/init.rst:902 msgid "The block above expands to the following code::" msgstr "" -#: ../../c-api/init.rst:907 +#: ../../c-api/init.rst:914 msgid "" "Here is how these functions work: the global interpreter lock is used to " "protect the pointer to the current thread state. When releasing the lock " @@ -1076,7 +1088,7 @@ msgid "" "state, the lock must be acquired before storing the thread state pointer." msgstr "" -#: ../../c-api/init.rst:916 +#: ../../c-api/init.rst:923 msgid "" "Calling system I/O functions is the most common use case for releasing the " "GIL, but it can also be useful before calling long-running computations " @@ -1086,11 +1098,11 @@ msgid "" "compressing or hashing data." msgstr "" -#: ../../c-api/init.rst:927 +#: ../../c-api/init.rst:934 msgid "Non-Python created threads" msgstr "" -#: ../../c-api/init.rst:929 +#: ../../c-api/init.rst:936 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 " @@ -1100,7 +1112,7 @@ msgid "" "for them." msgstr "" -#: ../../c-api/init.rst:936 +#: ../../c-api/init.rst:943 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " @@ -1111,14 +1123,14 @@ msgid "" "finally free the thread state data structure." msgstr "" -#: ../../c-api/init.rst:944 +#: ../../c-api/init.rst:951 msgid "" "The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions " "do all of the above automatically. The typical idiom for calling into " "Python from a C thread is::" msgstr "" -#: ../../c-api/init.rst:958 +#: ../../c-api/init.rst:965 msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " @@ -1127,11 +1139,11 @@ msgid "" "``PyGILState_*`` API is unsupported." msgstr "" -#: ../../c-api/init.rst:968 +#: ../../c-api/init.rst:975 msgid "Cautions about fork()" msgstr "" -#: ../../c-api/init.rst:970 +#: ../../c-api/init.rst:977 msgid "" "Another important thing to note about threads is their behaviour in the face " "of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " @@ -1140,7 +1152,7 @@ msgid "" "CPython's runtime." msgstr "" -#: ../../c-api/init.rst:976 +#: ../../c-api/init.rst:983 msgid "" "The fact that only the \"current\" thread remains means any locks held by " "other threads will never be released. Python solves this for :func:`os.fork` " @@ -1157,7 +1169,7 @@ msgid "" "locks, but is not always able to." msgstr "" -#: ../../c-api/init.rst:991 +#: ../../c-api/init.rst:998 msgid "" "The fact that all other threads go away also means that CPython's runtime " "state there must be cleaned up properly, which :func:`os.fork` does. This " @@ -1170,17 +1182,17 @@ msgid "" "called immediately after." msgstr "" -#: ../../c-api/init.rst:1004 +#: ../../c-api/init.rst:1011 msgid "High-level API" msgstr "高階 API" -#: ../../c-api/init.rst:1006 +#: ../../c-api/init.rst:1013 msgid "" "These are the most commonly used types and functions when writing C " "extension code, or when embedding the Python interpreter:" msgstr "" -#: ../../c-api/init.rst:1011 +#: ../../c-api/init.rst:1018 msgid "" "This data structure represents the state shared by a number of cooperating " "threads. Threads belonging to the same interpreter share their module " @@ -1188,7 +1200,7 @@ msgid "" "in this structure." msgstr "" -#: ../../c-api/init.rst:1016 +#: ../../c-api/init.rst:1023 msgid "" "Threads belonging to different interpreters initially share nothing, except " "process state like available memory, open file descriptors and such. The " @@ -1196,52 +1208,52 @@ msgid "" "which interpreter they belong." msgstr "" -#: ../../c-api/init.rst:1024 +#: ../../c-api/init.rst:1031 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" -#: ../../c-api/init.rst:1029 +#: ../../c-api/init.rst:1036 msgid "This thread's interpreter state." msgstr "" -#: ../../c-api/init.rst:1040 +#: ../../c-api/init.rst:1047 msgid "Deprecated function which does nothing." msgstr "" -#: ../../c-api/init.rst:1042 +#: ../../c-api/init.rst:1049 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: ../../c-api/init.rst:1044 +#: ../../c-api/init.rst:1051 msgid "The function now does nothing." msgstr "此函式現在不會做任何事情。" -#: ../../c-api/init.rst:1047 +#: ../../c-api/init.rst:1054 msgid "" "This function is now called by :c:func:`Py_Initialize()`, so you don't have " "to call it yourself anymore." msgstr "" -#: ../../c-api/init.rst:1051 +#: ../../c-api/init.rst:1058 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: ../../c-api/init.rst:1061 +#: ../../c-api/init.rst:1068 msgid "" "Returns a non-zero value if :c:func:`PyEval_InitThreads` has been called. " "This function can be called without holding the GIL, and therefore can be " "used to avoid calls to the locking API when running single-threaded." msgstr "" -#: ../../c-api/init.rst:1065 +#: ../../c-api/init.rst:1072 msgid "The :term:`GIL` is now initialized by :c:func:`Py_Initialize()`." msgstr "" -#: ../../c-api/init.rst:1073 +#: ../../c-api/init.rst:1080 msgid "" "Release the global interpreter lock (if it has been created) and reset the " "thread state to ``NULL``, returning the previous thread state (which is not " @@ -1249,7 +1261,7 @@ msgid "" "acquired it." msgstr "" -#: ../../c-api/init.rst:1081 +#: ../../c-api/init.rst:1088 msgid "" "Acquire the global interpreter lock (if it has been created) and set the " "thread state to *tstate*, which must not be ``NULL``. If the lock has been " @@ -1257,8 +1269,8 @@ msgid "" "ensues." msgstr "" -#: ../../c-api/init.rst:1087 ../../c-api/init.rst:1133 -#: ../../c-api/init.rst:1415 +#: ../../c-api/init.rst:1094 ../../c-api/init.rst:1140 +#: ../../c-api/init.rst:1422 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 " @@ -1267,27 +1279,27 @@ msgid "" "avoid unwanted termination." msgstr "" -#: ../../c-api/init.rst:1095 +#: ../../c-api/init.rst:1102 msgid "" "Return the current thread state. The global interpreter lock must be held. " "When the current thread state is ``NULL``, this issues a fatal error (so " "that the caller needn't check for ``NULL``)." msgstr "" -#: ../../c-api/init.rst:1102 +#: ../../c-api/init.rst:1109 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." msgstr "" -#: ../../c-api/init.rst:1107 +#: ../../c-api/init.rst:1114 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:1112 +#: ../../c-api/init.rst:1119 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 " @@ -1300,7 +1312,7 @@ msgid "" "is acceptable." msgstr "" -#: ../../c-api/init.rst:1122 +#: ../../c-api/init.rst:1129 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:" @@ -1310,13 +1322,13 @@ msgid "" "func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1129 +#: ../../c-api/init.rst:1136 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:1141 +#: ../../c-api/init.rst:1148 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:" @@ -1324,13 +1336,13 @@ msgid "" "caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1146 +#: ../../c-api/init.rst:1153 msgid "" "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:1152 +#: ../../c-api/init.rst:1159 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 " @@ -1338,7 +1350,7 @@ msgid "" "made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1160 +#: ../../c-api/init.rst:1167 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 " @@ -1349,13 +1361,13 @@ msgid "" "otherwise behave differently." msgstr "" -#: ../../c-api/init.rst:1172 +#: ../../c-api/init.rst:1179 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:1178 +#: ../../c-api/init.rst:1185 msgid "" "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" "``. Note that it contains an opening brace; it must be matched with a " @@ -1363,7 +1375,7 @@ msgid "" "discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1186 +#: ../../c-api/init.rst:1193 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" @@ -1371,40 +1383,40 @@ msgid "" "macro." msgstr "" -#: ../../c-api/init.rst:1194 +#: ../../c-api/init.rst:1201 msgid "" "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:1200 +#: ../../c-api/init.rst:1207 msgid "" "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:1206 +#: ../../c-api/init.rst:1213 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1208 +#: ../../c-api/init.rst:1215 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1210 +#: ../../c-api/init.rst:1217 msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1216 +#: ../../c-api/init.rst:1223 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:1220 +#: ../../c-api/init.rst:1227 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_New`` with no arguments." @@ -1412,13 +1424,13 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_New``。" -#: ../../c-api/init.rst:1225 +#: ../../c-api/init.rst:1232 msgid "" "Reset all information in an interpreter state object. The global " "interpreter lock must be held." msgstr "" -#: ../../c-api/init.rst:1228 +#: ../../c-api/init.rst:1235 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_Clear`` with no arguments." @@ -1426,40 +1438,40 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1233 +#: ../../c-api/init.rst:1240 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:1240 +#: ../../c-api/init.rst:1247 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:1247 +#: ../../c-api/init.rst:1254 msgid "" "Reset all information in a thread state object. The global interpreter lock " "must be held." msgstr "" -#: ../../c-api/init.rst:1250 +#: ../../c-api/init.rst:1257 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:1257 +#: ../../c-api/init.rst:1264 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`." msgstr "" -#: ../../c-api/init.rst:1264 +#: ../../c-api/init.rst:1271 msgid "" "Destroy the current thread state and release the global interpreter lock. " "Like :c:func:`PyThreadState_Delete`, the global interpreter lock need not be " @@ -1467,119 +1479,119 @@ msgid "" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1272 +#: ../../c-api/init.rst:1279 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1274 +#: ../../c-api/init.rst:1281 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1277 +#: ../../c-api/init.rst:1284 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1279 ../../c-api/init.rst:1288 -#: ../../c-api/init.rst:1297 +#: ../../c-api/init.rst:1286 ../../c-api/init.rst:1295 +#: ../../c-api/init.rst:1304 msgid "*tstate* must not be ``NULL``." msgstr "*tstate* 不可為 ``NULL``。" -#: ../../c-api/init.rst:1286 +#: ../../c-api/init.rst:1293 msgid "" "Get the unique thread state identifier of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1295 +#: ../../c-api/init.rst:1302 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1304 +#: ../../c-api/init.rst:1311 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1306 +#: ../../c-api/init.rst:1313 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1313 +#: ../../c-api/init.rst:1320 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1316 +#: ../../c-api/init.rst:1323 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1324 +#: ../../c-api/init.rst:1331 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1326 +#: ../../c-api/init.rst:1333 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:1329 ../../c-api/init.rst:1339 +#: ../../c-api/init.rst:1336 ../../c-api/init.rst:1346 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/init.rst:1336 +#: ../../c-api/init.rst:1343 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:1346 +#: ../../c-api/init.rst:1353 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:1350 +#: ../../c-api/init.rst:1357 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:1357 +#: ../../c-api/init.rst:1364 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1359 +#: ../../c-api/init.rst:1366 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1362 +#: ../../c-api/init.rst:1369 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1365 +#: ../../c-api/init.rst:1372 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1370 +#: ../../c-api/init.rst:1377 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1372 ../../c-api/init.rst:1380 +#: ../../c-api/init.rst:1379 ../../c-api/init.rst:1387 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1378 +#: ../../c-api/init.rst:1385 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1387 +#: ../../c-api/init.rst:1394 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 " @@ -1588,7 +1600,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1396 +#: ../../c-api/init.rst:1403 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. " @@ -1600,33 +1612,33 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1404 +#: ../../c-api/init.rst:1411 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1410 +#: ../../c-api/init.rst:1417 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:1421 ../../c-api/init.rst:1459 +#: ../../c-api/init.rst:1428 ../../c-api/init.rst:1466 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." msgstr "" -#: ../../c-api/init.rst:1426 +#: ../../c-api/init.rst:1433 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:1432 +#: ../../c-api/init.rst:1439 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 " @@ -1635,25 +1647,25 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1438 +#: ../../c-api/init.rst:1445 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:1444 +#: ../../c-api/init.rst:1451 msgid "" "Acquire the global interpreter lock. The lock must have been created " "earlier. If this thread already has the lock, a deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1447 +#: ../../c-api/init.rst:1454 msgid "" "This function does not update the current thread state. Please use :c:func:" "`PyEval_RestoreThread` or :c:func:`PyEval_AcquireThread` instead." msgstr "" -#: ../../c-api/init.rst:1453 +#: ../../c-api/init.rst:1460 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 " @@ -1662,23 +1674,23 @@ msgid "" "avoid unwanted termination." msgstr "" -#: ../../c-api/init.rst:1467 +#: ../../c-api/init.rst:1474 msgid "" "Release the global interpreter lock. The lock must have been created " "earlier." msgstr "" -#: ../../c-api/init.rst:1469 +#: ../../c-api/init.rst:1476 msgid "" "This function does not update the current thread state. Please use :c:func:" "`PyEval_SaveThread` or :c:func:`PyEval_ReleaseThread` instead." msgstr "" -#: ../../c-api/init.rst:1478 +#: ../../c-api/init.rst:1485 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1480 +#: ../../c-api/init.rst:1487 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 " @@ -1686,7 +1698,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1485 +#: ../../c-api/init.rst:1492 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1697,31 +1709,31 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1492 +#: ../../c-api/init.rst:1499 msgid "" "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:1498 +#: ../../c-api/init.rst:1505 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:1504 +#: ../../c-api/init.rst:1511 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1508 +#: ../../c-api/init.rst:1515 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:1512 +#: ../../c-api/init.rst:1519 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " @@ -1729,44 +1741,44 @@ msgid "" "`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1520 +#: ../../c-api/init.rst:1527 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:1524 +#: ../../c-api/init.rst:1531 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1529 +#: ../../c-api/init.rst:1536 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:1534 +#: ../../c-api/init.rst:1541 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1539 +#: ../../c-api/init.rst:1546 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:1545 +#: ../../c-api/init.rst:1552 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)." msgstr "" -#: ../../c-api/init.rst:1552 +#: ../../c-api/init.rst:1559 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 " @@ -1775,37 +1787,37 @@ msgid "" "`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1559 +#: ../../c-api/init.rst:1566 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1564 +#: ../../c-api/init.rst:1571 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1571 +#: ../../c-api/init.rst:1578 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1575 +#: ../../c-api/init.rst:1582 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1579 +#: ../../c-api/init.rst:1586 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1581 +#: ../../c-api/init.rst:1588 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1595 +#: ../../c-api/init.rst:1602 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -1818,13 +1830,13 @@ msgid "" "underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1605 +#: ../../c-api/init.rst:1612 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1608 +#: ../../c-api/init.rst:1615 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 " @@ -1835,7 +1847,7 @@ msgid "" "state." msgstr "" -#: ../../c-api/init.rst:1617 +#: ../../c-api/init.rst:1624 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. " @@ -1847,13 +1859,13 @@ msgid "" "released here." msgstr "" -#: ../../c-api/init.rst:1628 +#: ../../c-api/init.rst:1635 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1642 +#: ../../c-api/init.rst:1649 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:" @@ -1861,11 +1873,11 @@ msgid "" "internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1651 +#: ../../c-api/init.rst:1658 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1653 +#: ../../c-api/init.rst:1660 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -1873,7 +1885,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1659 +#: ../../c-api/init.rst:1666 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -1885,7 +1897,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1670 +#: ../../c-api/init.rst:1677 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:" @@ -1895,7 +1907,7 @@ msgid "" "shared between these modules." msgstr "" -#: ../../c-api/init.rst:1690 +#: ../../c-api/init.rst:1697 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -1904,7 +1916,7 @@ msgid "" "single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1702 +#: ../../c-api/init.rst:1709 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 " @@ -1914,17 +1926,17 @@ msgid "" "be held before calling this function. No GIL is held when it returns." msgstr "" -#: ../../c-api/init.rst:1710 +#: ../../c-api/init.rst:1717 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1715 +#: ../../c-api/init.rst:1722 msgid "A Per-Interpreter GIL" msgstr "" -#: ../../c-api/init.rst:1717 +#: ../../c-api/init.rst:1724 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -1936,7 +1948,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:1734 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -1950,7 +1962,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1738 +#: ../../c-api/init.rst:1745 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -1958,7 +1970,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1743 +#: ../../c-api/init.rst:1750 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -1968,11 +1980,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1754 +#: ../../c-api/init.rst:1761 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1756 +#: ../../c-api/init.rst:1763 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -1985,7 +1997,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1766 +#: ../../c-api/init.rst:1773 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -1994,7 +2006,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1772 +#: ../../c-api/init.rst:1779 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -2006,25 +2018,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1783 +#: ../../c-api/init.rst:1790 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1785 +#: ../../c-api/init.rst:1792 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:1792 +#: ../../c-api/init.rst:1799 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:1796 +#: ../../c-api/init.rst:1803 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2032,17 +2044,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1801 +#: ../../c-api/init.rst:1808 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1802 +#: ../../c-api/init.rst:1809 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1805 +#: ../../c-api/init.rst:1812 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2050,20 +2062,20 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1810 +#: ../../c-api/init.rst:1817 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:1813 +#: ../../c-api/init.rst:1820 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:1818 +#: ../../c-api/init.rst:1825 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 " @@ -2073,7 +2085,7 @@ msgid "" "`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1827 +#: ../../c-api/init.rst:1834 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 " @@ -2081,18 +2093,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1836 +#: ../../c-api/init.rst:1843 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1841 +#: ../../c-api/init.rst:1848 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:1845 +#: ../../c-api/init.rst:1852 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 " @@ -2102,7 +2114,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:1862 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 " @@ -2114,66 +2126,66 @@ msgid "" "value of *what*:" msgstr "" -#: ../../c-api/init.rst:1864 +#: ../../c-api/init.rst:1871 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1864 +#: ../../c-api/init.rst:1871 msgid "Meaning of *arg*" msgstr "" -#: ../../c-api/init.rst:1866 +#: ../../c-api/init.rst:1873 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1866 ../../c-api/init.rst:1871 -#: ../../c-api/init.rst:1882 +#: ../../c-api/init.rst:1873 ../../c-api/init.rst:1878 +#: ../../c-api/init.rst:1889 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1868 +#: ../../c-api/init.rst:1875 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1868 +#: ../../c-api/init.rst:1875 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1871 +#: ../../c-api/init.rst:1878 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1873 +#: ../../c-api/init.rst:1880 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1873 +#: ../../c-api/init.rst:1880 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1876 +#: ../../c-api/init.rst:1883 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1876 ../../c-api/init.rst:1878 -#: ../../c-api/init.rst:1880 +#: ../../c-api/init.rst:1883 ../../c-api/init.rst:1885 +#: ../../c-api/init.rst:1887 msgid "Function object being called." msgstr "" -#: ../../c-api/init.rst:1878 +#: ../../c-api/init.rst:1885 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1880 +#: ../../c-api/init.rst:1887 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1882 +#: ../../c-api/init.rst:1889 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1887 +#: ../../c-api/init.rst:1894 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 " @@ -2182,7 +2194,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1896 +#: ../../c-api/init.rst:1903 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 " @@ -2194,7 +2206,7 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1907 +#: ../../c-api/init.rst:1914 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 " @@ -2202,31 +2214,31 @@ msgid "" "f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:1915 +#: ../../c-api/init.rst:1922 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:1921 +#: ../../c-api/init.rst:1928 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:1927 +#: ../../c-api/init.rst:1934 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:1933 +#: ../../c-api/init.rst:1940 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:1939 +#: ../../c-api/init.rst:1946 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 " @@ -2234,7 +2246,7 @@ msgid "" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:1947 +#: ../../c-api/init.rst:1954 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``. " @@ -2244,29 +2256,29 @@ msgid "" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:1954 +#: ../../c-api/init.rst:1961 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: ../../c-api/init.rst:1956 ../../c-api/init.rst:1963 -#: ../../c-api/init.rst:1982 ../../c-api/init.rst:1989 +#: ../../c-api/init.rst:1963 ../../c-api/init.rst:1970 +#: ../../c-api/init.rst:1989 ../../c-api/init.rst:1996 msgid "The caller must hold the :term:`GIL`." msgstr "呼叫者必須持有 :term:`GIL`。" -#: ../../c-api/init.rst:1960 +#: ../../c-api/init.rst:1967 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:1965 +#: ../../c-api/init.rst:1972 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:1973 +#: ../../c-api/init.rst:1980 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2277,65 +2289,65 @@ msgid "" "*what* parameter." msgstr "" -#: ../../c-api/init.rst:1980 +#: ../../c-api/init.rst:1987 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:1986 +#: ../../c-api/init.rst:1993 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:1991 +#: ../../c-api/init.rst:1998 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:2000 +#: ../../c-api/init.rst:2007 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2005 +#: ../../c-api/init.rst:2012 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2010 +#: ../../c-api/init.rst:2017 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2015 +#: ../../c-api/init.rst:2022 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2020 +#: ../../c-api/init.rst:2027 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2026 +#: ../../c-api/init.rst:2033 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:2032 +#: ../../c-api/init.rst:2039 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:2039 +#: ../../c-api/init.rst:2046 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2043 +#: ../../c-api/init.rst:2050 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2345,19 +2357,19 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2050 +#: ../../c-api/init.rst:2057 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:2053 +#: ../../c-api/init.rst:2060 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:2057 +#: ../../c-api/init.rst:2064 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 " @@ -2365,22 +2377,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2065 +#: ../../c-api/init.rst:2072 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2067 +#: ../../c-api/init.rst:2074 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:2073 +#: ../../c-api/init.rst:2080 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2078 +#: ../../c-api/init.rst:2085 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 " @@ -2388,52 +2400,52 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2083 +#: ../../c-api/init.rst:2090 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:2089 +#: ../../c-api/init.rst:2096 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:2094 +#: ../../c-api/init.rst:2101 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2096 +#: ../../c-api/init.rst:2103 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:2103 +#: ../../c-api/init.rst:2110 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." msgstr "" -#: ../../c-api/init.rst:2110 +#: ../../c-api/init.rst:2117 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:2116 +#: ../../c-api/init.rst:2123 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2121 +#: ../../c-api/init.rst:2128 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2123 +#: ../../c-api/init.rst:2130 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 " @@ -2441,13 +2453,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2131 +#: ../../c-api/init.rst:2138 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:2137 +#: ../../c-api/init.rst:2144 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 " @@ -2456,7 +2468,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2146 +#: ../../c-api/init.rst:2153 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 " @@ -2465,31 +2477,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2155 +#: ../../c-api/init.rst:2162 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:2162 +#: ../../c-api/init.rst:2169 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:2170 +#: ../../c-api/init.rst:2177 msgid "Thread Local Storage (TLS) API" msgstr "" -#: ../../c-api/init.rst:2172 +#: ../../c-api/init.rst:2179 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2177 +#: ../../c-api/init.rst:2184 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 " @@ -2498,13 +2510,13 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2182 +#: ../../c-api/init.rst:2189 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:334 ../../c-api/init.rst:495 ../../c-api/init.rst:570 +#: ../../c-api/init.rst:334 ../../c-api/init.rst:502 ../../c-api/init.rst:577 msgid "Py_SetProgramName()" msgstr "Py_SetProgramName()" @@ -2516,33 +2528,33 @@ msgstr "PyEval_InitThreads()" msgid "modules (in module sys)" msgstr "modules(sys 模組中)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:589 ../../c-api/init.rst:615 +#: ../../c-api/init.rst:334 ../../c-api/init.rst:596 ../../c-api/init.rst:622 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:589 ../../c-api/init.rst:615 -#: ../../c-api/init.rst:1056 ../../c-api/init.rst:1587 -#: ../../c-api/init.rst:1682 +#: ../../c-api/init.rst:334 ../../c-api/init.rst:596 ../../c-api/init.rst:622 +#: ../../c-api/init.rst:1063 ../../c-api/init.rst:1594 +#: ../../c-api/init.rst:1689 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:1587 ../../c-api/init.rst:1682 +#: ../../c-api/init.rst:334 ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:1587 ../../c-api/init.rst:1682 +#: ../../c-api/init.rst:334 ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:1587 ../../c-api/init.rst:1682 +#: ../../c-api/init.rst:334 ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 msgid "sys" msgstr "sys" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:589 ../../c-api/init.rst:615 +#: ../../c-api/init.rst:334 ../../c-api/init.rst:596 ../../c-api/init.rst:622 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:589 ../../c-api/init.rst:615 +#: ../../c-api/init.rst:334 ../../c-api/init.rst:596 ../../c-api/init.rst:622 msgid "path" msgstr "path(路徑)" @@ -2554,134 +2566,134 @@ msgstr "PySys_SetArgv(C 函式)" msgid "PySys_SetArgvEx (C function)" msgstr "PySys_SetArgvEx(C 函式)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:1647 ../../c-api/init.rst:1700 +#: ../../c-api/init.rst:334 ../../c-api/init.rst:1654 ../../c-api/init.rst:1707 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" -#: ../../c-api/init.rst:430 ../../c-api/init.rst:467 +#: ../../c-api/init.rst:437 ../../c-api/init.rst:474 msgid "Py_Initialize()" msgstr "Py_Initialize()" -#: ../../c-api/init.rst:430 ../../c-api/init.rst:467 ../../c-api/init.rst:723 +#: ../../c-api/init.rst:437 ../../c-api/init.rst:474 ../../c-api/init.rst:730 msgid "main()" msgstr "main()" -#: ../../c-api/init.rst:430 +#: ../../c-api/init.rst:437 msgid "stdin" msgstr "stdin" -#: ../../c-api/init.rst:430 +#: ../../c-api/init.rst:437 msgid "stdout" msgstr "stdout" -#: ../../c-api/init.rst:430 +#: ../../c-api/init.rst:437 msgid "sdterr" msgstr "sdterr" -#: ../../c-api/init.rst:467 ../../c-api/init.rst:615 +#: ../../c-api/init.rst:474 ../../c-api/init.rst:622 msgid "Py_GetPath()" msgstr "Py_GetPath()" -#: ../../c-api/init.rst:570 +#: ../../c-api/init.rst:577 msgid "executable (in module sys)" msgstr "executable(sys 模組中)" -#: ../../c-api/init.rst:589 +#: ../../c-api/init.rst:596 msgid "Py_SetPath()" msgstr "Py_SetPath()" -#: ../../c-api/init.rst:658 ../../c-api/init.rst:700 ../../c-api/init.rst:714 +#: ../../c-api/init.rst:665 ../../c-api/init.rst:707 ../../c-api/init.rst:721 msgid "version (in module sys)" msgstr "version(sys 模組中)" -#: ../../c-api/init.rst:670 +#: ../../c-api/init.rst:677 msgid "platform (in module sys)" msgstr "platform(sys 模組中)" -#: ../../c-api/init.rst:687 +#: ../../c-api/init.rst:694 msgid "copyright (in module sys)" msgstr "copyright(sys 模組中)" -#: ../../c-api/init.rst:723 +#: ../../c-api/init.rst:730 msgid "Py_FatalError()" msgstr "Py_FatalError()" -#: ../../c-api/init.rst:723 +#: ../../c-api/init.rst:730 msgid "argv (in module sys)" msgstr "argv(sys 模組中)" -#: ../../c-api/init.rst:839 +#: ../../c-api/init.rst:846 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../c-api/init.rst:839 +#: ../../c-api/init.rst:846 msgid "interpreter lock" msgstr "interpreter lock(直譯器鎖)" -#: ../../c-api/init.rst:839 +#: ../../c-api/init.rst:846 msgid "lock, interpreter" msgstr "lock, interpreter(鎖、直譯器)" -#: ../../c-api/init.rst:852 +#: ../../c-api/init.rst:859 msgid "setswitchinterval (in module sys)" msgstr "setswitchinterval (sys 模組中)" -#: ../../c-api/init.rst:861 +#: ../../c-api/init.rst:868 msgid "PyThreadState (C type)" msgstr "PyThreadState(C 型別)" -#: ../../c-api/init.rst:887 +#: ../../c-api/init.rst:894 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" msgstr "Py_BEGIN_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:887 +#: ../../c-api/init.rst:894 msgid "Py_END_ALLOW_THREADS (C macro)" msgstr "Py_END_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:903 +#: ../../c-api/init.rst:910 msgid "PyEval_RestoreThread (C function)" msgstr "PyEval_RestoreThread(C 函式)" -#: ../../c-api/init.rst:903 +#: ../../c-api/init.rst:910 msgid "PyEval_SaveThread (C function)" msgstr "PyEval_SaveThread(C 函式)" -#: ../../c-api/init.rst:1034 +#: ../../c-api/init.rst:1041 msgid "PyEval_AcquireThread()" msgstr "PyEval_AcquireThread()" -#: ../../c-api/init.rst:1034 +#: ../../c-api/init.rst:1041 msgid "PyEval_ReleaseThread()" msgstr "PyEval_ReleaseThread()" -#: ../../c-api/init.rst:1034 +#: ../../c-api/init.rst:1041 msgid "PyEval_SaveThread()" msgstr "PyEval_SaveThread()" -#: ../../c-api/init.rst:1034 +#: ../../c-api/init.rst:1041 msgid "PyEval_RestoreThread()" msgstr "PyEval_RestoreThread()" -#: ../../c-api/init.rst:1056 +#: ../../c-api/init.rst:1063 msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1587 ../../c-api/init.rst:1682 +#: ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1587 ../../c-api/init.rst:1682 +#: ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1587 ../../c-api/init.rst:1682 +#: ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1647 +#: ../../c-api/init.rst:1654 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1677 +#: ../../c-api/init.rst:1684 msgid "close (in module os)" msgstr "close(os 模組中)" diff --git a/c-api/module.po b/c-api/module.po index 8b7a946404..f8dcc54cc6 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-08-23 00:03+0000\n" +"POT-Creation-Date: 2024-07-15 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,17 +50,22 @@ msgid "" "`__file__` attribute." msgstr "" -#: ../../c-api/module.rst:48 +#: ../../c-api/module.rst:46 ../../c-api/module.rst:270 +#: ../../c-api/module.rst:443 +msgid "Return ``NULL`` with an exception set on error." +msgstr "" + +#: ../../c-api/module.rst:50 msgid ":attr:`__package__` and :attr:`__loader__` are set to ``None``." msgstr ":attr:`__package__` 和 :attr:`__loader__` 被設為 ``None``。" -#: ../../c-api/module.rst:54 +#: ../../c-api/module.rst:56 msgid "" "Similar to :c:func:`PyModule_NewObject`, but the name is a UTF-8 encoded " "string instead of a Unicode object." msgstr "" -#: ../../c-api/module.rst:62 +#: ../../c-api/module.rst:64 msgid "" "Return the dictionary object that implements *module*'s namespace; this " "object is the same as the :attr:`~object.__dict__` attribute of the module " @@ -68,40 +73,40 @@ msgid "" "object), :exc:`SystemError` is raised and ``NULL`` is returned." msgstr "" -#: ../../c-api/module.rst:67 +#: ../../c-api/module.rst:69 msgid "" "It is recommended extensions use other ``PyModule_*`` and ``PyObject_*`` " "functions rather than directly manipulate a module's :attr:`~object." "__dict__`." msgstr "" -#: ../../c-api/module.rst:78 +#: ../../c-api/module.rst:80 msgid "" "Return *module*'s :attr:`__name__` value. If the module does not provide " "one, or if it is not a string, :exc:`SystemError` is raised and ``NULL`` is " "returned." msgstr "" -#: ../../c-api/module.rst:86 +#: ../../c-api/module.rst:88 msgid "" "Similar to :c:func:`PyModule_GetNameObject` but return the name encoded to " "``'utf-8'``." msgstr "" -#: ../../c-api/module.rst:91 +#: ../../c-api/module.rst:93 msgid "" "Return the \"state\" of the module, that is, a pointer to the block of " "memory allocated at module creation time, or ``NULL``. See :c:member:" "`PyModuleDef.m_size`." msgstr "" -#: ../../c-api/module.rst:98 +#: ../../c-api/module.rst:100 msgid "" "Return a pointer to the :c:type:`PyModuleDef` struct from which the module " "was created, or ``NULL`` if the module wasn't created from a definition." msgstr "" -#: ../../c-api/module.rst:108 +#: ../../c-api/module.rst:110 msgid "" "Return the name of the file from which *module* was loaded using *module*'s :" "attr:`__file__` attribute. If this is not defined, or if it is not a " @@ -109,23 +114,23 @@ msgid "" "return a reference to a Unicode object." msgstr "" -#: ../../c-api/module.rst:118 +#: ../../c-api/module.rst:120 msgid "" "Similar to :c:func:`PyModule_GetFilenameObject` but return the filename " "encoded to 'utf-8'." msgstr "" -#: ../../c-api/module.rst:121 +#: ../../c-api/module.rst:123 msgid "" ":c:func:`PyModule_GetFilename` raises :exc:`UnicodeEncodeError` on " "unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead." msgstr "" -#: ../../c-api/module.rst:129 +#: ../../c-api/module.rst:131 msgid "Initializing C modules" msgstr "" -#: ../../c-api/module.rst:131 +#: ../../c-api/module.rst:133 msgid "" "Modules objects are usually created from extension modules (shared libraries " "which export an initialization function), or compiled-in modules (where the " @@ -133,55 +138,55 @@ msgid "" "See :ref:`building` or :ref:`extending-with-embedding` for details." msgstr "" -#: ../../c-api/module.rst:136 +#: ../../c-api/module.rst:138 msgid "" "The initialization function can either pass a module definition instance to :" "c:func:`PyModule_Create`, and return the resulting module object, or request " "\"multi-phase initialization\" by returning the definition struct itself." msgstr "" -#: ../../c-api/module.rst:142 +#: ../../c-api/module.rst:144 msgid "" "The module definition struct, which holds all information needed to create a " "module object. There is usually only one statically initialized variable of " "this type for each module." msgstr "" -#: ../../c-api/module.rst:148 +#: ../../c-api/module.rst:150 msgid "Always initialize this member to :c:macro:`PyModuleDef_HEAD_INIT`." msgstr "" -#: ../../c-api/module.rst:152 +#: ../../c-api/module.rst:154 msgid "Name for the new module." msgstr "" -#: ../../c-api/module.rst:156 +#: ../../c-api/module.rst:158 msgid "" "Docstring for the module; usually a docstring variable created with :c:macro:" "`PyDoc_STRVAR` is used." msgstr "" -#: ../../c-api/module.rst:161 +#: ../../c-api/module.rst:163 msgid "" "Module state may be kept in a per-module memory area that can be retrieved " "with :c:func:`PyModule_GetState`, rather than in static globals. This makes " "modules safe for use in multiple sub-interpreters." msgstr "" -#: ../../c-api/module.rst:165 +#: ../../c-api/module.rst:167 msgid "" "This memory area is allocated based on *m_size* on module creation, and " "freed when the module object is deallocated, after the :c:member:" "`~PyModuleDef.m_free` function has been called, if present." msgstr "" -#: ../../c-api/module.rst:169 +#: ../../c-api/module.rst:171 msgid "" "Setting ``m_size`` to ``-1`` means that the module does not support sub-" "interpreters, because it has global state." msgstr "" -#: ../../c-api/module.rst:172 +#: ../../c-api/module.rst:174 msgid "" "Setting it to a non-negative value means that the module can be re-" "initialized and specifies the additional amount of memory it requires for " @@ -189,37 +194,37 @@ msgid "" "initialization." msgstr "" -#: ../../c-api/module.rst:177 +#: ../../c-api/module.rst:179 msgid "See :PEP:`3121` for more details." msgstr "更多詳情請見 :pep:`3121`。" -#: ../../c-api/module.rst:181 +#: ../../c-api/module.rst:183 msgid "" "A pointer to a table of module-level functions, described by :c:type:" "`PyMethodDef` values. Can be ``NULL`` if no functions are present." msgstr "" -#: ../../c-api/module.rst:186 +#: ../../c-api/module.rst:188 msgid "" "An array of slot definitions for multi-phase initialization, terminated by a " "``{0, NULL}`` entry. When using single-phase initialization, *m_slots* must " "be ``NULL``." msgstr "" -#: ../../c-api/module.rst:192 +#: ../../c-api/module.rst:194 msgid "" "Prior to version 3.5, this member was always set to ``NULL``, and was " "defined as:" msgstr "" -#: ../../c-api/module.rst:199 +#: ../../c-api/module.rst:201 msgid "" "A traversal function to call during GC traversal of the module object, or " "``NULL`` if not needed." msgstr "" -#: ../../c-api/module.rst:202 ../../c-api/module.rst:217 -#: ../../c-api/module.rst:238 +#: ../../c-api/module.rst:204 ../../c-api/module.rst:219 +#: ../../c-api/module.rst:240 msgid "" "This function is not called if the module state was requested but is not " "allocated yet. This is the case immediately after the module is created and " @@ -229,18 +234,18 @@ msgid "" "`PyModule_GetState`) is ``NULL``." msgstr "" -#: ../../c-api/module.rst:209 ../../c-api/module.rst:230 -#: ../../c-api/module.rst:245 +#: ../../c-api/module.rst:211 ../../c-api/module.rst:232 +#: ../../c-api/module.rst:247 msgid "No longer called before the module state is allocated." msgstr "" -#: ../../c-api/module.rst:214 +#: ../../c-api/module.rst:216 msgid "" "A clear function to call during GC clearing of the module object, or " "``NULL`` if not needed." msgstr "" -#: ../../c-api/module.rst:224 +#: ../../c-api/module.rst:226 msgid "" "Like :c:member:`PyTypeObject.tp_clear`, this function is not *always* called " "before a module is deallocated. For example, when reference counting is " @@ -249,55 +254,55 @@ msgid "" "directly." msgstr "" -#: ../../c-api/module.rst:235 +#: ../../c-api/module.rst:237 msgid "" "A function to call during deallocation of the module object, or ``NULL`` if " "not needed." msgstr "" -#: ../../c-api/module.rst:249 +#: ../../c-api/module.rst:251 msgid "Single-phase initialization" msgstr "" -#: ../../c-api/module.rst:251 +#: ../../c-api/module.rst:253 msgid "" "The module initialization function may create and return the module object " "directly. This is referred to as \"single-phase initialization\", and uses " "one of the following two module creation functions:" msgstr "" -#: ../../c-api/module.rst:257 +#: ../../c-api/module.rst:259 msgid "" "Create a new module object, given the definition in *def*. This behaves " "like :c:func:`PyModule_Create2` with *module_api_version* set to :c:macro:" "`PYTHON_API_VERSION`." msgstr "" -#: ../../c-api/module.rst:264 +#: ../../c-api/module.rst:266 msgid "" "Create a new module object, given the definition in *def*, assuming the API " "version *module_api_version*. If that version does not match the version of " "the running interpreter, a :exc:`RuntimeWarning` is emitted." msgstr "" -#: ../../c-api/module.rst:270 +#: ../../c-api/module.rst:274 msgid "" "Most uses of this function should be using :c:func:`PyModule_Create` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:273 +#: ../../c-api/module.rst:277 msgid "" "Before it is returned from in the initialization function, the resulting " "module object is typically populated using functions like :c:func:" "`PyModule_AddObjectRef`." msgstr "" -#: ../../c-api/module.rst:279 +#: ../../c-api/module.rst:283 msgid "Multi-phase initialization" msgstr "" -#: ../../c-api/module.rst:281 +#: ../../c-api/module.rst:285 msgid "" "An alternate way to specify extensions is to request \"multi-phase " "initialization\". Extension modules created this way behave more like Python " @@ -307,7 +312,7 @@ msgid "" "__init__` methods of classes." msgstr "" -#: ../../c-api/module.rst:288 +#: ../../c-api/module.rst:292 msgid "" "Unlike modules created using single-phase initialization, these modules are " "not singletons: if the *sys.modules* entry is removed and the module is re-" @@ -320,14 +325,14 @@ msgid "" "__dict__` or individual classes created with :c:func:`PyType_FromSpec`)." msgstr "" -#: ../../c-api/module.rst:298 +#: ../../c-api/module.rst:302 msgid "" "All modules created using multi-phase initialization are expected to " "support :ref:`sub-interpreters `. Making sure " "multiple modules are independent is typically enough to achieve this." msgstr "" -#: ../../c-api/module.rst:302 +#: ../../c-api/module.rst:306 msgid "" "To request multi-phase initialization, the initialization function " "(PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-empty :" @@ -335,65 +340,65 @@ msgid "" "instance must be initialized with the following function:" msgstr "" -#: ../../c-api/module.rst:309 +#: ../../c-api/module.rst:313 msgid "" "Ensures a module definition is a properly initialized Python object that " "correctly reports its type and reference count." msgstr "" -#: ../../c-api/module.rst:312 +#: ../../c-api/module.rst:316 msgid "Returns *def* cast to ``PyObject*``, or ``NULL`` if an error occurred." msgstr "" -#: ../../c-api/module.rst:316 +#: ../../c-api/module.rst:320 msgid "" "The *m_slots* member of the module definition must point to an array of " "``PyModuleDef_Slot`` structures:" msgstr "" -#: ../../c-api/module.rst:323 +#: ../../c-api/module.rst:327 msgid "A slot ID, chosen from the available values explained below." msgstr "" -#: ../../c-api/module.rst:327 +#: ../../c-api/module.rst:331 msgid "Value of the slot, whose meaning depends on the slot ID." msgstr "" -#: ../../c-api/module.rst:331 +#: ../../c-api/module.rst:335 msgid "The *m_slots* array must be terminated by a slot with id 0." msgstr "" -#: ../../c-api/module.rst:333 +#: ../../c-api/module.rst:337 msgid "The available slot types are:" msgstr "" -#: ../../c-api/module.rst:337 +#: ../../c-api/module.rst:341 msgid "" "Specifies a function that is called to create the module object itself. The " "*value* pointer of this slot must point to a function of the signature:" msgstr "" -#: ../../c-api/module.rst:343 +#: ../../c-api/module.rst:347 msgid "" "The function receives a :py:class:`~importlib.machinery.ModuleSpec` " "instance, as defined in :PEP:`451`, and the module definition. It should " "return a new module object, or set an error and return ``NULL``." msgstr "" -#: ../../c-api/module.rst:348 +#: ../../c-api/module.rst:352 msgid "" "This function should be kept minimal. In particular, it should not call " "arbitrary Python code, as trying to import the same module again may result " "in an infinite loop." msgstr "" -#: ../../c-api/module.rst:352 +#: ../../c-api/module.rst:356 msgid "" "Multiple ``Py_mod_create`` slots may not be specified in one module " "definition." msgstr "" -#: ../../c-api/module.rst:355 +#: ../../c-api/module.rst:359 msgid "" "If ``Py_mod_create`` is not specified, the import machinery will create a " "normal module object using :c:func:`PyModule_New`. The name is taken from " @@ -402,7 +407,7 @@ msgid "" "through symlinks, all while sharing a single module definition." msgstr "" -#: ../../c-api/module.rst:361 +#: ../../c-api/module.rst:365 msgid "" "There is no requirement for the returned object to be an instance of :c:type:" "`PyModule_Type`. Any type can be used, as long as it supports setting and " @@ -412,7 +417,7 @@ msgid "" "``Py_mod_create``." msgstr "" -#: ../../c-api/module.rst:370 +#: ../../c-api/module.rst:374 msgid "" "Specifies a function that is called to *execute* the module. This is " "equivalent to executing the code of a Python module: typically, this " @@ -420,59 +425,59 @@ msgid "" "function is:" msgstr "" -#: ../../c-api/module.rst:378 +#: ../../c-api/module.rst:382 msgid "" "If multiple ``Py_mod_exec`` slots are specified, they are processed in the " "order they appear in the *m_slots* array." msgstr "" -#: ../../c-api/module.rst:383 +#: ../../c-api/module.rst:387 msgid "Specifies one of the following values:" msgstr "" -#: ../../c-api/module.rst:389 +#: ../../c-api/module.rst:393 msgid "The module does not support being imported in subinterpreters." msgstr "" -#: ../../c-api/module.rst:393 +#: ../../c-api/module.rst:397 msgid "" "The module supports being imported in subinterpreters, but only when they " "share the main interpreter's GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: ../../c-api/module.rst:399 +#: ../../c-api/module.rst:403 msgid "" "The module supports being imported in subinterpreters, even when they have " "their own GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: ../../c-api/module.rst:403 +#: ../../c-api/module.rst:407 msgid "" "This slot determines whether or not importing this module in a " "subinterpreter will fail." msgstr "" -#: ../../c-api/module.rst:406 +#: ../../c-api/module.rst:410 msgid "" "Multiple ``Py_mod_multiple_interpreters`` slots may not be specified in one " "module definition." msgstr "" -#: ../../c-api/module.rst:409 +#: ../../c-api/module.rst:413 msgid "" "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery " "defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``." msgstr "" -#: ../../c-api/module.rst:414 +#: ../../c-api/module.rst:418 msgid "See :PEP:`489` for more details on multi-phase initialization." msgstr "" -#: ../../c-api/module.rst:417 +#: ../../c-api/module.rst:421 msgid "Low-level module creation functions" msgstr "" -#: ../../c-api/module.rst:419 +#: ../../c-api/module.rst:423 msgid "" "The following functions are called under the hood when using multi-phase " "initialization. They can be used directly, for example when creating module " @@ -480,14 +485,14 @@ msgid "" "``PyModule_ExecDef`` must be called to fully initialize a module." msgstr "" -#: ../../c-api/module.rst:426 +#: ../../c-api/module.rst:430 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*. This behaves like :c:func:`PyModule_FromDefAndSpec2` with " "*module_api_version* set to :c:macro:`PYTHON_API_VERSION`." msgstr "" -#: ../../c-api/module.rst:434 +#: ../../c-api/module.rst:438 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*, assuming the API version *module_api_version*. If that version does " @@ -495,24 +500,24 @@ msgid "" "emitted." msgstr "" -#: ../../c-api/module.rst:441 +#: ../../c-api/module.rst:447 msgid "" "Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:448 +#: ../../c-api/module.rst:454 msgid "Process any execution slots (:c:data:`Py_mod_exec`) given in *def*." msgstr "" -#: ../../c-api/module.rst:454 +#: ../../c-api/module.rst:460 msgid "" "Set the docstring for *module* to *docstring*. This function is called " "automatically when creating a module from ``PyModuleDef``, using either " "``PyModule_Create`` or ``PyModule_FromDefAndSpec``." msgstr "" -#: ../../c-api/module.rst:463 +#: ../../c-api/module.rst:469 msgid "" "Add the functions from the ``NULL`` terminated *functions* array to " "*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " @@ -524,11 +529,11 @@ msgid "" "``PyModule_FromDefAndSpec``." msgstr "" -#: ../../c-api/module.rst:475 +#: ../../c-api/module.rst:481 msgid "Support functions" msgstr "" -#: ../../c-api/module.rst:477 +#: ../../c-api/module.rst:483 msgid "" "The module initialization function (if using single phase initialization) or " "a function called from a module execution slot (if using multi-phase " @@ -536,117 +541,118 @@ msgid "" "module state:" msgstr "" -#: ../../c-api/module.rst:484 +#: ../../c-api/module.rst:490 msgid "" "Add an object to *module* as *name*. This is a convenience function which " "can be used from the module's initialization function." msgstr "" -#: ../../c-api/module.rst:487 +#: ../../c-api/module.rst:493 msgid "" "On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" -#: ../../c-api/module.rst:489 +#: ../../c-api/module.rst:495 msgid "" -"Return ``NULL`` if *value* is ``NULL``. It must be called with an exception " +"Return ``-1`` if *value* is ``NULL``. It must be called with an exception " "raised in this case." msgstr "" -#: ../../c-api/module.rst:492 ../../c-api/module.rst:541 +#: ../../c-api/module.rst:498 ../../c-api/module.rst:547 msgid "Example usage::" msgstr "用法範例: ::" -#: ../../c-api/module.rst:506 ../../c-api/module.rst:559 +#: ../../c-api/module.rst:512 ../../c-api/module.rst:565 msgid "" "The example can also be written without checking explicitly if *obj* is " "``NULL``::" msgstr "" -#: ../../c-api/module.rst:518 ../../c-api/module.rst:575 +#: ../../c-api/module.rst:524 ../../c-api/module.rst:581 msgid "" "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " "case, since *obj* can be ``NULL``." msgstr "" -#: ../../c-api/module.rst:526 +#: ../../c-api/module.rst:532 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to " "*value* on success (if it returns ``0``)." msgstr "" -#: ../../c-api/module.rst:529 +#: ../../c-api/module.rst:535 msgid "" "The new :c:func:`PyModule_AddObjectRef` function is recommended, since it is " "easy to introduce reference leaks by misusing the :c:func:" "`PyModule_AddObject` function." msgstr "" -#: ../../c-api/module.rst:535 +#: ../../c-api/module.rst:541 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" -#: ../../c-api/module.rst:538 +#: ../../c-api/module.rst:544 msgid "" "This means that its return value must be checked, and calling code must :c:" "func:`Py_DECREF` *value* manually on error." msgstr "" -#: ../../c-api/module.rst:581 +#: ../../c-api/module.rst:587 msgid "" "Add an integer constant to *module* as *name*. This convenience function " -"can be used from the module's initialization function. Return ``-1`` on " -"error, ``0`` on success." +"can be used from the module's initialization function. Return ``-1`` with an " +"exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:588 +#: ../../c-api/module.rst:594 msgid "" "Add a string constant to *module* as *name*. This convenience function can " "be used from the module's initialization function. The string *value* must " -"be ``NULL``-terminated. Return ``-1`` on error, ``0`` on success." +"be ``NULL``-terminated. Return ``-1`` with an exception set on error, ``0`` " +"on success." msgstr "" -#: ../../c-api/module.rst:595 +#: ../../c-api/module.rst:602 msgid "" "Add an int constant to *module*. The name and the value are taken from " "*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int " -"constant *AF_INET* with the value of *AF_INET* to *module*. Return ``-1`` on " -"error, ``0`` on success." +"constant *AF_INET* with the value of *AF_INET* to *module*. Return ``-1`` " +"with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:603 +#: ../../c-api/module.rst:610 msgid "Add a string constant to *module*." msgstr "" -#: ../../c-api/module.rst:607 +#: ../../c-api/module.rst:614 msgid "" "Add a type object to *module*. The type object is finalized by calling " "internally :c:func:`PyType_Ready`. The name of the type object is taken from " "the last component of :c:member:`~PyTypeObject.tp_name` after dot. Return " -"``-1`` on error, ``0`` on success." +"``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:617 +#: ../../c-api/module.rst:624 msgid "Module lookup" msgstr "" -#: ../../c-api/module.rst:619 +#: ../../c-api/module.rst:626 msgid "" "Single-phase initialization creates singleton modules that can be looked up " "in the context of the current interpreter. This allows the module object to " "be retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:623 +#: ../../c-api/module.rst:630 msgid "" "These functions will not work on modules created using multi-phase " "initialization, since multiple such modules can be created from a single " "definition." msgstr "" -#: ../../c-api/module.rst:628 +#: ../../c-api/module.rst:635 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -655,18 +661,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:635 +#: ../../c-api/module.rst:642 msgid "" "Attaches the module object passed to the function to the interpreter state. " "This allows the module object to be accessible via :c:func:" "`PyState_FindModule`." msgstr "" -#: ../../c-api/module.rst:638 +#: ../../c-api/module.rst:645 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:640 +#: ../../c-api/module.rst:647 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module, " "so it is unnecessary (but harmless) to call it from module initialization " @@ -677,18 +683,18 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:648 ../../c-api/module.rst:659 +#: ../../c-api/module.rst:655 ../../c-api/module.rst:666 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/module.rst:650 -msgid "Return 0 on success or -1 on failure." +#: ../../c-api/module.rst:657 +msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:656 +#: ../../c-api/module.rst:663 msgid "" "Removes the module object created from *def* from the interpreter state. " -"Return 0 on success or -1 on failure." +"Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" #: ../../c-api/module.rst:8 @@ -703,7 +709,7 @@ msgstr "module(模組)" msgid "ModuleType (in module types)" msgstr "MethodType(types 模組中)" -#: ../../c-api/module.rst:33 ../../c-api/module.rst:74 +#: ../../c-api/module.rst:33 ../../c-api/module.rst:76 msgid "__name__ (module attribute)" msgstr "__name__(模組屬性)" @@ -711,7 +717,7 @@ msgstr "__name__(模組屬性)" msgid "__doc__ (module attribute)" msgstr "__doc__(模組屬性)" -#: ../../c-api/module.rst:33 ../../c-api/module.rst:104 +#: ../../c-api/module.rst:33 ../../c-api/module.rst:106 msgid "__file__ (module attribute)" msgstr "__file__(模組屬性)" @@ -723,10 +729,10 @@ msgstr "__package__(模組屬性)" msgid "__loader__ (module attribute)" msgstr "__loader__(模組屬性)" -#: ../../c-api/module.rst:60 +#: ../../c-api/module.rst:62 msgid "__dict__ (module attribute)" msgstr "__dict__(模組屬性)" -#: ../../c-api/module.rst:74 ../../c-api/module.rst:104 +#: ../../c-api/module.rst:76 ../../c-api/module.rst:106 msgid "SystemError (built-in exception)" msgstr "SystemError(內建例外)" diff --git a/c-api/slice.po b/c-api/slice.po index 952d8af806..62308eddf9 100644 --- a/c-api/slice.po +++ b/c-api/slice.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-22 00:04+0000\n" +"POT-Creation-Date: 2024-07-11 00:04+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,34 +40,39 @@ msgid "" "Return a new slice object with the given values. The *start*, *stop*, and " "*step* parameters are used as the values of the slice object attributes of " "the same names. Any of the values may be ``NULL``, in which case the " -"``None`` will be used for the corresponding attribute. Return ``NULL`` if " -"the new object could not be allocated." +"``None`` will be used for the corresponding attribute." msgstr "" -#: ../../c-api/slice.rst:32 +#: ../../c-api/slice.rst:28 +msgid "" +"Return ``NULL`` with an exception set if the new object could not be " +"allocated." +msgstr "" + +#: ../../c-api/slice.rst:34 msgid "" "Retrieve the start, stop and step indices from the slice object *slice*, " "assuming a sequence of length *length*. Treats indices greater than *length* " "as errors." msgstr "" -#: ../../c-api/slice.rst:36 +#: ../../c-api/slice.rst:38 msgid "" "Returns ``0`` on success and ``-1`` on error with no exception set (unless " "one of the indices was not ``None`` and failed to be converted to an " "integer, in which case ``-1`` is returned with an exception set)." msgstr "" -#: ../../c-api/slice.rst:40 +#: ../../c-api/slice.rst:42 msgid "You probably do not want to use this function." msgstr "" -#: ../../c-api/slice.rst:42 ../../c-api/slice.rst:73 +#: ../../c-api/slice.rst:44 ../../c-api/slice.rst:75 msgid "" "The parameter type for the *slice* parameter was ``PySliceObject*`` before." msgstr "" -#: ../../c-api/slice.rst:49 +#: ../../c-api/slice.rst:51 msgid "" "Usable replacement for :c:func:`PySlice_GetIndices`. Retrieve the start, " "stop, and step indices from the slice object *slice* assuming a sequence of " @@ -76,22 +81,22 @@ msgid "" "normal slices." msgstr "" -#: ../../c-api/slice.rst:55 -msgid "Returns ``0`` on success and ``-1`` on error with exception set." +#: ../../c-api/slice.rst:57 +msgid "Return ``0`` on success and ``-1`` on error with an exception set." msgstr "" -#: ../../c-api/slice.rst:58 +#: ../../c-api/slice.rst:60 msgid "" "This function is considered not safe for resizable sequences. Its invocation " "should be replaced by a combination of :c:func:`PySlice_Unpack` and :c:func:" "`PySlice_AdjustIndices` where ::" msgstr "" -#: ../../c-api/slice.rst:66 +#: ../../c-api/slice.rst:68 msgid "is replaced by ::" msgstr "" -#: ../../c-api/slice.rst:77 +#: ../../c-api/slice.rst:79 msgid "" "If ``Py_LIMITED_API`` is not set or set to the value between ``0x03050400`` " "and ``0x03060000`` (not including) or ``0x03060100`` or higher :c:func:`!" @@ -100,14 +105,14 @@ msgid "" "*stop* and *step* are evaluated more than once." msgstr "" -#: ../../c-api/slice.rst:84 +#: ../../c-api/slice.rst:86 msgid "" "If ``Py_LIMITED_API`` is set to the value less than ``0x03050400`` or " "between ``0x03060000`` and ``0x03060100`` (not including) :c:func:`!" "PySlice_GetIndicesEx` is a deprecated function." msgstr "" -#: ../../c-api/slice.rst:92 +#: ../../c-api/slice.rst:94 msgid "" "Extract the start, stop and step data members from a slice object as C " "integers. Silently reduce values larger than ``PY_SSIZE_T_MAX`` to " @@ -116,34 +121,34 @@ msgid "" "less than ``-PY_SSIZE_T_MAX`` to ``-PY_SSIZE_T_MAX``." msgstr "" -#: ../../c-api/slice.rst:98 -msgid "Return ``-1`` on error, ``0`` on success." +#: ../../c-api/slice.rst:100 +msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/slice.rst:105 +#: ../../c-api/slice.rst:107 msgid "" "Adjust start/end slice indices assuming a sequence of the specified length. " "Out of bounds indices are clipped in a manner consistent with the handling " "of normal slices." msgstr "" -#: ../../c-api/slice.rst:109 +#: ../../c-api/slice.rst:111 msgid "" "Return the length of the slice. Always successful. Doesn't call Python " "code." msgstr "" -#: ../../c-api/slice.rst:116 +#: ../../c-api/slice.rst:118 msgid "Ellipsis Object" msgstr "" -#: ../../c-api/slice.rst:121 +#: ../../c-api/slice.rst:123 msgid "" "The Python ``Ellipsis`` object. This object has no methods. Like :c:data:" "`Py_None`, it is an `immortal `_. " "singleton object." msgstr "" -#: ../../c-api/slice.rst:125 +#: ../../c-api/slice.rst:127 msgid ":c:data:`Py_Ellipsis` is immortal." msgstr ":c:data:`Py_Ellipsis` 為不滅的 (immortal)。" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 4511425d90..a040db916c 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-20 00:03+0000\n" +"POT-Creation-Date: 2024-07-04 00:03+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-" @@ -2442,7 +2442,7 @@ msgstr "" #: ../../c-api/typeobj.rst:1586 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " -"and :c:member:`~PyTypeObject.tp_weaklist`." +"and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" #: ../../c-api/typeobj.rst:1591 @@ -2457,7 +2457,7 @@ msgstr "" #: ../../c-api/typeobj.rst:1598 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" -"`~PyTypeObject.tp_dict` field, then :c:member:`~PyTypeObject." +"`~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 "" diff --git a/faq/programming.po b/faq/programming.po index 7b20f672d4..4afa15c02c 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-08-20 15:45+0000\n" +"POT-Creation-Date: 2024-07-14 00:03+0000\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2462,27 +2462,38 @@ msgstr "" "被去除。" #: ../../faq/programming.rst:1744 +msgid "" +"The identifier can be used unchanged within the class, but to access it " +"outside the class, the mangled name must be used:" +msgstr "" + +#: ../../faq/programming.rst:1761 #, fuzzy msgid "" -"This doesn't guarantee privacy: an outside user can still deliberately " -"access the \"_classname__spam\" attribute, and private values are visible in " -"the object's ``__dict__``. Many Python programmers never bother to use " -"private variable names at all." +"In particular, this does not guarantee privacy since an outside user can " +"still deliberately access the private attribute; many Python programmers " +"never bother to use private variable names at all." msgstr "" "這並不能保證隱私:外部使用者仍然可以故意存取 \"_classname__spam\" 屬性,並且" "私有值在物件的 __dict__ 中可見。許多 Python 程式員根本懶得使用私有變數名。" -#: ../../faq/programming.rst:1751 +#: ../../faq/programming.rst:1767 +msgid "" +"The :ref:`private name mangling specifications ` for " +"details and special cases." +msgstr "" + +#: ../../faq/programming.rst:1771 #, fuzzy msgid "My class defines __del__ but it is not called when I delete the object." msgstr "我的類別定義了 __del__ 但是當我刪除物件時它沒有被呼叫。" -#: ../../faq/programming.rst:1753 +#: ../../faq/programming.rst:1773 #, fuzzy msgid "There are several possible reasons for this." msgstr "這有幾個可能的原因。" -#: ../../faq/programming.rst:1755 +#: ../../faq/programming.rst:1775 #, fuzzy msgid "" "The :keyword:`del` statement does not necessarily call :meth:`~object." @@ -2492,7 +2503,7 @@ msgstr "" ":keyword:`del` 陳述式不一定呼叫 :meth:`~object.__del__` -- 它只是減少物件的引" "用計數,如果達到零,則呼叫 :meth:`!__del__`。" -#: ../../faq/programming.rst:1759 +#: ../../faq/programming.rst:1779 #, fuzzy msgid "" "If your data structures contain circular links (e.g. a tree where each child " @@ -2514,7 +2525,7 @@ msgstr "" "行順序是任意的。你可以運行 :func:`gc.collect` 來強制收集,但*存在*永遠不會收" "集物件的病態情況。" -#: ../../faq/programming.rst:1770 +#: ../../faq/programming.rst:1790 #, fuzzy msgid "" "Despite the cycle collector, it's still a good idea to define an explicit " @@ -2529,7 +2540,7 @@ msgstr "" "性。不要直接呼叫 :meth:`!__del__` -- :meth:`!__del__` 應該呼叫 ``close()`` 並" "且 ``close()`` 應該確保它可以多次呼叫同一個物件。" -#: ../../faq/programming.rst:1777 +#: ../../faq/programming.rst:1797 #, fuzzy msgid "" "Another way to avoid cyclical references is to use the :mod:`weakref` " @@ -2541,7 +2552,7 @@ msgstr "" "的情況下指向物件。例如,樹資料結構應該對其父引用和同級引用使用弱引用(如果需" "要的話!)。" -#: ../../faq/programming.rst:1790 +#: ../../faq/programming.rst:1810 #, fuzzy msgid "" "Finally, if your :meth:`!__del__` method raises an exception, a warning " @@ -2550,12 +2561,12 @@ msgstr "" "最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告消息印出到 :data:" "`sys.stderr`。" -#: ../../faq/programming.rst:1795 +#: ../../faq/programming.rst:1815 #, fuzzy msgid "How do I get a list of all instances of a given class?" msgstr "如何獲取給定類別的所有實例的 list?" -#: ../../faq/programming.rst:1797 +#: ../../faq/programming.rst:1817 #, fuzzy msgid "" "Python does not keep track of all instances of a class (or of a built-in " @@ -2565,12 +2576,12 @@ msgstr "" "Python 不會跟踪類別(或內置型別)的所有實例。你可以對類別的構造函式進行編程," "以透過保留對每個實例的弱引用list來跟踪所有實例。" -#: ../../faq/programming.rst:1803 +#: ../../faq/programming.rst:1823 #, fuzzy msgid "Why does the result of ``id()`` appear to be not unique?" msgstr "為什麼 ``id()`` 的結果看起來不唯一?" -#: ../../faq/programming.rst:1805 +#: ../../faq/programming.rst:1825 #, fuzzy msgid "" "The :func:`id` builtin returns an integer that is guaranteed to be unique " @@ -2583,7 +2594,7 @@ msgstr "" "CPython 中,這是物件的記憶體地址,所以經常發生在從記憶體中刪除一個物件後,下" "一個新建立的物件被分配在記憶體中的相同位置。這個例子說明了這一點:" -#: ../../faq/programming.rst:1816 +#: ../../faq/programming.rst:1836 #, fuzzy msgid "" "The two ids belong to different integer objects that are created before, and " @@ -2594,18 +2605,18 @@ msgstr "" "這兩個 id 屬於之前建立的不同整數物件,並在執行 id() 呼叫後立即刪除。要確保你" "要檢查其 id 的物件仍然存在,請建立對該物件的另一個引用:" -#: ../../faq/programming.rst:1829 +#: ../../faq/programming.rst:1849 msgid "When can I rely on identity tests with the *is* operator?" msgstr "我什麼時候可以依靠 *is* 運算子進行識別性測試?" -#: ../../faq/programming.rst:1831 +#: ../../faq/programming.rst:1851 msgid "" "The ``is`` operator tests for object identity. The test ``a is b`` is " "equivalent to ``id(a) == id(b)``." msgstr "" "``is`` 運算子測試物件識別性。測試 ``a is b`` 等同於 ``id(a) == id(b)`` 。" -#: ../../faq/programming.rst:1834 +#: ../../faq/programming.rst:1854 msgid "" "The most important property of an identity test is that an object is always " "identical to itself, ``a is a`` always returns ``True``. Identity tests are " @@ -2616,7 +2627,7 @@ msgstr "" "識別性測試通常比相等性測試更快。與相等性測試不同,識別性測試保證回傳布林值 " "``True`` 或 ``False`` 。" -#: ../../faq/programming.rst:1839 +#: ../../faq/programming.rst:1859 msgid "" "However, identity tests can *only* be substituted for equality tests when " "object identity is assured. Generally, there are three circumstances where " @@ -2625,7 +2636,7 @@ msgstr "" "然而,*只有*\\ 當物件識別性得到保證時,識別性測試才能代替相等性測試。一般來" "說,保證識別性的情況有以下三種:" -#: ../../faq/programming.rst:1843 +#: ../../faq/programming.rst:1863 msgid "" "1) Assignments create new names but do not change object identity. After " "the assignment ``new = old``, it is guaranteed that ``new is old``." @@ -2633,7 +2644,7 @@ msgstr "" "1) 賦值建立新名稱但不改變物件識別性。賦值 ``new = old`` 後,保證 ``new is " "old``。" -#: ../../faq/programming.rst:1846 +#: ../../faq/programming.rst:1866 msgid "" "2) Putting an object in a container that stores object references does not " "change object identity. After the list assignment ``s[0] = x``, it is " @@ -2642,7 +2653,7 @@ msgstr "" "2) 將物件放入存儲物件參照的容器中不會改變物件識別性。在 list 賦值 ``s[0] = " "x`` 之後,保證 ``s[0] 是 x``。" -#: ../../faq/programming.rst:1850 +#: ../../faq/programming.rst:1870 #, fuzzy msgid "" "3) If an object is a singleton, it means that only one instance of that " @@ -2652,7 +2663,7 @@ msgstr "" "3)如果一個物件是單例,則意味著該物件只能存在一個實例。在賦值 ``a = None`` " "和 ``b = None`` 之後,可以保證 ``a is b`` 因為 ``None`` 是單例。" -#: ../../faq/programming.rst:1854 +#: ../../faq/programming.rst:1874 msgid "" "In most other circumstances, identity tests are inadvisable and equality " "tests are preferred. In particular, identity tests should not be used to " @@ -2662,18 +2673,18 @@ msgstr "" "在大多數其他情況下,識別性測試是不可取的,相等性測試是首選。特別是,識別性測" "試不應用於檢查常數,例如不能保證是單例的 :class:`int` 和 :class:`str`: ::" -#: ../../faq/programming.rst:1871 +#: ../../faq/programming.rst:1891 #, fuzzy msgid "Likewise, new instances of mutable containers are never identical::" msgstr "同樣,可變容器的新實例永遠不會相同: ::" -#: ../../faq/programming.rst:1878 +#: ../../faq/programming.rst:1898 msgid "" "In the standard library code, you will see several common patterns for " "correctly using identity tests:" msgstr "在標準函式庫程式碼中,你將看到幾種正確使用識別性測試的常見模式:" -#: ../../faq/programming.rst:1881 +#: ../../faq/programming.rst:1901 msgid "" "1) As recommended by :pep:`8`, an identity test is the preferred way to " "check for ``None``. This reads like plain English in code and avoids " @@ -2683,7 +2694,7 @@ msgstr "" "1) 正如 :pep:`8` 所推薦的,識別性測試是檢查 ``None`` 的首選方法。這在程式碼中" "讀起來像簡單的英語,並避免與其他可能具有評估為 false 的布林值的物件混淆。" -#: ../../faq/programming.rst:1885 +#: ../../faq/programming.rst:1905 #, fuzzy msgid "" "2) Detecting optional arguments can be tricky when ``None`` is a valid input " @@ -2695,7 +2706,7 @@ msgstr "" "建立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似" "於 :meth:`dict.pop` 的方法: ::" -#: ../../faq/programming.rst:1901 +#: ../../faq/programming.rst:1921 msgid "" "3) Container implementations sometimes need to augment equality tests with " "identity tests. This prevents the code from being confused by objects such " @@ -2704,19 +2715,19 @@ msgstr "" "3) 容器實作有時需要透過識別性測試來增強相等性測試。這可以防止程式碼被諸如 " "float('NaN') 之類的不等於自身的物件所混淆。" -#: ../../faq/programming.rst:1905 +#: ../../faq/programming.rst:1925 msgid "" "For example, here is the implementation of :meth:`!collections.abc.Sequence." "__contains__`::" msgstr "" "例如,以下是 :meth:`!collections.abc.Sequence.__contains__` 的實作: ::" -#: ../../faq/programming.rst:1916 +#: ../../faq/programming.rst:1936 msgid "" "How can a subclass control what data is stored in an immutable instance?" msgstr "子類別如何控制不可變實例中存儲的資料?" -#: ../../faq/programming.rst:1918 +#: ../../faq/programming.rst:1938 #, fuzzy msgid "" "When subclassing an immutable type, override the :meth:`~object.__new__` " @@ -2728,23 +2739,23 @@ msgstr "" "`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法更改不可變" "實例中的資料。" -#: ../../faq/programming.rst:1923 +#: ../../faq/programming.rst:1943 #, fuzzy msgid "" "All of these immutable classes have a different signature than their parent " "class:" msgstr "所有這些不可變類別都具有與其父類別不同的簽名:" -#: ../../faq/programming.rst:1949 +#: ../../faq/programming.rst:1969 msgid "The classes can be used like this:" msgstr "這些類別可以像這樣使用:" -#: ../../faq/programming.rst:1966 +#: ../../faq/programming.rst:1986 #, fuzzy msgid "How do I cache method calls?" msgstr "如何快取方法呼叫?" -#: ../../faq/programming.rst:1968 +#: ../../faq/programming.rst:1988 #, fuzzy msgid "" "The two principal tools for caching methods are :func:`functools." @@ -2754,7 +2765,7 @@ msgstr "" "快取方法的兩個主要工具是 func:`functools.cached_property` 和 :func:" "`functools.lru_cache`。前者在實例級別存儲結果,後者在類別級別存儲結果。" -#: ../../faq/programming.rst:1973 +#: ../../faq/programming.rst:1993 #, fuzzy msgid "" "The *cached_property* approach only works with methods that do not take any " @@ -2764,7 +2775,7 @@ msgstr "" "*cached_property* 方法僅適用於不帶任何引數的方法。它不會建立對實例的引用。只" "要實例還活著,快取的方法結果就會被保留。" -#: ../../faq/programming.rst:1977 +#: ../../faq/programming.rst:1997 #, fuzzy msgid "" "The advantage is that when an instance is no longer used, the cached method " @@ -2775,7 +2786,7 @@ msgstr "" "好處是當一個實例不再使用時,快取的方法結果會立即釋放。缺點是如果實例累積,累" "積的方法結果也會累積。他們可以不受限制地成長。" -#: ../../faq/programming.rst:1982 +#: ../../faq/programming.rst:2002 msgid "" "The *lru_cache* approach works with methods that have :term:`hashable` " "arguments. It creates a reference to the instance unless special efforts " @@ -2784,7 +2795,7 @@ msgstr "" "*lru_cache* 方法適用於具有\\ :term:`可雜湊 `\\ 引數的方法。除非特別" "努力傳遞弱引用,否則它會建立對實例的引用。" -#: ../../faq/programming.rst:1986 +#: ../../faq/programming.rst:2006 #, fuzzy msgid "" "The advantage of the least recently used algorithm is that the cache is " @@ -2794,12 +2805,12 @@ msgstr "" "最近最少使用演算法的優點是快取受指定的 *maxsize* 限制。缺點是實例會一直保持活" "動狀態,直到它們從快取中老化或快取被清除。" -#: ../../faq/programming.rst:1991 +#: ../../faq/programming.rst:2011 #, fuzzy msgid "This example shows the various techniques::" msgstr "這個例子展示了各種技術: ::" -#: ../../faq/programming.rst:2015 +#: ../../faq/programming.rst:2035 #, fuzzy msgid "" "The above example assumes that the *station_id* never changes. If the " @@ -2809,7 +2820,7 @@ msgstr "" "上面的例子假設 *station_id* 永遠不會改變。如果相關的實例屬性是可變的,則 " "*cached_property* 方法無法工作,因為它無法檢測到屬性的更改。" -#: ../../faq/programming.rst:2020 +#: ../../faq/programming.rst:2040 #, fuzzy msgid "" "To make the *lru_cache* approach work when the *station_id* is mutable, the " @@ -2820,16 +2831,16 @@ msgstr "" "`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測相關屬性更" "新: ::" -#: ../../faq/programming.rst:2046 +#: ../../faq/programming.rst:2066 msgid "Modules" msgstr "模組" -#: ../../faq/programming.rst:2049 +#: ../../faq/programming.rst:2069 #, fuzzy msgid "How do I create a .pyc file?" msgstr "如何建立 .pyc 檔案?" -#: ../../faq/programming.rst:2051 +#: ../../faq/programming.rst:2071 #, fuzzy msgid "" "When a module is imported for the first time (or when the source file has " @@ -2846,7 +2857,7 @@ msgstr "" "間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參閱 :" "pep:`3147`。)" -#: ../../faq/programming.rst:2059 +#: ../../faq/programming.rst:2079 #, fuzzy msgid "" "One reason that a ``.pyc`` file may not be created is a permissions problem " @@ -2859,7 +2870,7 @@ msgstr "" "__pycache__ 子目錄。例如,如果你以一個使用者的身份開發但以另一個使用者的身份" "運行,例如你正在使用 Web 服務器進行測試,就會發生這種情況。" -#: ../../faq/programming.rst:2064 +#: ../../faq/programming.rst:2084 #, fuzzy msgid "" "Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, " @@ -2872,7 +2883,7 @@ msgstr "" "並且 Python 有能力(權限,空閒空間等)建立一個 .pyc 檔案是自動的建立一個" "``__pycache__ `` 子目錄並將編譯後的模組寫入該子目錄。" -#: ../../faq/programming.rst:2069 +#: ../../faq/programming.rst:2089 #, fuzzy msgid "" "Running Python on a top level script is not considered an import and no ``." @@ -2887,7 +2898,7 @@ msgstr "" "入 ``python foo.py`` 作為一個 shell 命令),將為 xyz 建立一個 .pyc 因為引入" "了 xyz,但是不會為 foo 建立 .pyc 檔案,因為 ` `foo.py`` 沒有被引入。" -#: ../../faq/programming.rst:2076 +#: ../../faq/programming.rst:2096 #, fuzzy msgid "" "If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." @@ -2897,7 +2908,7 @@ msgstr "" "如果你需要為 ``foo`` 建立一個 ``.pyc`` 檔案——也就是說,為一個未引入的模組建立" "一個 ``.pyc`` 檔案——你可以使用 :mod :`py_compile` 和 :mod:`compileall` 模組。" -#: ../../faq/programming.rst:2080 +#: ../../faq/programming.rst:2100 #, fuzzy msgid "" "The :mod:`py_compile` module can manually compile any module. One way is to " @@ -2906,7 +2917,7 @@ msgstr "" ":mod:`py_compile` 模組可以手動編譯任何模組。一種方法是在該模組中以交互方式使" "用 ``compile()`` 函式: ::" -#: ../../faq/programming.rst:2086 +#: ../../faq/programming.rst:2106 #, fuzzy msgid "" "This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same " @@ -2916,7 +2927,7 @@ msgstr "" "這會將 .pyc 寫入與 foo.py 相同位置的 __pycache__ 子目錄(或者你可以使用可選參" "數 cfile 覆蓋它)。" -#: ../../faq/programming.rst:2090 +#: ../../faq/programming.rst:2110 #, fuzzy msgid "" "You can also automatically compile all files in a directory or directories " @@ -2927,12 +2938,12 @@ msgstr "" "你還可以使用 :mod:`compileall` 模組自動編譯目錄中的所有檔案。你可以在 shell " "提示符下運行 ``compileall.py`` 並提供包含要編譯的 Python 檔案的目錄路徑: ::" -#: ../../faq/programming.rst:2099 +#: ../../faq/programming.rst:2119 #, fuzzy msgid "How do I find the current module name?" msgstr "如何找到當前模組名稱?" -#: ../../faq/programming.rst:2101 +#: ../../faq/programming.rst:2121 #, fuzzy msgid "" "A module can find out its own module name by looking at the predefined " @@ -2945,59 +2956,59 @@ msgstr "" "值為``'__main__'``,則該程式作為腳本運行。許多通常透過引入使用的模組還提供命" "令行界面或自檢,只有在檢查 ``__name__`` 後才執行此程式碼: ::" -#: ../../faq/programming.rst:2116 +#: ../../faq/programming.rst:2136 #, fuzzy msgid "How can I have modules that mutually import each other?" msgstr "我怎樣才能擁有相互引入的模組?" -#: ../../faq/programming.rst:2118 +#: ../../faq/programming.rst:2138 #, fuzzy msgid "Suppose you have the following modules:" msgstr "假設你有以下模組:" -#: ../../faq/programming.rst:2120 +#: ../../faq/programming.rst:2140 msgid ":file:`foo.py`::" msgstr ":file:`foo.py`: ::" -#: ../../faq/programming.rst:2125 +#: ../../faq/programming.rst:2145 msgid ":file:`bar.py`::" msgstr ":file:`bar.py`: ::" -#: ../../faq/programming.rst:2130 +#: ../../faq/programming.rst:2150 #, fuzzy msgid "The problem is that the interpreter will perform the following steps:" msgstr "問題是直譯器將執行以下步驟:" -#: ../../faq/programming.rst:2132 +#: ../../faq/programming.rst:2152 #, fuzzy msgid "main imports ``foo``" msgstr "主要進口``foo``" -#: ../../faq/programming.rst:2133 +#: ../../faq/programming.rst:2153 #, fuzzy msgid "Empty globals for ``foo`` are created" msgstr "建立了 ``foo`` 的空全域變數" -#: ../../faq/programming.rst:2134 +#: ../../faq/programming.rst:2154 #, fuzzy msgid "``foo`` is compiled and starts executing" msgstr "``foo`` 被編譯並開始執行" -#: ../../faq/programming.rst:2135 +#: ../../faq/programming.rst:2155 #, fuzzy msgid "``foo`` imports ``bar``" msgstr "``foo`` 引入 ``bar``" -#: ../../faq/programming.rst:2136 +#: ../../faq/programming.rst:2156 #, fuzzy msgid "Empty globals for ``bar`` are created" msgstr "建立了 ``bar`` 的空全域變數" -#: ../../faq/programming.rst:2137 +#: ../../faq/programming.rst:2157 msgid "``bar`` is compiled and starts executing" msgstr "``bar`` 已被編譯並開始執行" -#: ../../faq/programming.rst:2138 +#: ../../faq/programming.rst:2158 #, fuzzy msgid "" "``bar`` imports ``foo`` (which is a no-op since there already is a module " @@ -3005,7 +3016,7 @@ msgid "" msgstr "" "``bar`` 引入 ``foo``(這是一個空操作,因為已經有一個名為 ``foo`` 的模組)" -#: ../../faq/programming.rst:2139 +#: ../../faq/programming.rst:2159 #, fuzzy msgid "" "The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set " @@ -3014,7 +3025,7 @@ msgstr "" "引入機制嘗試從 ``foo`` 全域變數中讀取 ``foo_var`` ,以設定 ``bar.foo_var = " "foo.foo_var`` " -#: ../../faq/programming.rst:2141 +#: ../../faq/programming.rst:2161 #, fuzzy msgid "" "The last step fails, because Python isn't done with interpreting ``foo`` yet " @@ -3023,7 +3034,7 @@ msgstr "" "最後一步失敗了,因為 Python 還沒有完成對 ``foo`` 的直譯,而 ``foo`` 的全域符" "號字典仍然是空的。" -#: ../../faq/programming.rst:2144 +#: ../../faq/programming.rst:2164 #, fuzzy msgid "" "The same thing happens when you use ``import foo``, and then try to access " @@ -3032,11 +3043,11 @@ msgstr "" "當你使用 ``import foo``,然後嘗試在全域程式碼中存取 ``foo.foo_var`` 時,也會" "發生同樣的事情。" -#: ../../faq/programming.rst:2147 +#: ../../faq/programming.rst:2167 msgid "There are (at least) three possible workarounds for this problem." msgstr "此問題有(至少)三種可能的解決方法。" -#: ../../faq/programming.rst:2149 +#: ../../faq/programming.rst:2169 #, fuzzy msgid "" "Guido van Rossum recommends avoiding all uses of ``from import ..." @@ -3049,28 +3060,28 @@ msgstr "" "函式中。全域變數和類別變數的初始化應該只使用常數或內置函式。這意味著來自引入" "模組的所有內容都被引用為 ``.``。" -#: ../../faq/programming.rst:2154 +#: ../../faq/programming.rst:2174 msgid "" "Jim Roskind suggests performing steps in the following order in each module:" msgstr "Jim Roskind 建議在每個模組中按以下順序執行各個步驟:" -#: ../../faq/programming.rst:2156 +#: ../../faq/programming.rst:2176 #, fuzzy msgid "" "exports (globals, functions, and classes that don't need imported base " "classes)" msgstr "導出(不需要引入基底類別的全域變數、函式和類別)" -#: ../../faq/programming.rst:2158 +#: ../../faq/programming.rst:2178 msgid "``import`` statements" msgstr "``import`` 陳述式" -#: ../../faq/programming.rst:2159 +#: ../../faq/programming.rst:2179 msgid "" "active code (including globals that are initialized from imported values)." msgstr "活躍程式碼(包括從引入值初始化的全域變數)。" -#: ../../faq/programming.rst:2161 +#: ../../faq/programming.rst:2181 #, fuzzy msgid "" "Van Rossum doesn't like this approach much because the imports appear in a " @@ -3078,21 +3089,21 @@ msgid "" msgstr "" "Van Rossum 不太喜歡這種方法,因為引入出現在一個奇怪的地方,但它確實有效。" -#: ../../faq/programming.rst:2164 +#: ../../faq/programming.rst:2184 msgid "" "Matthias Urlichs recommends restructuring your code so that the recursive " "import is not necessary in the first place." msgstr "Matthias Urlichs 建議重構你的程式碼,以便打從一開始就不需要遞迴引入。" -#: ../../faq/programming.rst:2167 +#: ../../faq/programming.rst:2187 msgid "These solutions are not mutually exclusive." msgstr "這些方案並不衝突。" -#: ../../faq/programming.rst:2171 +#: ../../faq/programming.rst:2191 msgid "__import__('x.y.z') returns ; how do I get z?" msgstr "__import__('x.y.z') 回傳 ,那我怎麼得到 z?" -#: ../../faq/programming.rst:2173 +#: ../../faq/programming.rst:2193 #, fuzzy msgid "" "Consider using the convenience function :func:`~importlib.import_module` " @@ -3101,13 +3112,13 @@ msgstr "" "考慮使用來自 :mod:`importlib` 的便利函式 :func:`~importlib.import_module` 代" "替: ::" -#: ../../faq/programming.rst:2180 +#: ../../faq/programming.rst:2200 msgid "" "When I edit an imported module and reimport it, the changes don't show up. " "Why does this happen?" msgstr "當我編輯需要引入的模組並重新引入它時,更動沒有反應出來。為什麼會這樣?" -#: ../../faq/programming.rst:2182 +#: ../../faq/programming.rst:2202 #, fuzzy msgid "" "For reasons of efficiency as well as consistency, Python only reads the " @@ -3120,14 +3131,14 @@ msgstr "" "一個由許多模組組成的程式中,每個模組都引入相同的基本模組,基本模組將被解析和" "重新解析很多次。要強制重新讀取已更改的模組,請執行以下操作: ::" -#: ../../faq/programming.rst:2192 +#: ../../faq/programming.rst:2212 #, fuzzy msgid "" "Warning: this technique is not 100% fool-proof. In particular, modules " "containing statements like ::" msgstr "警告:此技術並非 100% 萬無一失。尤其是,包含像這樣的陳述式的模組: ::" -#: ../../faq/programming.rst:2197 +#: ../../faq/programming.rst:2217 #, fuzzy msgid "" "will continue to work with the old version of the imported objects. If the " @@ -3138,7 +3149,7 @@ msgstr "" "將繼續使用舊版本的引入物件。如果模組包含類別定義,現有的類別實例將*不會*更新" "為使用新的類別定義。這可能會導致以下自相矛盾的行為: ::" -#: ../../faq/programming.rst:2210 +#: ../../faq/programming.rst:2230 msgid "" "The nature of the problem is made clear if you print out the \"identity\" of " "the class objects::" diff --git a/howto/descriptor.po b/howto/descriptor.po index 15242f52c8..f74accc814 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-02-21 00:03+0000\n" +"POT-Creation-Date: 2024-06-13 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -561,7 +561,7 @@ msgstr "" #: ../../howto/descriptor.rst:789 msgid "" "The logic for super's dotted lookup is in the :meth:`__getattribute__` " -"method for object returned by :class:`super()`." +"method for object returned by :func:`super`." msgstr "" #: ../../howto/descriptor.rst:792 diff --git a/howto/enum.po b/howto/enum.po index d7b391b8a7..82e5e23b33 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-30 00:03+0000\n" +"POT-Creation-Date: 2024-06-20 00:03+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -972,78 +972,78 @@ msgstr "" msgid "names of pseudo-flags are constructed from their members' names::" msgstr "" -#: ../../howto/enum.rst:1132 +#: ../../howto/enum.rst:1140 msgid "multi-bit flags, aka aliases, can be returned from operations::" msgstr "" -#: ../../howto/enum.rst:1143 +#: ../../howto/enum.rst:1151 msgid "" "membership / containment checking: zero-valued flags are always considered " "to be contained::" msgstr "" -#: ../../howto/enum.rst:1149 +#: ../../howto/enum.rst:1157 msgid "" "otherwise, only if all bits of one flag are in the other flag will True be " "returned::" msgstr "" -#: ../../howto/enum.rst:1158 +#: ../../howto/enum.rst:1166 msgid "" "There is a new boundary mechanism that controls how out-of-range / invalid " "bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:" msgstr "" -#: ../../howto/enum.rst:1161 +#: ../../howto/enum.rst:1169 msgid "STRICT --> raises an exception when presented with invalid values" msgstr "" -#: ../../howto/enum.rst:1162 +#: ../../howto/enum.rst:1170 msgid "CONFORM --> discards any invalid bits" msgstr "" -#: ../../howto/enum.rst:1163 +#: ../../howto/enum.rst:1171 msgid "EJECT --> lose Flag status and become a normal int with the given value" msgstr "" -#: ../../howto/enum.rst:1164 +#: ../../howto/enum.rst:1172 msgid "KEEP --> keep the extra bits" msgstr "" -#: ../../howto/enum.rst:1166 +#: ../../howto/enum.rst:1174 msgid "keeps Flag status and extra bits" msgstr "" -#: ../../howto/enum.rst:1167 +#: ../../howto/enum.rst:1175 msgid "extra bits do not show up in iteration" msgstr "" -#: ../../howto/enum.rst:1168 +#: ../../howto/enum.rst:1176 msgid "extra bits do show up in repr() and str()" msgstr "" -#: ../../howto/enum.rst:1170 +#: ../../howto/enum.rst:1178 msgid "" "The default for Flag is ``STRICT``, the default for ``IntFlag`` is " "``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl." "Options`` for an example of when ``KEEP`` is needed)." msgstr "" -#: ../../howto/enum.rst:1178 +#: ../../howto/enum.rst:1186 msgid "How are Enums and Flags different?" msgstr "" -#: ../../howto/enum.rst:1180 +#: ../../howto/enum.rst:1188 msgid "" "Enums have a custom metaclass that affects many aspects of both derived :" "class:`Enum` classes and their instances (members)." msgstr "" -#: ../../howto/enum.rst:1185 +#: ../../howto/enum.rst:1193 msgid "Enum Classes" msgstr "" -#: ../../howto/enum.rst:1187 +#: ../../howto/enum.rst:1195 msgid "" "The :class:`EnumType` metaclass is responsible for providing the :meth:" "`__contains__`, :meth:`__dir__`, :meth:`__iter__` and other methods that " @@ -1054,11 +1054,11 @@ msgid "" "`__getnewargs__`, :meth:`__str__` and :meth:`__repr__`)." msgstr "" -#: ../../howto/enum.rst:1196 +#: ../../howto/enum.rst:1204 msgid "Flag Classes" msgstr "" -#: ../../howto/enum.rst:1198 +#: ../../howto/enum.rst:1206 msgid "" "Flags have an expanded view of aliasing: to be canonical, the value of a " "flag needs to be a power-of-two value, and not a duplicate name. So, in " @@ -1067,11 +1067,11 @@ msgid "" "considered an alias." msgstr "" -#: ../../howto/enum.rst:1204 +#: ../../howto/enum.rst:1212 msgid "Enum Members (aka instances)" msgstr "" -#: ../../howto/enum.rst:1206 +#: ../../howto/enum.rst:1214 msgid "" "The most interesting thing about enum members is that they are singletons. :" "class:`EnumType` creates them all while it is creating the enum class " @@ -1080,37 +1080,37 @@ msgid "" "instances." msgstr "" -#: ../../howto/enum.rst:1212 +#: ../../howto/enum.rst:1220 msgid "Flag Members" msgstr "" -#: ../../howto/enum.rst:1214 +#: ../../howto/enum.rst:1222 msgid "" "Flag members can be iterated over just like the :class:`Flag` class, and " "only the canonical members will be returned. For example::" msgstr "" -#: ../../howto/enum.rst:1220 +#: ../../howto/enum.rst:1228 msgid "(Note that ``BLACK``, ``PURPLE``, and ``WHITE`` do not show up.)" msgstr "" -#: ../../howto/enum.rst:1222 +#: ../../howto/enum.rst:1230 msgid "" "Inverting a flag member returns the corresponding positive value, rather " "than a negative value --- for example::" msgstr "" -#: ../../howto/enum.rst:1228 +#: ../../howto/enum.rst:1236 msgid "" "Flag members have a length corresponding to the number of power-of-two " "values they contain. For example::" msgstr "" -#: ../../howto/enum.rst:1238 +#: ../../howto/enum.rst:1246 msgid "Enum Cookbook" msgstr "" -#: ../../howto/enum.rst:1241 +#: ../../howto/enum.rst:1249 msgid "" "While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :" "class:`IntFlag` are expected to cover the majority of use-cases, they cannot " @@ -1118,155 +1118,155 @@ msgid "" "that can be used directly, or as examples for creating one's own." msgstr "" -#: ../../howto/enum.rst:1248 +#: ../../howto/enum.rst:1256 msgid "Omitting values" msgstr "" -#: ../../howto/enum.rst:1250 +#: ../../howto/enum.rst:1258 msgid "" "In many use-cases, one doesn't care what the actual value of an enumeration " "is. There are several ways to define this type of simple enumeration:" msgstr "" -#: ../../howto/enum.rst:1253 +#: ../../howto/enum.rst:1261 msgid "use instances of :class:`auto` for the value" msgstr "" -#: ../../howto/enum.rst:1254 +#: ../../howto/enum.rst:1262 msgid "use instances of :class:`object` as the value" msgstr "" -#: ../../howto/enum.rst:1255 +#: ../../howto/enum.rst:1263 msgid "use a descriptive string as the value" msgstr "" -#: ../../howto/enum.rst:1256 +#: ../../howto/enum.rst:1264 msgid "" "use a tuple as the value and a custom :meth:`__new__` to replace the tuple " "with an :class:`int` value" msgstr "" -#: ../../howto/enum.rst:1259 +#: ../../howto/enum.rst:1267 msgid "" "Using any of these methods signifies to the user that these values are not " "important, and also enables one to add, remove, or reorder members without " "having to renumber the remaining members." msgstr "" -#: ../../howto/enum.rst:1265 +#: ../../howto/enum.rst:1273 msgid "Using :class:`auto`" msgstr "" -#: ../../howto/enum.rst:1267 +#: ../../howto/enum.rst:1275 msgid "Using :class:`auto` would look like::" msgstr "" -#: ../../howto/enum.rst:1279 +#: ../../howto/enum.rst:1287 msgid "Using :class:`object`" msgstr "" -#: ../../howto/enum.rst:1281 +#: ../../howto/enum.rst:1289 msgid "Using :class:`object` would look like::" msgstr "" -#: ../../howto/enum.rst:1291 +#: ../../howto/enum.rst:1299 msgid "" "This is also a good example of why you might want to write your own :meth:" "`__repr__`::" msgstr "" -#: ../../howto/enum.rst:1307 +#: ../../howto/enum.rst:1315 msgid "Using a descriptive string" msgstr "" -#: ../../howto/enum.rst:1309 +#: ../../howto/enum.rst:1317 msgid "Using a string as the value would look like::" msgstr "" -#: ../../howto/enum.rst:1321 +#: ../../howto/enum.rst:1329 msgid "Using a custom :meth:`__new__`" msgstr "" -#: ../../howto/enum.rst:1323 +#: ../../howto/enum.rst:1331 msgid "Using an auto-numbering :meth:`__new__` would look like::" msgstr "" -#: ../../howto/enum.rst:1340 +#: ../../howto/enum.rst:1348 msgid "" "To make a more general purpose ``AutoNumber``, add ``*args`` to the " "signature::" msgstr "" -#: ../../howto/enum.rst:1350 +#: ../../howto/enum.rst:1358 msgid "" "Then when you inherit from ``AutoNumber`` you can write your own " "``__init__`` to handle any extra arguments::" msgstr "" -#: ../../howto/enum.rst:1369 +#: ../../howto/enum.rst:1377 msgid "" "The :meth:`__new__` method, if defined, is used during creation of the Enum " "members; it is then replaced by Enum's :meth:`__new__` which is used after " "class creation for lookup of existing members." msgstr "" -#: ../../howto/enum.rst:1375 +#: ../../howto/enum.rst:1383 msgid "" "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " "one that is found; instead, use the data type directly -- e.g.::" msgstr "" -#: ../../howto/enum.rst:1382 +#: ../../howto/enum.rst:1390 msgid "OrderedEnum" msgstr "" -#: ../../howto/enum.rst:1384 +#: ../../howto/enum.rst:1392 msgid "" "An ordered enumeration that is not based on :class:`IntEnum` and so " "maintains the normal :class:`Enum` invariants (such as not being comparable " "to other enumerations)::" msgstr "" -#: ../../howto/enum.rst:1418 +#: ../../howto/enum.rst:1426 msgid "DuplicateFreeEnum" msgstr "" -#: ../../howto/enum.rst:1420 +#: ../../howto/enum.rst:1428 msgid "" "Raises an error if a duplicate member value is found instead of creating an " "alias::" msgstr "" -#: ../../howto/enum.rst:1445 +#: ../../howto/enum.rst:1453 msgid "" "This is a useful example for subclassing Enum to add or change other " "behaviors as well as disallowing aliases. If the only desired change is " "disallowing aliases, the :func:`unique` decorator can be used instead." msgstr "" -#: ../../howto/enum.rst:1451 +#: ../../howto/enum.rst:1459 msgid "Planet" msgstr "" -#: ../../howto/enum.rst:1453 +#: ../../howto/enum.rst:1461 msgid "" "If :meth:`__new__` or :meth:`__init__` is defined, the value of the enum " "member will be passed to those methods::" msgstr "" -#: ../../howto/enum.rst:1482 +#: ../../howto/enum.rst:1490 msgid "TimePeriod" msgstr "" -#: ../../howto/enum.rst:1484 +#: ../../howto/enum.rst:1492 msgid "An example to show the :attr:`_ignore_` attribute in use::" msgstr "" -#: ../../howto/enum.rst:1503 +#: ../../howto/enum.rst:1511 msgid "Subclassing EnumType" msgstr "" -#: ../../howto/enum.rst:1505 +#: ../../howto/enum.rst:1513 msgid "" "While most enum needs can be met by customizing :class:`Enum` subclasses, " "either with class decorators or custom functions, :class:`EnumType` can be " diff --git a/howto/logging.po b/howto/logging.po index 25bd64c3e4..bb744e4c00 100644 --- a/howto/logging.po +++ b/howto/logging.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-18 00:04+0000\n" +"POT-Creation-Date: 2024-07-04 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -143,7 +143,7 @@ msgid "" "below (in increasing order of severity):" msgstr "" -#: ../../howto/logging.rst:75 ../../howto/logging.rst:830 +#: ../../howto/logging.rst:75 ../../howto/logging.rst:870 msgid "Level" msgstr "" @@ -151,7 +151,7 @@ msgstr "" msgid "When it's used" msgstr "" -#: ../../howto/logging.rst:77 ../../howto/logging.rst:840 +#: ../../howto/logging.rst:77 ../../howto/logging.rst:880 msgid "``DEBUG``" msgstr "``DEBUG``" @@ -160,7 +160,7 @@ msgid "" "Detailed information, typically of interest only when diagnosing problems." msgstr "" -#: ../../howto/logging.rst:80 ../../howto/logging.rst:838 +#: ../../howto/logging.rst:80 ../../howto/logging.rst:878 msgid "``INFO``" msgstr "``INFO``" @@ -168,7 +168,7 @@ msgstr "``INFO``" msgid "Confirmation that things are working as expected." msgstr "" -#: ../../howto/logging.rst:83 ../../howto/logging.rst:836 +#: ../../howto/logging.rst:83 ../../howto/logging.rst:876 msgid "``WARNING``" msgstr "``WARNING``" @@ -179,7 +179,7 @@ msgid "" "working as expected." msgstr "" -#: ../../howto/logging.rst:88 ../../howto/logging.rst:834 +#: ../../howto/logging.rst:88 ../../howto/logging.rst:874 msgid "``ERROR``" msgstr "``ERROR``" @@ -189,7 +189,7 @@ msgid "" "some function." msgstr "" -#: ../../howto/logging.rst:91 ../../howto/logging.rst:832 +#: ../../howto/logging.rst:91 ../../howto/logging.rst:872 msgid "``CRITICAL``" msgstr "``CRITICAL``" @@ -539,11 +539,11 @@ msgid "" "the following diagram." msgstr "" -#: ../../howto/logging.rst:388 +#: ../../howto/logging.rst:428 msgid "Loggers" msgstr "" -#: ../../howto/logging.rst:390 +#: ../../howto/logging.rst:430 msgid "" ":class:`Logger` objects have a threefold job. First, they expose several " "methods to application code so that applications can log messages at " @@ -553,17 +553,17 @@ msgid "" "handlers." msgstr "" -#: ../../howto/logging.rst:396 +#: ../../howto/logging.rst:436 msgid "" "The most widely used methods on logger objects fall into two categories: " "configuration and message sending." msgstr "" -#: ../../howto/logging.rst:399 +#: ../../howto/logging.rst:439 msgid "These are the most common configuration methods:" msgstr "" -#: ../../howto/logging.rst:401 +#: ../../howto/logging.rst:441 msgid "" ":meth:`Logger.setLevel` specifies the lowest-severity log message a logger " "will handle, where debug is the lowest built-in severity level and critical " @@ -572,32 +572,32 @@ msgid "" "messages and will ignore DEBUG messages." msgstr "" -#: ../../howto/logging.rst:407 +#: ../../howto/logging.rst:447 msgid "" ":meth:`Logger.addHandler` and :meth:`Logger.removeHandler` add and remove " "handler objects from the logger object. Handlers are covered in more detail " "in :ref:`handler-basic`." msgstr "" -#: ../../howto/logging.rst:411 +#: ../../howto/logging.rst:451 msgid "" ":meth:`Logger.addFilter` and :meth:`Logger.removeFilter` add and remove " "filter objects from the logger object. Filters are covered in more detail " "in :ref:`filter`." msgstr "" -#: ../../howto/logging.rst:415 +#: ../../howto/logging.rst:455 msgid "" "You don't need to always call these methods on every logger you create. See " "the last two paragraphs in this section." msgstr "" -#: ../../howto/logging.rst:418 +#: ../../howto/logging.rst:458 msgid "" "With the logger object configured, the following methods create log messages:" msgstr "" -#: ../../howto/logging.rst:420 +#: ../../howto/logging.rst:460 msgid "" ":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:" "`Logger.error`, and :meth:`Logger.critical` all create log records with a " @@ -610,14 +610,14 @@ msgid "" "exception information." msgstr "" -#: ../../howto/logging.rst:430 +#: ../../howto/logging.rst:470 msgid "" ":meth:`Logger.exception` creates a log message similar to :meth:`Logger." "error`. The difference is that :meth:`Logger.exception` dumps a stack trace " "along with it. Call this method only from an exception handler." msgstr "" -#: ../../howto/logging.rst:434 +#: ../../howto/logging.rst:474 msgid "" ":meth:`Logger.log` takes a log level as an explicit argument. This is a " "little more verbose for logging messages than using the log level " @@ -625,7 +625,7 @@ msgid "" "levels." msgstr "" -#: ../../howto/logging.rst:438 +#: ../../howto/logging.rst:478 msgid "" ":func:`getLogger` returns a reference to a logger instance with the " "specified name if it is provided, or ``root`` if not. The names are period-" @@ -637,7 +637,7 @@ msgid "" "descendants of ``foo``." msgstr "" -#: ../../howto/logging.rst:446 +#: ../../howto/logging.rst:486 msgid "" "Loggers have a concept of *effective level*. If a level is not explicitly " "set on a logger, the level of its parent is used instead as its effective " @@ -649,7 +649,7 @@ msgid "" "handlers." msgstr "" -#: ../../howto/logging.rst:454 +#: ../../howto/logging.rst:494 msgid "" "Child loggers propagate messages up to the handlers associated with their " "ancestor loggers. Because of this, it is unnecessary to define and configure " @@ -659,11 +659,11 @@ msgid "" "attribute of a logger to ``False``.)" msgstr "" -#: ../../howto/logging.rst:465 +#: ../../howto/logging.rst:505 msgid "Handlers" msgstr "" -#: ../../howto/logging.rst:467 +#: ../../howto/logging.rst:507 msgid "" ":class:`~logging.Handler` objects are responsible for dispatching the " "appropriate log messages (based on the log messages' severity) to the " @@ -676,14 +676,14 @@ msgid "" "of a specific severity to a specific location." msgstr "" -#: ../../howto/logging.rst:477 +#: ../../howto/logging.rst:517 msgid "" "The standard library includes quite a few handler types (see :ref:`useful-" "handlers`); the tutorials use mainly :class:`StreamHandler` and :class:" "`FileHandler` in its examples." msgstr "" -#: ../../howto/logging.rst:481 +#: ../../howto/logging.rst:521 msgid "" "There are very few methods in a handler for application developers to " "concern themselves with. The only handler methods that seem relevant for " @@ -691,7 +691,7 @@ msgid "" "not creating custom handlers) are the following configuration methods:" msgstr "" -#: ../../howto/logging.rst:486 +#: ../../howto/logging.rst:526 msgid "" "The :meth:`~Handler.setLevel` method, just as in logger objects, specifies " "the lowest severity that will be dispatched to the appropriate destination. " @@ -701,19 +701,19 @@ msgid "" "send on." msgstr "" -#: ../../howto/logging.rst:492 +#: ../../howto/logging.rst:532 msgid "" ":meth:`~Handler.setFormatter` selects a Formatter object for this handler to " "use." msgstr "" -#: ../../howto/logging.rst:495 +#: ../../howto/logging.rst:535 msgid "" ":meth:`~Handler.addFilter` and :meth:`~Handler.removeFilter` respectively " "configure and deconfigure filter objects on handlers." msgstr "" -#: ../../howto/logging.rst:498 +#: ../../howto/logging.rst:538 msgid "" "Application code should not directly instantiate and use instances of :class:" "`Handler`. Instead, the :class:`Handler` class is a base class that defines " @@ -721,11 +721,11 @@ msgid "" "behavior that child classes can use (or override)." msgstr "" -#: ../../howto/logging.rst:505 +#: ../../howto/logging.rst:545 msgid "Formatters" msgstr "" -#: ../../howto/logging.rst:507 +#: ../../howto/logging.rst:547 msgid "" "Formatter objects configure the final order, structure, and contents of the " "log message. Unlike the base :class:`logging.Handler` class, application " @@ -735,20 +735,20 @@ msgid "" "string and a style indicator." msgstr "" -#: ../../howto/logging.rst:516 +#: ../../howto/logging.rst:556 msgid "" "If there is no message format string, the default is to use the raw " "message. If there is no date format string, the default date format is:" msgstr "" -#: ../../howto/logging.rst:523 +#: ../../howto/logging.rst:563 msgid "" "with the milliseconds tacked on at the end. The ``style`` is one of ``'%'``, " "``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be " "used." msgstr "" -#: ../../howto/logging.rst:526 +#: ../../howto/logging.rst:566 msgid "" "If the ``style`` is ``'%'``, the message format string uses ``%()s`` styled string substitution; the possible keys are documented in :" @@ -758,18 +758,18 @@ msgid "" "should conform to what is expected by :meth:`string.Template.substitute`." msgstr "" -#: ../../howto/logging.rst:533 +#: ../../howto/logging.rst:573 msgid "Added the ``style`` parameter." msgstr "新增 ``style`` 參數。" -#: ../../howto/logging.rst:536 +#: ../../howto/logging.rst:576 msgid "" "The following message format string will log the time in a human-readable " "format, the severity of the message, and the contents of the message, in " "that order::" msgstr "" -#: ../../howto/logging.rst:542 +#: ../../howto/logging.rst:582 msgid "" "Formatters use a user-configurable function to convert the creation time of " "a record to a tuple. By default, :func:`time.localtime` is used; to change " @@ -780,68 +780,68 @@ msgid "" "in the Formatter class (to ``time.gmtime`` for GMT display)." msgstr "" -#: ../../howto/logging.rst:552 +#: ../../howto/logging.rst:592 msgid "Configuring Logging" msgstr "" -#: ../../howto/logging.rst:556 +#: ../../howto/logging.rst:596 msgid "Programmers can configure logging in three ways:" msgstr "" -#: ../../howto/logging.rst:558 +#: ../../howto/logging.rst:598 msgid "" "Creating loggers, handlers, and formatters explicitly using Python code that " "calls the configuration methods listed above." msgstr "" -#: ../../howto/logging.rst:560 +#: ../../howto/logging.rst:600 msgid "" "Creating a logging config file and reading it using the :func:`fileConfig` " "function." msgstr "" -#: ../../howto/logging.rst:562 +#: ../../howto/logging.rst:602 msgid "" "Creating a dictionary of configuration information and passing it to the :" "func:`dictConfig` function." msgstr "" -#: ../../howto/logging.rst:565 +#: ../../howto/logging.rst:605 msgid "" "For the reference documentation on the last two options, see :ref:`logging-" "config-api`. The following example configures a very simple logger, a " "console handler, and a simple formatter using Python code::" msgstr "" -#: ../../howto/logging.rst:595 +#: ../../howto/logging.rst:635 msgid "" "Running this module from the command line produces the following output:" msgstr "" -#: ../../howto/logging.rst:606 +#: ../../howto/logging.rst:646 msgid "" "The following Python module creates a logger, handler, and formatter nearly " "identical to those in the example listed above, with the only difference " "being the names of the objects::" msgstr "" -#: ../../howto/logging.rst:625 +#: ../../howto/logging.rst:665 msgid "Here is the logging.conf file:" msgstr "" -#: ../../howto/logging.rst:657 +#: ../../howto/logging.rst:697 msgid "" "The output is nearly identical to that of the non-config-file-based example:" msgstr "" -#: ../../howto/logging.rst:668 +#: ../../howto/logging.rst:708 msgid "" "You can see that the config file approach has a few advantages over the " "Python code approach, mainly separation of configuration and code and the " "ability of noncoders to easily modify the logging properties." msgstr "" -#: ../../howto/logging.rst:672 +#: ../../howto/logging.rst:712 msgid "" "The :func:`fileConfig` function takes a default parameter, " "``disable_existing_loggers``, which defaults to ``True`` for reasons of " @@ -852,7 +852,7 @@ msgid "" "information, and specify ``False`` for this parameter if you wish." msgstr "" -#: ../../howto/logging.rst:680 +#: ../../howto/logging.rst:720 msgid "" "The dictionary passed to :func:`dictConfig` can also specify a Boolean value " "with key ``disable_existing_loggers``, which if not specified explicitly in " @@ -861,7 +861,7 @@ msgid "" "want - in which case, provide the key explicitly with a value of ``False``." msgstr "" -#: ../../howto/logging.rst:690 +#: ../../howto/logging.rst:730 msgid "" "Note that the class names referenced in config files need to be either " "relative to the logging module, or absolute values which can be resolved " @@ -872,7 +872,7 @@ msgid "" "path)." msgstr "" -#: ../../howto/logging.rst:698 +#: ../../howto/logging.rst:738 msgid "" "In Python 3.2, a new means of configuring logging has been introduced, using " "dictionaries to hold configuration information. This provides a superset of " @@ -887,30 +887,30 @@ msgid "" "a socket, or use whatever approach makes sense for your application." msgstr "" -#: ../../howto/logging.rst:710 +#: ../../howto/logging.rst:750 msgid "" "Here's an example of the same configuration as above, in YAML format for the " "new dictionary-based approach:" msgstr "" -#: ../../howto/logging.rst:734 +#: ../../howto/logging.rst:774 msgid "" "For more information about logging using a dictionary, see :ref:`logging-" "config-api`." msgstr "" -#: ../../howto/logging.rst:738 +#: ../../howto/logging.rst:778 msgid "What happens if no configuration is provided" msgstr "" -#: ../../howto/logging.rst:740 +#: ../../howto/logging.rst:780 msgid "" "If no logging configuration is provided, it is possible to have a situation " "where a logging event needs to be output, but no handlers can be found to " "output the event." msgstr "" -#: ../../howto/logging.rst:744 +#: ../../howto/logging.rst:784 msgid "" "The event is output using a 'handler of last resort', stored in :data:" "`lastResort`. This internal handler is not associated with any logger, and " @@ -922,32 +922,32 @@ msgid "" "severities will be output." msgstr "" -#: ../../howto/logging.rst:755 +#: ../../howto/logging.rst:795 msgid "For versions of Python prior to 3.2, the behaviour is as follows:" msgstr "" -#: ../../howto/logging.rst:757 +#: ../../howto/logging.rst:797 msgid "" "If :data:`raiseExceptions` is ``False`` (production mode), the event is " "silently dropped." msgstr "" -#: ../../howto/logging.rst:760 +#: ../../howto/logging.rst:800 msgid "" "If :data:`raiseExceptions` is ``True`` (development mode), a message 'No " "handlers could be found for logger X.Y.Z' is printed once." msgstr "" -#: ../../howto/logging.rst:763 +#: ../../howto/logging.rst:803 msgid "" "To obtain the pre-3.2 behaviour, :data:`lastResort` can be set to ``None``." msgstr "" -#: ../../howto/logging.rst:769 +#: ../../howto/logging.rst:809 msgid "Configuring Logging for a Library" msgstr "" -#: ../../howto/logging.rst:771 +#: ../../howto/logging.rst:811 msgid "" "When developing a library which uses logging, you should take care to " "document how the library uses logging - for example, the names of loggers " @@ -958,7 +958,7 @@ msgid "" "is regarded as the best default behaviour." msgstr "" -#: ../../howto/logging.rst:779 +#: ../../howto/logging.rst:819 msgid "" "If for some reason you *don't* want these messages printed in the absence of " "any logging configuration, you can attach a do-nothing handler to the top-" @@ -970,7 +970,7 @@ msgid "" "to those handlers, as normal." msgstr "" -#: ../../howto/logging.rst:788 +#: ../../howto/logging.rst:828 msgid "" "A do-nothing handler is included in the logging package: :class:`~logging." "NullHandler` (since Python 3.1). An instance of this handler could be added " @@ -981,14 +981,14 @@ msgid "" "etc. then the code::" msgstr "" -#: ../../howto/logging.rst:799 +#: ../../howto/logging.rst:839 msgid "" "should have the desired effect. If an organisation produces a number of " "libraries, then the logger name specified can be 'orgname.foo' rather than " "just 'foo'." msgstr "" -#: ../../howto/logging.rst:803 +#: ../../howto/logging.rst:843 msgid "" "It is strongly advised that you *do not log to the root logger* in your " "library. Instead, use a logger with a unique and easily identifiable name, " @@ -998,7 +998,7 @@ msgid "" "library as they wish." msgstr "" -#: ../../howto/logging.rst:810 +#: ../../howto/logging.rst:850 msgid "" "It is strongly advised that you *do not add any handlers other than* :class:" "`~logging.NullHandler` *to your library's loggers*. This is because the " @@ -1009,11 +1009,11 @@ msgid "" "carry out unit tests and deliver logs which suit their requirements." msgstr "" -#: ../../howto/logging.rst:821 +#: ../../howto/logging.rst:861 msgid "Logging Levels" msgstr "" -#: ../../howto/logging.rst:823 +#: ../../howto/logging.rst:863 msgid "" "The numeric values of logging levels are given in the following table. These " "are primarily of interest if you want to define your own levels, and need " @@ -1022,39 +1022,39 @@ msgid "" "value; the predefined name is lost." msgstr "" -#: ../../howto/logging.rst:830 +#: ../../howto/logging.rst:870 msgid "Numeric value" msgstr "" -#: ../../howto/logging.rst:832 +#: ../../howto/logging.rst:872 msgid "50" msgstr "50" -#: ../../howto/logging.rst:834 +#: ../../howto/logging.rst:874 msgid "40" msgstr "40" -#: ../../howto/logging.rst:836 +#: ../../howto/logging.rst:876 msgid "30" msgstr "30" -#: ../../howto/logging.rst:838 +#: ../../howto/logging.rst:878 msgid "20" msgstr "20" -#: ../../howto/logging.rst:840 +#: ../../howto/logging.rst:880 msgid "10" msgstr "10" -#: ../../howto/logging.rst:842 +#: ../../howto/logging.rst:882 msgid "``NOTSET``" msgstr "``NOTSET``" -#: ../../howto/logging.rst:842 +#: ../../howto/logging.rst:882 msgid "0" msgstr "0" -#: ../../howto/logging.rst:845 +#: ../../howto/logging.rst:885 msgid "" "Levels can also be associated with loggers, being set either by the " "developer or through loading a saved logging configuration. When a logging " @@ -1064,14 +1064,14 @@ msgid "" "basic mechanism controlling the verbosity of logging output." msgstr "" -#: ../../howto/logging.rst:852 +#: ../../howto/logging.rst:892 msgid "" "Logging messages are encoded as instances of the :class:`~logging.LogRecord` " "class. When a logger decides to actually log an event, a :class:`~logging." "LogRecord` instance is created from the logging message." msgstr "" -#: ../../howto/logging.rst:856 +#: ../../howto/logging.rst:896 msgid "" "Logging messages are subjected to a dispatch mechanism through the use of :" "dfn:`handlers`, which are instances of subclasses of the :class:`Handler` " @@ -1088,7 +1088,7 @@ msgid "" "at which point the passing to ancestor handlers stops)." msgstr "" -#: ../../howto/logging.rst:870 +#: ../../howto/logging.rst:910 msgid "" "Just as for loggers, handlers can have levels associated with them. A " "handler's level acts as a filter in the same way as a logger's level does. " @@ -1098,11 +1098,11 @@ msgid "" "`~Handler.emit`." msgstr "" -#: ../../howto/logging.rst:879 +#: ../../howto/logging.rst:919 msgid "Custom Levels" msgstr "" -#: ../../howto/logging.rst:881 +#: ../../howto/logging.rst:921 msgid "" "Defining your own levels is possible, but should not be necessary, as the " "existing levels have been chosen on the basis of practical experience. " @@ -1115,27 +1115,27 @@ msgid "" "given numeric value might mean different things for different libraries." msgstr "" -#: ../../howto/logging.rst:894 +#: ../../howto/logging.rst:934 msgid "Useful Handlers" msgstr "" -#: ../../howto/logging.rst:896 +#: ../../howto/logging.rst:936 msgid "" "In addition to the base :class:`Handler` class, many useful subclasses are " "provided:" msgstr "" -#: ../../howto/logging.rst:899 +#: ../../howto/logging.rst:939 msgid "" ":class:`StreamHandler` instances send messages to streams (file-like " "objects)." msgstr "" -#: ../../howto/logging.rst:902 +#: ../../howto/logging.rst:942 msgid ":class:`FileHandler` instances send messages to disk files." msgstr "" -#: ../../howto/logging.rst:904 +#: ../../howto/logging.rst:944 msgid "" ":class:`~handlers.BaseRotatingHandler` is the base class for handlers that " "rotate log files at a certain point. It is not meant to be instantiated " @@ -1143,61 +1143,61 @@ msgid "" "`~handlers.TimedRotatingFileHandler`." msgstr "" -#: ../../howto/logging.rst:909 +#: ../../howto/logging.rst:949 msgid "" ":class:`~handlers.RotatingFileHandler` instances send messages to disk " "files, with support for maximum log file sizes and log file rotation." msgstr "" -#: ../../howto/logging.rst:912 +#: ../../howto/logging.rst:952 msgid "" ":class:`~handlers.TimedRotatingFileHandler` instances send messages to disk " "files, rotating the log file at certain timed intervals." msgstr "" -#: ../../howto/logging.rst:915 +#: ../../howto/logging.rst:955 msgid "" ":class:`~handlers.SocketHandler` instances send messages to TCP/IP sockets. " "Since 3.4, Unix domain sockets are also supported." msgstr "" -#: ../../howto/logging.rst:918 +#: ../../howto/logging.rst:958 msgid "" ":class:`~handlers.DatagramHandler` instances send messages to UDP sockets. " "Since 3.4, Unix domain sockets are also supported." msgstr "" -#: ../../howto/logging.rst:921 +#: ../../howto/logging.rst:961 msgid "" ":class:`~handlers.SMTPHandler` instances send messages to a designated email " "address." msgstr "" -#: ../../howto/logging.rst:924 +#: ../../howto/logging.rst:964 msgid "" ":class:`~handlers.SysLogHandler` instances send messages to a Unix syslog " "daemon, possibly on a remote machine." msgstr "" -#: ../../howto/logging.rst:927 +#: ../../howto/logging.rst:967 msgid "" ":class:`~handlers.NTEventLogHandler` instances send messages to a Windows " "NT/2000/XP event log." msgstr "" -#: ../../howto/logging.rst:930 +#: ../../howto/logging.rst:970 msgid "" ":class:`~handlers.MemoryHandler` instances send messages to a buffer in " "memory, which is flushed whenever specific criteria are met." msgstr "" -#: ../../howto/logging.rst:933 +#: ../../howto/logging.rst:973 msgid "" ":class:`~handlers.HTTPHandler` instances send messages to an HTTP server " "using either ``GET`` or ``POST`` semantics." msgstr "" -#: ../../howto/logging.rst:936 +#: ../../howto/logging.rst:976 msgid "" ":class:`~handlers.WatchedFileHandler` instances watch the file they are " "logging to. If the file changes, it is closed and reopened using the file " @@ -1205,13 +1205,13 @@ msgid "" "support the underlying mechanism used." msgstr "" -#: ../../howto/logging.rst:941 +#: ../../howto/logging.rst:981 msgid "" ":class:`~handlers.QueueHandler` instances send messages to a queue, such as " "those implemented in the :mod:`queue` or :mod:`multiprocessing` modules." msgstr "" -#: ../../howto/logging.rst:944 +#: ../../howto/logging.rst:984 msgid "" ":class:`NullHandler` instances do nothing with error messages. They are used " "by library developers who want to use logging, but want to avoid the 'No " @@ -1220,15 +1220,15 @@ msgid "" "more information." msgstr "" -#: ../../howto/logging.rst:950 +#: ../../howto/logging.rst:990 msgid "The :class:`NullHandler` class." msgstr "" -#: ../../howto/logging.rst:953 +#: ../../howto/logging.rst:993 msgid "The :class:`~handlers.QueueHandler` class." msgstr "" -#: ../../howto/logging.rst:956 +#: ../../howto/logging.rst:996 msgid "" "The :class:`NullHandler`, :class:`StreamHandler` and :class:`FileHandler` " "classes are defined in the core logging package. The other handlers are " @@ -1236,14 +1236,14 @@ msgid "" "module, :mod:`logging.config`, for configuration functionality.)" msgstr "" -#: ../../howto/logging.rst:961 +#: ../../howto/logging.rst:1001 msgid "" "Logged messages are formatted for presentation through instances of the :" "class:`Formatter` class. They are initialized with a format string suitable " "for use with the % operator and a dictionary." msgstr "" -#: ../../howto/logging.rst:965 +#: ../../howto/logging.rst:1005 msgid "" "For formatting multiple messages in a batch, instances of :class:" "`BufferingFormatter` can be used. In addition to the format string (which is " @@ -1251,7 +1251,7 @@ msgid "" "trailer format strings." msgstr "" -#: ../../howto/logging.rst:970 +#: ../../howto/logging.rst:1010 msgid "" "When filtering based on logger level and/or handler level is not enough, " "instances of :class:`Filter` can be added to both :class:`Logger` and :class:" @@ -1261,18 +1261,18 @@ msgid "" "value, the message is not processed further." msgstr "" -#: ../../howto/logging.rst:977 +#: ../../howto/logging.rst:1017 msgid "" "The basic :class:`Filter` functionality allows filtering by specific logger " "name. If this feature is used, messages sent to the named logger and its " "children are allowed through the filter, and all others dropped." msgstr "" -#: ../../howto/logging.rst:985 +#: ../../howto/logging.rst:1025 msgid "Exceptions raised during logging" msgstr "" -#: ../../howto/logging.rst:987 +#: ../../howto/logging.rst:1027 msgid "" "The logging package is designed to swallow exceptions which occur while " "logging in production. This is so that errors which occur while handling " @@ -1280,7 +1280,7 @@ msgid "" "errors - do not cause the application using logging to terminate prematurely." msgstr "" -#: ../../howto/logging.rst:992 +#: ../../howto/logging.rst:1032 msgid "" ":class:`SystemExit` and :class:`KeyboardInterrupt` exceptions are never " "swallowed. Other exceptions which occur during the :meth:`~Handler.emit` " @@ -1288,7 +1288,7 @@ msgid "" "handleError` method." msgstr "" -#: ../../howto/logging.rst:997 +#: ../../howto/logging.rst:1037 msgid "" "The default implementation of :meth:`~Handler.handleError` in :class:" "`Handler` checks to see if a module-level variable, :data:`raiseExceptions`, " @@ -1296,7 +1296,7 @@ msgid "" "the exception is swallowed." msgstr "" -#: ../../howto/logging.rst:1003 +#: ../../howto/logging.rst:1043 msgid "" "The default value of :data:`raiseExceptions` is ``True``. This is because " "during development, you typically want to be notified of any exceptions that " @@ -1304,11 +1304,11 @@ msgid "" "production usage." msgstr "" -#: ../../howto/logging.rst:1013 +#: ../../howto/logging.rst:1053 msgid "Using arbitrary objects as messages" msgstr "" -#: ../../howto/logging.rst:1015 +#: ../../howto/logging.rst:1055 msgid "" "In the preceding sections and examples, it has been assumed that the message " "passed when logging the event is a string. However, this is not the only " @@ -1320,11 +1320,11 @@ msgid "" "the wire." msgstr "" -#: ../../howto/logging.rst:1026 +#: ../../howto/logging.rst:1066 msgid "Optimization" msgstr "" -#: ../../howto/logging.rst:1028 +#: ../../howto/logging.rst:1068 msgid "" "Formatting of message arguments is deferred until it cannot be avoided. " "However, computing the arguments passed to the logging method can also be " @@ -1335,13 +1335,13 @@ msgid "" "code like this::" msgstr "" -#: ../../howto/logging.rst:1040 +#: ../../howto/logging.rst:1080 msgid "" "so that if the logger's threshold is set above ``DEBUG``, the calls to " "``expensive_func1`` and ``expensive_func2`` are never made." msgstr "" -#: ../../howto/logging.rst:1043 +#: ../../howto/logging.rst:1083 msgid "" "In some cases, :meth:`~Logger.isEnabledFor` can itself be more expensive " "than you'd like (e.g. for deeply nested loggers where an explicit level is " @@ -1353,7 +1353,7 @@ msgid "" "while the application is running (which is not all that common)." msgstr "" -#: ../../howto/logging.rst:1052 +#: ../../howto/logging.rst:1092 msgid "" "There are other optimizations which can be made for specific applications " "which need more precise control over what logging information is collected. " @@ -1361,94 +1361,94 @@ msgid "" "you don't need:" msgstr "" -#: ../../howto/logging.rst:1058 +#: ../../howto/logging.rst:1098 msgid "What you don't want to collect" msgstr "" -#: ../../howto/logging.rst:1058 +#: ../../howto/logging.rst:1098 msgid "How to avoid collecting it" msgstr "" -#: ../../howto/logging.rst:1060 +#: ../../howto/logging.rst:1100 msgid "Information about where calls were made from." msgstr "" -#: ../../howto/logging.rst:1060 +#: ../../howto/logging.rst:1100 msgid "" "Set ``logging._srcfile`` to ``None``. This avoids calling :func:`sys." "_getframe`, which may help to speed up your code in environments like PyPy " "(which can't speed up code that uses :func:`sys._getframe`)." msgstr "" -#: ../../howto/logging.rst:1066 +#: ../../howto/logging.rst:1106 msgid "Threading information." msgstr "" -#: ../../howto/logging.rst:1066 +#: ../../howto/logging.rst:1106 msgid "Set ``logging.logThreads`` to ``False``." msgstr "" -#: ../../howto/logging.rst:1068 +#: ../../howto/logging.rst:1108 msgid "Current process ID (:func:`os.getpid`)" msgstr "" -#: ../../howto/logging.rst:1068 +#: ../../howto/logging.rst:1108 msgid "Set ``logging.logProcesses`` to ``False``." msgstr "" -#: ../../howto/logging.rst:1070 +#: ../../howto/logging.rst:1110 msgid "" "Current process name when using ``multiprocessing`` to manage multiple " "processes." msgstr "" -#: ../../howto/logging.rst:1070 +#: ../../howto/logging.rst:1110 msgid "Set ``logging.logMultiprocessing`` to ``False``." msgstr "" -#: ../../howto/logging.rst:1073 +#: ../../howto/logging.rst:1113 msgid "Current :class:`asyncio.Task` name when using ``asyncio``." msgstr "" -#: ../../howto/logging.rst:1073 +#: ../../howto/logging.rst:1113 msgid "Set ``logging.logAsyncioTasks`` to ``False``." msgstr "" -#: ../../howto/logging.rst:1077 +#: ../../howto/logging.rst:1117 msgid "" "Also note that the core logging module only includes the basic handlers. If " "you don't import :mod:`logging.handlers` and :mod:`logging.config`, they " "won't take up any memory." msgstr "" -#: ../../howto/logging.rst:1084 +#: ../../howto/logging.rst:1124 msgid "Other resources" msgstr "" -#: ../../howto/logging.rst:1088 +#: ../../howto/logging.rst:1128 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging.rst:1089 +#: ../../howto/logging.rst:1129 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging.rst:1091 +#: ../../howto/logging.rst:1131 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging.rst:1092 +#: ../../howto/logging.rst:1132 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging.rst:1094 +#: ../../howto/logging.rst:1134 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging.rst:1095 +#: ../../howto/logging.rst:1135 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging.rst:1097 +#: ../../howto/logging.rst:1137 msgid ":ref:`A logging cookbook `" msgstr "" diff --git a/library/__main__.po b/library/__main__.po index 980abbc8c7..7742bbf409 100644 --- a/library/__main__.po +++ b/library/__main__.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-07-05 00:03+0000\n" "PO-Revision-Date: 2023-12-21 14:49+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -333,12 +333,12 @@ msgstr "" #: ../../library/__main__.rst:254 msgid "" -"This won't work for ``__main__.py`` files in the root directory of a .zip " -"file though. Hence, for consistency, minimal ``__main__.py`` like the :mod:" -"`venv` one mentioned below are preferred." +"This won't work for ``__main__.py`` files in the root directory of a ``." +"zip`` file though. Hence, for consistency, a minimal ``__main__.py`` " +"without a ``__name__`` check is preferred." msgstr "" -"但這對於 .zip 檔案根目錄中的 ``__main__.py`` 檔案不起作用。因此,為了保持一致" -"性,最小的 ``__main__.py`` 如下面提到的 :mod:`venv` 會是首選。" +"但這對於 ``.zip`` 檔案根目錄中的 ``__main__.py`` 檔案不起作用。因此,為了保持" +"一致性,最小的、沒有 ``__name__`` 檢查的 ``__main__.py`` 會是首選。" #: ../../library/__main__.rst:260 msgid "" diff --git a/library/ast.po b/library/ast.po index 358f3b19c6..b9d1641bcf 100644 --- a/library/ast.po +++ b/library/ast.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-16 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -639,8 +639,8 @@ msgstr "" "``targets`` 中的多個節點表示為每個節點分配相同的值。解包是透過在 ``targets`` " "中放置一個 :class:`Tuple` 或 :class:`List` 來表示的。" -#: ../../library/ast.rst:853 ../../library/ast.rst:1161 -#: ../../library/ast.rst:1366 ../../library/ast.rst:1891 +#: ../../library/ast.rst:853 ../../library/ast.rst:1165 +#: ../../library/ast.rst:1370 ../../library/ast.rst:1895 msgid "" "``type_comment`` is an optional string with the type annotation as a comment." msgstr "``type_comment`` 是一個可選字串,其中的註解為型別註釋。" @@ -650,17 +650,26 @@ msgid "" "An assignment with a type annotation. ``target`` is a single node and can be " "a :class:`Name`, a :class:`Attribute` or a :class:`Subscript`. " "``annotation`` is the annotation, such as a :class:`Constant` or :class:" -"`Name` node. ``value`` is a single optional node. ``simple`` is a boolean " -"integer set to True for a :class:`Name` node in ``target`` that do not " -"appear in between parenthesis and are hence pure names and not expressions." +"`Name` node. ``value`` is a single optional node." msgstr "" "帶有型別註釋的賦值。``target`` 是單個節點,可以是 :class:`Name`、:class:" "`Attribute` 或 :class:`Subscript`。``annotation`` 是註釋,例如 :class:" -"`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節點。``simple`` 是一個" -"布林整數,對於 ``target`` 中的 :class:`Name` 節點會設定為 True,它不會出現在" -"括號之間,因此是純名稱而不是運算式。" +"`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節點。" -#: ../../library/ast.rst:938 +#: ../../library/ast.rst:888 +msgid "" +"``simple`` is always either 0 (indicating a \"complex\" target) or 1 " +"(indicating a \"simple\" target). A \"simple\" target consists solely of a :" +"class:`Name` node that does not appear between parentheses; all other " +"targets are considered complex. Only simple targets appear in the :attr:" +"`__annotations__` dictionary of modules and classes." +msgstr "" +"``simple`` 總會是 0(表示一個「複雜」目標)或 1(表示一個「簡單」目標)。一個" +"「簡單」目標僅包含一個 :class:`Name` 節點,且不出現在括號之間;所有其他目標都" +"被視為是複雜的。只有簡單目標會出現在模組和類別的 :attr:`__annotations__` 字典" +"中。" + +#: ../../library/ast.rst:942 msgid "" "Augmented assignment, such as ``a += 1``. In the following example, " "``target`` is a :class:`Name` node for ``x`` (with the :class:`Store` " @@ -671,7 +680,7 @@ msgstr "" "是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` 是 :class:" "`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" -#: ../../library/ast.rst:943 +#: ../../library/ast.rst:947 msgid "" "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, " "unlike the targets of :class:`Assign`." @@ -679,7 +688,7 @@ msgstr "" "與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` 或 :" "class:`List` 類別。" -#: ../../library/ast.rst:960 +#: ../../library/ast.rst:964 msgid "" "A ``raise`` statement. ``exc`` is the exception object to be raised, " "normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone " @@ -689,7 +698,7 @@ msgstr "" "class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " "from y`` 中的可選部分 ``y``。" -#: ../../library/ast.rst:977 +#: ../../library/ast.rst:981 msgid "" "An assertion. ``test`` holds the condition, such as a :class:`Compare` node. " "``msg`` holds the failure message." @@ -697,7 +706,7 @@ msgstr "" "一個斷言 (assertion)。``test`` 保存條件,例如 :class:`Compare` 節點。``msg`` " "保存失敗訊息。" -#: ../../library/ast.rst:993 +#: ../../library/ast.rst:997 msgid "" "Represents a ``del`` statement. ``targets`` is a list of nodes, such as :" "class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." @@ -705,11 +714,11 @@ msgstr "" "代表一個 ``del`` 陳述式。``targets`` 是節點串列,例如 :class:`Name`、:class:" "`Attribute` 或 :class:`Subscript` 節點。" -#: ../../library/ast.rst:1011 +#: ../../library/ast.rst:1015 msgid "A ``pass`` statement." msgstr "一個 ``pass`` 陳述式。" -#: ../../library/ast.rst:1024 +#: ../../library/ast.rst:1028 msgid "" "A :ref:`type alias ` created through the :keyword:`type` " "statement. ``name`` is the name of the alias, ``type_params`` is a list of :" @@ -720,21 +729,21 @@ msgstr "" "aliases>`。``name`` 是別名的名稱、``type_params`` 是\\ :ref:`型別參數 (type " "parameter) ` 的串列、``value`` 是型別別名的值。" -#: ../../library/ast.rst:1042 +#: ../../library/ast.rst:1046 msgid "" "Other statements which are only applicable inside functions or loops are " "described in other sections." msgstr "其他僅適用於函式或迴圈內部的陳述式將在其他部分中描述。" -#: ../../library/ast.rst:1046 +#: ../../library/ast.rst:1050 msgid "Imports" msgstr "引入 (imports)" -#: ../../library/ast.rst:1050 +#: ../../library/ast.rst:1054 msgid "An import statement. ``names`` is a list of :class:`alias` nodes." msgstr "一個 import 陳述式。``names`` 是 :class:`alias` 節點的串列。" -#: ../../library/ast.rst:1067 +#: ../../library/ast.rst:1071 msgid "" "Represents ``from x import y``. ``module`` is a raw string of the 'from' " "name, without any leading dots, or ``None`` for statements such as ``from . " @@ -745,7 +754,7 @@ msgstr "" "點 (dot),或者對於諸如 ``from . import foo`` 之類的陳述式則為 ``None``。" "``level`` 是一個整數,保存相對引入的級別(0 表示絕對引入)。" -#: ../../library/ast.rst:1089 +#: ../../library/ast.rst:1093 msgid "" "Both parameters are raw strings of the names. ``asname`` can be ``None`` if " "the regular name is to be used." @@ -753,17 +762,17 @@ msgstr "" "這兩個參數都是名稱的原始字串。如果要使用常規名稱,``asname`` 可以為 " "``None``。" -#: ../../library/ast.rst:1106 +#: ../../library/ast.rst:1110 msgid "Control flow" msgstr "流程控制" -#: ../../library/ast.rst:1109 +#: ../../library/ast.rst:1113 msgid "" "Optional clauses such as ``else`` are stored as an empty list if they're not " "present." msgstr "諸如 ``else`` 之類的可選子句如果不存在,則將被儲存為空串列。" -#: ../../library/ast.rst:1114 +#: ../../library/ast.rst:1118 msgid "" "An ``if`` statement. ``test`` holds a single node, such as a :class:" "`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." @@ -771,7 +780,7 @@ msgstr "" "一個 ``if`` 陳述式。``test`` 保存單個節點,例如 :class:`Compare` 節點。" "``body`` 和 ``orelse`` 各自保存一個節點串列。" -#: ../../library/ast.rst:1117 +#: ../../library/ast.rst:1121 msgid "" "``elif`` clauses don't have a special representation in the AST, but rather " "appear as extra :class:`If` nodes within the ``orelse`` section of the " @@ -780,7 +789,7 @@ msgstr "" "``elif`` 子句在 AST 中沒有特殊表示,而是在前一個子句的 ``orelse`` 部分中作為" "額外的 :class:`If` 節點出現。" -#: ../../library/ast.rst:1152 +#: ../../library/ast.rst:1156 msgid "" "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a " "single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` or :" @@ -795,17 +804,17 @@ msgstr "" "行的節點串列。如果迴圈正常完成,則執行 ``orelse`` 中的內容,而不是透過 " "``break`` 陳述式執行。" -#: ../../library/ast.rst:1187 +#: ../../library/ast.rst:1191 msgid "" "A ``while`` loop. ``test`` holds the condition, such as a :class:`Compare` " "node." msgstr "一個 ``while`` 迴圈。``test`` 保存條件,例如 :class:`Compare` 節點。" -#: ../../library/ast.rst:1214 +#: ../../library/ast.rst:1218 msgid "The ``break`` and ``continue`` statements." msgstr "``break`` 和 ``continue`` 陳述式。" -#: ../../library/ast.rst:1249 +#: ../../library/ast.rst:1253 msgid "" "``try`` blocks. All attributes are list of nodes to execute, except for " "``handlers``, which is a list of :class:`ExceptHandler` nodes." @@ -813,7 +822,7 @@ msgstr "" "``try`` 區塊。除 ``handlers`` 是 :class:`ExceptHandler` 節點的串列外,其他所" "有屬性都是要執行之節點的串列。" -#: ../../library/ast.rst:1295 +#: ../../library/ast.rst:1299 msgid "" "``try`` blocks which are followed by ``except*`` clauses. The attributes are " "the same as for :class:`Try` but the :class:`ExceptHandler` nodes in " @@ -823,7 +832,7 @@ msgstr "" "``handlers`` 中的 :class:`ExceptHandler` 節點被直譯 (interpret) 為 " "``except*`` 區塊而不是 ``except``。" -#: ../../library/ast.rst:1327 +#: ../../library/ast.rst:1331 msgid "" "A single ``except`` clause. ``type`` is the exception type it will match, " "typically a :class:`Name` node (or ``None`` for a catch-all ``except:`` " @@ -835,7 +844,7 @@ msgstr "" "``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則為 " "``None``。``body`` 是節點串列。" -#: ../../library/ast.rst:1361 +#: ../../library/ast.rst:1365 msgid "" "A ``with`` block. ``items`` is a list of :class:`withitem` nodes " "representing the context managers, and ``body`` is the indented block inside " @@ -844,7 +853,7 @@ msgstr "" "一個 ``with`` 區塊。``items`` 是表示情境管理器的 :class:`withitem` 節點串列," "``body`` 是情境內的縮進區塊。" -#: ../../library/ast.rst:1371 +#: ../../library/ast.rst:1375 msgid "" "A single context manager in a ``with`` block. ``context_expr`` is the " "context manager, often a :class:`Call` node. ``optional_vars`` is a :class:" @@ -855,11 +864,11 @@ msgstr "" "class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分的 :class:`Name`、:" "class:`Tuple` 或 :class:`List`,或者如果不使用則為 ``None`` 。" -#: ../../library/ast.rst:1404 +#: ../../library/ast.rst:1408 msgid "Pattern matching" msgstr "模式匹配 (pattern matching)" -#: ../../library/ast.rst:1409 +#: ../../library/ast.rst:1413 msgid "" "A ``match`` statement. ``subject`` holds the subject of the match (the " "object that is being matched against the cases) and ``cases`` contains an " @@ -868,7 +877,7 @@ msgstr "" "一個 ``match`` 陳述式。``subject`` 保存匹配的主題(與案例匹配的物件)," "``cases`` 包含具有不同案例的 :class:`match_case` 節點的可疊代物件。" -#: ../../library/ast.rst:1417 +#: ../../library/ast.rst:1421 msgid "" "A single case pattern in a ``match`` statement. ``pattern`` contains the " "match pattern that the subject will be matched against. Note that the :class:" @@ -879,13 +888,13 @@ msgstr "" "請注意,為模式生成的 :class:`AST` 節點與為運算式生成的節點不同,即使它們共享" "相同的語法。" -#: ../../library/ast.rst:1422 +#: ../../library/ast.rst:1426 msgid "" "The ``guard`` attribute contains an expression that will be evaluated if the " "pattern matches the subject." msgstr "``guard`` 屬性包含一個運算式,如果模式與主題匹配,則將對該運算式求值。" -#: ../../library/ast.rst:1425 +#: ../../library/ast.rst:1429 msgid "" "``body`` contains a list of nodes to execute if the pattern matches and the " "result of evaluating the guard expression is true." @@ -893,7 +902,7 @@ msgstr "" "``body`` 包含一個節點串列,如果模式匹配並且為防護運算式 (guard expression) 的" "求值 (evaluate) 結果為真,則會執行該節點串列。" -#: ../../library/ast.rst:1470 +#: ../../library/ast.rst:1474 msgid "" "A match literal or value pattern that compares by equality. ``value`` is an " "expression node. Permitted value nodes are restricted as described in the " @@ -903,7 +912,7 @@ msgstr "" "以相等性進行比較的匹配文本或值的模式。``value`` 是一個運算式節點。允許值節點" "受到匹配陳述式文件中所述的限制。如果匹配主題等於求出值,則此模式成功。" -#: ../../library/ast.rst:1499 +#: ../../library/ast.rst:1503 msgid "" "A match literal pattern that compares by identity. ``value`` is the " "singleton to be compared against: ``None``, ``True``, or ``False``. This " @@ -913,7 +922,7 @@ msgstr "" "``True`` 或 ``False`` 進行比較的單例 (singleton)。如果匹配主題是給定的常數," "則此模式成功。" -#: ../../library/ast.rst:1526 +#: ../../library/ast.rst:1530 msgid "" "A match sequence pattern. ``patterns`` contains the patterns to be matched " "against the subject elements if the subject is a sequence. Matches a " @@ -923,7 +932,7 @@ msgstr "" "匹配序列模式。如果主題是一個序列,``patterns`` 包含與主題元素匹配的模式。如果" "子模式之一是 ``MatchStar`` 節點,則匹配可變長度序列,否則匹配固定長度序列。" -#: ../../library/ast.rst:1559 +#: ../../library/ast.rst:1563 msgid "" "Matches the rest of the sequence in a variable length match sequence " "pattern. If ``name`` is not ``None``, a list containing the remaining " @@ -933,7 +942,7 @@ msgstr "" "以可變長度匹配序列模式匹配序列的其餘部分。如果 ``name`` 不是 ``None``,則如果" "整體序列模式成功,則包含其餘序列元素的串列將綁定到該名稱。" -#: ../../library/ast.rst:1601 +#: ../../library/ast.rst:1605 msgid "" "A match mapping pattern. ``keys`` is a sequence of expression nodes. " "``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an " @@ -945,7 +954,7 @@ msgstr "" "列。``rest`` 是一個可選名稱,可以指定它來捕獲剩餘的對映元素。允許的鍵運算式受" "到匹配陳述式文件中所述的限制。" -#: ../../library/ast.rst:1607 +#: ../../library/ast.rst:1611 msgid "" "This pattern succeeds if the subject is a mapping, all evaluated key " "expressions are present in the mapping, and the value corresponding to each " @@ -957,7 +966,7 @@ msgstr "" "應的子模式匹配,則此模式成功。如果 ``rest`` 不是 ``None``,則如果整體對映模式" "成功,則包含其餘對映元素的字典將綁定到該名稱。" -#: ../../library/ast.rst:1649 +#: ../../library/ast.rst:1653 msgid "" "A match class pattern. ``cls`` is an expression giving the nominal class to " "be matched. ``patterns`` is a sequence of pattern nodes to be matched " @@ -972,7 +981,7 @@ msgstr "" "``kwd_attrs`` 是要匹配的附加屬性序列(在類別模式中指定為關鍵字引數)," "``kwd_patterns`` 是相應的模式(在類別模式中指定為關鍵字的值)。" -#: ../../library/ast.rst:1656 +#: ../../library/ast.rst:1660 msgid "" "This pattern succeeds if the subject is an instance of the nominated class, " "all positional patterns match the corresponding class-defined attributes, " @@ -981,7 +990,7 @@ msgstr "" "如果主題是指定類別的實例,所有位置模式都與相應的類別定義屬性匹配,並且任何指" "定的關鍵字屬性與其相應模式匹配,則此模式成功。" -#: ../../library/ast.rst:1660 +#: ../../library/ast.rst:1664 msgid "" "Note: classes may define a property that returns self in order to match a " "pattern node against the instance being matched. Several builtin types are " @@ -990,7 +999,7 @@ msgstr "" "注意:類別可以定義一個回傳 self 的特性 (property),以便將模式節點與正在匹配的" "實例進行匹配。一些內建型別也以這種方式匹配,如同匹配陳述式文件中所述。" -#: ../../library/ast.rst:1715 +#: ../../library/ast.rst:1719 msgid "" "A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` " "contains the match pattern that the subject will be matched against. If the " @@ -1001,7 +1010,7 @@ msgstr "" "(wildcard pattern)。``pattern`` 包含主題將與之匹配的匹配模式。如果模式為 " "``None``,則該節點代表捕獲模式(即裸名 (bare name))並且始終會成功。" -#: ../../library/ast.rst:1720 +#: ../../library/ast.rst:1724 msgid "" "The ``name`` attribute contains the name that will be bound if the pattern " "is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` " @@ -1010,7 +1019,7 @@ msgstr "" "``name`` 屬性包含模式成功時將綁定的名稱。如果 ``name`` 為 ``None``,則 " "``pattern`` 也必須為 ``None``,並且節點代表通配模式。" -#: ../../library/ast.rst:1758 +#: ../../library/ast.rst:1762 msgid "" "A match \"or-pattern\". An or-pattern matches each of its subpatterns in " "turn to the subject, until one succeeds. The or-pattern is then deemed to " @@ -1022,17 +1031,17 @@ msgstr "" "到成功為止,然後 or 模式就會被認為是成功的。如果沒有一個子模式成功,則 or 模" "式將失敗。 ``patterns`` 屬性包含將與主題進行匹配的匹配模式節點串列。" -#: ../../library/ast.rst:1793 +#: ../../library/ast.rst:1797 msgid "Type parameters" msgstr "型別參數 (type parameters)" -#: ../../library/ast.rst:1795 +#: ../../library/ast.rst:1799 msgid "" ":ref:`Type parameters ` can exist on classes, functions, and " "type aliases." msgstr ":ref:`型別參數 `\\ 可以存在於類別、函式和型別別名上。" -#: ../../library/ast.rst:1800 +#: ../../library/ast.rst:1804 msgid "" "A :class:`typing.TypeVar`. ``name`` is the name of the type variable. " "``bound`` is the bound or constraints, if any. If ``bound`` is a :class:" @@ -1042,39 +1051,39 @@ msgstr "" "存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一個 :class:" "`Tuple`,它代表約束;否則它代表界限。" -#: ../../library/ast.rst:1825 +#: ../../library/ast.rst:1829 msgid "" "A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " "specification." msgstr "A :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。" -#: ../../library/ast.rst:1850 +#: ../../library/ast.rst:1854 msgid "" "A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " "tuple." msgstr "一個 :class:`typing.TypeVarTuple`。``name`` 是型別變數元組的名稱。" -#: ../../library/ast.rst:1875 +#: ../../library/ast.rst:1879 msgid "Function and class definitions" msgstr "函式和類別定義" -#: ../../library/ast.rst:1879 +#: ../../library/ast.rst:1883 msgid "A function definition." msgstr "一個函式定義。" -#: ../../library/ast.rst:1881 +#: ../../library/ast.rst:1885 msgid "``name`` is a raw string of the function name." msgstr "``name`` 是函式名稱的原始字串。" -#: ../../library/ast.rst:1882 +#: ../../library/ast.rst:1886 msgid "``args`` is an :class:`arguments` node." msgstr "``args`` 是一個 :class:`arguments` 節點。" -#: ../../library/ast.rst:1883 +#: ../../library/ast.rst:1887 msgid "``body`` is the list of nodes inside the function." msgstr "``body`` 是函式內節點的串列。" -#: ../../library/ast.rst:1884 +#: ../../library/ast.rst:1888 msgid "" "``decorator_list`` is the list of decorators to be applied, stored outermost " "first (i.e. the first in the list will be applied last)." @@ -1082,20 +1091,20 @@ msgstr "" "``decorator_list`` 是要應用的裝飾器串列,在最外層者會被儲存在首位(即串列中首" "位將會是最後一個被應用的那個)。" -#: ../../library/ast.rst:1886 +#: ../../library/ast.rst:1890 msgid "``returns`` is the return annotation." msgstr "``returns`` 是回傳註釋。" -#: ../../library/ast.rst:1887 ../../library/ast.rst:2064 +#: ../../library/ast.rst:1891 ../../library/ast.rst:2068 msgid "``type_params`` is a list of :ref:`type parameters `." msgstr "``type_params`` 是\\ :ref:`型別參數 `\\ 的串列。" -#: ../../library/ast.rst:1893 ../../library/ast.rst:2093 -#: ../../library/ast.rst:2104 +#: ../../library/ast.rst:1897 ../../library/ast.rst:2097 +#: ../../library/ast.rst:2108 msgid "Added ``type_params``." msgstr "新增了 ``type_params``。" -#: ../../library/ast.rst:1899 +#: ../../library/ast.rst:1903 msgid "" "``lambda`` is a minimal function definition that can be used inside an " "expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." @@ -1103,17 +1112,17 @@ msgstr "" "``lambda`` 是可以在運算式內使用的最小函式定義。與 :class:`FunctionDef` 不同," "``body`` 保存單個節點。" -#: ../../library/ast.rst:1923 +#: ../../library/ast.rst:1927 msgid "The arguments for a function." msgstr "函式的引數。" -#: ../../library/ast.rst:1925 +#: ../../library/ast.rst:1929 msgid "" "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "" "``posonlyargs``、``args`` 和 ``kwonlyargs`` 是 :class:`arg` 節點的串列。" -#: ../../library/ast.rst:1926 +#: ../../library/ast.rst:1930 msgid "" "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the " "``*args, **kwargs`` parameters." @@ -1121,7 +1130,7 @@ msgstr "" "``vararg`` 和 ``kwarg`` 是單個 :class:`arg` 節點,指的是 ``*args, **kwargs`` " "參數。" -#: ../../library/ast.rst:1928 +#: ../../library/ast.rst:1932 msgid "" "``kw_defaults`` is a list of default values for keyword-only arguments. If " "one is ``None``, the corresponding argument is required." @@ -1129,7 +1138,7 @@ msgstr "" "``kw_defaults`` 是僅限關鍵字引數的預設值串列。如果其中某個為 ``None``,則相應" "參數就會是必要的。" -#: ../../library/ast.rst:1930 +#: ../../library/ast.rst:1934 msgid "" "``defaults`` is a list of default values for arguments that can be passed " "positionally. If there are fewer defaults, they correspond to the last n " @@ -1138,7 +1147,7 @@ msgstr "" "``defaults`` 是可以按位置傳遞的引數的預設值串列。如果預設值較少,則它們對應於" "最後 n 個引數。" -#: ../../library/ast.rst:1937 +#: ../../library/ast.rst:1941 msgid "" "A single argument in a list. ``arg`` is a raw string of the argument name; " "``annotation`` is its annotation, such as a :class:`Name` node." @@ -1146,16 +1155,16 @@ msgstr "" "串列中的單個引數。``arg`` 是引數名稱的原始字串,``annotation`` 是它的註釋,例" "如 :class:`Name` 節點。" -#: ../../library/ast.rst:1942 +#: ../../library/ast.rst:1946 msgid "" "``type_comment`` is an optional string with the type annotation as a comment" msgstr "``type_comment`` 是一個可選字串,其註解為型別註釋" -#: ../../library/ast.rst:1987 +#: ../../library/ast.rst:1991 msgid "A ``return`` statement." msgstr "一個 ``return`` 陳述式。" -#: ../../library/ast.rst:2002 +#: ../../library/ast.rst:2006 msgid "" "A ``yield`` or ``yield from`` expression. Because these are expressions, " "they must be wrapped in a :class:`Expr` node if the value sent back is not " @@ -1164,24 +1173,24 @@ msgstr "" "一個 ``yield`` 或 ``yield from`` 運算式。因為這些是運算式,所以如果不使用發送" "回來的值,則必須將它們包裝在 :class:`Expr` 節點中。" -#: ../../library/ast.rst:2027 +#: ../../library/ast.rst:2031 msgid "" "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "``global`` 和 ``nonlocal`` 陳述式。``names`` 是原始字串的串列。" -#: ../../library/ast.rst:2054 +#: ../../library/ast.rst:2058 msgid "A class definition." msgstr "一個類別定義。" -#: ../../library/ast.rst:2056 +#: ../../library/ast.rst:2060 msgid "``name`` is a raw string for the class name" msgstr "``name`` 是類別名的原始字串" -#: ../../library/ast.rst:2057 +#: ../../library/ast.rst:2061 msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "``bases`` 是被顯式指定的基底類別節點串列。" -#: ../../library/ast.rst:2058 +#: ../../library/ast.rst:2062 msgid "" "``keywords`` is a list of :class:`.keyword` nodes, principally for " "'metaclass'. Other keywords will be passed to the metaclass, as per " @@ -1191,27 +1200,27 @@ msgstr "" "別)。如 `PEP-3115 `_ 所述,其他關鍵字將被" "傳遞到 metaclass。" -#: ../../library/ast.rst:2061 +#: ../../library/ast.rst:2065 msgid "" "``body`` is a list of nodes representing the code within the class " "definition." msgstr "``body`` 是表示類別定義中程式碼的節點串列。" -#: ../../library/ast.rst:2063 +#: ../../library/ast.rst:2067 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "``decorator_list`` 是一個節點串列,如 :class:`FunctionDef` 中所示。" -#: ../../library/ast.rst:2097 +#: ../../library/ast.rst:2101 msgid "Async and await" msgstr "async 和 await" -#: ../../library/ast.rst:2101 +#: ../../library/ast.rst:2105 msgid "" "An ``async def`` function definition. Has the same fields as :class:" "`FunctionDef`." msgstr "一個 ``async def`` 函式定義。與 :class:`FunctionDef` 具有相同的欄位。" -#: ../../library/ast.rst:2110 +#: ../../library/ast.rst:2114 msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." @@ -1219,7 +1228,7 @@ msgstr "" "一個 ``await`` 運算式。``value`` 是它等待的東西。僅在 :class:" "`AsyncFunctionDef` 主體 (body) 中有效。" -#: ../../library/ast.rst:2144 +#: ../../library/ast.rst:2148 msgid "" "``async for`` loops and ``async with`` context managers. They have the same " "fields as :class:`For` and :class:`With`, respectively. Only valid in the " @@ -1228,7 +1237,7 @@ msgstr "" "``async for`` 迴圈和 ``async with`` 情境管理器。它們分別具有與 :class:`For` " "和 :class:`With` 相同的欄位。僅在 :class:`AsyncFunctionDef` 主體中有效。" -#: ../../library/ast.rst:2149 +#: ../../library/ast.rst:2153 msgid "" "When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" "class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." @@ -1241,11 +1250,11 @@ msgstr "" "boolop` 和 :class:`ast.expr_context`\\ )將是單例。對其中之一的更改將反映在所" "有其他出現的相同值中(例如 :class:`ast.Add`\\ )。" -#: ../../library/ast.rst:2157 +#: ../../library/ast.rst:2161 msgid ":mod:`ast` Helpers" msgstr ":mod:`ast` 輔助程式" -#: ../../library/ast.rst:2159 +#: ../../library/ast.rst:2163 msgid "" "Apart from the node classes, the :mod:`ast` module defines these utility " "functions and classes for traversing abstract syntax trees:" @@ -1253,7 +1262,7 @@ msgstr "" "除了節點類別之外,:mod:`ast` 模組還定義了這些用於遍歷 (traverse) 抽象語法樹的" "實用函式和類別:" -#: ../../library/ast.rst:2164 +#: ../../library/ast.rst:2168 msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " "filename, mode, ast.PyCF_ONLY_AST)``." @@ -1261,7 +1270,7 @@ msgstr "" "將原始碼剖析為 AST 節點。相當於 ``compile(source, filename, mode, ast." "PyCF_ONLY_AST)``。" -#: ../../library/ast.rst:2167 +#: ../../library/ast.rst:2171 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " @@ -1280,7 +1289,7 @@ msgstr "" "``None``。此外,``# type: ignore`` 註釋的位置將作為 :class:`Module` 的 " "``type_ignores`` 屬性回傳(否則它始終是一個空串列)。" -#: ../../library/ast.rst:2177 +#: ../../library/ast.rst:2181 msgid "" "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " "correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " @@ -1290,7 +1299,7 @@ msgstr "" "名型別註解 (signature type comments)」而被修改,例如 ``(str, int) -> " "List[str]``。" -#: ../../library/ast.rst:2181 +#: ../../library/ast.rst:2185 msgid "" "Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a " "\"best-effort\" attempt to parse using that Python version's grammar. For " @@ -1302,13 +1311,20 @@ msgid "" "is the same as when run on the Python version corresponding to " "``feature_version``." msgstr "" +"將 ``feature_version`` 設定為元組 ``(major, minor)`` 將「盡可能」嘗試使用該 " +"Python 版本的文法進行剖析。當前 ``major`` 必須等於 ``3``。例如,設定 " +"``feature_version=(3, 4)`` 將嘗試禁止剖析 :keyword:`match` 陳述式。目前 " +"``major`` 必須為 ``3``、支援的最低版本為 ``(3, 4)``\\ (這在未來的 Python 版" +"本中可能會增加);最高的是 ``sys.version_info[0:2]``。「盡可能」嘗試意味著不" +"能保證剖析(或剖析的成功)與在與 ``feature_version`` 對應的 Python 版本上運行" +"時相同。" -#: ../../library/ast.rst:2191 +#: ../../library/ast.rst:2195 msgid "" "If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "如果來源包含 null 字元 (``\\0``),則會引發 :exc:`ValueError`。" -#: ../../library/ast.rst:2194 +#: ../../library/ast.rst:2198 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -1322,14 +1338,14 @@ msgstr "" "原始的 ``return 42`` 為 return 陳述式生成一個有效的 AST 節點,但它不能單獨編" "譯(它需要位於函式節點內)。" -#: ../../library/ast.rst:2201 +#: ../../library/ast.rst:2205 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" "特別是 :func:`ast.parse` 不會執行任何範圍檢查,而編譯步驟才會執行此操作。" -#: ../../library/ast.rst:2205 +#: ../../library/ast.rst:2209 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string due to stack depth limitations in Python's AST compiler." @@ -1337,11 +1353,11 @@ msgstr "" "由於 Python AST 編譯器中的堆疊 (stack) 深度限制,太大或太複雜的字串可能會導" "致 Python 直譯器崩潰。" -#: ../../library/ast.rst:2209 +#: ../../library/ast.rst:2213 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "新增 ``type_comments``、``mode='func_type'`` 與 ``feature_version``。" -#: ../../library/ast.rst:2215 +#: ../../library/ast.rst:2219 msgid "" "Unparse an :class:`ast.AST` object and generate a string with code that " "would produce an equivalent :class:`ast.AST` object if parsed back with :" @@ -1350,7 +1366,7 @@ msgstr "" "反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使用 :func:`ast." "parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" -#: ../../library/ast.rst:2220 +#: ../../library/ast.rst:2224 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " @@ -1359,13 +1375,13 @@ msgstr "" "生成的程式碼字串不一定等於生成 :class:`ast.AST` 物件的原始程式碼(沒有任何編" "譯器最佳化,例如常數元組/凍結集合)。" -#: ../../library/ast.rst:2225 +#: ../../library/ast.rst:2229 msgid "" "Trying to unparse a highly complex expression would result with :exc:" "`RecursionError`." msgstr "嘗試剖析高度複雜的運算式會導致 :exc:`RecursionError`。" -#: ../../library/ast.rst:2233 +#: ../../library/ast.rst:2237 msgid "" "Evaluate an expression node or a string containing only a Python literal or " "container display. The string or node provided may only consist of the " @@ -1376,7 +1392,7 @@ msgstr "" "能包含以下 Python 文本結構:字串、位元組、數字、元組、串列、字典、集合、布林" "值、``None`` 和 ``Ellipsis``。" -#: ../../library/ast.rst:2238 +#: ../../library/ast.rst:2242 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " @@ -1385,7 +1401,7 @@ msgstr "" "這可用於為包含 Python 值的字串求值,而無需自己剖析這些值。它無法計算任意複雜" "的運算式,例如涉及運算子或索引。" -#: ../../library/ast.rst:2243 +#: ../../library/ast.rst:2247 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -1402,13 +1418,13 @@ msgstr "" "盡或 C 堆疊耗盡,從而導致行程崩潰。某些輸入也可能會出現 CPU 消耗過多而導致拒" "絕服務的情況。因此不建議在不受信任的資料上呼叫它。" -#: ../../library/ast.rst:2253 +#: ../../library/ast.rst:2257 msgid "" "It is possible to crash the Python interpreter due to stack depth " "limitations in Python's AST compiler." msgstr "由於 Python AST 編譯器的堆疊深度限制,Python 直譯器可能會崩潰。" -#: ../../library/ast.rst:2256 +#: ../../library/ast.rst:2260 msgid "" "It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" "`MemoryError` and :exc:`RecursionError` depending on the malformed input." @@ -1416,19 +1432,19 @@ msgstr "" "它可能會引發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:" "`MemoryError` 和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" -#: ../../library/ast.rst:2260 +#: ../../library/ast.rst:2264 msgid "Now allows bytes and set literals." msgstr "現在允許位元組和集合文本 (set literal)。" -#: ../../library/ast.rst:2263 +#: ../../library/ast.rst:2267 msgid "Now supports creating empty sets with ``'set()'``." msgstr "現在支援使用 ``'set()'`` 建立空集合。" -#: ../../library/ast.rst:2266 +#: ../../library/ast.rst:2270 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "對於字串輸入,前導空格和定位字元 (tab) 現在已被去除。" -#: ../../library/ast.rst:2272 +#: ../../library/ast.rst:2276 msgid "" "Return the docstring of the given *node* (which must be a :class:" "`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" @@ -1440,11 +1456,11 @@ msgstr "" "件字串則為 ``None``。如果 *clean* 為 true,則使用 :func:`inspect.cleandoc` 清" "理文件字串的縮排。" -#: ../../library/ast.rst:2278 +#: ../../library/ast.rst:2282 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "目前已支援 :class:`AsyncFunctionDef`。" -#: ../../library/ast.rst:2284 +#: ../../library/ast.rst:2288 msgid "" "Get source code segment of the *source* that generated *node*. If some " "location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :" @@ -1455,7 +1471,7 @@ msgstr "" "lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` 或 :attr:" "`~ast.AST.end_col_offset`\\ )遺漏,則回傳 ``None``。" -#: ../../library/ast.rst:2288 +#: ../../library/ast.rst:2292 msgid "" "If *padded* is ``True``, the first line of a multi-line statement will be " "padded with spaces to match its original position." @@ -1463,7 +1479,7 @@ msgstr "" "如果 *padded* 為 ``True``,則多列陳述式的第一列將用空格填充 (padded) 以匹配其" "原始位置。" -#: ../../library/ast.rst:2296 +#: ../../library/ast.rst:2300 msgid "" "When you compile a node tree with :func:`compile`, the compiler expects :" "attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every " @@ -1477,7 +1493,7 @@ msgstr "" "要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些屬性設定為父節點的" "值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞迴地作用。" -#: ../../library/ast.rst:2305 +#: ../../library/ast.rst:2309 msgid "" "Increment the line number and end line number of each node in the tree " "starting at *node* by *n*. This is useful to \"move code\" to a different " @@ -1486,7 +1502,7 @@ msgstr "" "將樹中從 *node* 開始的每個節點的列號和結束列號增加 *n*。這對於「移動程式碼」" "到檔案中的不同位置很有用。" -#: ../../library/ast.rst:2312 +#: ../../library/ast.rst:2316 msgid "" "Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :" "attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from " @@ -1496,7 +1512,7 @@ msgstr "" "attr:`~ast.AST.end_lineno` 和 :attr:`~ast.AST.end_col_offset` )從 " "*old_node* 複製到 *new_node*,並回傳 *new_node* 。" -#: ../../library/ast.rst:2319 +#: ../../library/ast.rst:2323 msgid "" "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " "that is present on *node*." @@ -1504,7 +1520,7 @@ msgstr "" "為 *node* 上存在的 ``node._fields`` 中的每個欄位生成一個 ``(fieldname, " "value)`` 元組。" -#: ../../library/ast.rst:2325 +#: ../../library/ast.rst:2329 msgid "" "Yield all direct child nodes of *node*, that is, all fields that are nodes " "and all items of fields that are lists of nodes." @@ -1512,7 +1528,7 @@ msgstr "" "生成 *node* 的所有直接子節點,即作為節點的所有欄位以及作為節點串列欄位的所有" "項目。" -#: ../../library/ast.rst:2331 +#: ../../library/ast.rst:2335 msgid "" "Recursively yield all descendant nodes in the tree starting at *node* " "(including *node* itself), in no specified order. This is useful if you " @@ -1521,7 +1537,7 @@ msgstr "" "遞迴地生成樹中從 *node* 開始的所有後代節點(包括 *node* 本身),不按指定順" "序。如果你只想就地修改節點而不關心情境,這非常有用。" -#: ../../library/ast.rst:2338 +#: ../../library/ast.rst:2342 msgid "" "A node visitor base class that walks the abstract syntax tree and calls a " "visitor function for every node found. This function may return a value " @@ -1530,13 +1546,13 @@ msgstr "" "節點訪問者基底類別,它遍歷抽象語法樹並為找到的每個節點呼叫訪問者函式。該函式" "可能會回傳一個由 :meth:`visit` 方法轉發的值。" -#: ../../library/ast.rst:2342 +#: ../../library/ast.rst:2346 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." msgstr "這個類別應該被子類別化,子類別新增訪問者方法。" -#: ../../library/ast.rst:2347 +#: ../../library/ast.rst:2351 msgid "" "Visit a node. The default implementation calls the method called :samp:" "`self.visit_{classname}` where *classname* is the name of the node class, " @@ -1546,11 +1562,11 @@ msgstr "" "*classname* 是節點類別的名稱,或者在該方法不存在時呼叫 :meth:" "`generic_visit`。" -#: ../../library/ast.rst:2353 +#: ../../library/ast.rst:2357 msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "該訪問者對該節點的所有子節點呼叫 :meth:`visit`。" -#: ../../library/ast.rst:2355 +#: ../../library/ast.rst:2359 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." @@ -1558,11 +1574,11 @@ msgstr "" "請注意,除非訪問者呼叫 :meth:`generic_visit` 或訪問它們本身,否則不會訪問具有" "自定義訪問者方法的節點之子節點。" -#: ../../library/ast.rst:2361 +#: ../../library/ast.rst:2365 msgid "Handles all constant nodes." msgstr "處理所有常數節點。" -#: ../../library/ast.rst:2363 +#: ../../library/ast.rst:2367 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " "during traversal. For this a special visitor exists (:class:" @@ -1572,7 +1588,7 @@ msgstr "" "`NodeVisitor`。為此,有個允許修改的特殊遍歷訪問者工具 :class:" "`NodeTransformer`。" -#: ../../library/ast.rst:2369 +#: ../../library/ast.rst:2373 msgid "" "Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:" "`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated now and " @@ -1583,13 +1599,13 @@ msgstr "" "visit_NameConstant` 和 :meth:`!visit_Ellipsis` 方法現已棄用,並且不會在未來的" "Python 版本中被呼叫。新增 :meth:`visit_Constant` 方法來處理所有常數節點。" -#: ../../library/ast.rst:2377 +#: ../../library/ast.rst:2381 msgid "" "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " "allows modification of nodes." msgstr "一個 :class:`NodeVisitor` 子類別,它會遍歷抽象語法樹並允許修改節點。" -#: ../../library/ast.rst:2380 +#: ../../library/ast.rst:2384 msgid "" "The :class:`NodeTransformer` will walk the AST and use the return value of " "the visitor methods to replace or remove the old node. If the return value " @@ -1601,7 +1617,7 @@ msgstr "" "點。如果訪問者方法的回傳值為 ``None``,則該節點將從其位置中刪除,否則將被替換" "為回傳值。回傳值可能是原始節點,在這種情況下不會發生替換。" -#: ../../library/ast.rst:2386 +#: ../../library/ast.rst:2390 msgid "" "Here is an example transformer that rewrites all occurrences of name lookups " "(``foo``) to ``data['foo']``::" @@ -1609,7 +1625,7 @@ msgstr "" "下面是一個示範用的 transformer,它將查找所有出現名稱 (``foo``) 並改寫為 " "``data['foo']``: ::" -#: ../../library/ast.rst:2398 +#: ../../library/ast.rst:2402 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " "either transform the child nodes yourself or call the :meth:`~ast." @@ -1618,7 +1634,7 @@ msgstr "" "請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點的 :" "meth:`~ast.NodeVisitor.generic_visit` 方法。" -#: ../../library/ast.rst:2402 +#: ../../library/ast.rst:2406 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " @@ -1627,7 +1643,7 @@ msgstr "" "對於屬於陳述式總集 (collection) 一部分的節點(適用於所有陳述式節點),訪問者" "還可以回傳節點串列,而不僅僅是單個節點。" -#: ../../library/ast.rst:2406 +#: ../../library/ast.rst:2410 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " "original tree) without giving them location information (such as :attr:`~ast." @@ -1638,11 +1654,11 @@ msgstr "" "它們提供位置資訊(例如 :attr:`~ast.AST.lineno`\\ ),則應使用新的子樹呼叫 :" "func:`fix_missing_locations` 以重新計算位置資訊: ::" -#: ../../library/ast.rst:2414 +#: ../../library/ast.rst:2418 msgid "Usually you use the transformer like this::" msgstr "你通常會像這樣使用 transformer: ::" -#: ../../library/ast.rst:2421 +#: ../../library/ast.rst:2425 msgid "" "Return a formatted dump of the tree in *node*. This is mainly useful for " "debugging purposes. If *annotate_fields* is true (by default), the returned " @@ -1658,7 +1674,7 @@ msgstr "" "潔。預設情況下,不會傾印列號和行偏移量等屬性。如果需要,可以設定 " "*include_attributes* 為 true。" -#: ../../library/ast.rst:2429 +#: ../../library/ast.rst:2433 msgid "" "If *indent* is a non-negative integer or string, then the tree will be " "pretty-printed with that indent level. An indent level of 0, negative, or " @@ -1672,21 +1688,21 @@ msgstr "" "(預設值)代表選擇單列表示。使用正整數縮排可以在每個級別縮排相同數量的空格。" "如果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個級別。" -#: ../../library/ast.rst:2436 +#: ../../library/ast.rst:2440 msgid "Added the *indent* option." msgstr "新增 *indent* 選項。" -#: ../../library/ast.rst:2443 +#: ../../library/ast.rst:2447 msgid "Compiler Flags" msgstr "編譯器旗標" -#: ../../library/ast.rst:2445 +#: ../../library/ast.rst:2449 msgid "" "The following flags may be passed to :func:`compile` in order to change " "effects on the compilation of a program:" msgstr "可以將以下旗標傳遞給 :func:`compile` 以變更對程式的編譯效果:" -#: ../../library/ast.rst:2450 +#: ../../library/ast.rst:2454 msgid "" "Enables support for top-level ``await``, ``async for``, ``async with`` and " "async comprehensions." @@ -1694,13 +1710,13 @@ msgstr "" "啟用對最高階 ``await``、``async for``、``async with`` 和非同步綜合運算的支" "援。" -#: ../../library/ast.rst:2457 +#: ../../library/ast.rst:2461 msgid "" "Generates and returns an abstract syntax tree instead of returning a " "compiled code object." msgstr "生成並回傳抽象語法樹,而不是回傳已編譯的程式碼物件。" -#: ../../library/ast.rst:2462 +#: ../../library/ast.rst:2466 msgid "" "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " "``, ``# type: ignore ``)." @@ -1708,43 +1724,43 @@ msgstr "" "啟用對 :pep:`484` 和 :pep:`526` 樣式型別註釋的支援 (``# type: ``, ``# " "type: ignore ``)。" -#: ../../library/ast.rst:2471 +#: ../../library/ast.rst:2475 msgid "Command-Line Usage" msgstr "命令列用法" -#: ../../library/ast.rst:2475 +#: ../../library/ast.rst:2479 msgid "" "The :mod:`ast` module can be executed as a script from the command line. It " "is as simple as:" msgstr ":mod:`ast` 模組可以作為腳本從命令列執行,可以像這樣簡單地做到:" -#: ../../library/ast.rst:2482 +#: ../../library/ast.rst:2486 msgid "The following options are accepted:" msgstr "以下選項可被接受:" -#: ../../library/ast.rst:2488 +#: ../../library/ast.rst:2492 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/ast.rst:2493 +#: ../../library/ast.rst:2497 msgid "" "Specify what kind of code must be compiled, like the *mode* argument in :" "func:`parse`." msgstr "指定必須編譯哪種類型的程式碼,像是 :func:`parse` 中的 *mode* 引數。" -#: ../../library/ast.rst:2498 +#: ../../library/ast.rst:2502 msgid "Don't parse type comments." msgstr "不要剖析型別註解。" -#: ../../library/ast.rst:2502 +#: ../../library/ast.rst:2506 msgid "Include attributes such as line numbers and column offsets." msgstr "包括列號和行偏移量等屬性。" -#: ../../library/ast.rst:2507 +#: ../../library/ast.rst:2511 msgid "Indentation of nodes in AST (number of spaces)." msgstr "AST 中節點的縮進(空格數)。" -#: ../../library/ast.rst:2509 +#: ../../library/ast.rst:2513 msgid "" "If :file:`infile` is specified its contents are parsed to AST and dumped to " "stdout. Otherwise, the content is read from stdin." @@ -1752,7 +1768,7 @@ msgstr "" "如果指定了 :file:`infile`,則其內容將被剖析為 AST 並傾印 (dump) 到 stdout。否" "則會從 stdin 讀取內容。" -#: ../../library/ast.rst:2515 +#: ../../library/ast.rst:2519 msgid "" "`Green Tree Snakes `_, an external " "documentation resource, has good details on working with Python ASTs." @@ -1760,7 +1776,7 @@ msgstr "" "`Green Tree Snakes `_ 是一個外部文件" "資源,提供了有關使用 Python AST 的詳細資訊。" -#: ../../library/ast.rst:2518 +#: ../../library/ast.rst:2522 msgid "" "`ASTTokens `_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -1771,7 +1787,7 @@ msgstr "" "用生成它們的原始碼中的標記和文本的位置來註釋 Python AST。這對於進行原始碼轉換" "的工具很有幫助。" -#: ../../library/ast.rst:2523 +#: ../../library/ast.rst:2527 msgid "" "`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs " @@ -1781,7 +1797,7 @@ msgstr "" "py>`_ 透過在 token 和 ast 節點之間插入雙向鏈結,統一了 python 程式的基於 " "token 和基於剖析樹的視圖。" -#: ../../library/ast.rst:2528 +#: ../../library/ast.rst:2532 msgid "" "`LibCST `_ parses code as a Concrete Syntax " "Tree that looks like an ast tree and keeps all formatting details. It's " @@ -1791,7 +1807,7 @@ msgstr "" "(Concrete Syntax Tree),看起來像 ast 樹並保留所有格式詳細資訊。它對於建置自動" "重構 (codemod) 應用程式和 linter 非常有用。" -#: ../../library/ast.rst:2533 +#: ../../library/ast.rst:2537 msgid "" "`Parso `_ is a Python parser that supports " "error recovery and round-trip parsing for different Python versions (in " @@ -1813,16 +1829,3 @@ msgstr "於 AST 文法中" #: ../../library/ast.rst:60 msgid "* (asterisk)" msgstr "* (星號)" - -#~ msgid "" -#~ "Also, setting ``feature_version`` to a tuple ``(major, minor)`` will " -#~ "attempt to parse using that Python version's grammar. Currently ``major`` " -#~ "must equal to ``3``. For example, setting ``feature_version=(3, 4)`` " -#~ "will allow the use of ``async`` and ``await`` as variable names. The " -#~ "lowest supported version is ``(3, 4)``; the highest is ``sys." -#~ "version_info[0:2]``." -#~ msgstr "" -#~ "此外,將 ``feature_version`` 設定為元組 ``(major, minor)`` 將嘗試使用該 " -#~ "Python 版本的文法進行剖析。當前 ``major`` 必須等於 ``3``。例如,設定 " -#~ "``feature_version=(3, 4)`` 將允許使用 ``async`` 和 ``await`` 作為變數名" -#~ "稱。有支援的最低版本是 ``(3, 4)``;最高的是 ``sys.version_info[0:2]``。" diff --git a/library/collections.po b/library/collections.po index d7360eb812..7778f02885 100644 --- a/library/collections.po +++ b/library/collections.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-13 00:03+0000\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -231,10 +231,9 @@ msgstr "" #: ../../library/collections.rst:102 msgid "" -"Note, the iteration order of a :class:`ChainMap()` is determined by scanning " +"Note, the iteration order of a :class:`ChainMap` is determined by scanning " "the mappings last to first::" -msgstr "" -"注意,一個 :class:`ChainMap()` 的疊代順序是透過由後往前掃描對映而定: ::" +msgstr "注意,一個 :class:`ChainMap` 的疊代順序是透過由後往前掃描對映而定: ::" #: ../../library/collections.rst:110 msgid "" diff --git a/library/configparser.po b/library/configparser.po index 258bff3639..1dbf75df8f 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-07-14 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -107,32 +107,34 @@ msgid "" "and stored in lowercase [1]_." msgstr "" -#: ../../library/configparser.rst:147 +#: ../../library/configparser.rst:147 ../../library/configparser.rst:966 msgid "" "It is possible to read several configurations into a single :class:" "`ConfigParser`, where the most recently added configuration has the highest " "priority. Any conflicting keys are taken from the more recent configuration " -"while the previously existing keys are retained." +"while the previously existing keys are retained. The example below reads in " +"an ``override.ini`` file, which will override any conflicting keys from the " +"``example.ini`` file." msgstr "" -#: ../../library/configparser.rst:168 +#: ../../library/configparser.rst:173 msgid "" "This behaviour is equivalent to a :meth:`ConfigParser.read` call with " "several files passed to the *filenames* parameter." msgstr "" -#: ../../library/configparser.rst:173 +#: ../../library/configparser.rst:178 msgid "Supported Datatypes" msgstr "" -#: ../../library/configparser.rst:175 +#: ../../library/configparser.rst:180 msgid "" "Config parsers do not guess datatypes of values in configuration files, " "always storing them internally as strings. This means that if you need " "other datatypes, you should convert on your own:" msgstr "" -#: ../../library/configparser.rst:186 +#: ../../library/configparser.rst:191 msgid "" "Since this task is so common, config parsers provide a range of handy getter " "methods to handle integers, floats and booleans. The last one is the most " @@ -143,7 +145,7 @@ msgid "" "``'true'``/``'false'`` and ``'1'``/``'0'`` [1]_. For example:" msgstr "" -#: ../../library/configparser.rst:203 +#: ../../library/configparser.rst:208 msgid "" "Apart from :meth:`~ConfigParser.getboolean`, config parsers also provide " "equivalent :meth:`~ConfigParser.getint` and :meth:`~ConfigParser.getfloat` " @@ -151,17 +153,17 @@ msgid "" "ones. [1]_" msgstr "" -#: ../../library/configparser.rst:209 +#: ../../library/configparser.rst:214 msgid "Fallback Values" msgstr "" -#: ../../library/configparser.rst:211 +#: ../../library/configparser.rst:216 msgid "" "As with a dictionary, you can use a section's :meth:`~ConfigParser.get` " "method to provide fallback values:" msgstr "" -#: ../../library/configparser.rst:224 +#: ../../library/configparser.rst:229 msgid "" "Please note that default values have precedence over fallback values. For " "instance, in our example the ``'CompressionLevel'`` key was specified only " @@ -170,7 +172,7 @@ msgid "" "specify a fallback:" msgstr "" -#: ../../library/configparser.rst:235 +#: ../../library/configparser.rst:240 msgid "" "One more thing to be aware of is that the parser-level :meth:`~ConfigParser." "get` method provides a custom, more complex interface, maintained for " @@ -178,18 +180,18 @@ msgid "" "provided via the ``fallback`` keyword-only argument:" msgstr "" -#: ../../library/configparser.rst:246 +#: ../../library/configparser.rst:251 msgid "" "The same ``fallback`` argument can be used with the :meth:`~ConfigParser." "getint`, :meth:`~ConfigParser.getfloat` and :meth:`~ConfigParser.getboolean` " "methods, for example:" msgstr "" -#: ../../library/configparser.rst:262 +#: ../../library/configparser.rst:267 msgid "Supported INI File Structure" msgstr "" -#: ../../library/configparser.rst:264 +#: ../../library/configparser.rst:269 msgid "" "A configuration file consists of sections, each led by a ``[section]`` " "header, followed by key/value entries separated by a specific string (``=`` " @@ -202,35 +204,35 @@ msgid "" "parts of multiline values or ignored." msgstr "" -#: ../../library/configparser.rst:274 +#: ../../library/configparser.rst:279 msgid "" "By default, a valid section name can be any string that does not contain '\\" "\\n'. To change this, see :attr:`ConfigParser.SECTCRE`." msgstr "" -#: ../../library/configparser.rst:277 +#: ../../library/configparser.rst:282 msgid "" "Configuration files may include comments, prefixed by specific characters " "(``#`` and ``;`` by default [1]_). Comments may appear on their own on an " "otherwise empty line, possibly indented. [1]_" msgstr "" -#: ../../library/configparser.rst:281 ../../library/configparser.rst:344 +#: ../../library/configparser.rst:286 ../../library/configparser.rst:349 msgid "For example:" msgstr "" -#: ../../library/configparser.rst:329 +#: ../../library/configparser.rst:334 msgid "Interpolation of values" msgstr "" -#: ../../library/configparser.rst:331 +#: ../../library/configparser.rst:336 msgid "" "On top of the core functionality, :class:`ConfigParser` supports " "interpolation. This means values can be preprocessed before returning them " "from ``get()`` calls." msgstr "" -#: ../../library/configparser.rst:339 +#: ../../library/configparser.rst:344 msgid "" "The default implementation used by :class:`ConfigParser`. It enables values " "to contain format strings which refer to other values in the same section, " @@ -238,7 +240,7 @@ msgid "" "can be provided on initialization." msgstr "" -#: ../../library/configparser.rst:357 +#: ../../library/configparser.rst:362 msgid "" "In the example above, :class:`ConfigParser` with *interpolation* set to " "``BasicInterpolation()`` would resolve ``%(home_dir)s`` to the value of " @@ -248,14 +250,14 @@ msgid "" "specific order in the configuration file." msgstr "" -#: ../../library/configparser.rst:364 +#: ../../library/configparser.rst:369 msgid "" "With ``interpolation`` set to ``None``, the parser would simply return " "``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" "lumberjack`` as the value of ``my_dir``." msgstr "" -#: ../../library/configparser.rst:372 +#: ../../library/configparser.rst:377 msgid "" "An alternative handler for interpolation which implements a more advanced " "syntax, used for instance in ``zc.buildout``. Extended interpolation is " @@ -265,21 +267,21 @@ msgid "" "possibly the default values from the special section)." msgstr "" -#: ../../library/configparser.rst:379 +#: ../../library/configparser.rst:384 msgid "" "For example, the configuration specified above with basic interpolation, " "would look like this with extended interpolation:" msgstr "" -#: ../../library/configparser.rst:393 +#: ../../library/configparser.rst:398 msgid "Values from other sections can be fetched as well:" msgstr "" -#: ../../library/configparser.rst:415 +#: ../../library/configparser.rst:420 msgid "Mapping Protocol Access" msgstr "" -#: ../../library/configparser.rst:419 +#: ../../library/configparser.rst:424 msgid "" "Mapping protocol access is a generic name for functionality that enables " "using custom objects as if they were dictionaries. In case of :mod:" @@ -287,7 +289,7 @@ msgid "" "``parser['section']['option']`` notation." msgstr "" -#: ../../library/configparser.rst:424 +#: ../../library/configparser.rst:429 msgid "" "``parser['section']`` in particular returns a proxy for the section's data " "in the parser. This means that the values are not copied but they are taken " @@ -296,7 +298,7 @@ msgid "" "original parser." msgstr "" -#: ../../library/configparser.rst:430 +#: ../../library/configparser.rst:435 msgid "" ":mod:`configparser` objects behave as close to actual dictionaries as " "possible. The mapping interface is complete and adheres to the :class:" @@ -304,7 +306,7 @@ msgid "" "that should be taken into account:" msgstr "" -#: ../../library/configparser.rst:435 +#: ../../library/configparser.rst:440 msgid "" "By default, all keys in sections are accessible in a case-insensitive manner " "[1]_. E.g. ``for option in parser[\"section\"]`` yields only " @@ -313,7 +315,7 @@ msgid "" "expressions return ``True``::" msgstr "" -#: ../../library/configparser.rst:443 +#: ../../library/configparser.rst:448 msgid "" "All sections include ``DEFAULTSECT`` values as well which means that ``." "clear()`` on a section may not leave the section visibly empty. This is " @@ -323,30 +325,30 @@ msgid "" "default value causes a :exc:`KeyError`." msgstr "" -#: ../../library/configparser.rst:450 +#: ../../library/configparser.rst:455 msgid "``DEFAULTSECT`` cannot be removed from the parser:" msgstr "" -#: ../../library/configparser.rst:452 +#: ../../library/configparser.rst:457 msgid "trying to delete it raises :exc:`ValueError`," msgstr "" -#: ../../library/configparser.rst:454 +#: ../../library/configparser.rst:459 msgid "``parser.clear()`` leaves it intact," msgstr "" -#: ../../library/configparser.rst:456 +#: ../../library/configparser.rst:461 msgid "``parser.popitem()`` never returns it." msgstr "" -#: ../../library/configparser.rst:458 +#: ../../library/configparser.rst:463 msgid "" "``parser.get(section, option, **kwargs)`` - the second argument is **not** a " "fallback value. Note however that the section-level ``get()`` methods are " "compatible both with the mapping protocol and the classic configparser API." msgstr "" -#: ../../library/configparser.rst:462 +#: ../../library/configparser.rst:467 msgid "" "``parser.items()`` is compatible with the mapping protocol (returns a list " "of *section_name*, *section_proxy* pairs including the DEFAULTSECT). " @@ -356,18 +358,18 @@ msgid "" "(unless ``raw=True`` is provided)." msgstr "" -#: ../../library/configparser.rst:469 +#: ../../library/configparser.rst:474 msgid "" "The mapping protocol is implemented on top of the existing legacy API so " "that subclasses overriding the original interface still should have mappings " "working as expected." msgstr "" -#: ../../library/configparser.rst:475 +#: ../../library/configparser.rst:480 msgid "Customizing Parser Behaviour" msgstr "" -#: ../../library/configparser.rst:477 +#: ../../library/configparser.rst:482 msgid "" "There are nearly as many INI format variants as there are applications using " "it. :mod:`configparser` goes a long way to provide support for the largest " @@ -376,17 +378,17 @@ msgid "" "customize some of the features." msgstr "" -#: ../../library/configparser.rst:483 +#: ../../library/configparser.rst:488 msgid "" "The most common way to change the way a specific config parser works is to " "use the :meth:`!__init__` options:" msgstr "" -#: ../../library/configparser.rst:486 +#: ../../library/configparser.rst:491 msgid "*defaults*, default value: ``None``" msgstr "" -#: ../../library/configparser.rst:488 +#: ../../library/configparser.rst:493 msgid "" "This option accepts a dictionary of key-value pairs which will be initially " "put in the ``DEFAULT`` section. This makes for an elegant way to support " @@ -394,17 +396,17 @@ msgid "" "the documented default." msgstr "" -#: ../../library/configparser.rst:493 +#: ../../library/configparser.rst:498 msgid "" "Hint: if you want to specify default values for a specific section, use :" "meth:`~ConfigParser.read_dict` before you read the actual file." msgstr "" -#: ../../library/configparser.rst:496 +#: ../../library/configparser.rst:501 msgid "*dict_type*, default value: :class:`dict`" msgstr "" -#: ../../library/configparser.rst:498 +#: ../../library/configparser.rst:503 msgid "" "This option has a major impact on how the mapping protocol will behave and " "how the written configuration files look. With the standard dictionary, " @@ -412,24 +414,24 @@ msgid "" "goes for options within sections." msgstr "" -#: ../../library/configparser.rst:503 +#: ../../library/configparser.rst:508 msgid "" "An alternative dictionary type can be used for example to sort sections and " "options on write-back." msgstr "" -#: ../../library/configparser.rst:506 +#: ../../library/configparser.rst:511 msgid "" "Please note: there are ways to add a set of key-value pairs in a single " "operation. When you use a regular dictionary in those operations, the order " "of the keys will be ordered. For example:" msgstr "" -#: ../../library/configparser.rst:528 +#: ../../library/configparser.rst:533 msgid "*allow_no_value*, default value: ``False``" msgstr "" -#: ../../library/configparser.rst:530 +#: ../../library/configparser.rst:535 msgid "" "Some configuration files are known to include settings without values, but " "which otherwise conform to the syntax supported by :mod:`configparser`. The " @@ -437,32 +439,32 @@ msgid "" "such values should be accepted:" msgstr "" -#: ../../library/configparser.rst:565 +#: ../../library/configparser.rst:570 msgid "*delimiters*, default value: ``('=', ':')``" msgstr "" -#: ../../library/configparser.rst:567 +#: ../../library/configparser.rst:572 msgid "" "Delimiters are substrings that delimit keys from values within a section. " "The first occurrence of a delimiting substring on a line is considered a " "delimiter. This means values (but not keys) can contain the delimiters." msgstr "" -#: ../../library/configparser.rst:571 +#: ../../library/configparser.rst:576 msgid "" "See also the *space_around_delimiters* argument to :meth:`ConfigParser." "write`." msgstr "" -#: ../../library/configparser.rst:574 +#: ../../library/configparser.rst:579 msgid "*comment_prefixes*, default value: ``('#', ';')``" msgstr "" -#: ../../library/configparser.rst:576 +#: ../../library/configparser.rst:581 msgid "*inline_comment_prefixes*, default value: ``None``" msgstr "" -#: ../../library/configparser.rst:578 +#: ../../library/configparser.rst:583 msgid "" "Comment prefixes are strings that indicate the start of a valid comment " "within a config file. *comment_prefixes* are used only on otherwise empty " @@ -472,13 +474,13 @@ msgid "" "used as prefixes for whole line comments." msgstr "" -#: ../../library/configparser.rst:585 +#: ../../library/configparser.rst:590 msgid "" "In previous versions of :mod:`configparser` behaviour matched " "``comment_prefixes=('#',';')`` and ``inline_comment_prefixes=(';',)``." msgstr "" -#: ../../library/configparser.rst:589 +#: ../../library/configparser.rst:594 msgid "" "Please note that config parsers don't support escaping of comment prefixes " "so using *inline_comment_prefixes* may prevent users from specifying option " @@ -488,11 +490,11 @@ msgid "" "values is to interpolate the prefix, for example::" msgstr "" -#: ../../library/configparser.rst:635 +#: ../../library/configparser.rst:640 msgid "*strict*, default value: ``True``" msgstr "" -#: ../../library/configparser.rst:637 +#: ../../library/configparser.rst:642 msgid "" "When set to ``True``, the parser will not allow for any section or option " "duplicates while reading from a single source (using :meth:`~ConfigParser." @@ -500,17 +502,17 @@ msgid "" "read_dict`). It is recommended to use strict parsers in new applications." msgstr "" -#: ../../library/configparser.rst:642 +#: ../../library/configparser.rst:647 msgid "" "In previous versions of :mod:`configparser` behaviour matched " "``strict=False``." msgstr "" -#: ../../library/configparser.rst:646 +#: ../../library/configparser.rst:651 msgid "*empty_lines_in_values*, default value: ``True``" msgstr "" -#: ../../library/configparser.rst:648 +#: ../../library/configparser.rst:653 msgid "" "In config parsers, values can span multiple lines as long as they are " "indented more than the key that holds them. By default parsers also let " @@ -520,7 +522,7 @@ msgid "" "lose track of the file structure. Take for instance:" msgstr "" -#: ../../library/configparser.rst:663 +#: ../../library/configparser.rst:668 msgid "" "This can be especially problematic for the user to see if she's using a " "proportional font to edit the file. That is why when your application does " @@ -529,13 +531,13 @@ msgid "" "would produce two keys, ``key`` and ``this``." msgstr "" -#: ../../library/configparser.rst:669 +#: ../../library/configparser.rst:674 msgid "" "*default_section*, default value: ``configparser.DEFAULTSECT`` (that is: " "``\"DEFAULT\"``)" msgstr "" -#: ../../library/configparser.rst:672 +#: ../../library/configparser.rst:677 msgid "" "The convention of allowing a special section of default values for other " "sections or interpolation purposes is a powerful concept of this library, " @@ -549,11 +551,11 @@ msgid "" "files from one format to another)." msgstr "" -#: ../../library/configparser.rst:683 +#: ../../library/configparser.rst:688 msgid "*interpolation*, default value: ``configparser.BasicInterpolation``" msgstr "" -#: ../../library/configparser.rst:685 +#: ../../library/configparser.rst:690 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -563,11 +565,11 @@ msgid "" "`RawConfigParser` has a default value of ``None``." msgstr "" -#: ../../library/configparser.rst:692 +#: ../../library/configparser.rst:697 msgid "*converters*, default value: not set" msgstr "" -#: ../../library/configparser.rst:694 +#: ../../library/configparser.rst:699 msgid "" "Config parsers provide option value getters that perform type conversion. " "By default :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat`, " @@ -581,7 +583,7 @@ msgid "" "``parser_instance['section'].getdecimal('key', 0)``." msgstr "" -#: ../../library/configparser.rst:705 +#: ../../library/configparser.rst:710 msgid "" "If the converter needs to access the state of the parser, it can be " "implemented as a method on a config parser subclass. If the name of this " @@ -589,14 +591,14 @@ msgid "" "the dict-compatible form (see the ``getdecimal()`` example above)." msgstr "" -#: ../../library/configparser.rst:710 +#: ../../library/configparser.rst:715 msgid "" "More advanced customization may be achieved by overriding default values of " "these parser attributes. The defaults are defined on the classes, so they " "may be overridden by subclasses or by attribute assignment." msgstr "" -#: ../../library/configparser.rst:716 +#: ../../library/configparser.rst:721 msgid "" "By default when using :meth:`~ConfigParser.getboolean`, config parsers " "consider the following values ``True``: ``'1'``, ``'yes'``, ``'true'``, " @@ -605,13 +607,13 @@ msgid "" "strings and their Boolean outcomes. For example:" msgstr "" -#: ../../library/configparser.rst:734 +#: ../../library/configparser.rst:739 msgid "" "Other typical Boolean pairs include ``accept``/``reject`` or ``enabled``/" "``disabled``." msgstr "" -#: ../../library/configparser.rst:740 +#: ../../library/configparser.rst:745 msgid "" "This method transforms option names on every read, get, or set operation. " "The default converts the name to lowercase. This also means that when a " @@ -619,14 +621,14 @@ msgid "" "method if that's unsuitable. For example:" msgstr "" -#: ../../library/configparser.rst:770 +#: ../../library/configparser.rst:775 msgid "" "The optionxform function transforms option names to a canonical form. This " "should be an idempotent function: if the name is already in canonical form, " "it should be returned unchanged." msgstr "" -#: ../../library/configparser.rst:777 +#: ../../library/configparser.rst:782 msgid "" "A compiled regular expression used to parse section headers. The default " "matches ``[section]`` to the name ``\"section\"``. Whitespace is considered " @@ -635,18 +637,18 @@ msgid "" "example:" msgstr "" -#: ../../library/configparser.rst:805 +#: ../../library/configparser.rst:810 msgid "" "While ConfigParser objects also use an ``OPTCRE`` attribute for recognizing " "option lines, it's not recommended to override it because that would " "interfere with constructor options *allow_no_value* and *delimiters*." msgstr "" -#: ../../library/configparser.rst:811 +#: ../../library/configparser.rst:816 msgid "Legacy API Examples" msgstr "" -#: ../../library/configparser.rst:813 +#: ../../library/configparser.rst:818 msgid "" "Mainly because of backwards compatibility concerns, :mod:`configparser` " "provides also a legacy API with explicit ``get``/``set`` methods. While " @@ -655,29 +657,29 @@ msgid "" "advanced, low-level and downright counterintuitive." msgstr "" -#: ../../library/configparser.rst:819 +#: ../../library/configparser.rst:824 msgid "An example of writing to a configuration file::" msgstr "" -#: ../../library/configparser.rst:842 +#: ../../library/configparser.rst:847 msgid "An example of reading the configuration file again::" msgstr "" -#: ../../library/configparser.rst:860 +#: ../../library/configparser.rst:865 msgid "To get interpolation, use :class:`ConfigParser`::" msgstr "" -#: ../../library/configparser.rst:893 +#: ../../library/configparser.rst:898 msgid "" "Default values are available in both types of ConfigParsers. They are used " "in interpolation if an option used is not defined elsewhere. ::" msgstr "" -#: ../../library/configparser.rst:911 +#: ../../library/configparser.rst:916 msgid "ConfigParser Objects" msgstr "ConfigParser 物件" -#: ../../library/configparser.rst:915 +#: ../../library/configparser.rst:920 msgid "" "The main configuration parser. When *defaults* is given, it is initialized " "into the dictionary of intrinsic defaults. When *dict_type* is given, it " @@ -685,7 +687,7 @@ msgid "" "the options within a section, and for the default values." msgstr "" -#: ../../library/configparser.rst:920 +#: ../../library/configparser.rst:925 msgid "" "When *delimiters* is given, it is used as the set of substrings that divide " "keys from values. When *comment_prefixes* is given, it will be used as the " @@ -694,7 +696,7 @@ msgid "" "as the set of substrings that prefix comments in non-empty lines." msgstr "" -#: ../../library/configparser.rst:926 +#: ../../library/configparser.rst:931 msgid "" "When *strict* is ``True`` (the default), the parser won't allow for any " "section or option duplicates while reading from a single source (file, " @@ -707,7 +709,7 @@ msgid "" "without the trailing delimiter." msgstr "" -#: ../../library/configparser.rst:936 +#: ../../library/configparser.rst:941 msgid "" "When *default_section* is given, it specifies the name for the special " "section holding default values for other sections and interpolation purposes " @@ -717,7 +719,7 @@ msgid "" "settings to a new config file." msgstr "" -#: ../../library/configparser.rst:943 +#: ../../library/configparser.rst:948 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -726,7 +728,7 @@ msgid "" "`dedicated documentation section <#interpolation-of-values>`_." msgstr "" -#: ../../library/configparser.rst:949 +#: ../../library/configparser.rst:954 msgid "" "All option names used in interpolation will be passed through the :meth:" "`optionxform` method just like any other option name reference. For " @@ -735,7 +737,7 @@ msgid "" "%(BAR)s`` are equivalent." msgstr "" -#: ../../library/configparser.rst:955 +#: ../../library/configparser.rst:960 msgid "" "When *converters* is given, it should be a dictionary where each key " "represents the name of a type converter and each value is a callable " @@ -744,44 +746,44 @@ msgid "" "object and section proxies." msgstr "" -#: ../../library/configparser.rst:961 +#: ../../library/configparser.rst:991 msgid "The default *dict_type* is :class:`collections.OrderedDict`." msgstr "" -#: ../../library/configparser.rst:964 +#: ../../library/configparser.rst:994 msgid "" "*allow_no_value*, *delimiters*, *comment_prefixes*, *strict*, " "*empty_lines_in_values*, *default_section* and *interpolation* were added." msgstr "" -#: ../../library/configparser.rst:969 +#: ../../library/configparser.rst:999 msgid "The *converters* argument was added." msgstr "新增 *converters* 引數。" -#: ../../library/configparser.rst:972 +#: ../../library/configparser.rst:1002 msgid "" "The *defaults* argument is read with :meth:`read_dict()`, providing " "consistent behavior across the parser: non-string keys and values are " "implicitly converted to strings." msgstr "" -#: ../../library/configparser.rst:977 ../../library/configparser.rst:1240 +#: ../../library/configparser.rst:1007 ../../library/configparser.rst:1270 msgid "" "The default *dict_type* is :class:`dict`, since it now preserves insertion " "order." msgstr "" -#: ../../library/configparser.rst:983 +#: ../../library/configparser.rst:1013 msgid "Return a dictionary containing the instance-wide defaults." msgstr "" -#: ../../library/configparser.rst:988 +#: ../../library/configparser.rst:1018 msgid "" "Return a list of the sections available; the *default section* is not " "included in the list." msgstr "" -#: ../../library/configparser.rst:994 +#: ../../library/configparser.rst:1024 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " @@ -789,34 +791,34 @@ msgid "" "the section must be a string; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:999 +#: ../../library/configparser.rst:1029 msgid "Non-string section names raise :exc:`TypeError`." msgstr "" -#: ../../library/configparser.rst:1005 +#: ../../library/configparser.rst:1035 msgid "" "Indicates whether the named *section* is present in the configuration. The " "*default section* is not acknowledged." msgstr "" -#: ../../library/configparser.rst:1011 +#: ../../library/configparser.rst:1041 msgid "Return a list of options available in the specified *section*." msgstr "" -#: ../../library/configparser.rst:1016 +#: ../../library/configparser.rst:1046 msgid "" "If the given *section* exists, and contains the given *option*, return :" "const:`True`; otherwise return :const:`False`. If the specified *section* " "is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" -#: ../../library/configparser.rst:1023 +#: ../../library/configparser.rst:1053 msgid "" "Attempt to read and parse an iterable of filenames, returning a list of " "filenames which were successfully parsed." msgstr "" -#: ../../library/configparser.rst:1026 +#: ../../library/configparser.rst:1056 msgid "" "If *filenames* is a string, a :class:`bytes` object or a :term:`path-like " "object`, it is treated as a single filename. If a file named in *filenames* " @@ -827,7 +829,7 @@ msgid "" "be read." msgstr "" -#: ../../library/configparser.rst:1035 +#: ../../library/configparser.rst:1065 msgid "" "If none of the named files exist, the :class:`ConfigParser` instance will " "contain an empty dataset. An application which requires initial values to " @@ -835,49 +837,49 @@ msgid "" "`read_file` before calling :meth:`read` for any optional files::" msgstr "" -#: ../../library/configparser.rst:1048 +#: ../../library/configparser.rst:1078 msgid "" "Added the *encoding* parameter. Previously, all files were read using the " "default encoding for :func:`open`." msgstr "" -#: ../../library/configparser.rst:1052 +#: ../../library/configparser.rst:1082 msgid "The *filenames* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/configparser.rst:1055 +#: ../../library/configparser.rst:1085 msgid "The *filenames* parameter accepts a :class:`bytes` object." msgstr "" -#: ../../library/configparser.rst:1061 +#: ../../library/configparser.rst:1091 msgid "" "Read and parse configuration data from *f* which must be an iterable " "yielding Unicode strings (for example files opened in text mode)." msgstr "" -#: ../../library/configparser.rst:1064 +#: ../../library/configparser.rst:1094 msgid "" "Optional argument *source* specifies the name of the file being read. If " "not given and *f* has a :attr:`!name` attribute, that is used for *source*; " "the default is ``''``." msgstr "" -#: ../../library/configparser.rst:1068 +#: ../../library/configparser.rst:1098 msgid "Replaces :meth:`!readfp`." msgstr "取代 :meth:`!readfp`。" -#: ../../library/configparser.rst:1073 +#: ../../library/configparser.rst:1103 msgid "Parse configuration data from a string." msgstr "" -#: ../../library/configparser.rst:1075 +#: ../../library/configparser.rst:1105 msgid "" "Optional argument *source* specifies a context-specific name of the string " "passed. If not given, ``''`` is used. This should commonly be a " "filesystem path or a URL." msgstr "" -#: ../../library/configparser.rst:1084 +#: ../../library/configparser.rst:1114 msgid "" "Load configuration from any object that provides a dict-like ``items()`` " "method. Keys are section names, values are dictionaries with keys and " @@ -886,17 +888,17 @@ msgid "" "automatically converted to strings." msgstr "" -#: ../../library/configparser.rst:1090 +#: ../../library/configparser.rst:1120 msgid "" "Optional argument *source* specifies a context-specific name of the " "dictionary passed. If not given, ```` is used." msgstr "" -#: ../../library/configparser.rst:1093 +#: ../../library/configparser.rst:1123 msgid "This method can be used to copy state between parsers." msgstr "" -#: ../../library/configparser.rst:1100 +#: ../../library/configparser.rst:1130 msgid "" "Get an *option* value for the named *section*. If *vars* is provided, it " "must be a dictionary. The *option* is looked up in *vars* (if provided), " @@ -905,35 +907,35 @@ msgid "" "provided as a *fallback* value." msgstr "" -#: ../../library/configparser.rst:1106 +#: ../../library/configparser.rst:1136 msgid "" "All the ``'%'`` interpolations are expanded in the return values, unless the " "*raw* argument is true. Values for interpolation keys are looked up in the " "same manner as the option." msgstr "" -#: ../../library/configparser.rst:1110 +#: ../../library/configparser.rst:1140 msgid "" "Arguments *raw*, *vars* and *fallback* are keyword only to protect users " "from trying to use the third argument as the *fallback* fallback (especially " "when using the mapping protocol)." msgstr "" -#: ../../library/configparser.rst:1118 +#: ../../library/configparser.rst:1148 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to an integer. See :meth:`get` for explanation of *raw*, *vars* and " "*fallback*." msgstr "" -#: ../../library/configparser.rst:1125 +#: ../../library/configparser.rst:1155 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a floating point number. See :meth:`get` for explanation of *raw*, " "*vars* and *fallback*." msgstr "" -#: ../../library/configparser.rst:1132 +#: ../../library/configparser.rst:1162 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a Boolean value. Note that the accepted values for the option are " @@ -945,34 +947,34 @@ msgid "" "*fallback*." msgstr "" -#: ../../library/configparser.rst:1145 +#: ../../library/configparser.rst:1175 msgid "" "When *section* is not given, return a list of *section_name*, " "*section_proxy* pairs, including DEFAULTSECT." msgstr "" -#: ../../library/configparser.rst:1148 +#: ../../library/configparser.rst:1178 msgid "" "Otherwise, return a list of *name*, *value* pairs for the options in the " "given *section*. Optional arguments have the same meaning as for the :meth:" "`get` method." msgstr "" -#: ../../library/configparser.rst:1152 +#: ../../library/configparser.rst:1182 msgid "" "Items present in *vars* no longer appear in the result. The previous " "behaviour mixed actual parser options with variables provided for " "interpolation." msgstr "" -#: ../../library/configparser.rst:1160 +#: ../../library/configparser.rst:1190 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. *option* and *value* must be " "strings; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:1167 +#: ../../library/configparser.rst:1197 msgid "" "Write a representation of the configuration to the specified :term:`file " "object`, which must be opened in text mode (accepting strings). This " @@ -981,27 +983,27 @@ msgid "" "surrounded by spaces." msgstr "" -#: ../../library/configparser.rst:1175 +#: ../../library/configparser.rst:1205 msgid "" "Comments in the original configuration file are not preserved when writing " "the configuration back. What is considered a comment, depends on the given " "values for *comment_prefix* and *inline_comment_prefix*." msgstr "" -#: ../../library/configparser.rst:1183 +#: ../../library/configparser.rst:1213 msgid "" "Remove the specified *option* from the specified *section*. If the section " "does not exist, raise :exc:`NoSectionError`. If the option existed to be " "removed, return :const:`True`; otherwise return :const:`False`." msgstr "" -#: ../../library/configparser.rst:1191 +#: ../../library/configparser.rst:1221 msgid "" "Remove the specified *section* from the configuration. If the section in " "fact existed, return ``True``. Otherwise return ``False``." msgstr "" -#: ../../library/configparser.rst:1197 +#: ../../library/configparser.rst:1227 msgid "" "Transforms the option name *option* as found in an input file or as passed " "in by client code to the form that should be used in the internal " @@ -1010,7 +1012,7 @@ msgid "" "of this name on instances to affect this behavior." msgstr "" -#: ../../library/configparser.rst:1203 +#: ../../library/configparser.rst:1233 msgid "" "You don't need to subclass the parser to use this method, you can also set " "it on an instance, to a function that takes a string argument and returns a " @@ -1018,24 +1020,24 @@ msgid "" "sensitive::" msgstr "" -#: ../../library/configparser.rst:1211 +#: ../../library/configparser.rst:1241 msgid "" "Note that when reading configuration files, whitespace around the option " "names is stripped before :meth:`optionxform` is called." msgstr "" -#: ../../library/configparser.rst:1217 +#: ../../library/configparser.rst:1247 msgid "" "The maximum depth for recursive interpolation for :meth:`~configparser." "ConfigParser.get` when the *raw* parameter is false. This is relevant only " "when the default *interpolation* is used." msgstr "" -#: ../../library/configparser.rst:1225 +#: ../../library/configparser.rst:1255 msgid "RawConfigParser Objects" msgstr "RawConfigParser 物件" -#: ../../library/configparser.rst:1235 +#: ../../library/configparser.rst:1265 msgid "" "Legacy variant of the :class:`ConfigParser`. It has interpolation disabled " "by default and allows for non-string section names, option names, and values " @@ -1043,27 +1045,27 @@ msgid "" "``defaults=`` keyword argument handling." msgstr "" -#: ../../library/configparser.rst:1245 +#: ../../library/configparser.rst:1275 msgid "" "Consider using :class:`ConfigParser` instead which checks types of the " "values to be stored internally. If you don't want interpolation, you can " "use ``ConfigParser(interpolation=None)``." msgstr "" -#: ../../library/configparser.rst:1252 +#: ../../library/configparser.rst:1282 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " "*default section* name is passed, :exc:`ValueError` is raised." msgstr "" -#: ../../library/configparser.rst:1256 +#: ../../library/configparser.rst:1286 msgid "" "Type of *section* is not checked which lets users create non-string named " "sections. This behaviour is unsupported and may cause internal errors." msgstr "" -#: ../../library/configparser.rst:1262 +#: ../../library/configparser.rst:1292 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. While it is possible to use :class:" @@ -1073,7 +1075,7 @@ msgid "" "string values." msgstr "" -#: ../../library/configparser.rst:1269 +#: ../../library/configparser.rst:1299 msgid "" "This method lets users assign non-string values to keys internally. This " "behaviour is unsupported and will cause errors when attempting to write to a " @@ -1081,32 +1083,32 @@ msgid "" "not allow such assignments to take place." msgstr "" -#: ../../library/configparser.rst:1276 +#: ../../library/configparser.rst:1306 msgid "Exceptions" msgstr "例外" -#: ../../library/configparser.rst:1280 +#: ../../library/configparser.rst:1310 msgid "Base class for all other :mod:`configparser` exceptions." msgstr "" -#: ../../library/configparser.rst:1285 +#: ../../library/configparser.rst:1315 msgid "Exception raised when a specified section is not found." msgstr "" -#: ../../library/configparser.rst:1290 +#: ../../library/configparser.rst:1320 msgid "" "Exception raised if :meth:`~ConfigParser.add_section` is called with the " "name of a section that is already present or in strict parsers when a " "section if found more than once in a single input file, string or dictionary." msgstr "" -#: ../../library/configparser.rst:1294 +#: ../../library/configparser.rst:1324 msgid "" "Added the optional *source* and *lineno* attributes and parameters to :meth:" "`!__init__`." msgstr "" -#: ../../library/configparser.rst:1301 +#: ../../library/configparser.rst:1331 msgid "" "Exception raised by strict parsers if a single option appears twice during " "reading from a single file, string or dictionary. This catches misspellings " @@ -1114,58 +1116,58 @@ msgid "" "representing the same case-insensitive configuration key." msgstr "" -#: ../../library/configparser.rst:1309 +#: ../../library/configparser.rst:1339 msgid "" "Exception raised when a specified option is not found in the specified " "section." msgstr "" -#: ../../library/configparser.rst:1315 +#: ../../library/configparser.rst:1345 msgid "" "Base class for exceptions raised when problems occur performing string " "interpolation." msgstr "" -#: ../../library/configparser.rst:1321 +#: ../../library/configparser.rst:1351 msgid "" "Exception raised when string interpolation cannot be completed because the " "number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :" "exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1328 +#: ../../library/configparser.rst:1358 msgid "" "Exception raised when an option referenced from a value does not exist. " "Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1334 +#: ../../library/configparser.rst:1364 msgid "" "Exception raised when the source text into which substitutions are made does " "not conform to the required syntax. Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1340 +#: ../../library/configparser.rst:1370 msgid "" "Exception raised when attempting to parse a file which has no section " "headers." msgstr "" -#: ../../library/configparser.rst:1346 +#: ../../library/configparser.rst:1376 msgid "Exception raised when errors occur attempting to parse a file." msgstr "" -#: ../../library/configparser.rst:1348 +#: ../../library/configparser.rst:1378 msgid "" "The ``filename`` attribute and :meth:`!__init__` constructor argument were " "removed. They have been available using the name ``source`` since 3.2." msgstr "" -#: ../../library/configparser.rst:1353 +#: ../../library/configparser.rst:1383 msgid "Footnotes" msgstr "註解" -#: ../../library/configparser.rst:1354 +#: ../../library/configparser.rst:1384 msgid "" "Config parsers allow for heavy customization. If you are interested in " "changing the behaviour outlined by the footnote reference, consult the " @@ -1192,14 +1194,14 @@ msgstr "ini file(ini 檔案)" msgid "Windows ini file" msgstr "Windows ini file(Windows ini 檔案)" -#: ../../library/configparser.rst:335 +#: ../../library/configparser.rst:340 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/configparser.rst:335 ../../library/configparser.rst:368 +#: ../../library/configparser.rst:340 ../../library/configparser.rst:373 msgid "interpolation in configuration files" msgstr "interpolation in configuration files(設定檔中的插值)" -#: ../../library/configparser.rst:368 +#: ../../library/configparser.rst:373 msgid "$ (dollar)" msgstr "$ (金錢符號)" diff --git a/library/datetime.po b/library/datetime.po index 9cfd8502bc..a0681787de 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-07-17 00:03+0000\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" "Last-Translator: Griiid \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -92,7 +92,7 @@ msgstr "" #: ../../library/datetime.rst:50 msgid "" "Date and time objects may be categorized as \"aware\" or \"naive\" depending " -"on whether or not they include timezone information." +"on whether or not they include time zone information." msgstr "" #: ../../library/datetime.rst:53 @@ -109,7 +109,7 @@ msgid "" "A **naive** object does not contain enough information to unambiguously " "locate itself relative to other date/time objects. Whether a naive object " "represents Coordinated Universal Time (UTC), local time, or time in some " -"other timezone is purely up to the program, just like it is up to the " +"other time zone is purely up to the program, just like it is up to the " "program whether a particular number represents metres, miles, or mass. Naive " "objects are easy to understand and to work with, at the cost of ignoring " "some aspects of reality." @@ -128,9 +128,9 @@ msgstr "" #: ../../library/datetime.rst:72 msgid "" "Only one concrete :class:`tzinfo` class, the :class:`timezone` class, is " -"supplied by the :mod:`!datetime` module. The :class:`timezone` class can " -"represent simple timezones with fixed offsets from UTC, such as UTC itself " -"or North American EST and EDT timezones. Supporting timezones at deeper " +"supplied by the :mod:`!datetime` module. The :class:`!timezone` class can " +"represent simple time zones with fixed offsets from UTC, such as UTC itself " +"or North American EST and EDT time zones. Supporting time zones at deeper " "levels of detail is up to the application. The rules for time adjustment " "across the world are more political than rational, change frequently, and " "there is no standard suitable for every application aside from UTC." @@ -157,7 +157,7 @@ msgid "" msgstr "" #: ../../library/datetime.rst:98 -msgid "Alias for the UTC timezone singleton :attr:`datetime.timezone.utc`." +msgid "Alias for the UTC time zone singleton :attr:`datetime.timezone.utc`." msgstr "" #: ../../library/datetime.rst:103 @@ -1131,8 +1131,8 @@ msgid "Added the *fold* parameter." msgstr "新增 *fold* 參數。" #: ../../library/datetime.rst:853 -msgid "Return the current local datetime, with :attr:`.tzinfo` ``None``." -msgstr "" +msgid "Return the current local date and time, with :attr:`.tzinfo` ``None``." +msgstr "回傳目前的本地日期與時間,且 :attr:`.tzinfo` 為 ``None``。" #: ../../library/datetime.rst:855 msgid "Equivalent to::" @@ -1356,7 +1356,7 @@ msgstr "" #: ../../library/datetime.rst:1054 msgid "" -"If *format* does not contain microseconds or timezone information, this is " +"If *format* does not contain microseconds or time zone information, this is " "equivalent to::" msgstr "" @@ -1597,13 +1597,13 @@ msgstr "" msgid "" "If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and " "its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. If " -"*self* is naive, it is presumed to represent time in the system timezone." +"*self* is naive, it is presumed to represent time in the system time zone." msgstr "" #: ../../library/datetime.rst:1272 msgid "" -"If called without arguments (or with ``tz=None``) the system local timezone " -"is assumed for the target timezone. The ``.tzinfo`` attribute of the " +"If called without arguments (or with ``tz=None``) the system local time zone " +"is assumed for the target time zone. The ``.tzinfo`` attribute of the " "converted datetime instance will be set to an instance of :class:`timezone` " "with the zone name and offset obtained from the OS." msgstr "" @@ -1612,17 +1612,18 @@ msgstr "" msgid "" "If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no " "adjustment of date or time data is performed. Else the result is local time " -"in the timezone *tz*, representing the same UTC time as *self*: after " +"in the time zone *tz*, representing the same UTC time as *self*: after " "``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will have the same " "date and time data as ``dt - dt.utcoffset()``." msgstr "" #: ../../library/datetime.rst:1283 msgid "" -"If you merely want to attach a time zone object *tz* to a datetime *dt* " -"without adjustment of date and time data, use ``dt.replace(tzinfo=tz)``. If " -"you merely want to remove the time zone object from an aware datetime *dt* " -"without conversion of date and time data, use ``dt.replace(tzinfo=None)``." +"If you merely want to attach a :class:`timezone` object *tz* to a datetime " +"*dt* without adjustment of date and time data, use ``dt." +"replace(tzinfo=tz)``. If you merely want to remove the :class:`!timezone` " +"object from an aware datetime *dt* without conversion of date and time data, " +"use ``dt.replace(tzinfo=None)``." msgstr "" #: ../../library/datetime.rst:1288 @@ -1750,7 +1751,7 @@ msgstr "" msgid "" "There is no method to obtain the POSIX timestamp directly from a naive :" "class:`.datetime` instance representing UTC time. If your application uses " -"this convention and your system timezone is not set to UTC, you can obtain " +"this convention and your system time zone is not set to UTC, you can obtain " "the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" msgstr "" @@ -2150,7 +2151,7 @@ msgid "" "implementations of the standard :class:`tzinfo` methods needed by the :class:" "`.datetime` methods you use. The :mod:`!datetime` module provides :class:" "`timezone`, a simple concrete subclass of :class:`tzinfo` which can " -"represent timezones with fixed offset from UTC such as UTC itself or North " +"represent time zones with fixed offset from UTC such as UTC itself or North " "American EST and EDT." msgstr "" @@ -2300,8 +2301,8 @@ msgid "" "datetime` method, ``dt.tzinfo`` is the same object as *self*. :class:" "`tzinfo` methods can rely on this, unless user code calls :class:`tzinfo` " "methods directly. The intent is that the :class:`tzinfo` methods interpret " -"*dt* as being in local time, and not need worry about objects in other " -"timezones." +"*dt* as being in local time, and not need worry about objects in other time " +"zones." msgstr "" #: ../../library/datetime.rst:2104 @@ -2312,11 +2313,11 @@ msgstr "" #: ../../library/datetime.rst:2109 msgid "" -"This is called from the default :class:`datetime.astimezone()` " -"implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s " -"date and time data are to be viewed as expressing a UTC time. The purpose " -"of :meth:`fromutc` is to adjust the date and time data, returning an " -"equivalent datetime in *self*'s local time." +"This is called from the default :meth:`datetime.astimezone` implementation. " +"When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time " +"data are to be viewed as expressing a UTC time. The purpose of :meth:" +"`fromutc` is to adjust the date and time data, returning an equivalent " +"datetime in *self*'s local time." msgstr "" #: ../../library/datetime.rst:2115 @@ -2403,17 +2404,17 @@ msgstr ":mod:`zoneinfo`" msgid "" "The :mod:`!datetime` module has a basic :class:`timezone` class (for " "handling arbitrary fixed offsets from UTC) and its :attr:`timezone.utc` " -"attribute (a UTC timezone instance)." +"attribute (a UTC :class:`!timezone` instance)." msgstr "" #: ../../library/datetime.rst:2221 msgid "" -"``zoneinfo`` brings the *IANA timezone database* (also known as the Olson " +"``zoneinfo`` brings the *IANA time zone database* (also known as the Olson " "database) to Python, and its usage is recommended." msgstr "" #: ../../library/datetime.rst:2224 -msgid "`IANA timezone database `_" +msgid "`IANA time zone database `_" msgstr "`IANA 時區資料庫 `_" #: ../../library/datetime.rst:2225 @@ -2432,12 +2433,12 @@ msgstr ":class:`timezone` 物件" #: ../../library/datetime.rst:2237 msgid "" "The :class:`timezone` class is a subclass of :class:`tzinfo`, each instance " -"of which represents a timezone defined by a fixed offset from UTC." +"of which represents a time zone defined by a fixed offset from UTC." msgstr "" #: ../../library/datetime.rst:2241 msgid "" -"Objects of this class cannot be used to represent timezone information in " +"Objects of this class cannot be used to represent time zone information in " "the locations where different offsets are used in different days of the year " "or where historical changes have been made to civil time." msgstr "" @@ -2494,7 +2495,7 @@ msgid "" msgstr "" #: ../../library/datetime.rst:2302 -msgid "The UTC timezone, ``timezone(timedelta(0))``." +msgid "The UTC time zone, ``timezone(timedelta(0))``." msgstr "UTC 時區,``timezone(timedelta(0))``。" #: ../../library/datetime.rst:2311 @@ -3074,7 +3075,7 @@ msgstr "" #: ../../library/datetime.rst:2511 msgid "" -"except when the format includes sub-second components or timezone offset " +"except when the format includes sub-second components or time zone offset " "information, which are supported in ``datetime.strptime`` but are discarded " "by ``time.strptime``." msgstr "" diff --git a/library/decimal.po b/library/decimal.po index d9e163f06a..4bc9950c75 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-14 00:03+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-" @@ -860,12 +860,12 @@ msgstr "" msgid "Return the square root of the argument to full precision." msgstr "" -#: ../../library/decimal.rst:873 ../../library/decimal.rst:1468 +#: ../../library/decimal.rst:873 ../../library/decimal.rst:1510 msgid "" "Convert to a string, using engineering notation if an exponent is needed." msgstr "" -#: ../../library/decimal.rst:875 ../../library/decimal.rst:1470 +#: ../../library/decimal.rst:875 ../../library/decimal.rst:1512 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 " @@ -898,11 +898,55 @@ msgid "" "method in either the supplied *context* or the current context." msgstr "" -#: ../../library/decimal.rst:904 +#: ../../library/decimal.rst:900 +msgid "Decimal numbers can be rounded using the :func:`.round` function:" +msgstr "" + +#: ../../library/decimal.rst:905 +msgid "" +"If *ndigits* is not given or ``None``, returns the nearest :class:`int` to " +"*number*, rounding ties to even, and ignoring the rounding mode of the :" +"class:`Decimal` context. Raises :exc:`OverflowError` if *number* is an " +"infinity or :exc:`ValueError` if it is a (quiet or signaling) NaN." +msgstr "" + +#: ../../library/decimal.rst:911 +msgid "" +"If *ndigits* is an :class:`int`, the context's rounding mode is respected " +"and a :class:`Decimal` representing *number* rounded to the nearest multiple " +"of ``Decimal('1E-ndigits')`` is returned; in this case, ``round(number, " +"ndigits)`` is equivalent to ``self.quantize(Decimal('1E-ndigits'))``. " +"Returns ``Decimal('NaN')`` if *number* is a quiet NaN. Raises :class:" +"`InvalidOperation` if *number* is an infinity, a signaling NaN, or if the " +"length of the coefficient after the quantize operation would be greater than " +"the current context's precision. In other words, for the non-corner cases:" +msgstr "" + +#: ../../library/decimal.rst:921 +msgid "" +"if *ndigits* is positive, return *number* rounded to *ndigits* decimal " +"places;" +msgstr "" + +#: ../../library/decimal.rst:923 +msgid "if *ndigits* is zero, return *number* rounded to the nearest integer;" +msgstr "" + +#: ../../library/decimal.rst:924 +msgid "" +"if *ndigits* is negative, return *number* rounded to the nearest multiple of " +"``10**abs(ndigits)``." +msgstr "" + +#: ../../library/decimal.rst:927 +msgid "For example::" +msgstr "" + +#: ../../library/decimal.rst:946 msgid "Logical operands" msgstr "" -#: ../../library/decimal.rst:906 +#: ../../library/decimal.rst:948 msgid "" "The :meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:" "`~Decimal.logical_or`, and :meth:`~Decimal.logical_xor` methods expect their " @@ -911,38 +955,38 @@ msgid "" "are all either ``0`` or ``1``." msgstr "" -#: ../../library/decimal.rst:918 +#: ../../library/decimal.rst:960 msgid "Context objects" msgstr "" -#: ../../library/decimal.rst:920 +#: ../../library/decimal.rst:962 msgid "" "Contexts are environments for arithmetic operations. They govern precision, " "set rules for rounding, determine which signals are treated as exceptions, " "and limit the range for exponents." msgstr "" -#: ../../library/decimal.rst:924 +#: ../../library/decimal.rst:966 msgid "" "Each thread has its own current context which is accessed or changed using " "the :func:`getcontext` and :func:`setcontext` functions:" msgstr "" -#: ../../library/decimal.rst:930 +#: ../../library/decimal.rst:972 msgid "Return the current context for the active thread." msgstr "" -#: ../../library/decimal.rst:935 +#: ../../library/decimal.rst:977 msgid "Set the current context for the active thread to *c*." msgstr "" -#: ../../library/decimal.rst:937 +#: ../../library/decimal.rst:979 msgid "" "You can also use the :keyword:`with` statement and the :func:`localcontext` " "function to temporarily change the active context." msgstr "" -#: ../../library/decimal.rst:942 +#: ../../library/decimal.rst:984 msgid "" "Return a context manager that will set the current context for the active " "thread to a copy of *ctx* on entry to the with-statement and restore the " @@ -951,37 +995,37 @@ msgid "" "used to set the attributes of the new context." msgstr "" -#: ../../library/decimal.rst:948 +#: ../../library/decimal.rst:990 msgid "" "For example, the following code sets the current decimal precision to 42 " "places, performs a calculation, and then automatically restores the previous " "context::" msgstr "" -#: ../../library/decimal.rst:958 +#: ../../library/decimal.rst:1000 msgid "Using keyword arguments, the code would be the following::" msgstr "" -#: ../../library/decimal.rst:966 +#: ../../library/decimal.rst:1008 msgid "" "Raises :exc:`TypeError` if *kwargs* supplies an attribute that :class:" "`Context` doesn't support. Raises either :exc:`TypeError` or :exc:" "`ValueError` if *kwargs* supplies an invalid value for an attribute." msgstr "" -#: ../../library/decimal.rst:970 +#: ../../library/decimal.rst:1012 msgid "" ":meth:`localcontext` now supports setting context attributes through the use " "of keyword arguments." msgstr "" -#: ../../library/decimal.rst:973 +#: ../../library/decimal.rst:1015 msgid "" "New contexts can also be created using the :class:`Context` constructor " "described below. In addition, the module provides three pre-made contexts:" msgstr "" -#: ../../library/decimal.rst:979 +#: ../../library/decimal.rst:1021 msgid "" "This is a standard context defined by the General Decimal Arithmetic " "Specification. Precision is set to nine. Rounding is set to :const:" @@ -990,12 +1034,12 @@ msgid "" "`Subnormal`." msgstr "" -#: ../../library/decimal.rst:985 +#: ../../library/decimal.rst:1027 msgid "" "Because many of the traps are enabled, this context is useful for debugging." msgstr "" -#: ../../library/decimal.rst:990 +#: ../../library/decimal.rst:1032 msgid "" "This is a standard context defined by the General Decimal Arithmetic " "Specification. Precision is set to nine. Rounding is set to :const:" @@ -1003,7 +1047,7 @@ msgid "" "exceptions are not raised during computations)." msgstr "" -#: ../../library/decimal.rst:995 +#: ../../library/decimal.rst:1037 msgid "" "Because the traps are disabled, this context is useful for applications that " "prefer to have result value of ``NaN`` or ``Infinity`` instead of raising " @@ -1011,7 +1055,7 @@ msgid "" "conditions that would otherwise halt the program." msgstr "" -#: ../../library/decimal.rst:1003 +#: ../../library/decimal.rst:1045 msgid "" "This context is used by the :class:`Context` constructor as a prototype for " "new contexts. Changing a field (such a precision) has the effect of " @@ -1019,7 +1063,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/decimal.rst:1007 +#: ../../library/decimal.rst:1049 msgid "" "This context is most useful in multi-threaded environments. Changing one of " "the fields before threads are started has the effect of setting system-wide " @@ -1027,65 +1071,65 @@ msgid "" "as it would require thread synchronization to prevent race conditions." msgstr "" -#: ../../library/decimal.rst:1012 +#: ../../library/decimal.rst:1054 msgid "" "In single threaded environments, it is preferable to not use this context at " "all. Instead, simply create contexts explicitly as described below." msgstr "" -#: ../../library/decimal.rst:1015 +#: ../../library/decimal.rst:1057 msgid "" "The default values are :attr:`Context.prec`\\ =\\ ``28``, :attr:`Context." "rounding`\\ =\\ :const:`ROUND_HALF_EVEN`, and enabled traps for :class:" "`Overflow`, :class:`InvalidOperation`, and :class:`DivisionByZero`." msgstr "" -#: ../../library/decimal.rst:1020 +#: ../../library/decimal.rst:1062 msgid "" "In addition to the three supplied contexts, new contexts can be created with " "the :class:`Context` constructor." msgstr "" -#: ../../library/decimal.rst:1026 +#: ../../library/decimal.rst:1068 msgid "" "Creates a new context. If a field is not specified or is :const:`None`, the " "default values are copied from the :const:`DefaultContext`. If the *flags* " "field is not specified or is :const:`None`, all flags are cleared." msgstr "" -#: ../../library/decimal.rst:1030 +#: ../../library/decimal.rst:1072 msgid "" "*prec* is an integer in the range [``1``, :const:`MAX_PREC`] that sets the " "precision for arithmetic operations in the context." msgstr "" -#: ../../library/decimal.rst:1033 +#: ../../library/decimal.rst:1075 msgid "" "The *rounding* option is one of the constants listed in the section " "`Rounding Modes`_." msgstr "" -#: ../../library/decimal.rst:1036 +#: ../../library/decimal.rst:1078 msgid "" "The *traps* and *flags* fields list any signals to be set. Generally, new " "contexts should only set traps and leave the flags clear." msgstr "" -#: ../../library/decimal.rst:1039 +#: ../../library/decimal.rst:1081 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`]." msgstr "" -#: ../../library/decimal.rst:1043 +#: ../../library/decimal.rst:1085 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')``." msgstr "" -#: ../../library/decimal.rst:1047 +#: ../../library/decimal.rst:1089 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 " @@ -1099,13 +1143,13 @@ msgid "" "For example::" msgstr "" -#: ../../library/decimal.rst:1062 +#: ../../library/decimal.rst:1104 msgid "" "A *clamp* value of ``1`` allows compatibility with the fixed-width decimal " "interchange formats specified in IEEE 754." msgstr "" -#: ../../library/decimal.rst:1065 +#: ../../library/decimal.rst:1107 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 " @@ -1118,30 +1162,30 @@ msgid "" "instance of :class:`int`) anywhere that a Decimal instance is accepted." msgstr "" -#: ../../library/decimal.rst:1078 +#: ../../library/decimal.rst:1120 msgid "Resets all of the flags to ``0``." msgstr "" -#: ../../library/decimal.rst:1082 +#: ../../library/decimal.rst:1124 msgid "Resets all of the traps to ``0``." msgstr "" -#: ../../library/decimal.rst:1088 +#: ../../library/decimal.rst:1130 msgid "Return a duplicate of the context." msgstr "" -#: ../../library/decimal.rst:1092 +#: ../../library/decimal.rst:1134 msgid "Return a copy of the Decimal instance num." msgstr "" -#: ../../library/decimal.rst:1096 +#: ../../library/decimal.rst:1138 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:1100 +#: ../../library/decimal.rst:1142 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 " @@ -1150,14 +1194,14 @@ msgid "" "sum can change the result:" msgstr "" -#: ../../library/decimal.rst:1114 +#: ../../library/decimal.rst:1156 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:1120 +#: ../../library/decimal.rst:1162 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 " @@ -1165,18 +1209,18 @@ msgid "" "conversion." msgstr "" -#: ../../library/decimal.rst:1140 +#: ../../library/decimal.rst:1182 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:1146 +#: ../../library/decimal.rst:1188 msgid "Returns a value equal to ``Emax - prec + 1``." msgstr "" -#: ../../library/decimal.rst:1148 +#: ../../library/decimal.rst:1190 msgid "" "The usual approach to working with decimals is to create :class:`Decimal` " "instances and then apply arithmetic operations which take place within the " @@ -1186,189 +1230,189 @@ msgid "" "recounted here." msgstr "" -#: ../../library/decimal.rst:1158 +#: ../../library/decimal.rst:1200 msgid "Returns the absolute value of *x*." msgstr "" -#: ../../library/decimal.rst:1163 +#: ../../library/decimal.rst:1205 msgid "Return the sum of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1168 +#: ../../library/decimal.rst:1210 msgid "Returns the same Decimal object *x*." msgstr "" -#: ../../library/decimal.rst:1173 +#: ../../library/decimal.rst:1215 msgid "Compares *x* and *y* numerically." msgstr "" -#: ../../library/decimal.rst:1178 +#: ../../library/decimal.rst:1220 msgid "Compares the values of the two operands numerically." msgstr "" -#: ../../library/decimal.rst:1183 +#: ../../library/decimal.rst:1225 msgid "Compares two operands using their abstract representation." msgstr "" -#: ../../library/decimal.rst:1188 +#: ../../library/decimal.rst:1230 msgid "" "Compares two operands using their abstract representation, ignoring sign." msgstr "" -#: ../../library/decimal.rst:1193 +#: ../../library/decimal.rst:1235 msgid "Returns a copy of *x* with the sign set to 0." msgstr "" -#: ../../library/decimal.rst:1198 +#: ../../library/decimal.rst:1240 msgid "Returns a copy of *x* with the sign inverted." msgstr "" -#: ../../library/decimal.rst:1203 +#: ../../library/decimal.rst:1245 msgid "Copies the sign from *y* to *x*." msgstr "" -#: ../../library/decimal.rst:1208 +#: ../../library/decimal.rst:1250 msgid "Return *x* divided by *y*." msgstr "" -#: ../../library/decimal.rst:1213 +#: ../../library/decimal.rst:1255 msgid "Return *x* divided by *y*, truncated to an integer." msgstr "" -#: ../../library/decimal.rst:1218 +#: ../../library/decimal.rst:1260 msgid "Divides two numbers and returns the integer part of the result." msgstr "" -#: ../../library/decimal.rst:1223 +#: ../../library/decimal.rst:1265 msgid "Returns ``e ** x``." msgstr "" -#: ../../library/decimal.rst:1228 +#: ../../library/decimal.rst:1270 msgid "Returns *x* multiplied by *y*, plus *z*." msgstr "" -#: ../../library/decimal.rst:1233 +#: ../../library/decimal.rst:1275 msgid "Returns ``True`` if *x* is canonical; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1238 +#: ../../library/decimal.rst:1280 msgid "Returns ``True`` if *x* is finite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1243 +#: ../../library/decimal.rst:1285 msgid "Returns ``True`` if *x* is infinite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1248 +#: ../../library/decimal.rst:1290 msgid "Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1253 +#: ../../library/decimal.rst:1295 msgid "" "Returns ``True`` if *x* is a normal number; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1258 +#: ../../library/decimal.rst:1300 msgid "Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1263 +#: ../../library/decimal.rst:1305 msgid "Returns ``True`` if *x* is negative; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1268 +#: ../../library/decimal.rst:1310 msgid "" "Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1273 +#: ../../library/decimal.rst:1315 msgid "Returns ``True`` if *x* is subnormal; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1278 +#: ../../library/decimal.rst:1320 msgid "Returns ``True`` if *x* is a zero; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1283 +#: ../../library/decimal.rst:1325 msgid "Returns the natural (base e) logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1288 +#: ../../library/decimal.rst:1330 msgid "Returns the base 10 logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1293 +#: ../../library/decimal.rst:1335 msgid "Returns the exponent of the magnitude of the operand's MSD." msgstr "" -#: ../../library/decimal.rst:1298 +#: ../../library/decimal.rst:1340 msgid "Applies the logical operation *and* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1303 +#: ../../library/decimal.rst:1345 msgid "Invert all the digits in *x*." msgstr "" -#: ../../library/decimal.rst:1308 +#: ../../library/decimal.rst:1350 msgid "Applies the logical operation *or* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1313 +#: ../../library/decimal.rst:1355 msgid "Applies the logical operation *xor* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1318 +#: ../../library/decimal.rst:1360 msgid "Compares two values numerically and returns the maximum." msgstr "" -#: ../../library/decimal.rst:1323 ../../library/decimal.rst:1333 +#: ../../library/decimal.rst:1365 ../../library/decimal.rst:1375 msgid "Compares the values numerically with their sign ignored." msgstr "" -#: ../../library/decimal.rst:1328 +#: ../../library/decimal.rst:1370 msgid "Compares two values numerically and returns the minimum." msgstr "" -#: ../../library/decimal.rst:1338 +#: ../../library/decimal.rst:1380 msgid "Minus corresponds to the unary prefix minus operator in Python." msgstr "" -#: ../../library/decimal.rst:1343 +#: ../../library/decimal.rst:1385 msgid "Return the product of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1348 +#: ../../library/decimal.rst:1390 msgid "Returns the largest representable number smaller than *x*." msgstr "" -#: ../../library/decimal.rst:1353 +#: ../../library/decimal.rst:1395 msgid "Returns the smallest representable number larger than *x*." msgstr "" -#: ../../library/decimal.rst:1358 +#: ../../library/decimal.rst:1400 msgid "Returns the number closest to *x*, in direction towards *y*." msgstr "" -#: ../../library/decimal.rst:1363 +#: ../../library/decimal.rst:1405 msgid "Reduces *x* to its simplest form." msgstr "" -#: ../../library/decimal.rst:1368 +#: ../../library/decimal.rst:1410 msgid "Returns an indication of the class of *x*." msgstr "" -#: ../../library/decimal.rst:1373 +#: ../../library/decimal.rst:1415 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:1380 +#: ../../library/decimal.rst:1422 msgid "Return ``x`` to the power of ``y``, reduced modulo ``modulo`` if given." msgstr "" -#: ../../library/decimal.rst:1382 +#: ../../library/decimal.rst:1424 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 " @@ -1377,42 +1421,42 @@ msgid "" "in the Python version." msgstr "" -#: ../../library/decimal.rst:1388 +#: ../../library/decimal.rst:1430 msgid "" "``Decimal(0) ** Decimal(0)`` results in ``InvalidOperation``, and if " "``InvalidOperation`` is not trapped, then results in ``Decimal('NaN')``." msgstr "" -#: ../../library/decimal.rst:1391 +#: ../../library/decimal.rst:1433 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:1396 +#: ../../library/decimal.rst:1438 msgid "" "With three arguments, compute ``(x**y) % modulo``. For the three argument " "form, the following restrictions on the arguments hold:" msgstr "" -#: ../../library/decimal.rst:1399 +#: ../../library/decimal.rst:1441 msgid "all three arguments must be integral" msgstr "" -#: ../../library/decimal.rst:1400 +#: ../../library/decimal.rst:1442 msgid "``y`` must be nonnegative" msgstr "" -#: ../../library/decimal.rst:1401 +#: ../../library/decimal.rst:1443 msgid "at least one of ``x`` or ``y`` must be nonzero" msgstr "" -#: ../../library/decimal.rst:1402 +#: ../../library/decimal.rst:1444 msgid "``modulo`` must be nonzero and have at most 'precision' digits" msgstr "" -#: ../../library/decimal.rst:1404 +#: ../../library/decimal.rst:1446 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 " @@ -1421,110 +1465,110 @@ msgid "" "result is always exact." msgstr "" -#: ../../library/decimal.rst:1414 +#: ../../library/decimal.rst:1456 msgid "Returns a value equal to *x* (rounded), having the exponent of *y*." msgstr "" -#: ../../library/decimal.rst:1419 +#: ../../library/decimal.rst:1461 msgid "Just returns 10, as this is Decimal, :)" msgstr "" -#: ../../library/decimal.rst:1424 +#: ../../library/decimal.rst:1466 msgid "Returns the remainder from integer division." msgstr "" -#: ../../library/decimal.rst:1426 +#: ../../library/decimal.rst:1468 msgid "" "The sign of the result, if non-zero, is the same as that of the original " "dividend." msgstr "" -#: ../../library/decimal.rst:1432 +#: ../../library/decimal.rst:1474 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:1438 +#: ../../library/decimal.rst:1480 msgid "Returns a rotated copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1443 +#: ../../library/decimal.rst:1485 msgid "Returns ``True`` if the two operands have the same exponent." msgstr "" -#: ../../library/decimal.rst:1448 +#: ../../library/decimal.rst:1490 msgid "Returns the first operand after adding the second value its exp." msgstr "" -#: ../../library/decimal.rst:1453 +#: ../../library/decimal.rst:1495 msgid "Returns a shifted copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1458 +#: ../../library/decimal.rst:1500 msgid "Square root of a non-negative number to context precision." msgstr "" -#: ../../library/decimal.rst:1463 +#: ../../library/decimal.rst:1505 msgid "Return the difference between *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1477 +#: ../../library/decimal.rst:1519 msgid "Rounds to an integer." msgstr "" -#: ../../library/decimal.rst:1482 +#: ../../library/decimal.rst:1524 msgid "Converts a number to a string using scientific notation." msgstr "" -#: ../../library/decimal.rst:1489 +#: ../../library/decimal.rst:1531 msgid "Constants" msgstr "常數" -#: ../../library/decimal.rst:1491 +#: ../../library/decimal.rst:1533 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:1495 +#: ../../library/decimal.rst:1537 msgid "32-bit" msgstr "" -#: ../../library/decimal.rst:1495 +#: ../../library/decimal.rst:1537 msgid "64-bit" msgstr "" -#: ../../library/decimal.rst:1497 ../../library/decimal.rst:1499 +#: ../../library/decimal.rst:1539 ../../library/decimal.rst:1541 msgid "``425000000``" msgstr "``425000000``" -#: ../../library/decimal.rst:1497 ../../library/decimal.rst:1499 +#: ../../library/decimal.rst:1539 ../../library/decimal.rst:1541 msgid "``999999999999999999``" msgstr "``999999999999999999``" -#: ../../library/decimal.rst:1501 +#: ../../library/decimal.rst:1543 msgid "``-425000000``" msgstr "``-425000000``" -#: ../../library/decimal.rst:1501 +#: ../../library/decimal.rst:1543 msgid "``-999999999999999999``" msgstr "``-999999999999999999``" -#: ../../library/decimal.rst:1503 +#: ../../library/decimal.rst:1545 msgid "``-849999999``" msgstr "``-849999999``" -#: ../../library/decimal.rst:1503 +#: ../../library/decimal.rst:1545 msgid "``-1999999999999999997``" msgstr "``-1999999999999999997``" -#: ../../library/decimal.rst:1509 +#: ../../library/decimal.rst:1551 msgid "" "The value is ``True``. Deprecated, because Python now always has threads." msgstr "" -#: ../../library/decimal.rst:1515 +#: ../../library/decimal.rst:1557 msgid "" "The default value is ``True``. If Python is :option:`configured using the --" "without-decimal-contextvar option <--without-decimal-contextvar>`, the C " @@ -1533,55 +1577,55 @@ msgid "" "scenarios." msgstr "" -#: ../../library/decimal.rst:1524 +#: ../../library/decimal.rst:1566 msgid "Rounding modes" msgstr "" -#: ../../library/decimal.rst:1528 +#: ../../library/decimal.rst:1570 msgid "Round towards ``Infinity``." msgstr "" -#: ../../library/decimal.rst:1532 +#: ../../library/decimal.rst:1574 msgid "Round towards zero." msgstr "" -#: ../../library/decimal.rst:1536 +#: ../../library/decimal.rst:1578 msgid "Round towards ``-Infinity``." msgstr "" -#: ../../library/decimal.rst:1540 +#: ../../library/decimal.rst:1582 msgid "Round to nearest with ties going towards zero." msgstr "" -#: ../../library/decimal.rst:1544 +#: ../../library/decimal.rst:1586 msgid "Round to nearest with ties going to nearest even integer." msgstr "" -#: ../../library/decimal.rst:1548 +#: ../../library/decimal.rst:1590 msgid "Round to nearest with ties going away from zero." msgstr "" -#: ../../library/decimal.rst:1552 +#: ../../library/decimal.rst:1594 msgid "Round away from zero." msgstr "" -#: ../../library/decimal.rst:1556 +#: ../../library/decimal.rst:1598 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:1563 +#: ../../library/decimal.rst:1605 msgid "Signals" msgstr "" -#: ../../library/decimal.rst:1565 +#: ../../library/decimal.rst:1607 msgid "" "Signals represent conditions that arise during computation. Each corresponds " "to one context flag and one context trap enabler." msgstr "" -#: ../../library/decimal.rst:1568 +#: ../../library/decimal.rst:1610 msgid "" "The context flag is set whenever the condition is encountered. After the " "computation, flags may be checked for informational purposes (for instance, " @@ -1589,7 +1633,7 @@ msgid "" "sure to clear all flags before starting the next computation." msgstr "" -#: ../../library/decimal.rst:1573 +#: ../../library/decimal.rst:1615 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:" @@ -1597,58 +1641,58 @@ msgid "" "raised upon encountering the condition." msgstr "" -#: ../../library/decimal.rst:1581 +#: ../../library/decimal.rst:1623 msgid "Altered an exponent to fit representation constraints." msgstr "" -#: ../../library/decimal.rst:1583 +#: ../../library/decimal.rst:1625 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:1590 +#: ../../library/decimal.rst:1632 msgid "Base class for other signals and a subclass of :exc:`ArithmeticError`." msgstr "" -#: ../../library/decimal.rst:1595 +#: ../../library/decimal.rst:1637 msgid "Signals the division of a non-infinite number by zero." msgstr "" -#: ../../library/decimal.rst:1597 +#: ../../library/decimal.rst:1639 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:1604 +#: ../../library/decimal.rst:1646 msgid "Indicates that rounding occurred and the result is not exact." msgstr "" -#: ../../library/decimal.rst:1606 +#: ../../library/decimal.rst:1648 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:1613 +#: ../../library/decimal.rst:1655 msgid "An invalid operation was performed." msgstr "" -#: ../../library/decimal.rst:1615 +#: ../../library/decimal.rst:1657 msgid "" "Indicates that an operation was requested that does not make sense. If not " "trapped, returns ``NaN``. Possible causes include::" msgstr "" -#: ../../library/decimal.rst:1631 +#: ../../library/decimal.rst:1673 msgid "Numerical overflow." msgstr "" -#: ../../library/decimal.rst:1633 +#: ../../library/decimal.rst:1675 msgid "" "Indicates the exponent is larger than :attr:`Context.Emax` after rounding " "has occurred. If not trapped, the result depends on the rounding mode, " @@ -1657,42 +1701,42 @@ msgid "" "`Rounded` are also signaled." msgstr "" -#: ../../library/decimal.rst:1642 +#: ../../library/decimal.rst:1684 msgid "Rounding occurred though possibly no information was lost." msgstr "" -#: ../../library/decimal.rst:1644 +#: ../../library/decimal.rst:1686 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:1652 +#: ../../library/decimal.rst:1694 msgid "Exponent was lower than :attr:`~Context.Emin` prior to rounding." msgstr "" -#: ../../library/decimal.rst:1654 +#: ../../library/decimal.rst:1696 msgid "" "Occurs when an operation result is subnormal (the exponent is too small). If " "not trapped, returns the result unchanged." msgstr "" -#: ../../library/decimal.rst:1660 +#: ../../library/decimal.rst:1702 msgid "Numerical underflow with result rounded to zero." msgstr "" -#: ../../library/decimal.rst:1662 +#: ../../library/decimal.rst:1704 msgid "" "Occurs when a subnormal result is pushed to zero by rounding. :class:" "`Inexact` and :class:`Subnormal` are also signaled." msgstr "" -#: ../../library/decimal.rst:1668 +#: ../../library/decimal.rst:1710 msgid "Enable stricter semantics for mixing floats and Decimals." msgstr "" -#: ../../library/decimal.rst:1670 +#: ../../library/decimal.rst:1712 msgid "" "If the signal is not trapped (default), mixing floats and Decimals is " "permitted in the :class:`~decimal.Decimal` constructor, :meth:`~decimal." @@ -1703,26 +1747,26 @@ msgid "" "Context.create_decimal_from_float` do not set the flag." msgstr "" -#: ../../library/decimal.rst:1678 +#: ../../library/decimal.rst:1720 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:1682 +#: ../../library/decimal.rst:1724 msgid "The following table summarizes the hierarchy of signals::" msgstr "" -#: ../../library/decimal.rst:1703 +#: ../../library/decimal.rst:1745 msgid "Floating Point Notes" msgstr "" -#: ../../library/decimal.rst:1707 +#: ../../library/decimal.rst:1749 msgid "Mitigating round-off error with increased precision" msgstr "" -#: ../../library/decimal.rst:1709 +#: ../../library/decimal.rst:1751 msgid "" "The use of decimal floating point eliminates decimal representation error " "(making it possible to represent ``0.1`` exactly); however, some operations " @@ -1730,7 +1774,7 @@ msgid "" "precision." msgstr "" -#: ../../library/decimal.rst:1713 +#: ../../library/decimal.rst:1755 msgid "" "The effects of round-off error can be amplified by the addition or " "subtraction of nearly offsetting quantities resulting in loss of " @@ -1739,24 +1783,24 @@ msgid "" "of the associative and distributive properties of addition:" msgstr "" -#: ../../library/decimal.rst:1737 +#: ../../library/decimal.rst:1779 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:1757 +#: ../../library/decimal.rst:1799 msgid "Special values" msgstr "" -#: ../../library/decimal.rst:1759 +#: ../../library/decimal.rst:1801 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:1763 +#: ../../library/decimal.rst:1805 msgid "" "Infinities can be constructed directly with: ``Decimal('Infinity')``. Also, " "they can arise from dividing by zero when the :exc:`DivisionByZero` signal " @@ -1765,14 +1809,14 @@ msgid "" "representable number." msgstr "" -#: ../../library/decimal.rst:1768 +#: ../../library/decimal.rst:1810 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:1772 +#: ../../library/decimal.rst:1814 msgid "" "Some operations are indeterminate and return ``NaN``, or if the :exc:" "`InvalidOperation` signal is trapped, raise an exception. For example, " @@ -1783,14 +1827,14 @@ msgid "" "the calculation to proceed while flagging specific results as invalid." msgstr "" -#: ../../library/decimal.rst:1780 +#: ../../library/decimal.rst:1822 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:1784 +#: ../../library/decimal.rst:1826 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 " @@ -1807,7 +1851,7 @@ msgid "" "compare_signal` methods instead." msgstr "" -#: ../../library/decimal.rst:1797 +#: ../../library/decimal.rst:1839 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 " @@ -1815,7 +1859,7 @@ msgid "" "negative zeros are treated as equal and their sign is informational." msgstr "" -#: ../../library/decimal.rst:1802 +#: ../../library/decimal.rst:1844 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 " @@ -1824,11 +1868,11 @@ msgid "" "that the following calculation returns a value equal to zero:" msgstr "" -#: ../../library/decimal.rst:1817 +#: ../../library/decimal.rst:1859 msgid "Working with threads" msgstr "" -#: ../../library/decimal.rst:1819 +#: ../../library/decimal.rst:1861 msgid "" "The :func:`getcontext` function accesses a different :class:`Context` object " "for each thread. Having separate thread contexts means that threads may " @@ -1836,20 +1880,20 @@ msgid "" "other threads." msgstr "" -#: ../../library/decimal.rst:1823 +#: ../../library/decimal.rst:1865 msgid "" "Likewise, the :func:`setcontext` function automatically assigns its target " "to the current thread." msgstr "" -#: ../../library/decimal.rst:1826 +#: ../../library/decimal.rst:1868 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:1830 +#: ../../library/decimal.rst:1872 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 " @@ -1858,51 +1902,51 @@ msgid "" "a race condition between threads calling :func:`getcontext`. For example::" msgstr "" -#: ../../library/decimal.rst:1855 +#: ../../library/decimal.rst:1897 msgid "Recipes" msgstr "" -#: ../../library/decimal.rst:1857 +#: ../../library/decimal.rst:1899 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:2012 +#: ../../library/decimal.rst:2054 msgid "Decimal FAQ" msgstr "" -#: ../../library/decimal.rst:2014 +#: ../../library/decimal.rst:2056 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:2017 +#: ../../library/decimal.rst:2059 msgid "A. Some users abbreviate the constructor to just a single letter:" msgstr "" -#: ../../library/decimal.rst:2023 +#: ../../library/decimal.rst:2065 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:2027 +#: ../../library/decimal.rst:2069 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:2045 +#: ../../library/decimal.rst:2087 msgid "" "Q. Once I have valid two place inputs, how do I maintain that invariant " "throughout an application?" msgstr "" -#: ../../library/decimal.rst:2048 +#: ../../library/decimal.rst:2090 msgid "" "A. Some operations like addition, subtraction, and multiplication by an " "integer will automatically preserve fixed point. Others operations, like " @@ -1910,13 +1954,13 @@ msgid "" "places and need to be followed-up with a :meth:`~Decimal.quantize` step:" msgstr "" -#: ../../library/decimal.rst:2066 +#: ../../library/decimal.rst:2108 msgid "" "In developing fixed-point applications, it is convenient to define functions " "to handle the :meth:`~Decimal.quantize` step:" msgstr "" -#: ../../library/decimal.rst:2080 +#: ../../library/decimal.rst:2122 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 " @@ -1924,17 +1968,17 @@ msgid "" "canonical value?" msgstr "" -#: ../../library/decimal.rst:2085 +#: ../../library/decimal.rst:2127 msgid "" "A. The :meth:`~Decimal.normalize` method maps all equivalent values to a " "single representative:" msgstr "" -#: ../../library/decimal.rst:2092 +#: ../../library/decimal.rst:2134 msgid "Q. When does rounding occur in a computation?" msgstr "" -#: ../../library/decimal.rst:2094 +#: ../../library/decimal.rst:2136 msgid "" "A. It occurs *after* the computation. The philosophy of the decimal " "specification is that numbers are considered exact and are created " @@ -1944,13 +1988,13 @@ msgid "" "computation::" msgstr "" -#: ../../library/decimal.rst:2112 +#: ../../library/decimal.rst:2154 msgid "" "Q. Some decimal values always print with exponential notation. Is there a " "way to get a non-exponential representation?" msgstr "" -#: ../../library/decimal.rst:2115 +#: ../../library/decimal.rst:2157 msgid "" "A. For some values, exponential notation is the only way to express the " "number of significant places in the coefficient. For example, expressing " @@ -1958,31 +2002,31 @@ msgid "" "original's two-place significance." msgstr "" -#: ../../library/decimal.rst:2120 +#: ../../library/decimal.rst:2162 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:2130 +#: ../../library/decimal.rst:2172 msgid "Q. Is there a way to convert a regular float to a :class:`Decimal`?" msgstr "" -#: ../../library/decimal.rst:2132 +#: ../../library/decimal.rst:2174 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:2141 +#: ../../library/decimal.rst:2183 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:2144 +#: ../../library/decimal.rst:2186 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. " @@ -1990,14 +2034,14 @@ msgid "" "issues, ill-conditioned inputs, or a numerically unstable algorithm." msgstr "" -#: ../../library/decimal.rst:2149 +#: ../../library/decimal.rst:2191 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:2153 +#: ../../library/decimal.rst:2195 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 " @@ -2006,23 +2050,23 @@ msgid "" "haven't been rounded:" msgstr "" -#: ../../library/decimal.rst:2166 +#: ../../library/decimal.rst:2208 msgid "" "The solution is either to increase precision or to force rounding of inputs " "using the unary plus operation:" msgstr "" -#: ../../library/decimal.rst:2175 +#: ../../library/decimal.rst:2217 msgid "" "Alternatively, inputs can be rounded upon creation using the :meth:`Context." "create_decimal` method:" msgstr "" -#: ../../library/decimal.rst:2181 +#: ../../library/decimal.rst:2223 msgid "Q. Is the CPython implementation fast for large numbers?" msgstr "" -#: ../../library/decimal.rst:2183 +#: ../../library/decimal.rst:2225 msgid "" "A. Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of " "the decimal module integrate the high speed `libmpdec \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -717,10 +717,11 @@ msgstr "" msgid "" "``Flag`` is the same as :class:`Enum`, but its members support the bitwise " "operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); " -"the results of those operators are members of the enumeration." +"the results of those operations are (aliases of) members of the enumeration." msgstr "" "``Flag`` 與 :class:`Enum` 相同,但其成員支援位元運算子 ``&`` (*AND*)、``|`` " -"(*OR*)、``^`` (*XOR*) 和 ``~`` (*INVERT*);這些運算子的結果是列舉的成員。" +"(*OR*)、``^`` (*XOR*) 和 ``~`` (*INVERT*);這些操作的結果是列舉的成員(的別" +"名)。" #: ../../library/enum.rst:524 msgid "Returns *True* if value is in self::" diff --git a/library/fileinput.po b/library/fileinput.po index a5de640e6f..eedb8c97fd 100644 --- a/library/fileinput.po +++ b/library/fileinput.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-13 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -82,7 +82,7 @@ msgstr "" #: ../../library/fileinput.rst:49 msgid "" "You can control how files are opened by providing an opening hook via the " -"*openhook* parameter to :func:`fileinput.input` or :class:`FileInput()`. The " +"*openhook* parameter to :func:`fileinput.input` or :func:`FileInput`. The " "hook must be a function that takes two arguments, *filename* and *mode*, and " "returns an accordingly opened file-like object. If *encoding* and/or " "*errors* are specified, they will be passed to the hook as additional " diff --git a/library/ftplib.po b/library/ftplib.po index c5de581e50..06d50d04d5 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-07-14 00:03+0000\n" "PO-Revision-Date: 2023-04-26 19:44+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -278,9 +278,9 @@ msgstr "" msgid "Retrieve a file in binary transfer mode." msgstr "以二進位傳輸模式 (binary transfer mode) 取得檔案。" -#: ../../library/ftplib.rst:245 ../../library/ftplib.rst:289 -msgid "An appropriate ``STOR`` command: :samp:`\"STOR {filename}\"`." -msgstr "一個正確的 ``STOR`` 指令::samp:`\"STOR {filename}\"`。" +#: ../../library/ftplib.rst:245 +msgid "An appropriate ``RETR`` command: :samp:`\"RETR {filename}\"`." +msgstr "一個正確的 ``RETR`` 指令::samp:`\"RETR {filename}\"`。" #: ../../library/ftplib.rst:248 msgid "" @@ -336,6 +336,10 @@ msgstr "" msgid "Store a file in binary transfer mode." msgstr "以二進位傳輸模式儲存檔案。" +#: ../../library/ftplib.rst:289 +msgid "An appropriate ``STOR`` command: :samp:`\"STOR {filename}\"`." +msgstr "一個正確的 ``STOR`` 指令::samp:`\"STOR {filename}\"`。" + #: ../../library/ftplib.rst:292 msgid "" "A file object (opened in binary mode) which is read until EOF, using its :" diff --git a/library/gzip.po b/library/gzip.po index 97f83cf316..3a665efc02 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-18 00:03+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-" @@ -285,10 +285,12 @@ msgstr "" msgid "" "Speed is improved by compressing all data at once instead of in a streamed " "fashion. Calls with *mtime* set to ``0`` are delegated to :func:`zlib." -"compress` for better speed." +"compress` for better speed. In this situation the output may contain a gzip " +"header \"OS\" byte value other than 255 \"unknown\" as supplied by the " +"underlying zlib implementation." msgstr "" -#: ../../library/gzip.rst:201 +#: ../../library/gzip.rst:203 msgid "" "Decompress the *data*, returning a :class:`bytes` object containing the " "uncompressed data. This function is capable of decompressing multi-member " @@ -297,82 +299,82 @@ msgid "" "*wbits* set to 31 is faster." msgstr "" -#: ../../library/gzip.rst:208 +#: ../../library/gzip.rst:210 msgid "" "Speed is improved by decompressing members at once in memory instead of in a " "streamed fashion." msgstr "" -#: ../../library/gzip.rst:215 +#: ../../library/gzip.rst:217 msgid "Examples of usage" msgstr "用法範例" -#: ../../library/gzip.rst:217 +#: ../../library/gzip.rst:219 msgid "Example of how to read a compressed file::" msgstr "如何讀取壓縮檔案的範例: ::" -#: ../../library/gzip.rst:223 +#: ../../library/gzip.rst:225 msgid "Example of how to create a compressed GZIP file::" msgstr "如何建立一個壓縮的 GZIP 檔案的範例: ::" -#: ../../library/gzip.rst:230 +#: ../../library/gzip.rst:232 msgid "Example of how to GZIP compress an existing file::" msgstr "如何壓縮一個已存在的檔案的範例: ::" -#: ../../library/gzip.rst:238 +#: ../../library/gzip.rst:240 msgid "Example of how to GZIP compress a binary string::" msgstr "如何壓縮一個二進位字串的範例: ::" -#: ../../library/gzip.rst:246 +#: ../../library/gzip.rst:248 msgid "Module :mod:`zlib`" msgstr ":mod:`zlib` 模組" -#: ../../library/gzip.rst:247 +#: ../../library/gzip.rst:249 msgid "" "The basic data compression module needed to support the :program:`gzip` file " "format." msgstr "" -#: ../../library/gzip.rst:256 +#: ../../library/gzip.rst:258 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/gzip.rst:258 +#: ../../library/gzip.rst:260 msgid "" "The :mod:`gzip` module provides a simple command line interface to compress " "or decompress files." msgstr "" -#: ../../library/gzip.rst:261 +#: ../../library/gzip.rst:263 msgid "Once executed the :mod:`gzip` module keeps the input file(s)." msgstr "" -#: ../../library/gzip.rst:265 +#: ../../library/gzip.rst:267 msgid "" "Add a new command line interface with a usage. By default, when you will " "execute the CLI, the default compression level is 6." msgstr "" -#: ../../library/gzip.rst:269 +#: ../../library/gzip.rst:271 msgid "Command line options" msgstr "命令列選項" -#: ../../library/gzip.rst:273 +#: ../../library/gzip.rst:275 msgid "If *file* is not specified, read from :data:`sys.stdin`." msgstr "如果未指定 *file*,則從 :data:`sys.stdin` 讀取。" -#: ../../library/gzip.rst:277 +#: ../../library/gzip.rst:279 msgid "Indicates the fastest compression method (less compression)." msgstr "" -#: ../../library/gzip.rst:281 +#: ../../library/gzip.rst:283 msgid "Indicates the slowest compression method (best compression)." msgstr "" -#: ../../library/gzip.rst:285 +#: ../../library/gzip.rst:287 msgid "Decompress the given file." msgstr "解壓縮指定的檔案。" -#: ../../library/gzip.rst:289 +#: ../../library/gzip.rst:291 msgid "Show the help message." msgstr "顯示幫助訊息。" diff --git a/library/inspect.po b/library/inspect.po index c81a34fb06..e873661720 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-22 00:03+0000\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -75,18 +75,19 @@ msgid "class" msgstr "" #: ../../library/inspect.rst:48 ../../library/inspect.rst:63 -#: ../../library/inspect.rst:81 ../../library/inspect.rst:248 +#: ../../library/inspect.rst:81 ../../library/inspect.rst:261 msgid "__doc__" msgstr "__doc__" #: ../../library/inspect.rst:48 ../../library/inspect.rst:63 -#: ../../library/inspect.rst:81 ../../library/inspect.rst:248 +#: ../../library/inspect.rst:81 ../../library/inspect.rst:261 msgid "documentation string" msgstr "" #: ../../library/inspect.rst:50 ../../library/inspect.rst:65 #: ../../library/inspect.rst:83 ../../library/inspect.rst:217 -#: ../../library/inspect.rst:231 ../../library/inspect.rst:250 +#: ../../library/inspect.rst:231 ../../library/inspect.rst:244 +#: ../../library/inspect.rst:263 msgid "__name__" msgstr "__name__" @@ -96,13 +97,15 @@ msgstr "" #: ../../library/inspect.rst:53 ../../library/inspect.rst:68 #: ../../library/inspect.rst:86 ../../library/inspect.rst:219 -#: ../../library/inspect.rst:233 ../../library/inspect.rst:253 +#: ../../library/inspect.rst:233 ../../library/inspect.rst:246 +#: ../../library/inspect.rst:266 msgid "__qualname__" msgstr "__qualname__" #: ../../library/inspect.rst:53 ../../library/inspect.rst:68 #: ../../library/inspect.rst:86 ../../library/inspect.rst:219 -#: ../../library/inspect.rst:233 ../../library/inspect.rst:253 +#: ../../library/inspect.rst:233 ../../library/inspect.rst:246 +#: ../../library/inspect.rst:266 msgid "qualified name" msgstr "" @@ -141,7 +144,7 @@ msgstr "__func__" msgid "function object containing implementation of method" msgstr "" -#: ../../library/inspect.rst:74 ../../library/inspect.rst:255 +#: ../../library/inspect.rst:74 ../../library/inspect.rst:268 msgid "__self__" msgstr "__self__" @@ -258,7 +261,7 @@ msgid "next inner traceback object (called by this level)" msgstr "" #: ../../library/inspect.rst:132 ../../library/inspect.rst:221 -#: ../../library/inspect.rst:238 +#: ../../library/inspect.rst:238 ../../library/inspect.rst:251 msgid "frame" msgstr "" @@ -319,7 +322,7 @@ msgid "tracing function for this frame, or ``None``" msgstr "" #: ../../library/inspect.rst:156 ../../library/inspect.rst:225 -#: ../../library/inspect.rst:242 +#: ../../library/inspect.rst:242 ../../library/inspect.rst:255 msgid "code" msgstr "code(程式碼)" @@ -467,6 +470,7 @@ msgid "generator" msgstr "" #: ../../library/inspect.rst:217 ../../library/inspect.rst:231 +#: ../../library/inspect.rst:244 msgid "name" msgstr "" @@ -478,7 +482,7 @@ msgstr "gi_frame" msgid "gi_running" msgstr "gi_running" -#: ../../library/inspect.rst:223 +#: ../../library/inspect.rst:223 ../../library/inspect.rst:240 msgid "is the generator running?" msgstr "" @@ -495,72 +499,92 @@ msgid "object being iterated by ``yield from``, or ``None``" msgstr "" #: ../../library/inspect.rst:231 -msgid "coroutine" +msgid "async generator" msgstr "" #: ../../library/inspect.rst:235 -msgid "cr_await" -msgstr "cr_await" +msgid "ag_await" +msgstr "ag_await" -#: ../../library/inspect.rst:235 +#: ../../library/inspect.rst:235 ../../library/inspect.rst:248 msgid "object being awaited on, or ``None``" msgstr "" #: ../../library/inspect.rst:238 +msgid "ag_frame" +msgstr "ag_frame" + +#: ../../library/inspect.rst:240 +msgid "ag_running" +msgstr "ag_running" + +#: ../../library/inspect.rst:242 +msgid "ag_code" +msgstr "ag_code" + +#: ../../library/inspect.rst:244 +msgid "coroutine" +msgstr "coroutine" + +#: ../../library/inspect.rst:248 +msgid "cr_await" +msgstr "cr_await" + +#: ../../library/inspect.rst:251 msgid "cr_frame" msgstr "cr_frame" -#: ../../library/inspect.rst:240 +#: ../../library/inspect.rst:253 msgid "cr_running" msgstr "cr_running" -#: ../../library/inspect.rst:240 +#: ../../library/inspect.rst:253 msgid "is the coroutine running?" msgstr "" -#: ../../library/inspect.rst:242 +#: ../../library/inspect.rst:255 msgid "cr_code" msgstr "cr_code" -#: ../../library/inspect.rst:244 +#: ../../library/inspect.rst:257 msgid "cr_origin" msgstr "cr_origin" -#: ../../library/inspect.rst:244 +#: ../../library/inspect.rst:257 msgid "where coroutine was created, or ``None``. See |coroutine-origin-link|" msgstr "" -#: ../../library/inspect.rst:248 +#: ../../library/inspect.rst:261 msgid "builtin" msgstr "" -#: ../../library/inspect.rst:250 +#: ../../library/inspect.rst:263 msgid "original name of this function or method" msgstr "" -#: ../../library/inspect.rst:255 +#: ../../library/inspect.rst:268 msgid "instance to which a method is bound, or ``None``" msgstr "" -#: ../../library/inspect.rst:262 +#: ../../library/inspect.rst:275 msgid "Add ``__qualname__`` and ``gi_yieldfrom`` attributes to generators." msgstr "將 ``__qualname__`` 和 ``gi_yieldfrom`` 屬性加到產生器。" -#: ../../library/inspect.rst:264 +#: ../../library/inspect.rst:277 msgid "" "The ``__name__`` attribute of generators is now set from the function name, " "instead of the code name, and it can now be modified." msgstr "" -#: ../../library/inspect.rst:269 +#: ../../library/inspect.rst:282 msgid "Add ``cr_origin`` attribute to coroutines." msgstr "新增協程的 ``cr_origin`` 屬性。" -#: ../../library/inspect.rst:273 +#: ../../library/inspect.rst:286 msgid "Add ``__builtins__`` attribute to functions." msgstr "新增函式的 ``__builtins__`` 屬性。" -#: ../../library/inspect.rst:277 +#: ../../library/inspect.rst:290 msgid "" "Return all the members of an object in a list of ``(name, value)`` pairs " "sorted by name. If the optional *predicate* argument—which will be called " @@ -568,14 +592,14 @@ msgid "" "the predicate returns a true value are included." msgstr "" -#: ../../library/inspect.rst:284 +#: ../../library/inspect.rst:297 msgid "" ":func:`getmembers` will only return class attributes defined in the " "metaclass when the argument is a class and those attributes have been listed " "in the metaclass' custom :meth:`~object.__dir__`." msgstr "" -#: ../../library/inspect.rst:291 +#: ../../library/inspect.rst:304 msgid "" "Return all the members of an object in a list of ``(name, value)`` pairs " "sorted by name without triggering dynamic lookup via the descriptor " @@ -583,7 +607,7 @@ msgid "" "that satisfy a given predicate." msgstr "" -#: ../../library/inspect.rst:298 +#: ../../library/inspect.rst:311 msgid "" ":func:`getmembers_static` may not be able to retrieve all members that " "getmembers can fetch (like dynamically created attributes) and may find " @@ -592,7 +616,7 @@ msgid "" "cases." msgstr "" -#: ../../library/inspect.rst:309 +#: ../../library/inspect.rst:322 msgid "" "Return the name of the module named by the file *path*, without including " "the names of enclosing packages. The file extension is checked against all " @@ -601,52 +625,52 @@ msgid "" "``None`` is returned." msgstr "" -#: ../../library/inspect.rst:315 +#: ../../library/inspect.rst:328 msgid "" "Note that this function *only* returns a meaningful name for actual Python " "modules - paths that potentially refer to Python packages will still return " "``None``." msgstr "" -#: ../../library/inspect.rst:319 +#: ../../library/inspect.rst:332 msgid "The function is based directly on :mod:`importlib`." msgstr "此函式直接基於 :mod:`importlib`。" -#: ../../library/inspect.rst:325 +#: ../../library/inspect.rst:338 msgid "Return ``True`` if the object is a module." msgstr "如果物件是模組,則回傳 ``True``。" -#: ../../library/inspect.rst:330 +#: ../../library/inspect.rst:343 msgid "" "Return ``True`` if the object is a class, whether built-in or created in " "Python code." msgstr "" -#: ../../library/inspect.rst:336 +#: ../../library/inspect.rst:349 msgid "Return ``True`` if the object is a bound method written in Python." msgstr "" -#: ../../library/inspect.rst:341 +#: ../../library/inspect.rst:354 msgid "" "Return ``True`` if the object is a Python function, which includes functions " "created by a :term:`lambda` expression." msgstr "" -#: ../../library/inspect.rst:347 +#: ../../library/inspect.rst:360 msgid "Return ``True`` if the object is a Python generator function." msgstr "如果物件是 Python 產生器函式,則回傳 ``True``。" -#: ../../library/inspect.rst:349 +#: ../../library/inspect.rst:362 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is a Python generator function." msgstr "" -#: ../../library/inspect.rst:356 +#: ../../library/inspect.rst:369 msgid "Return ``True`` if the object is a generator." msgstr "如果物件是產生器,則回傳 ``True``。" -#: ../../library/inspect.rst:361 +#: ../../library/inspect.rst:374 msgid "" "Return ``True`` if the object is a :term:`coroutine function` (a function " "defined with an :keyword:`async def` syntax), a :func:`functools.partial` " @@ -654,118 +678,118 @@ msgid "" "`markcoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:368 +#: ../../library/inspect.rst:381 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is a :term:`coroutine function`." msgstr "" -#: ../../library/inspect.rst:372 +#: ../../library/inspect.rst:385 msgid "" "Sync functions marked with :func:`markcoroutinefunction` now return ``True``." msgstr "" -#: ../../library/inspect.rst:379 +#: ../../library/inspect.rst:392 msgid "" "Decorator to mark a callable as a :term:`coroutine function` if it would not " "otherwise be detected by :func:`iscoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:382 +#: ../../library/inspect.rst:395 msgid "" "This may be of use for sync functions that return a :term:`coroutine`, if " "the function is passed to an API that requires :func:`iscoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:385 +#: ../../library/inspect.rst:398 msgid "" "When possible, using an :keyword:`async def` function is preferred. Also " "acceptable is calling the function and testing the return with :func:" "`iscoroutine`." msgstr "" -#: ../../library/inspect.rst:394 +#: ../../library/inspect.rst:407 msgid "" "Return ``True`` if the object is a :term:`coroutine` created by an :keyword:" "`async def` function." msgstr "" -#: ../../library/inspect.rst:402 +#: ../../library/inspect.rst:415 msgid "" "Return ``True`` if the object can be used in :keyword:`await` expression." msgstr "" -#: ../../library/inspect.rst:404 +#: ../../library/inspect.rst:417 msgid "" "Can also be used to distinguish generator-based coroutines from regular " "generators:" msgstr "" -#: ../../library/inspect.rst:425 +#: ../../library/inspect.rst:438 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator` function, " "for example:" msgstr "" -#: ../../library/inspect.rst:438 +#: ../../library/inspect.rst:451 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is a :term:`asynchronous generator` function." msgstr "" -#: ../../library/inspect.rst:445 +#: ../../library/inspect.rst:458 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator iterator` " "created by an :term:`asynchronous generator` function." msgstr "" -#: ../../library/inspect.rst:452 +#: ../../library/inspect.rst:465 msgid "Return ``True`` if the object is a traceback." msgstr "" -#: ../../library/inspect.rst:457 +#: ../../library/inspect.rst:470 msgid "Return ``True`` if the object is a frame." msgstr "" -#: ../../library/inspect.rst:462 +#: ../../library/inspect.rst:475 msgid "Return ``True`` if the object is a code." -msgstr "" +msgstr "如果物件是程式碼,則回傳 ``True``。" -#: ../../library/inspect.rst:467 +#: ../../library/inspect.rst:480 msgid "" "Return ``True`` if the object is a built-in function or a bound built-in " "method." msgstr "" -#: ../../library/inspect.rst:472 +#: ../../library/inspect.rst:485 msgid "" "Return ``True`` if the type of object is a :class:`~types.MethodWrapperType`." msgstr "" -#: ../../library/inspect.rst:474 +#: ../../library/inspect.rst:487 msgid "" "These are instances of :class:`~types.MethodWrapperType`, such as :meth:" "`~object.__str__`, :meth:`~object.__eq__` and :meth:`~object.__repr__`." msgstr "" -#: ../../library/inspect.rst:482 +#: ../../library/inspect.rst:495 msgid "" "Return ``True`` if the object is a user-defined or built-in function or " "method." msgstr "如果物件是使用者定義或內建的函式或方法,則回傳 ``True``。" -#: ../../library/inspect.rst:487 +#: ../../library/inspect.rst:500 msgid "Return ``True`` if the object is an abstract base class." msgstr "如果物件是抽象基底類別,則回傳 ``True``。" -#: ../../library/inspect.rst:492 +#: ../../library/inspect.rst:505 msgid "" "Return ``True`` if the object is a method descriptor, but not if :func:" "`ismethod`, :func:`isclass`, :func:`isfunction` or :func:`isbuiltin` are " "true." msgstr "" -#: ../../library/inspect.rst:496 +#: ../../library/inspect.rst:509 msgid "" "This, for example, is true of ``int.__add__``. An object passing this test " "has a :meth:`~object.__get__` method but not a :meth:`~object.__set__` " @@ -773,7 +797,7 @@ msgid "" "__name__` attribute is usually sensible, and :attr:`!__doc__` often is." msgstr "" -#: ../../library/inspect.rst:502 +#: ../../library/inspect.rst:515 msgid "" "Methods implemented via descriptors that also pass one of the other tests " "return ``False`` from the :func:`ismethoddescriptor` test, simply because " @@ -781,11 +805,11 @@ msgid "" "`~method.__func__` attribute (etc) when an object passes :func:`ismethod`." msgstr "" -#: ../../library/inspect.rst:511 +#: ../../library/inspect.rst:524 msgid "Return ``True`` if the object is a data descriptor." -msgstr "" +msgstr "如果物件是資料描述器,則回傳 ``True``。" -#: ../../library/inspect.rst:513 +#: ../../library/inspect.rst:526 msgid "" "Data descriptors have a :attr:`~object.__set__` or a :attr:`~object." "__delete__` method. Examples are properties (defined in Python), getsets, " @@ -796,33 +820,33 @@ msgid "" "and members have both of these attributes), but this is not guaranteed." msgstr "" -#: ../../library/inspect.rst:524 +#: ../../library/inspect.rst:537 msgid "Return ``True`` if the object is a getset descriptor." msgstr "" -#: ../../library/inspect.rst:528 +#: ../../library/inspect.rst:541 msgid "" "getsets are attributes defined in extension modules via :c:type:" "`PyGetSetDef` structures. For Python implementations without such types, " "this method will always return ``False``." msgstr "" -#: ../../library/inspect.rst:535 +#: ../../library/inspect.rst:548 msgid "Return ``True`` if the object is a member descriptor." -msgstr "" +msgstr "如果物件是成員描述器,則回傳 ``True``。" -#: ../../library/inspect.rst:539 +#: ../../library/inspect.rst:552 msgid "" "Member descriptors are attributes defined in extension modules via :c:type:" "`PyMemberDef` structures. For Python implementations without such types, " "this method will always return ``False``." msgstr "" -#: ../../library/inspect.rst:547 +#: ../../library/inspect.rst:560 msgid "Retrieving source code" -msgstr "" +msgstr "取得原始碼" -#: ../../library/inspect.rst:551 +#: ../../library/inspect.rst:564 msgid "" "Get the documentation string for an object, cleaned up with :func:" "`cleandoc`. If the documentation string for an object is not provided and " @@ -831,11 +855,11 @@ msgid "" "documentation string is invalid or missing." msgstr "" -#: ../../library/inspect.rst:557 +#: ../../library/inspect.rst:570 msgid "Documentation strings are now inherited if not overridden." msgstr "" -#: ../../library/inspect.rst:563 +#: ../../library/inspect.rst:576 msgid "" "Return in a single string any lines of comments immediately preceding the " "object's source code (for a class, function, or method), or at the top of " @@ -844,27 +868,27 @@ msgid "" "been defined in C or the interactive shell." msgstr "" -#: ../../library/inspect.rst:572 +#: ../../library/inspect.rst:585 msgid "" "Return the name of the (text or binary) file in which an object was defined. " "This will fail with a :exc:`TypeError` if the object is a built-in module, " "class, or function." msgstr "" -#: ../../library/inspect.rst:579 +#: ../../library/inspect.rst:592 msgid "" "Try to guess which module an object was defined in. Return ``None`` if the " "module cannot be determined." msgstr "" -#: ../../library/inspect.rst:585 +#: ../../library/inspect.rst:598 msgid "" "Return the name of the Python source file in which an object was defined or " "``None`` if no way can be identified to get the source. This will fail with " "a :exc:`TypeError` if the object is a built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:593 +#: ../../library/inspect.rst:606 msgid "" "Return a list of source lines and starting line number for an object. The " "argument may be a module, class, method, function, traceback, frame, or code " @@ -875,13 +899,13 @@ msgid "" "built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:602 ../../library/inspect.rst:616 +#: ../../library/inspect.rst:615 ../../library/inspect.rst:629 msgid "" ":exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the " "former." msgstr "" -#: ../../library/inspect.rst:609 +#: ../../library/inspect.rst:622 msgid "" "Return the text of the source code for an object. The argument may be a " "module, class, method, function, traceback, frame, or code object. The " @@ -890,13 +914,13 @@ msgid "" "object is a built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:623 +#: ../../library/inspect.rst:636 msgid "" "Clean up indentation from docstrings that are indented to line up with " "blocks of code." msgstr "" -#: ../../library/inspect.rst:626 +#: ../../library/inspect.rst:639 msgid "" "All leading whitespace is removed from the first line. Any leading " "whitespace that can be uniformly removed from the second line onwards is " @@ -904,28 +928,28 @@ msgid "" "Also, all tabs are expanded to spaces." msgstr "" -#: ../../library/inspect.rst:635 +#: ../../library/inspect.rst:648 msgid "Introspecting callables with the Signature object" msgstr "" -#: ../../library/inspect.rst:639 +#: ../../library/inspect.rst:652 msgid "" "The :class:`Signature` object represents the call signature of a callable " "object and its return annotation. To retrieve a :class:`!Signature` object, " "use the :func:`!signature` function." msgstr "" -#: ../../library/inspect.rst:646 +#: ../../library/inspect.rst:659 msgid "Return a :class:`Signature` object for the given *callable*:" msgstr "" -#: ../../library/inspect.rst:665 +#: ../../library/inspect.rst:678 msgid "" "Accepts a wide range of Python callables, from plain functions and classes " "to :func:`functools.partial` objects." msgstr "" -#: ../../library/inspect.rst:668 +#: ../../library/inspect.rst:681 msgid "" "For objects defined in modules using stringized annotations (``from " "__future__ import annotations``), :func:`signature` will attempt to " @@ -935,7 +959,7 @@ msgid "" "func:`get_annotations` for instructions on how to use these parameters." msgstr "" -#: ../../library/inspect.rst:677 +#: ../../library/inspect.rst:690 msgid "" "Raises :exc:`ValueError` if no signature can be provided, and :exc:" "`TypeError` if that type of object is not supported. Also, if the " @@ -944,32 +968,32 @@ msgid "" "potentially raise any kind of exception." msgstr "" -#: ../../library/inspect.rst:683 +#: ../../library/inspect.rst:696 msgid "" "A slash(/) in the signature of a function denotes that the parameters prior " "to it are positional-only. For more info, see :ref:`the FAQ entry on " "positional-only parameters `." msgstr "" -#: ../../library/inspect.rst:687 +#: ../../library/inspect.rst:700 msgid "" "The *follow_wrapped* parameter was added. Pass ``False`` to get a signature " "of *callable* specifically (``callable.__wrapped__`` will not be used to " "unwrap decorated callables.)" msgstr "" -#: ../../library/inspect.rst:693 ../../library/inspect.rst:803 +#: ../../library/inspect.rst:706 ../../library/inspect.rst:816 msgid "The *globals*, *locals*, and *eval_str* parameters were added." msgstr "" -#: ../../library/inspect.rst:698 +#: ../../library/inspect.rst:711 msgid "" "Some callables may not be introspectable in certain implementations of " "Python. For example, in CPython, some built-in functions defined in C " "provide no metadata about their arguments." msgstr "" -#: ../../library/inspect.rst:704 +#: ../../library/inspect.rst:717 msgid "" "If the passed object has a :attr:`!__signature__` attribute, we may use it " "to create the signature. The exact semantics are an implementation detail " @@ -977,14 +1001,14 @@ msgid "" "semantics." msgstr "" -#: ../../library/inspect.rst:712 +#: ../../library/inspect.rst:725 msgid "" "A :class:`!Signature` object represents the call signature of a function and " "its return annotation. For each parameter accepted by the function it " "stores a :class:`Parameter` object in its :attr:`parameters` collection." msgstr "" -#: ../../library/inspect.rst:717 +#: ../../library/inspect.rst:730 msgid "" "The optional *parameters* argument is a sequence of :class:`Parameter` " "objects, which is validated to check that there are no parameters with " @@ -993,54 +1017,54 @@ msgid "" "defaults follow parameters without defaults." msgstr "" -#: ../../library/inspect.rst:723 +#: ../../library/inspect.rst:736 msgid "" "The optional *return_annotation* argument can be an arbitrary Python object. " "It represents the \"return\" annotation of the callable." msgstr "" -#: ../../library/inspect.rst:726 +#: ../../library/inspect.rst:739 msgid "" ":class:`!Signature` objects are *immutable*. Use :meth:`Signature.replace` " "to make a modified copy." msgstr "" -#: ../../library/inspect.rst:729 +#: ../../library/inspect.rst:742 msgid ":class:`!Signature` objects are now picklable and :term:`hashable`." msgstr "" -#: ../../library/inspect.rst:734 +#: ../../library/inspect.rst:747 msgid "A special class-level marker to specify absence of a return annotation." msgstr "" -#: ../../library/inspect.rst:738 +#: ../../library/inspect.rst:751 msgid "" "An ordered mapping of parameters' names to the corresponding :class:" "`Parameter` objects. Parameters appear in strict definition order, " "including keyword-only parameters." msgstr "" -#: ../../library/inspect.rst:742 ../../library/inspect.rst:1079 +#: ../../library/inspect.rst:755 ../../library/inspect.rst:1092 msgid "" "Python only explicitly guaranteed that it preserved the declaration order of " "keyword-only parameters as of version 3.7, although in practice this order " "had always been preserved in Python 3." msgstr "" -#: ../../library/inspect.rst:749 +#: ../../library/inspect.rst:762 msgid "" "The \"return\" annotation for the callable. If the callable has no " "\"return\" annotation, this attribute is set to :attr:`Signature.empty`." msgstr "" -#: ../../library/inspect.rst:754 +#: ../../library/inspect.rst:767 msgid "" "Create a mapping from positional and keyword arguments to parameters. " "Returns :class:`BoundArguments` if ``*args`` and ``**kwargs`` match the " "signature, or raises a :exc:`TypeError`." msgstr "" -#: ../../library/inspect.rst:760 +#: ../../library/inspect.rst:773 msgid "" "Works the same way as :meth:`Signature.bind`, but allows the omission of " "some required arguments (mimics :func:`functools.partial` behavior.) " @@ -1048,7 +1072,7 @@ msgid "" "arguments do not match the signature." msgstr "" -#: ../../library/inspect.rst:767 +#: ../../library/inspect.rst:780 msgid "" "Create a new :class:`Signature` instance based on the instance :meth:" "`replace` was invoked on. It is possible to pass different *parameters* and/" @@ -1057,147 +1081,147 @@ msgid "" "Signature`, pass in :attr:`Signature.empty`." msgstr "" -#: ../../library/inspect.rst:787 +#: ../../library/inspect.rst:800 msgid "" "Return a :class:`Signature` (or its subclass) object for a given callable " "*obj*." msgstr "" -#: ../../library/inspect.rst:790 +#: ../../library/inspect.rst:803 msgid "This method simplifies subclassing of :class:`Signature`:" msgstr "" -#: ../../library/inspect.rst:799 +#: ../../library/inspect.rst:812 msgid "Its behavior is otherwise identical to that of :func:`signature`." msgstr "" -#: ../../library/inspect.rst:809 +#: ../../library/inspect.rst:822 msgid "" ":class:`!Parameter` objects are *immutable*. Instead of modifying a :class:`!" "Parameter` object, you can use :meth:`Parameter.replace` to create a " "modified copy." msgstr "" -#: ../../library/inspect.rst:813 +#: ../../library/inspect.rst:826 msgid "Parameter objects are now picklable and :term:`hashable`." msgstr "" -#: ../../library/inspect.rst:818 +#: ../../library/inspect.rst:831 msgid "" "A special class-level marker to specify absence of default values and " "annotations." msgstr "" -#: ../../library/inspect.rst:823 +#: ../../library/inspect.rst:836 msgid "" "The name of the parameter as a string. The name must be a valid Python " "identifier." msgstr "" -#: ../../library/inspect.rst:828 +#: ../../library/inspect.rst:841 msgid "" "CPython generates implicit parameter names of the form ``.0`` on the code " "objects used to implement comprehensions and generator expressions." msgstr "" -#: ../../library/inspect.rst:832 +#: ../../library/inspect.rst:845 msgid "" "These parameter names are now exposed by this module as names like " "``implicit0``." msgstr "" -#: ../../library/inspect.rst:838 +#: ../../library/inspect.rst:851 msgid "" "The default value for the parameter. If the parameter has no default value, " "this attribute is set to :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:843 +#: ../../library/inspect.rst:856 msgid "" "The annotation for the parameter. If the parameter has no annotation, this " "attribute is set to :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:848 +#: ../../library/inspect.rst:861 msgid "" "Describes how argument values are bound to the parameter. The possible " "values are accessible via :class:`Parameter` (like ``Parameter." "KEYWORD_ONLY``), and support comparison and ordering, in the following order:" msgstr "" -#: ../../library/inspect.rst:855 +#: ../../library/inspect.rst:868 msgid "Name" msgstr "名稱" -#: ../../library/inspect.rst:855 +#: ../../library/inspect.rst:868 msgid "Meaning" msgstr "意義" -#: ../../library/inspect.rst:857 +#: ../../library/inspect.rst:870 msgid "*POSITIONAL_ONLY*" msgstr "*POSITIONAL_ONLY*" -#: ../../library/inspect.rst:857 +#: ../../library/inspect.rst:870 msgid "" "Value must be supplied as a positional argument. Positional only parameters " "are those which appear before a ``/`` entry (if present) in a Python " "function definition." msgstr "" -#: ../../library/inspect.rst:862 +#: ../../library/inspect.rst:875 msgid "*POSITIONAL_OR_KEYWORD*" msgstr "*POSITIONAL_OR_KEYWORD*" -#: ../../library/inspect.rst:862 +#: ../../library/inspect.rst:875 msgid "" "Value may be supplied as either a keyword or positional argument (this is " "the standard binding behaviour for functions implemented in Python.)" msgstr "" -#: ../../library/inspect.rst:867 +#: ../../library/inspect.rst:880 msgid "*VAR_POSITIONAL*" msgstr "*VAR_POSITIONAL*" -#: ../../library/inspect.rst:867 +#: ../../library/inspect.rst:880 msgid "" "A tuple of positional arguments that aren't bound to any other parameter. " "This corresponds to a ``*args`` parameter in a Python function definition." msgstr "" -#: ../../library/inspect.rst:872 +#: ../../library/inspect.rst:885 msgid "*KEYWORD_ONLY*" msgstr "*KEYWORD_ONLY*" -#: ../../library/inspect.rst:872 +#: ../../library/inspect.rst:885 msgid "" "Value must be supplied as a keyword argument. Keyword only parameters are " "those which appear after a ``*`` or ``*args`` entry in a Python function " "definition." msgstr "" -#: ../../library/inspect.rst:877 +#: ../../library/inspect.rst:890 msgid "*VAR_KEYWORD*" msgstr "*VAR_KEYWORD*" -#: ../../library/inspect.rst:877 +#: ../../library/inspect.rst:890 msgid "" "A dict of keyword arguments that aren't bound to any other parameter. This " "corresponds to a ``**kwargs`` parameter in a Python function definition." msgstr "" -#: ../../library/inspect.rst:883 +#: ../../library/inspect.rst:896 msgid "Example: print all keyword-only arguments without default values:" msgstr "" -#: ../../library/inspect.rst:899 +#: ../../library/inspect.rst:912 msgid "Describes a enum value of :attr:`Parameter.kind`." msgstr "" -#: ../../library/inspect.rst:903 +#: ../../library/inspect.rst:916 msgid "Example: print all descriptions of arguments:" msgstr "範例:列印所有引數的描述:" -#: ../../library/inspect.rst:920 +#: ../../library/inspect.rst:933 msgid "" "Create a new :class:`Parameter` instance based on the instance replaced was " "invoked on. To override a :class:`!Parameter` attribute, pass the " @@ -1205,94 +1229,94 @@ msgid "" "a :class:`!Parameter`, pass :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:938 +#: ../../library/inspect.rst:951 msgid "" "In Python 3.3 :class:`Parameter` objects were allowed to have ``name`` set " "to ``None`` if their ``kind`` was set to ``POSITIONAL_ONLY``. This is no " "longer permitted." msgstr "" -#: ../../library/inspect.rst:945 +#: ../../library/inspect.rst:958 msgid "" "Result of a :meth:`Signature.bind` or :meth:`Signature.bind_partial` call. " "Holds the mapping of arguments to the function's parameters." msgstr "" -#: ../../library/inspect.rst:950 +#: ../../library/inspect.rst:963 msgid "" "A mutable mapping of parameters' names to arguments' values. Contains only " "explicitly bound arguments. Changes in :attr:`arguments` will reflect in :" "attr:`args` and :attr:`kwargs`." msgstr "" -#: ../../library/inspect.rst:954 +#: ../../library/inspect.rst:967 msgid "" "Should be used in conjunction with :attr:`Signature.parameters` for any " "argument processing purposes." msgstr "" -#: ../../library/inspect.rst:959 +#: ../../library/inspect.rst:972 msgid "" "Arguments for which :meth:`Signature.bind` or :meth:`Signature.bind_partial` " "relied on a default value are skipped. However, if needed, use :meth:" "`BoundArguments.apply_defaults` to add them." msgstr "" -#: ../../library/inspect.rst:964 +#: ../../library/inspect.rst:977 msgid "" ":attr:`arguments` is now of type :class:`dict`. Formerly, it was of type :" "class:`collections.OrderedDict`." msgstr "" -#: ../../library/inspect.rst:970 +#: ../../library/inspect.rst:983 msgid "" "A tuple of positional arguments values. Dynamically computed from the :attr:" "`arguments` attribute." msgstr "" -#: ../../library/inspect.rst:975 +#: ../../library/inspect.rst:988 msgid "" "A dict of keyword arguments values. Dynamically computed from the :attr:" "`arguments` attribute." msgstr "" -#: ../../library/inspect.rst:980 +#: ../../library/inspect.rst:993 msgid "A reference to the parent :class:`Signature` object." msgstr "" -#: ../../library/inspect.rst:984 +#: ../../library/inspect.rst:997 msgid "Set default values for missing arguments." msgstr "為遺漏的引數設定預設值。" -#: ../../library/inspect.rst:986 +#: ../../library/inspect.rst:999 msgid "" "For variable-positional arguments (``*args``) the default is an empty tuple." msgstr "" -#: ../../library/inspect.rst:989 +#: ../../library/inspect.rst:1002 msgid "" "For variable-keyword arguments (``**kwargs``) the default is an empty dict." msgstr "" -#: ../../library/inspect.rst:1002 +#: ../../library/inspect.rst:1015 msgid "" "The :attr:`args` and :attr:`kwargs` properties can be used to invoke " "functions:" msgstr "" -#: ../../library/inspect.rst:1017 +#: ../../library/inspect.rst:1030 msgid ":pep:`362` - Function Signature Object." msgstr "" -#: ../../library/inspect.rst:1018 +#: ../../library/inspect.rst:1031 msgid "The detailed specification, implementation details and examples." msgstr "" -#: ../../library/inspect.rst:1024 +#: ../../library/inspect.rst:1037 msgid "Classes and functions" msgstr "類別與函式" -#: ../../library/inspect.rst:1028 +#: ../../library/inspect.rst:1041 msgid "" "Arrange the given list of classes into a hierarchy of nested lists. Where a " "nested list appears, it contains classes derived from the class whose entry " @@ -1303,19 +1327,19 @@ msgid "" "will appear multiple times." msgstr "" -#: ../../library/inspect.rst:1039 +#: ../../library/inspect.rst:1052 msgid "" "Get the names and default values of a Python function's parameters. A :term:" "`named tuple` is returned:" msgstr "" -#: ../../library/inspect.rst:1042 +#: ../../library/inspect.rst:1055 msgid "" "``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, " "annotations)``" msgstr "" -#: ../../library/inspect.rst:1045 +#: ../../library/inspect.rst:1058 msgid "" "*args* is a list of the positional parameter names. *varargs* is the name of " "the ``*`` parameter or ``None`` if arbitrary positional arguments are not " @@ -1330,7 +1354,7 @@ msgid "" "report the function return value annotation (if any)." msgstr "" -#: ../../library/inspect.rst:1060 +#: ../../library/inspect.rst:1073 msgid "" "Note that :func:`signature` and :ref:`Signature Object ` provide the recommended API for callable introspection, and support " @@ -1340,14 +1364,14 @@ msgid "" "``inspect`` module API." msgstr "" -#: ../../library/inspect.rst:1067 +#: ../../library/inspect.rst:1080 msgid "" "This function is now based on :func:`signature`, but still ignores " "``__wrapped__`` attributes and includes the already bound first parameter in " "the signature output for bound methods." msgstr "" -#: ../../library/inspect.rst:1072 +#: ../../library/inspect.rst:1085 msgid "" "This method was previously documented as deprecated in favour of :func:" "`signature` in Python 3.5, but that decision has been reversed in order to " @@ -1355,7 +1379,7 @@ msgid "" "code migrating away from the legacy :func:`getargspec` API." msgstr "" -#: ../../library/inspect.rst:1087 +#: ../../library/inspect.rst:1100 msgid "" "Get information about arguments passed into a particular frame. A :term:" "`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is returned. " @@ -1364,18 +1388,18 @@ msgid "" "dictionary of the given frame." msgstr "" -#: ../../library/inspect.rst:1094 ../../library/inspect.rst:1104 +#: ../../library/inspect.rst:1107 ../../library/inspect.rst:1117 msgid "This function was inadvertently marked as deprecated in Python 3.5." msgstr "" -#: ../../library/inspect.rst:1099 +#: ../../library/inspect.rst:1112 msgid "" "Format a pretty argument spec from the four values returned by :func:" "`getargvalues`. The format\\* arguments are the corresponding optional " "formatting functions that are called to turn names and values into strings." msgstr "" -#: ../../library/inspect.rst:1109 +#: ../../library/inspect.rst:1122 msgid "" "Return a tuple of class cls's base classes, including cls, in method " "resolution order. No class appears more than once in this tuple. Note that " @@ -1383,7 +1407,7 @@ msgid "" "user-defined metatype is in use, cls will be the first element of the tuple." msgstr "" -#: ../../library/inspect.rst:1117 +#: ../../library/inspect.rst:1130 msgid "" "Bind the *args* and *kwds* to the argument names of the Python function or " "method *func*, as if it was called with them. For bound methods, bind also " @@ -1396,11 +1420,11 @@ msgid "" "example:" msgstr "" -#: ../../library/inspect.rst:1143 +#: ../../library/inspect.rst:1156 msgid "Use :meth:`Signature.bind` and :meth:`Signature.bind_partial` instead." msgstr "請改用 :meth:`Signature.bind` 與 :meth:`Signature.bind_partial`。" -#: ../../library/inspect.rst:1149 +#: ../../library/inspect.rst:1162 msgid "" "Get the mapping of external name references in a Python function or method " "*func* to their current values. A :term:`named tuple` " @@ -1412,18 +1436,18 @@ msgid "" "builtins." msgstr "" -#: ../../library/inspect.rst:1158 +#: ../../library/inspect.rst:1171 msgid "" ":exc:`TypeError` is raised if *func* is not a Python function or method." msgstr "如果 *func* 不是 Python 函式或方法,則引發 :exc:`TypeError`。" -#: ../../library/inspect.rst:1165 +#: ../../library/inspect.rst:1178 msgid "" "Get the object wrapped by *func*. It follows the chain of :attr:" "`__wrapped__` attributes returning the last object in the chain." msgstr "" -#: ../../library/inspect.rst:1168 +#: ../../library/inspect.rst:1181 msgid "" "*stop* is an optional callback accepting an object in the wrapper chain as " "its sole argument that allows the unwrapping to be terminated early if the " @@ -1433,68 +1457,68 @@ msgid "" "``__signature__`` attribute defined." msgstr "" -#: ../../library/inspect.rst:1175 +#: ../../library/inspect.rst:1188 msgid ":exc:`ValueError` is raised if a cycle is encountered." msgstr "如果遇到循環,則引發 :exc:`ValueError`。" -#: ../../library/inspect.rst:1182 +#: ../../library/inspect.rst:1195 msgid "Compute the annotations dict for an object." msgstr "" -#: ../../library/inspect.rst:1184 +#: ../../library/inspect.rst:1197 msgid "" "``obj`` may be a callable, class, or module. Passing in an object of any " "other type raises :exc:`TypeError`." msgstr "" -#: ../../library/inspect.rst:1187 +#: ../../library/inspect.rst:1200 msgid "" "Returns a dict. ``get_annotations()`` returns a new dict every time it's " "called; calling it twice on the same object will return two different but " "equivalent dicts." msgstr "" -#: ../../library/inspect.rst:1191 +#: ../../library/inspect.rst:1204 msgid "This function handles several details for you:" msgstr "" -#: ../../library/inspect.rst:1193 +#: ../../library/inspect.rst:1206 msgid "" "If ``eval_str`` is true, values of type ``str`` will be un-stringized using :" "func:`eval()`. This is intended for use with stringized annotations (``from " "__future__ import annotations``)." msgstr "" -#: ../../library/inspect.rst:1197 +#: ../../library/inspect.rst:1210 msgid "" "If ``obj`` doesn't have an annotations dict, returns an empty dict. " "(Functions and methods always have an annotations dict; classes, modules, " "and other types of callables may not.)" msgstr "" -#: ../../library/inspect.rst:1201 +#: ../../library/inspect.rst:1214 msgid "" "Ignores inherited annotations on classes. If a class doesn't have its own " "annotations dict, returns an empty dict." msgstr "" -#: ../../library/inspect.rst:1203 +#: ../../library/inspect.rst:1216 msgid "" "All accesses to object members and dict values are done using ``getattr()`` " "and ``dict.get()`` for safety." msgstr "" -#: ../../library/inspect.rst:1205 +#: ../../library/inspect.rst:1218 msgid "Always, always, always returns a freshly created dict." msgstr "" -#: ../../library/inspect.rst:1207 +#: ../../library/inspect.rst:1220 msgid "" "``eval_str`` controls whether or not values of type ``str`` are replaced " "with the result of calling :func:`eval()` on those values:" msgstr "" -#: ../../library/inspect.rst:1210 +#: ../../library/inspect.rst:1223 msgid "" "If eval_str is true, :func:`eval()` is called on values of type ``str``. " "(Note that ``get_annotations`` doesn't catch exceptions; if :func:`eval()` " @@ -1502,12 +1526,12 @@ msgid "" "call.)" msgstr "" -#: ../../library/inspect.rst:1214 +#: ../../library/inspect.rst:1227 msgid "" "If eval_str is false (the default), values of type ``str`` are unchanged." msgstr "" -#: ../../library/inspect.rst:1216 +#: ../../library/inspect.rst:1229 msgid "" "``globals`` and ``locals`` are passed in to :func:`eval()`; see the " "documentation for :func:`eval()` for more information. If ``globals`` or " @@ -1515,35 +1539,35 @@ msgid "" "specific default, contingent on ``type(obj)``:" msgstr "" -#: ../../library/inspect.rst:1221 +#: ../../library/inspect.rst:1234 msgid "If ``obj`` is a module, ``globals`` defaults to ``obj.__dict__``." msgstr "" -#: ../../library/inspect.rst:1222 +#: ../../library/inspect.rst:1235 msgid "" "If ``obj`` is a class, ``globals`` defaults to ``sys.modules[obj.__module__]." "__dict__`` and ``locals`` defaults to the ``obj`` class namespace." msgstr "" -#: ../../library/inspect.rst:1225 +#: ../../library/inspect.rst:1238 msgid "" "If ``obj`` is a callable, ``globals`` defaults to :attr:`obj.__globals__ " "`, although if ``obj`` is a wrapped function (using :" "func:`functools.update_wrapper`) it is first unwrapped." msgstr "" -#: ../../library/inspect.rst:1230 +#: ../../library/inspect.rst:1243 msgid "" "Calling ``get_annotations`` is best practice for accessing the annotations " "dict of any object. See :ref:`annotations-howto` for more information on " "annotations best practices." msgstr "" -#: ../../library/inspect.rst:1240 +#: ../../library/inspect.rst:1253 msgid "The interpreter stack" -msgstr "" +msgstr "直譯器堆疊" -#: ../../library/inspect.rst:1242 +#: ../../library/inspect.rst:1255 msgid "" "Some of the following functions return :class:`FrameInfo` objects. For " "backwards compatibility these objects allow tuple-like operations on all " @@ -1551,95 +1575,95 @@ msgid "" "may be removed in the future." msgstr "" -#: ../../library/inspect.rst:1251 +#: ../../library/inspect.rst:1264 msgid "The :ref:`frame object ` that the record corresponds to." msgstr "" -#: ../../library/inspect.rst:1255 +#: ../../library/inspect.rst:1268 msgid "" "The file name associated with the code being executed by the frame this " "record corresponds to." msgstr "" -#: ../../library/inspect.rst:1260 +#: ../../library/inspect.rst:1273 msgid "" "The line number of the current line associated with the code being executed " "by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1265 +#: ../../library/inspect.rst:1278 msgid "" "The function name that is being executed by the frame this record " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1269 +#: ../../library/inspect.rst:1282 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1274 ../../library/inspect.rst:1313 +#: ../../library/inspect.rst:1287 ../../library/inspect.rst:1326 msgid "" "The index of the current line being executed in the :attr:`code_context` " "list." msgstr "" -#: ../../library/inspect.rst:1278 +#: ../../library/inspect.rst:1291 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1282 +#: ../../library/inspect.rst:1295 msgid "Return a :term:`named tuple` instead of a :class:`tuple`." msgstr "" -#: ../../library/inspect.rst:1285 +#: ../../library/inspect.rst:1298 msgid "" ":class:`!FrameInfo` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1294 +#: ../../library/inspect.rst:1307 msgid "" "The file name associated with the code being executed by the frame this " "traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1299 +#: ../../library/inspect.rst:1312 msgid "" "The line number of the current line associated with the code being executed " "by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1304 +#: ../../library/inspect.rst:1317 msgid "" "The function name that is being executed by the frame this traceback " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1308 +#: ../../library/inspect.rst:1321 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1317 +#: ../../library/inspect.rst:1330 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1322 +#: ../../library/inspect.rst:1335 msgid "" ":class:`!Traceback` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1329 +#: ../../library/inspect.rst:1342 msgid "" "Keeping references to frame objects, as found in the first element of the " "frame records these functions return, can cause your program to create " @@ -1651,7 +1675,7 @@ msgid "" "consumption which occurs." msgstr "" -#: ../../library/inspect.rst:1337 +#: ../../library/inspect.rst:1350 msgid "" "Though the cycle detector will catch these, destruction of the frames (and " "local variables) can be made deterministic by removing the cycle in a :" @@ -1659,31 +1683,31 @@ msgid "" "disabled when Python was compiled or using :func:`gc.disable`. For example::" msgstr "" -#: ../../library/inspect.rst:1349 +#: ../../library/inspect.rst:1362 msgid "" "If you want to keep the frame around (for example to print a traceback " "later), you can also break reference cycles by using the :meth:`frame.clear` " "method." msgstr "" -#: ../../library/inspect.rst:1353 +#: ../../library/inspect.rst:1366 msgid "" "The optional *context* argument supported by most of these functions " "specifies the number of lines of context to return, which are centered " "around the current line." msgstr "" -#: ../../library/inspect.rst:1360 +#: ../../library/inspect.rst:1373 msgid "" "Get information about a frame or traceback object. A :class:`Traceback` " "object is returned." msgstr "" -#: ../../library/inspect.rst:1363 +#: ../../library/inspect.rst:1376 msgid "A :class:`Traceback` object is returned instead of a named tuple." msgstr "" -#: ../../library/inspect.rst:1368 +#: ../../library/inspect.rst:1381 msgid "" "Get a list of :class:`FrameInfo` objects for a frame and all outer frames. " "These frames represent the calls that lead to the creation of *frame*. The " @@ -1691,19 +1715,19 @@ msgid "" "represents the outermost call on *frame*'s stack." msgstr "" -#: ../../library/inspect.rst:1373 ../../library/inspect.rst:1388 -#: ../../library/inspect.rst:1414 ../../library/inspect.rst:1429 +#: ../../library/inspect.rst:1386 ../../library/inspect.rst:1401 +#: ../../library/inspect.rst:1427 ../../library/inspect.rst:1442 msgid "" "A list of :term:`named tuples ` ``FrameInfo(frame, filename, " "lineno, function, code_context, index)`` is returned." msgstr "" -#: ../../library/inspect.rst:1378 ../../library/inspect.rst:1393 -#: ../../library/inspect.rst:1419 ../../library/inspect.rst:1434 +#: ../../library/inspect.rst:1391 ../../library/inspect.rst:1406 +#: ../../library/inspect.rst:1432 ../../library/inspect.rst:1447 msgid "A list of :class:`FrameInfo` objects is returned." msgstr "回傳一個 :class:`FrameInfo` 物件串列。" -#: ../../library/inspect.rst:1383 +#: ../../library/inspect.rst:1396 msgid "" "Get a list of :class:`FrameInfo` objects for a traceback's frame and all " "inner frames. These frames represent calls made as a consequence of " @@ -1711,11 +1735,11 @@ msgid "" "represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1398 +#: ../../library/inspect.rst:1411 msgid "Return the frame object for the caller's stack frame." msgstr "" -#: ../../library/inspect.rst:1402 +#: ../../library/inspect.rst:1415 msgid "" "This function relies on Python stack frame support in the interpreter, which " "isn't guaranteed to exist in all implementations of Python. If running in " @@ -1723,14 +1747,14 @@ msgid "" "``None``." msgstr "" -#: ../../library/inspect.rst:1410 +#: ../../library/inspect.rst:1423 msgid "" "Return a list of :class:`FrameInfo` objects for the caller's stack. The " "first entry in the returned list represents the caller; the last entry " "represents the outermost call on the stack." msgstr "" -#: ../../library/inspect.rst:1424 +#: ../../library/inspect.rst:1437 msgid "" "Return a list of :class:`FrameInfo` objects for the stack between the " "current frame and the frame in which an exception currently being handled " @@ -1738,11 +1762,11 @@ msgid "" "entry represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1438 +#: ../../library/inspect.rst:1451 msgid "Fetching attributes statically" msgstr "" -#: ../../library/inspect.rst:1440 +#: ../../library/inspect.rst:1453 msgid "" "Both :func:`getattr` and :func:`hasattr` can trigger code execution when " "fetching or checking for the existence of attributes. Descriptors, like " @@ -1750,20 +1774,20 @@ msgid "" "`~object.__getattribute__` may be called." msgstr "" -#: ../../library/inspect.rst:1446 +#: ../../library/inspect.rst:1459 msgid "" "For cases where you want passive introspection, like documentation tools, " "this can be inconvenient. :func:`getattr_static` has the same signature as :" "func:`getattr` but avoids executing code when it fetches attributes." msgstr "" -#: ../../library/inspect.rst:1452 +#: ../../library/inspect.rst:1465 msgid "" "Retrieve attributes without triggering dynamic lookup via the descriptor " "protocol, :meth:`~object.__getattr__` or :meth:`~object.__getattribute__`." msgstr "" -#: ../../library/inspect.rst:1456 +#: ../../library/inspect.rst:1469 msgid "" "Note: this function may not be able to retrieve all attributes that getattr " "can fetch (like dynamically created attributes) and may find attributes that " @@ -1771,31 +1795,31 @@ msgid "" "return descriptors objects instead of instance members." msgstr "" -#: ../../library/inspect.rst:1462 +#: ../../library/inspect.rst:1475 msgid "" "If the instance :attr:`~object.__dict__` is shadowed by another member (for " "example a property) then this function will be unable to find instance " "members." msgstr "" -#: ../../library/inspect.rst:1468 +#: ../../library/inspect.rst:1481 msgid "" ":func:`getattr_static` does not resolve descriptors, for example slot " "descriptors or getset descriptors on objects implemented in C. The " "descriptor object is returned instead of the underlying attribute." msgstr "" -#: ../../library/inspect.rst:1472 +#: ../../library/inspect.rst:1485 msgid "" "You can handle these with code like the following. Note that for arbitrary " "getset descriptors invoking these may trigger code execution::" msgstr "" -#: ../../library/inspect.rst:1498 +#: ../../library/inspect.rst:1511 msgid "Current State of Generators, Coroutines, and Asynchronous Generators" msgstr "" -#: ../../library/inspect.rst:1500 +#: ../../library/inspect.rst:1513 msgid "" "When implementing coroutine schedulers and for other advanced uses of " "generators, it is useful to determine whether a generator is currently " @@ -1804,32 +1828,32 @@ msgid "" "generator to be determined easily." msgstr "" -#: ../../library/inspect.rst:1508 +#: ../../library/inspect.rst:1521 msgid "Get current state of a generator-iterator." msgstr "" -#: ../../library/inspect.rst:1510 ../../library/inspect.rst:1526 -#: ../../library/inspect.rst:1543 +#: ../../library/inspect.rst:1523 ../../library/inspect.rst:1539 +#: ../../library/inspect.rst:1556 msgid "Possible states are:" msgstr "" -#: ../../library/inspect.rst:1512 +#: ../../library/inspect.rst:1525 msgid "GEN_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1513 +#: ../../library/inspect.rst:1526 msgid "GEN_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1514 +#: ../../library/inspect.rst:1527 msgid "GEN_SUSPENDED: Currently suspended at a yield expression." msgstr "" -#: ../../library/inspect.rst:1515 +#: ../../library/inspect.rst:1528 msgid "GEN_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1521 +#: ../../library/inspect.rst:1534 msgid "" "Get current state of a coroutine object. The function is intended to be " "used with coroutine objects created by :keyword:`async def` functions, but " @@ -1837,23 +1861,23 @@ msgid "" "``cr_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1528 +#: ../../library/inspect.rst:1541 msgid "CORO_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1529 +#: ../../library/inspect.rst:1542 msgid "CORO_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1530 +#: ../../library/inspect.rst:1543 msgid "CORO_SUSPENDED: Currently suspended at an await expression." msgstr "" -#: ../../library/inspect.rst:1531 +#: ../../library/inspect.rst:1544 msgid "CORO_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1537 +#: ../../library/inspect.rst:1550 msgid "" "Get current state of an asynchronous generator object. The function is " "intended to be used with asynchronous iterator objects created by :keyword:" @@ -1862,30 +1886,30 @@ msgid "" "``ag_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1545 +#: ../../library/inspect.rst:1558 msgid "AGEN_CREATED: Waiting to start execution." -msgstr "" +msgstr "AGEN_CREATED: 等待開始執行。" -#: ../../library/inspect.rst:1546 +#: ../../library/inspect.rst:1559 msgid "AGEN_RUNNING: Currently being executed by the interpreter." -msgstr "" +msgstr "AGEN_RUNNING: 目前正在被直譯器執行。" -#: ../../library/inspect.rst:1547 +#: ../../library/inspect.rst:1560 msgid "AGEN_SUSPENDED: Currently suspended at a yield expression." -msgstr "" +msgstr "AGEN_SUSPENDED: 目前於 yield 運算式暫停。" -#: ../../library/inspect.rst:1548 +#: ../../library/inspect.rst:1561 msgid "AGEN_CLOSED: Execution has completed." -msgstr "" +msgstr "AGEN_CLOSED: 執行已完成。" -#: ../../library/inspect.rst:1552 +#: ../../library/inspect.rst:1565 msgid "" "The current internal state of the generator can also be queried. This is " "mostly useful for testing purposes, to ensure that internal state is being " "updated as expected:" msgstr "" -#: ../../library/inspect.rst:1558 +#: ../../library/inspect.rst:1571 msgid "" "Get the mapping of live local variables in *generator* to their current " "values. A dictionary is returned that maps from variable names to values. " @@ -1893,14 +1917,14 @@ msgid "" "generator, and all the same caveats apply." msgstr "" -#: ../../library/inspect.rst:1563 +#: ../../library/inspect.rst:1576 msgid "" "If *generator* is a :term:`generator` with no currently associated frame, " "then an empty dictionary is returned. :exc:`TypeError` is raised if " "*generator* is not a Python generator object." msgstr "" -#: ../../library/inspect.rst:1569 +#: ../../library/inspect.rst:1582 msgid "" "This function relies on the generator exposing a Python stack frame for " "introspection, which isn't guaranteed to be the case in all implementations " @@ -1908,79 +1932,79 @@ msgid "" "dictionary." msgstr "" -#: ../../library/inspect.rst:1578 +#: ../../library/inspect.rst:1591 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for coroutine objects created by :keyword:`async def` functions." msgstr "" -#: ../../library/inspect.rst:1585 +#: ../../library/inspect.rst:1598 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for asynchronous generator objects created by :keyword:`async def` functions " "which use the :keyword:`yield` statement." msgstr "" -#: ../../library/inspect.rst:1595 +#: ../../library/inspect.rst:1608 msgid "Code Objects Bit Flags" msgstr "" -#: ../../library/inspect.rst:1597 +#: ../../library/inspect.rst:1610 msgid "" "Python code objects have a :attr:`~codeobject.co_flags` attribute, which is " "a bitmap of the following flags:" msgstr "" -#: ../../library/inspect.rst:1602 +#: ../../library/inspect.rst:1615 msgid "The code object is optimized, using fast locals." msgstr "" -#: ../../library/inspect.rst:1606 +#: ../../library/inspect.rst:1619 msgid "" "If set, a new dict will be created for the frame's :attr:`~frame.f_locals` " "when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1611 +#: ../../library/inspect.rst:1624 msgid "The code object has a variable positional parameter (``*args``-like)." msgstr "" -#: ../../library/inspect.rst:1615 +#: ../../library/inspect.rst:1628 msgid "The code object has a variable keyword parameter (``**kwargs``-like)." msgstr "" -#: ../../library/inspect.rst:1619 +#: ../../library/inspect.rst:1632 msgid "The flag is set when the code object is a nested function." msgstr "" -#: ../../library/inspect.rst:1623 +#: ../../library/inspect.rst:1636 msgid "" "The flag is set when the code object is a generator function, i.e. a " "generator object is returned when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1628 +#: ../../library/inspect.rst:1641 msgid "" "The flag is set when the code object is a coroutine function. When the code " "object is executed it returns a coroutine object. See :pep:`492` for more " "details." msgstr "" -#: ../../library/inspect.rst:1636 +#: ../../library/inspect.rst:1649 msgid "" "The flag is used to transform generators into generator-based coroutines. " "Generator objects with this flag can be used in ``await`` expression, and " "can ``yield from`` coroutine objects. See :pep:`492` for more details." msgstr "" -#: ../../library/inspect.rst:1645 +#: ../../library/inspect.rst:1658 msgid "" "The flag is set when the code object is an asynchronous generator function. " "When the code object is executed it returns an asynchronous generator " "object. See :pep:`525` for more details." msgstr "" -#: ../../library/inspect.rst:1652 +#: ../../library/inspect.rst:1665 msgid "" "The flags are specific to CPython, and may not be defined in other Python " "implementations. Furthermore, the flags are an implementation detail, and " @@ -1988,39 +2012,39 @@ msgid "" "use public APIs from the :mod:`inspect` module for any introspection needs." msgstr "" -#: ../../library/inspect.rst:1660 +#: ../../library/inspect.rst:1673 msgid "Buffer flags" msgstr "" -#: ../../library/inspect.rst:1664 +#: ../../library/inspect.rst:1677 msgid "" "This is an :class:`enum.IntFlag` that represents the flags that can be " "passed to the :meth:`~object.__buffer__` method of objects implementing the :" "ref:`buffer protocol `." msgstr "" -#: ../../library/inspect.rst:1668 +#: ../../library/inspect.rst:1681 msgid "The meaning of the flags is explained at :ref:`buffer-request-types`." msgstr "" -#: ../../library/inspect.rst:1695 +#: ../../library/inspect.rst:1708 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/inspect.rst:1697 +#: ../../library/inspect.rst:1710 msgid "" "The :mod:`inspect` module also provides a basic introspection capability " "from the command line." msgstr "" -#: ../../library/inspect.rst:1702 +#: ../../library/inspect.rst:1715 msgid "" "By default, accepts the name of a module and prints the source of that " "module. A class or function within the module can be printed instead by " "appended a colon and the qualified name of the target object." msgstr "" -#: ../../library/inspect.rst:1708 +#: ../../library/inspect.rst:1721 msgid "" "Print information about the specified object rather than the source code" msgstr "" diff --git a/library/ipaddress.po b/library/ipaddress.po index 8f09c7af9d..53137322f5 100644 --- a/library/ipaddress.po +++ b/library/ipaddress.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-16 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -937,9 +937,9 @@ msgstr "" #: ../../library/ipaddress.rst:985 msgid "" "Return an iterator of the collapsed :class:`IPv4Network` or :class:" -"`IPv6Network` objects. *addresses* is an iterator of :class:`IPv4Network` " -"or :class:`IPv6Network` objects. A :exc:`TypeError` is raised if " -"*addresses* contains mixed version objects." +"`IPv6Network` objects. *addresses* is an :term:`iterable` of :class:" +"`IPv4Network` or :class:`IPv6Network` objects. A :exc:`TypeError` is raised " +"if *addresses* contains mixed version objects." msgstr "" #: ../../library/ipaddress.rst:998 diff --git a/library/multiprocessing.po b/library/multiprocessing.po index a9ded5fc5c..9af6c2dc48 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-07-15 00:03+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-" @@ -275,20 +275,22 @@ msgid "" msgstr "" #: ../../library/multiprocessing.rst:256 -msgid "Queues are thread and process safe." +msgid "" +"Queues are thread and process safe. Any object put into a :mod:" +"`~multiprocessing` queue will be serialized." msgstr "" -#: ../../library/multiprocessing.rst:258 +#: ../../library/multiprocessing.rst:259 msgid "**Pipes**" msgstr "" -#: ../../library/multiprocessing.rst:260 +#: ../../library/multiprocessing.rst:261 msgid "" "The :func:`Pipe` function returns a pair of connection objects connected by " "a pipe which by default is duplex (two-way). For example::" msgstr "" -#: ../../library/multiprocessing.rst:276 +#: ../../library/multiprocessing.rst:277 msgid "" "The two connection objects returned by :func:`Pipe` represent the two ends " "of the pipe. Each connection object has :meth:`~Connection.send` and :meth:" @@ -298,55 +300,61 @@ msgid "" "corruption from processes using different ends of the pipe at the same time." msgstr "" -#: ../../library/multiprocessing.rst:286 +#: ../../library/multiprocessing.rst:285 +msgid "" +"The :meth:`~Connection.send` method serializes the the object and :meth:" +"`~Connection.recv` re-creates the object." +msgstr "" + +#: ../../library/multiprocessing.rst:289 msgid "Synchronization between processes" msgstr "" -#: ../../library/multiprocessing.rst:288 +#: ../../library/multiprocessing.rst:291 msgid "" ":mod:`multiprocessing` contains equivalents of all the synchronization " "primitives from :mod:`threading`. For instance one can use a lock to ensure " "that only one process prints to standard output at a time::" msgstr "" -#: ../../library/multiprocessing.rst:307 +#: ../../library/multiprocessing.rst:310 msgid "" "Without using the lock output from the different processes is liable to get " "all mixed up." msgstr "" -#: ../../library/multiprocessing.rst:312 +#: ../../library/multiprocessing.rst:315 msgid "Sharing state between processes" msgstr "" -#: ../../library/multiprocessing.rst:314 +#: ../../library/multiprocessing.rst:317 msgid "" "As mentioned above, when doing concurrent programming it is usually best to " "avoid using shared state as far as possible. This is particularly true when " "using multiple processes." msgstr "" -#: ../../library/multiprocessing.rst:318 +#: ../../library/multiprocessing.rst:321 msgid "" "However, if you really do need to use some shared data then :mod:" "`multiprocessing` provides a couple of ways of doing so." msgstr "" -#: ../../library/multiprocessing.rst:321 +#: ../../library/multiprocessing.rst:324 msgid "**Shared memory**" msgstr "" -#: ../../library/multiprocessing.rst:323 +#: ../../library/multiprocessing.rst:326 msgid "" "Data can be stored in a shared memory map using :class:`Value` or :class:" "`Array`. For example, the following code ::" msgstr "" -#: ../../library/multiprocessing.rst:344 ../../library/multiprocessing.rst:390 +#: ../../library/multiprocessing.rst:347 ../../library/multiprocessing.rst:393 msgid "will print ::" msgstr "" -#: ../../library/multiprocessing.rst:349 +#: ../../library/multiprocessing.rst:352 msgid "" "The ``'d'`` and ``'i'`` arguments used when creating ``num`` and ``arr`` are " "typecodes of the kind used by the :mod:`array` module: ``'d'`` indicates a " @@ -354,25 +362,25 @@ msgid "" "objects will be process and thread-safe." msgstr "" -#: ../../library/multiprocessing.rst:354 +#: ../../library/multiprocessing.rst:357 msgid "" "For more flexibility in using shared memory one can use the :mod:" "`multiprocessing.sharedctypes` module which supports the creation of " "arbitrary ctypes objects allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:358 +#: ../../library/multiprocessing.rst:361 msgid "**Server process**" msgstr "" -#: ../../library/multiprocessing.rst:360 +#: ../../library/multiprocessing.rst:363 msgid "" "A manager object returned by :func:`Manager` controls a server process which " "holds Python objects and allows other processes to manipulate them using " "proxies." msgstr "" -#: ../../library/multiprocessing.rst:364 +#: ../../library/multiprocessing.rst:367 msgid "" "A manager returned by :func:`Manager` will support types :class:`list`, :" "class:`dict`, :class:`~managers.Namespace`, :class:`Lock`, :class:`RLock`, :" @@ -381,7 +389,7 @@ msgid "" "`Array`. For example, ::" msgstr "" -#: ../../library/multiprocessing.rst:395 +#: ../../library/multiprocessing.rst:398 msgid "" "Server process managers are more flexible than using shared memory objects " "because they can be made to support arbitrary object types. Also, a single " @@ -389,28 +397,28 @@ msgid "" "They are, however, slower than using shared memory." msgstr "" -#: ../../library/multiprocessing.rst:402 +#: ../../library/multiprocessing.rst:405 msgid "Using a pool of workers" msgstr "" -#: ../../library/multiprocessing.rst:404 +#: ../../library/multiprocessing.rst:407 msgid "" "The :class:`~multiprocessing.pool.Pool` class represents a pool of worker " "processes. It has methods which allows tasks to be offloaded to the worker " "processes in a few different ways." msgstr "" -#: ../../library/multiprocessing.rst:408 +#: ../../library/multiprocessing.rst:411 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/multiprocessing.rst:452 +#: ../../library/multiprocessing.rst:455 msgid "" "Note that the methods of a pool should only ever be used by the process " "which created it." msgstr "" -#: ../../library/multiprocessing.rst:457 +#: ../../library/multiprocessing.rst:460 msgid "" "Functionality within this package requires that the ``__main__`` module be " "importable by the children. This is covered in :ref:`multiprocessing-" @@ -419,35 +427,35 @@ msgid "" "work in the interactive interpreter. For example::" msgstr "" -#: ../../library/multiprocessing.rst:480 +#: ../../library/multiprocessing.rst:483 msgid "" "(If you try this it will actually output three full tracebacks interleaved " "in a semi-random fashion, and then you may have to stop the parent process " "somehow.)" msgstr "" -#: ../../library/multiprocessing.rst:486 +#: ../../library/multiprocessing.rst:489 msgid "Reference" msgstr "" -#: ../../library/multiprocessing.rst:488 +#: ../../library/multiprocessing.rst:491 msgid "" "The :mod:`multiprocessing` package mostly replicates the API of the :mod:" "`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:493 +#: ../../library/multiprocessing.rst:496 msgid ":class:`Process` and exceptions" msgstr ":class:`Process` 與例外" -#: ../../library/multiprocessing.rst:498 +#: ../../library/multiprocessing.rst:501 msgid "" "Process objects represent activity that is run in a separate process. The :" "class:`Process` class has equivalents of all the methods of :class:" "`threading.Thread`." msgstr "" -#: ../../library/multiprocessing.rst:502 +#: ../../library/multiprocessing.rst:505 msgid "" "The constructor should always be called with keyword arguments. *group* " "should always be ``None``; it exists solely for compatibility with :class:" @@ -461,29 +469,29 @@ msgid "" "creating process." msgstr "" -#: ../../library/multiprocessing.rst:513 +#: ../../library/multiprocessing.rst:516 msgid "" "By default, no arguments are passed to *target*. The *args* argument, which " "defaults to ``()``, can be used to specify a list or tuple of the arguments " "to pass to *target*." msgstr "" -#: ../../library/multiprocessing.rst:517 +#: ../../library/multiprocessing.rst:520 msgid "" "If a subclass overrides the constructor, it must make sure it invokes the " "base class constructor (:meth:`Process.__init__`) before doing anything else " "to the process." msgstr "" -#: ../../library/multiprocessing.rst:521 +#: ../../library/multiprocessing.rst:524 msgid "Added the *daemon* parameter." msgstr "新增 *daemon* 參數。" -#: ../../library/multiprocessing.rst:526 +#: ../../library/multiprocessing.rst:529 msgid "Method representing the process's activity." msgstr "" -#: ../../library/multiprocessing.rst:528 +#: ../../library/multiprocessing.rst:531 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 target " @@ -491,27 +499,27 @@ msgid "" "*args* and *kwargs* arguments, respectively." msgstr "" -#: ../../library/multiprocessing.rst:533 +#: ../../library/multiprocessing.rst:536 msgid "" "Using a list or tuple as the *args* argument passed to :class:`Process` " "achieves the same effect." msgstr "" -#: ../../library/multiprocessing.rst:536 +#: ../../library/multiprocessing.rst:539 msgid "Example::" msgstr "範例: ::" -#: ../../library/multiprocessing.rst:548 +#: ../../library/multiprocessing.rst:551 msgid "Start the process's activity." msgstr "" -#: ../../library/multiprocessing.rst:550 +#: ../../library/multiprocessing.rst:553 msgid "" "This must be called at most once per process object. It arranges for the " "object's :meth:`run` method to be invoked in a separate process." msgstr "" -#: ../../library/multiprocessing.rst:555 +#: ../../library/multiprocessing.rst:558 msgid "" "If the optional argument *timeout* is ``None`` (the default), the method " "blocks until the process whose :meth:`join` method is called terminates. If " @@ -521,23 +529,23 @@ msgid "" "terminated." msgstr "" -#: ../../library/multiprocessing.rst:562 +#: ../../library/multiprocessing.rst:565 msgid "A process can be joined many times." msgstr "" -#: ../../library/multiprocessing.rst:564 +#: ../../library/multiprocessing.rst:567 msgid "" "A process cannot join itself because this would cause a deadlock. It is an " "error to attempt to join a process before it has been started." msgstr "" -#: ../../library/multiprocessing.rst:569 +#: ../../library/multiprocessing.rst:572 msgid "" "The process's name. The name is a string used for identification purposes " "only. It has no semantics. Multiple processes may be given the same name." msgstr "" -#: ../../library/multiprocessing.rst:573 +#: ../../library/multiprocessing.rst:576 msgid "" "The initial name is set by the constructor. If no explicit name is provided " "to the constructor, a name of the form 'Process-N\\ :sub:`1`:N\\ :sub:" @@ -545,33 +553,33 @@ msgid "" "child of its parent." msgstr "" -#: ../../library/multiprocessing.rst:580 +#: ../../library/multiprocessing.rst:583 msgid "Return whether the process is alive." msgstr "" -#: ../../library/multiprocessing.rst:582 +#: ../../library/multiprocessing.rst:585 msgid "" "Roughly, a process object is alive from the moment the :meth:`start` method " "returns until the child process terminates." msgstr "" -#: ../../library/multiprocessing.rst:587 +#: ../../library/multiprocessing.rst:590 msgid "" "The process's daemon flag, a Boolean value. This must be set before :meth:" "`start` is called." msgstr "" -#: ../../library/multiprocessing.rst:590 +#: ../../library/multiprocessing.rst:593 msgid "The initial value is inherited from the creating process." msgstr "" -#: ../../library/multiprocessing.rst:592 +#: ../../library/multiprocessing.rst:595 msgid "" "When a process exits, it attempts to terminate all of its daemonic child " "processes." msgstr "" -#: ../../library/multiprocessing.rst:595 +#: ../../library/multiprocessing.rst:598 msgid "" "Note that a daemonic process is not allowed to create child processes. " "Otherwise a daemonic process would leave its children orphaned if it gets " @@ -580,92 +588,92 @@ msgid "" "(and not joined) if non-daemonic processes have exited." msgstr "" -#: ../../library/multiprocessing.rst:601 +#: ../../library/multiprocessing.rst:604 msgid "" "In addition to the :class:`threading.Thread` API, :class:`Process` objects " "also support the following attributes and methods:" msgstr "" -#: ../../library/multiprocessing.rst:606 +#: ../../library/multiprocessing.rst:609 msgid "" "Return the process ID. Before the process is spawned, this will be ``None``." msgstr "" -#: ../../library/multiprocessing.rst:611 +#: ../../library/multiprocessing.rst:614 msgid "" "The child's exit code. This will be ``None`` if the process has not yet " "terminated." msgstr "" -#: ../../library/multiprocessing.rst:614 +#: ../../library/multiprocessing.rst:617 msgid "" "If the child's :meth:`run` method returned normally, the exit code will be " "0. If it terminated via :func:`sys.exit` with an integer argument *N*, the " "exit code will be *N*." msgstr "" -#: ../../library/multiprocessing.rst:618 +#: ../../library/multiprocessing.rst:621 msgid "" "If the child terminated due to an exception not caught within :meth:`run`, " "the exit code will be 1. If it was terminated by signal *N*, the exit code " "will be the negative value *-N*." msgstr "" -#: ../../library/multiprocessing.rst:624 +#: ../../library/multiprocessing.rst:627 msgid "The process's authentication key (a byte string)." msgstr "" -#: ../../library/multiprocessing.rst:626 +#: ../../library/multiprocessing.rst:629 msgid "" "When :mod:`multiprocessing` is initialized the main process is assigned a " "random string using :func:`os.urandom`." msgstr "" -#: ../../library/multiprocessing.rst:629 +#: ../../library/multiprocessing.rst:632 msgid "" "When a :class:`Process` object is created, it will inherit the " "authentication key of its parent process, although this may be changed by " "setting :attr:`authkey` to another byte string." msgstr "" -#: ../../library/multiprocessing.rst:633 +#: ../../library/multiprocessing.rst:636 msgid "See :ref:`multiprocessing-auth-keys`." msgstr "參閱 :ref:`multiprocessing-auth-keys`。" -#: ../../library/multiprocessing.rst:637 +#: ../../library/multiprocessing.rst:640 msgid "" "A numeric handle of a system object which will become \"ready\" when the " "process ends." msgstr "" -#: ../../library/multiprocessing.rst:640 +#: ../../library/multiprocessing.rst:643 msgid "" "You can use this value if you want to wait on several events at once using :" "func:`multiprocessing.connection.wait`. Otherwise calling :meth:`join()` is " "simpler." msgstr "" -#: ../../library/multiprocessing.rst:644 +#: ../../library/multiprocessing.rst:647 msgid "" "On Windows, this is an OS handle usable with the ``WaitForSingleObject`` and " "``WaitForMultipleObjects`` family of API calls. On POSIX, this is a file " "descriptor usable with primitives from the :mod:`select` module." msgstr "" -#: ../../library/multiprocessing.rst:652 +#: ../../library/multiprocessing.rst:655 msgid "" "Terminate the process. On POSIX this is done using the :py:const:`~signal." "SIGTERM` signal; on Windows :c:func:`!TerminateProcess` is used. Note that " "exit handlers and finally clauses, etc., will not be executed." msgstr "" -#: ../../library/multiprocessing.rst:656 +#: ../../library/multiprocessing.rst:659 msgid "" "Note that descendant processes of the process will *not* be terminated -- " "they will simply become orphaned." msgstr "" -#: ../../library/multiprocessing.rst:661 +#: ../../library/multiprocessing.rst:664 msgid "" "If this method is used when the associated process is using a pipe or queue " "then the pipe or queue is liable to become corrupted and may become unusable " @@ -674,11 +682,11 @@ msgid "" "deadlock." msgstr "" -#: ../../library/multiprocessing.rst:669 +#: ../../library/multiprocessing.rst:672 msgid "Same as :meth:`terminate()` but using the ``SIGKILL`` signal on POSIX." msgstr "" -#: ../../library/multiprocessing.rst:675 +#: ../../library/multiprocessing.rst:678 msgid "" "Close the :class:`Process` object, releasing all resources associated with " "it. :exc:`ValueError` is raised if the underlying process is still " @@ -686,59 +694,59 @@ msgid "" "attributes of the :class:`Process` object will raise :exc:`ValueError`." msgstr "" -#: ../../library/multiprocessing.rst:683 +#: ../../library/multiprocessing.rst:686 msgid "" "Note that the :meth:`start`, :meth:`join`, :meth:`is_alive`, :meth:" "`terminate` and :attr:`exitcode` methods should only be called by the " "process that created the process object." msgstr "" -#: ../../library/multiprocessing.rst:687 +#: ../../library/multiprocessing.rst:690 msgid "Example usage of some of the methods of :class:`Process`:" msgstr "" -#: ../../library/multiprocessing.rst:708 +#: ../../library/multiprocessing.rst:711 msgid "The base class of all :mod:`multiprocessing` exceptions." msgstr "" -#: ../../library/multiprocessing.rst:712 +#: ../../library/multiprocessing.rst:715 msgid "" "Exception raised by :meth:`Connection.recv_bytes_into()` when the supplied " "buffer object is too small for the message read." msgstr "" -#: ../../library/multiprocessing.rst:715 +#: ../../library/multiprocessing.rst:718 msgid "" "If ``e`` is an instance of :exc:`BufferTooShort` then ``e.args[0]`` will " "give the message as a byte string." msgstr "" -#: ../../library/multiprocessing.rst:720 +#: ../../library/multiprocessing.rst:723 msgid "Raised when there is an authentication error." msgstr "" -#: ../../library/multiprocessing.rst:724 +#: ../../library/multiprocessing.rst:727 msgid "Raised by methods with a timeout when the timeout expires." msgstr "" -#: ../../library/multiprocessing.rst:727 +#: ../../library/multiprocessing.rst:730 msgid "Pipes and Queues" msgstr "" -#: ../../library/multiprocessing.rst:729 +#: ../../library/multiprocessing.rst:732 msgid "" "When using multiple processes, one generally uses message passing for " "communication between processes and avoids having to use any synchronization " "primitives like locks." msgstr "" -#: ../../library/multiprocessing.rst:733 +#: ../../library/multiprocessing.rst:736 msgid "" "For passing messages one can use :func:`Pipe` (for a connection between two " "processes) or a queue (which allows multiple producers and consumers)." msgstr "" -#: ../../library/multiprocessing.rst:736 +#: ../../library/multiprocessing.rst:739 msgid "" "The :class:`Queue`, :class:`SimpleQueue` and :class:`JoinableQueue` types " "are multi-producer, multi-consumer :abbr:`FIFO (first-in, first-out)` queues " @@ -748,7 +756,7 @@ msgid "" "Queue` class." msgstr "" -#: ../../library/multiprocessing.rst:743 +#: ../../library/multiprocessing.rst:746 msgid "" "If you use :class:`JoinableQueue` then you **must** call :meth:" "`JoinableQueue.task_done` for each task removed from the queue or else the " @@ -756,20 +764,28 @@ msgid "" "overflow, raising an exception." msgstr "" -#: ../../library/multiprocessing.rst:748 +#: ../../library/multiprocessing.rst:751 +msgid "" +"One difference from other Python queue implementations, is that :mod:" +"`multiprocessing` queues serializes all objects that are put into them " +"using :mod:`pickle`. The object return by the get method is a re-created " +"object that does not share memory with the original object." +msgstr "" + +#: ../../library/multiprocessing.rst:756 msgid "" "Note that one can also create a shared queue by using a manager object -- " "see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:753 +#: ../../library/multiprocessing.rst:761 msgid "" ":mod:`multiprocessing` uses the usual :exc:`queue.Empty` and :exc:`queue." "Full` exceptions to signal a timeout. They are not available in the :mod:" "`multiprocessing` namespace so you need to import them from :mod:`queue`." msgstr "" -#: ../../library/multiprocessing.rst:760 +#: ../../library/multiprocessing.rst:768 msgid "" "When an object is put on a queue, the object is pickled and a background " "thread later flushes the pickled data to an underlying pipe. This has some " @@ -778,14 +794,14 @@ msgid "" "a queue created with a :ref:`manager `." msgstr "" -#: ../../library/multiprocessing.rst:767 +#: ../../library/multiprocessing.rst:775 msgid "" "After putting an object on an empty queue there may be an infinitesimal " "delay before the queue's :meth:`~Queue.empty` method returns :const:`False` " "and :meth:`~Queue.get_nowait` can return without raising :exc:`queue.Empty`." msgstr "" -#: ../../library/multiprocessing.rst:772 +#: ../../library/multiprocessing.rst:780 msgid "" "If multiple processes are enqueuing objects, it is possible for the objects " "to be received at the other end out-of-order. However, objects enqueued by " @@ -793,7 +809,7 @@ msgid "" "other." msgstr "" -#: ../../library/multiprocessing.rst:779 +#: ../../library/multiprocessing.rst:787 msgid "" "If a process is killed using :meth:`Process.terminate` or :func:`os.kill` " "while it is trying to use a :class:`Queue`, then the data in the queue is " @@ -801,7 +817,7 @@ msgid "" "exception when it tries to use the queue later on." msgstr "" -#: ../../library/multiprocessing.rst:786 +#: ../../library/multiprocessing.rst:794 msgid "" "As mentioned above, if a child process has put items on a queue (and it has " "not used :meth:`JoinableQueue.cancel_join_thread ` -- see also :ref:`multiprocessing-listeners-clients`." msgstr "" -#: ../../library/multiprocessing.rst:1161 +#: ../../library/multiprocessing.rst:1175 msgid "" "Send an object to the other end of the connection which should be read " "using :meth:`recv`." msgstr "" -#: ../../library/multiprocessing.rst:1164 +#: ../../library/multiprocessing.rst:1178 msgid "" "The object must be picklable. Very large pickles (approximately 32 MiB+, " "though it depends on the OS) may raise a :exc:`ValueError` exception." msgstr "" -#: ../../library/multiprocessing.rst:1169 +#: ../../library/multiprocessing.rst:1183 msgid "" "Return an object sent from the other end of the connection using :meth:" "`send`. Blocks until there is something to receive. Raises :exc:`EOFError` " "if there is nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1176 +#: ../../library/multiprocessing.rst:1190 msgid "Return the file descriptor or handle used by the connection." msgstr "" -#: ../../library/multiprocessing.rst:1180 +#: ../../library/multiprocessing.rst:1194 msgid "Close the connection." msgstr "" -#: ../../library/multiprocessing.rst:1182 +#: ../../library/multiprocessing.rst:1196 msgid "This is called automatically when the connection is garbage collected." msgstr "" -#: ../../library/multiprocessing.rst:1186 +#: ../../library/multiprocessing.rst:1200 msgid "Return whether there is any data available to be read." msgstr "" -#: ../../library/multiprocessing.rst:1188 +#: ../../library/multiprocessing.rst:1202 msgid "" "If *timeout* is not specified then it will return immediately. If *timeout* " "is a number then this specifies the maximum time in seconds to block. If " "*timeout* is ``None`` then an infinite timeout is used." msgstr "" -#: ../../library/multiprocessing.rst:1192 +#: ../../library/multiprocessing.rst:1206 msgid "" "Note that multiple connection objects may be polled at once by using :func:" "`multiprocessing.connection.wait`." msgstr "" -#: ../../library/multiprocessing.rst:1197 +#: ../../library/multiprocessing.rst:1211 msgid "Send byte data from a :term:`bytes-like object` as a complete message." msgstr "" -#: ../../library/multiprocessing.rst:1199 +#: ../../library/multiprocessing.rst:1213 msgid "" "If *offset* is given then data is read from that position in *buffer*. If " "*size* is given then that many bytes will be read from buffer. Very large " @@ -1318,7 +1349,7 @@ msgid "" "exc:`ValueError` exception" msgstr "" -#: ../../library/multiprocessing.rst:1206 +#: ../../library/multiprocessing.rst:1220 msgid "" "Return a complete message of byte data sent from the other end of the " "connection as a string. Blocks until there is something to receive. Raises :" @@ -1326,19 +1357,19 @@ msgid "" "closed." msgstr "" -#: ../../library/multiprocessing.rst:1211 +#: ../../library/multiprocessing.rst:1225 msgid "" "If *maxlength* is specified and the message is longer than *maxlength* then :" "exc:`OSError` is raised and the connection will no longer be readable." msgstr "" -#: ../../library/multiprocessing.rst:1215 +#: ../../library/multiprocessing.rst:1229 msgid "" "This function used to raise :exc:`IOError`, which is now an alias of :exc:" "`OSError`." msgstr "" -#: ../../library/multiprocessing.rst:1222 +#: ../../library/multiprocessing.rst:1236 msgid "" "Read into *buffer* a complete message of byte data sent from the other end " "of the connection and return the number of bytes in the message. Blocks " @@ -1346,45 +1377,45 @@ msgid "" "nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1228 +#: ../../library/multiprocessing.rst:1242 msgid "" "*buffer* must be a writable :term:`bytes-like object`. If *offset* is given " "then the message will be written into the buffer from that position. Offset " "must be a non-negative integer less than the length of *buffer* (in bytes)." msgstr "" -#: ../../library/multiprocessing.rst:1233 +#: ../../library/multiprocessing.rst:1247 msgid "" "If the buffer is too short then a :exc:`BufferTooShort` exception is raised " "and the complete message is available as ``e.args[0]`` where ``e`` is the " "exception instance." msgstr "" -#: ../../library/multiprocessing.rst:1237 +#: ../../library/multiprocessing.rst:1251 msgid "" "Connection objects themselves can now be transferred between processes " "using :meth:`Connection.send` and :meth:`Connection.recv`." msgstr "" -#: ../../library/multiprocessing.rst:1241 +#: ../../library/multiprocessing.rst:1255 msgid "" "Connection objects also now support the context management protocol -- see :" "ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:1245 +#: ../../library/multiprocessing.rst:1259 msgid "For example:" msgstr "" -#: ../../library/multiprocessing.rst:1270 +#: ../../library/multiprocessing.rst:1284 msgid "" "The :meth:`Connection.recv` method automatically unpickles the data it " "receives, which can be a security risk unless you can trust the process " "which sent the message." msgstr "" -#: ../../library/multiprocessing.rst:1274 +#: ../../library/multiprocessing.rst:1288 msgid "" "Therefore, unless the connection object was produced using :func:`Pipe` you " "should only use the :meth:`~Connection.recv` and :meth:`~Connection.send` " @@ -1392,73 +1423,73 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:1281 +#: ../../library/multiprocessing.rst:1295 msgid "" "If a process is killed while it is trying to read or write to a pipe then " "the data in the pipe is likely to become corrupted, because it may become " "impossible to be sure where the message boundaries lie." msgstr "" -#: ../../library/multiprocessing.rst:1287 +#: ../../library/multiprocessing.rst:1301 msgid "Synchronization primitives" msgstr "" -#: ../../library/multiprocessing.rst:1291 +#: ../../library/multiprocessing.rst:1305 msgid "" "Generally synchronization primitives are not as necessary in a multiprocess " "program as they are in a multithreaded program. See the documentation for :" "mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:1295 +#: ../../library/multiprocessing.rst:1309 msgid "" "Note that one can also create synchronization primitives by using a manager " "object -- see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:1300 +#: ../../library/multiprocessing.rst:1314 msgid "A barrier object: a clone of :class:`threading.Barrier`." msgstr "" -#: ../../library/multiprocessing.rst:1306 +#: ../../library/multiprocessing.rst:1320 msgid "" "A bounded semaphore object: a close analog of :class:`threading." "BoundedSemaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1309 -#: ../../library/multiprocessing.rst:1447 +#: ../../library/multiprocessing.rst:1323 +#: ../../library/multiprocessing.rst:1461 msgid "" "A solitary difference from its close analog exists: its ``acquire`` method's " "first argument is named *block*, as is consistent with :meth:`Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1313 +#: ../../library/multiprocessing.rst:1327 msgid "" "On macOS, this is indistinguishable from :class:`Semaphore` because " "``sem_getvalue()`` is not implemented on that platform." msgstr "" -#: ../../library/multiprocessing.rst:1318 +#: ../../library/multiprocessing.rst:1332 msgid "A condition variable: an alias for :class:`threading.Condition`." msgstr "" -#: ../../library/multiprocessing.rst:1320 +#: ../../library/multiprocessing.rst:1334 msgid "" "If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` " "object from :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:1323 -#: ../../library/multiprocessing.rst:1872 +#: ../../library/multiprocessing.rst:1337 +#: ../../library/multiprocessing.rst:1886 msgid "The :meth:`~threading.Condition.wait_for` method was added." msgstr "" -#: ../../library/multiprocessing.rst:1328 +#: ../../library/multiprocessing.rst:1342 msgid "A clone of :class:`threading.Event`." msgstr "" -#: ../../library/multiprocessing.rst:1333 +#: ../../library/multiprocessing.rst:1347 msgid "" "A non-recursive lock object: a close analog of :class:`threading.Lock`. Once " "a process or thread has acquired a lock, subsequent attempts to acquire it " @@ -1469,25 +1500,25 @@ msgid "" "as noted." msgstr "" -#: ../../library/multiprocessing.rst:1341 +#: ../../library/multiprocessing.rst:1355 msgid "" "Note that :class:`Lock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.Lock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1345 +#: ../../library/multiprocessing.rst:1359 msgid "" ":class:`Lock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1350 -#: ../../library/multiprocessing.rst:1401 +#: ../../library/multiprocessing.rst:1364 +#: ../../library/multiprocessing.rst:1415 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: ../../library/multiprocessing.rst:1352 +#: ../../library/multiprocessing.rst:1366 msgid "" "With the *block* argument set to ``True`` (the default), the method call " "will block until the lock is in an unlocked state, then set it to locked and " @@ -1495,14 +1526,14 @@ msgid "" "that in :meth:`threading.Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1357 +#: ../../library/multiprocessing.rst:1371 msgid "" "With the *block* argument set to ``False``, the method call does not block. " "If the lock is currently in a locked state, return ``False``; otherwise set " "the lock to a locked state and return ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1361 +#: ../../library/multiprocessing.rst:1375 msgid "" "When invoked with a positive, floating-point value for *timeout*, block for " "at most the number of seconds specified by *timeout* as long as the lock can " @@ -1516,19 +1547,19 @@ msgid "" "acquired or ``False`` if the timeout period has elapsed." msgstr "" -#: ../../library/multiprocessing.rst:1376 +#: ../../library/multiprocessing.rst:1390 msgid "" "Release a lock. This can be called from any process or thread, not only the " "process or thread which originally acquired the lock." msgstr "" -#: ../../library/multiprocessing.rst:1379 +#: ../../library/multiprocessing.rst:1393 msgid "" "Behavior is the same as in :meth:`threading.Lock.release` except that when " "invoked on an unlocked lock, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:1385 +#: ../../library/multiprocessing.rst:1399 msgid "" "A recursive lock object: a close analog of :class:`threading.RLock`. A " "recursive lock must be released by the process or thread that acquired it. " @@ -1537,20 +1568,20 @@ msgid "" "release it once for each time it has been acquired." msgstr "" -#: ../../library/multiprocessing.rst:1391 +#: ../../library/multiprocessing.rst:1405 msgid "" "Note that :class:`RLock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.RLock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1395 +#: ../../library/multiprocessing.rst:1409 msgid "" ":class:`RLock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1403 +#: ../../library/multiprocessing.rst:1417 msgid "" "When invoked with the *block* argument set to ``True``, block until the lock " "is in an unlocked state (not owned by any process or thread) unless the lock " @@ -1563,7 +1594,7 @@ msgid "" "itself." msgstr "" -#: ../../library/multiprocessing.rst:1413 +#: ../../library/multiprocessing.rst:1427 msgid "" "When invoked with the *block* argument set to ``False``, do not block. If " "the lock has already been acquired (and thus is owned) by another process or " @@ -1574,14 +1605,14 @@ msgid "" "a return value of ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1421 +#: ../../library/multiprocessing.rst:1435 msgid "" "Use and behaviors of the *timeout* argument are the same as in :meth:`Lock." "acquire`. Note that some of these behaviors of *timeout* differ from the " "implemented behaviors in :meth:`threading.RLock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1428 +#: ../../library/multiprocessing.rst:1442 msgid "" "Release a lock, decrementing the recursion level. If after the decrement " "the recursion level is zero, reset the lock to unlocked (not owned by any " @@ -1591,7 +1622,7 @@ msgid "" "locked and owned by the calling process or thread." msgstr "" -#: ../../library/multiprocessing.rst:1436 +#: ../../library/multiprocessing.rst:1450 msgid "" "Only call this method when the calling process or thread owns the lock. An :" "exc:`AssertionError` is raised if this method is called by a process or " @@ -1600,17 +1631,17 @@ msgid "" "from the implemented behavior in :meth:`threading.RLock.release`." msgstr "" -#: ../../library/multiprocessing.rst:1445 +#: ../../library/multiprocessing.rst:1459 msgid "A semaphore object: a close analog of :class:`threading.Semaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1452 +#: ../../library/multiprocessing.rst:1466 msgid "" "On macOS, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with a " "timeout will emulate that function's behavior using a sleeping loop." msgstr "" -#: ../../library/multiprocessing.rst:1457 +#: ../../library/multiprocessing.rst:1471 msgid "" "If the SIGINT signal generated by :kbd:`Ctrl-C` arrives while the main " "thread is blocked by a call to :meth:`BoundedSemaphore.acquire`, :meth:`Lock." @@ -1619,13 +1650,13 @@ msgid "" "interrupted and :exc:`KeyboardInterrupt` will be raised." msgstr "" -#: ../../library/multiprocessing.rst:1463 +#: ../../library/multiprocessing.rst:1477 msgid "" "This differs from the behaviour of :mod:`threading` where SIGINT will be " "ignored while the equivalent blocking calls are in progress." msgstr "" -#: ../../library/multiprocessing.rst:1468 +#: ../../library/multiprocessing.rst:1482 msgid "" "Some of this package's functionality requires a functioning shared semaphore " "implementation on the host operating system. Without one, the :mod:" @@ -1634,32 +1665,32 @@ msgid "" "additional information." msgstr "" -#: ../../library/multiprocessing.rst:1476 +#: ../../library/multiprocessing.rst:1490 msgid "Shared :mod:`ctypes` Objects" msgstr "" -#: ../../library/multiprocessing.rst:1478 +#: ../../library/multiprocessing.rst:1492 msgid "" "It is possible to create shared objects using shared memory which can be " "inherited by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1483 +#: ../../library/multiprocessing.rst:1497 msgid "" "Return a :mod:`ctypes` object allocated from shared memory. By default the " "return value is actually a synchronized wrapper for the object. The object " "itself can be accessed via the *value* attribute of a :class:`Value`." msgstr "" -#: ../../library/multiprocessing.rst:1487 -#: ../../library/multiprocessing.rst:1574 +#: ../../library/multiprocessing.rst:1501 +#: ../../library/multiprocessing.rst:1588 msgid "" "*typecode_or_type* determines the type of the returned object: it is either " "a ctypes type or a one character typecode of the kind used by the :mod:" "`array` module. *\\*args* is passed on to the constructor for the type." msgstr "" -#: ../../library/multiprocessing.rst:1491 +#: ../../library/multiprocessing.rst:1505 msgid "" "If *lock* is ``True`` (the default) then a new recursive lock object is " "created to synchronize access to the value. If *lock* is a :class:`Lock` " @@ -1669,32 +1700,32 @@ msgid "" "\"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1498 +#: ../../library/multiprocessing.rst:1512 msgid "" "Operations like ``+=`` which involve a read and write are not atomic. So " "if, for instance, you want to atomically increment a shared value it is " "insufficient to just do ::" msgstr "" -#: ../../library/multiprocessing.rst:1504 +#: ../../library/multiprocessing.rst:1518 msgid "" "Assuming the associated lock is recursive (which it is by default) you can " "instead do ::" msgstr "" -#: ../../library/multiprocessing.rst:1510 -#: ../../library/multiprocessing.rst:1600 -#: ../../library/multiprocessing.rst:1615 +#: ../../library/multiprocessing.rst:1524 +#: ../../library/multiprocessing.rst:1614 +#: ../../library/multiprocessing.rst:1629 msgid "Note that *lock* is a keyword-only argument." msgstr "" -#: ../../library/multiprocessing.rst:1514 +#: ../../library/multiprocessing.rst:1528 msgid "" "Return a ctypes array allocated from shared memory. By default the return " "value is actually a synchronized wrapper for the array." msgstr "" -#: ../../library/multiprocessing.rst:1517 +#: ../../library/multiprocessing.rst:1531 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -1704,7 +1735,7 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1524 +#: ../../library/multiprocessing.rst:1538 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`Lock` or :class:" @@ -1714,28 +1745,28 @@ msgid "" "safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1531 +#: ../../library/multiprocessing.rst:1545 msgid "Note that *lock* is a keyword only argument." msgstr "" -#: ../../library/multiprocessing.rst:1533 +#: ../../library/multiprocessing.rst:1547 msgid "" "Note that an array of :data:`ctypes.c_char` has *value* and *raw* attributes " "which allow one to use it to store and retrieve strings." msgstr "" -#: ../../library/multiprocessing.rst:1538 +#: ../../library/multiprocessing.rst:1552 msgid "The :mod:`multiprocessing.sharedctypes` module" msgstr "" -#: ../../library/multiprocessing.rst:1543 +#: ../../library/multiprocessing.rst:1557 msgid "" "The :mod:`multiprocessing.sharedctypes` module provides functions for " "allocating :mod:`ctypes` objects from shared memory which can be inherited " "by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1549 +#: ../../library/multiprocessing.rst:1563 msgid "" "Although it is possible to store a pointer in shared memory remember that " "this will refer to a location in the address space of a specific process. " @@ -1744,11 +1775,11 @@ msgid "" "may cause a crash." msgstr "" -#: ../../library/multiprocessing.rst:1557 +#: ../../library/multiprocessing.rst:1571 msgid "Return a ctypes array allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1559 +#: ../../library/multiprocessing.rst:1573 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -1758,40 +1789,40 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1566 +#: ../../library/multiprocessing.rst:1580 msgid "" "Note that setting and getting an element is potentially non-atomic -- use :" "func:`Array` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1572 +#: ../../library/multiprocessing.rst:1586 msgid "Return a ctypes object allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1578 +#: ../../library/multiprocessing.rst:1592 msgid "" "Note that setting and getting the value is potentially non-atomic -- use :" "func:`Value` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1582 +#: ../../library/multiprocessing.rst:1596 msgid "" "Note that an array of :data:`ctypes.c_char` has ``value`` and ``raw`` " "attributes which allow one to use it to store and retrieve strings -- see " "documentation for :mod:`ctypes`." msgstr "" -#: ../../library/multiprocessing.rst:1588 +#: ../../library/multiprocessing.rst:1602 msgid "" "The same as :func:`RawArray` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "array." msgstr "" -#: ../../library/multiprocessing.rst:1592 -#: ../../library/multiprocessing.rst:1608 +#: ../../library/multiprocessing.rst:1606 +#: ../../library/multiprocessing.rst:1622 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`~multiprocessing." @@ -1801,121 +1832,121 @@ msgid "" "not necessarily be \"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1604 +#: ../../library/multiprocessing.rst:1618 msgid "" "The same as :func:`RawValue` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "object." msgstr "" -#: ../../library/multiprocessing.rst:1619 +#: ../../library/multiprocessing.rst:1633 msgid "" "Return a ctypes object allocated from shared memory which is a copy of the " "ctypes object *obj*." msgstr "" -#: ../../library/multiprocessing.rst:1624 +#: ../../library/multiprocessing.rst:1638 msgid "" "Return a process-safe wrapper object for a ctypes object which uses *lock* " "to synchronize access. If *lock* is ``None`` (the default) then a :class:" "`multiprocessing.RLock` object is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1628 +#: ../../library/multiprocessing.rst:1642 msgid "" "A synchronized wrapper will have two methods in addition to those of the " "object it wraps: :meth:`get_obj` returns the wrapped object and :meth:" "`get_lock` returns the lock object used for synchronization." msgstr "" -#: ../../library/multiprocessing.rst:1632 +#: ../../library/multiprocessing.rst:1646 msgid "" "Note that accessing the ctypes object through the wrapper can be a lot " "slower than accessing the raw ctypes object." msgstr "" -#: ../../library/multiprocessing.rst:1635 +#: ../../library/multiprocessing.rst:1649 msgid "Synchronized objects support the :term:`context manager` protocol." msgstr "" -#: ../../library/multiprocessing.rst:1639 +#: ../../library/multiprocessing.rst:1653 msgid "" "The table below compares the syntax for creating shared ctypes objects from " "shared memory with the normal ctypes syntax. (In the table ``MyStruct`` is " "some subclass of :class:`ctypes.Structure`.)" msgstr "" -#: ../../library/multiprocessing.rst:1644 +#: ../../library/multiprocessing.rst:1658 msgid "ctypes" msgstr "ctypes" -#: ../../library/multiprocessing.rst:1644 +#: ../../library/multiprocessing.rst:1658 msgid "sharedctypes using type" msgstr "" -#: ../../library/multiprocessing.rst:1644 +#: ../../library/multiprocessing.rst:1658 msgid "sharedctypes using typecode" msgstr "" -#: ../../library/multiprocessing.rst:1646 +#: ../../library/multiprocessing.rst:1660 msgid "c_double(2.4)" msgstr "c_double(2.4)" -#: ../../library/multiprocessing.rst:1646 +#: ../../library/multiprocessing.rst:1660 msgid "RawValue(c_double, 2.4)" msgstr "RawValue(c_double, 2.4)" -#: ../../library/multiprocessing.rst:1646 +#: ../../library/multiprocessing.rst:1660 msgid "RawValue('d', 2.4)" msgstr "RawValue('d', 2.4)" -#: ../../library/multiprocessing.rst:1647 +#: ../../library/multiprocessing.rst:1661 msgid "MyStruct(4, 6)" msgstr "MyStruct(4, 6)" -#: ../../library/multiprocessing.rst:1647 +#: ../../library/multiprocessing.rst:1661 msgid "RawValue(MyStruct, 4, 6)" msgstr "RawValue(MyStruct, 4, 6)" -#: ../../library/multiprocessing.rst:1648 +#: ../../library/multiprocessing.rst:1662 msgid "(c_short * 7)()" msgstr "(c_short * 7)()" -#: ../../library/multiprocessing.rst:1648 +#: ../../library/multiprocessing.rst:1662 msgid "RawArray(c_short, 7)" msgstr "RawArray(c_short, 7)" -#: ../../library/multiprocessing.rst:1648 +#: ../../library/multiprocessing.rst:1662 msgid "RawArray('h', 7)" msgstr "RawArray('h', 7)" -#: ../../library/multiprocessing.rst:1649 +#: ../../library/multiprocessing.rst:1663 msgid "(c_int * 3)(9, 2, 8)" msgstr "(c_int * 3)(9, 2, 8)" -#: ../../library/multiprocessing.rst:1649 +#: ../../library/multiprocessing.rst:1663 msgid "RawArray(c_int, (9, 2, 8))" msgstr "RawArray(c_int, (9, 2, 8))" -#: ../../library/multiprocessing.rst:1649 +#: ../../library/multiprocessing.rst:1663 msgid "RawArray('i', (9, 2, 8))" msgstr "RawArray('i', (9, 2, 8))" -#: ../../library/multiprocessing.rst:1653 +#: ../../library/multiprocessing.rst:1667 msgid "" "Below is an example where a number of ctypes objects are modified by a child " "process::" msgstr "" -#: ../../library/multiprocessing.rst:1691 +#: ../../library/multiprocessing.rst:1705 msgid "The results printed are ::" msgstr "" -#: ../../library/multiprocessing.rst:1704 +#: ../../library/multiprocessing.rst:1718 msgid "Managers" msgstr "" -#: ../../library/multiprocessing.rst:1706 +#: ../../library/multiprocessing.rst:1720 msgid "" "Managers provide a way to create data which can be shared between different " "processes, including sharing over a network between processes running on " @@ -1924,7 +1955,7 @@ msgid "" "proxies." msgstr "" -#: ../../library/multiprocessing.rst:1715 +#: ../../library/multiprocessing.rst:1729 msgid "" "Returns a started :class:`~multiprocessing.managers.SyncManager` object " "which can be used for sharing objects between processes. The returned " @@ -1932,31 +1963,31 @@ msgid "" "will create shared objects and return corresponding proxies." msgstr "" -#: ../../library/multiprocessing.rst:1723 +#: ../../library/multiprocessing.rst:1737 msgid "" "Manager processes will be shutdown as soon as they are garbage collected or " "their parent process exits. The manager classes are defined in the :mod:" "`multiprocessing.managers` module:" msgstr "" -#: ../../library/multiprocessing.rst:1729 +#: ../../library/multiprocessing.rst:1743 msgid "Create a BaseManager object." msgstr "" -#: ../../library/multiprocessing.rst:1731 +#: ../../library/multiprocessing.rst:1745 msgid "" "Once created one should call :meth:`start` or ``get_server()." "serve_forever()`` to ensure that the manager object refers to a started " "manager process." msgstr "" -#: ../../library/multiprocessing.rst:1734 +#: ../../library/multiprocessing.rst:1748 msgid "" "*address* is the address on which the manager process listens for new " "connections. If *address* is ``None`` then an arbitrary one is chosen." msgstr "" -#: ../../library/multiprocessing.rst:1737 +#: ../../library/multiprocessing.rst:1751 msgid "" "*authkey* is the authentication key which will be used to check the validity " "of incoming connections to the server process. If *authkey* is ``None`` " @@ -1964,19 +1995,19 @@ msgid "" "it must be a byte string." msgstr "" -#: ../../library/multiprocessing.rst:1742 +#: ../../library/multiprocessing.rst:1756 msgid "" "*serializer* must be ``'pickle'`` (use :mod:`pickle` serialization) or " "``'xmlrpclib'`` (use :mod:`xmlrpc.client` serialization)." msgstr "" -#: ../../library/multiprocessing.rst:1745 +#: ../../library/multiprocessing.rst:1759 msgid "" "*ctx* is a context object, or ``None`` (use the current context). See the :" "func:`get_context` function." msgstr "" -#: ../../library/multiprocessing.rst:1748 +#: ../../library/multiprocessing.rst:1762 msgid "" "*shutdown_timeout* is a timeout in seconds used to wait until the process " "used by the manager completes in the :meth:`shutdown` method. If the " @@ -1984,54 +2015,54 @@ msgid "" "also times out, the process is killed." msgstr "" -#: ../../library/multiprocessing.rst:1753 +#: ../../library/multiprocessing.rst:1767 msgid "Added the *shutdown_timeout* parameter." msgstr "新增 *shutdown_timeout* 參數。" -#: ../../library/multiprocessing.rst:1758 +#: ../../library/multiprocessing.rst:1772 msgid "" "Start a subprocess to start the manager. If *initializer* is not ``None`` " "then the subprocess will call ``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:1763 +#: ../../library/multiprocessing.rst:1777 msgid "" "Returns a :class:`Server` object which represents the actual server under " "the control of the Manager. The :class:`Server` object supports the :meth:" "`serve_forever` method::" msgstr "" -#: ../../library/multiprocessing.rst:1772 +#: ../../library/multiprocessing.rst:1786 msgid ":class:`Server` additionally has an :attr:`address` attribute." msgstr "" -#: ../../library/multiprocessing.rst:1776 +#: ../../library/multiprocessing.rst:1790 msgid "Connect a local manager object to a remote manager process::" msgstr "" -#: ../../library/multiprocessing.rst:1784 +#: ../../library/multiprocessing.rst:1798 msgid "" "Stop the process used by the manager. This is only available if :meth:" "`start` has been used to start the server process." msgstr "" -#: ../../library/multiprocessing.rst:1787 +#: ../../library/multiprocessing.rst:1801 msgid "This can be called multiple times." msgstr "" -#: ../../library/multiprocessing.rst:1791 +#: ../../library/multiprocessing.rst:1805 msgid "" "A classmethod which can be used for registering a type or callable with the " "manager class." msgstr "" -#: ../../library/multiprocessing.rst:1794 +#: ../../library/multiprocessing.rst:1808 msgid "" "*typeid* is a \"type identifier\" which is used to identify a particular " "type of shared object. This must be a string." msgstr "" -#: ../../library/multiprocessing.rst:1797 +#: ../../library/multiprocessing.rst:1811 msgid "" "*callable* is a callable used for creating objects for this type " "identifier. If a manager instance will be connected to the server using " @@ -2039,14 +2070,14 @@ msgid "" "then this can be left as ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1803 +#: ../../library/multiprocessing.rst:1817 msgid "" "*proxytype* is a subclass of :class:`BaseProxy` which is used to create " "proxies for shared objects with this *typeid*. If ``None`` then a proxy " "class is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1807 +#: ../../library/multiprocessing.rst:1821 msgid "" "*exposed* is used to specify a sequence of method names which proxies for " "this typeid should be allowed to access using :meth:`BaseProxy." @@ -2057,7 +2088,7 @@ msgid "" "method and whose name does not begin with ``'_'``.)" msgstr "" -#: ../../library/multiprocessing.rst:1816 +#: ../../library/multiprocessing.rst:1830 msgid "" "*method_to_typeid* is a mapping used to specify the return type of those " "exposed methods which should return a proxy. It maps method names to typeid " @@ -2067,22 +2098,22 @@ msgid "" "returned by the method will be copied by value." msgstr "" -#: ../../library/multiprocessing.rst:1823 +#: ../../library/multiprocessing.rst:1837 msgid "" "*create_method* determines whether a method should be created with name " "*typeid* which can be used to tell the server process to create a new shared " "object and return a proxy for it. By default it is ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1827 +#: ../../library/multiprocessing.rst:1841 msgid ":class:`BaseManager` instances also have one read-only property:" msgstr "" -#: ../../library/multiprocessing.rst:1831 +#: ../../library/multiprocessing.rst:1845 msgid "The address used by the manager." msgstr "" -#: ../../library/multiprocessing.rst:1833 +#: ../../library/multiprocessing.rst:1847 msgid "" "Manager objects support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the server " @@ -2090,173 +2121,173 @@ msgid "" "object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`." msgstr "" -#: ../../library/multiprocessing.rst:1839 +#: ../../library/multiprocessing.rst:1853 msgid "" "In previous versions :meth:`~contextmanager.__enter__` did not start the " "manager's server process if it was not already started." msgstr "" -#: ../../library/multiprocessing.rst:1844 +#: ../../library/multiprocessing.rst:1858 msgid "" "A subclass of :class:`BaseManager` which can be used for the synchronization " "of processes. Objects of this type are returned by :func:`multiprocessing." "Manager`." msgstr "" -#: ../../library/multiprocessing.rst:1848 +#: ../../library/multiprocessing.rst:1862 msgid "" "Its methods create and return :ref:`multiprocessing-proxy_objects` for a " "number of commonly used data types to be synchronized across processes. This " "notably includes shared lists and dictionaries." msgstr "" -#: ../../library/multiprocessing.rst:1854 +#: ../../library/multiprocessing.rst:1868 msgid "" "Create a shared :class:`threading.Barrier` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1861 +#: ../../library/multiprocessing.rst:1875 msgid "" "Create a shared :class:`threading.BoundedSemaphore` object and return a " "proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1866 +#: ../../library/multiprocessing.rst:1880 msgid "" "Create a shared :class:`threading.Condition` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1869 +#: ../../library/multiprocessing.rst:1883 msgid "" "If *lock* is supplied then it should be a proxy for a :class:`threading." "Lock` or :class:`threading.RLock` object." msgstr "" -#: ../../library/multiprocessing.rst:1877 +#: ../../library/multiprocessing.rst:1891 msgid "" "Create a shared :class:`threading.Event` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1881 +#: ../../library/multiprocessing.rst:1895 msgid "" "Create a shared :class:`threading.Lock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1885 +#: ../../library/multiprocessing.rst:1899 msgid "Create a shared :class:`Namespace` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1889 +#: ../../library/multiprocessing.rst:1903 msgid "Create a shared :class:`queue.Queue` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1893 +#: ../../library/multiprocessing.rst:1907 msgid "" "Create a shared :class:`threading.RLock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1897 +#: ../../library/multiprocessing.rst:1911 msgid "" "Create a shared :class:`threading.Semaphore` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1902 +#: ../../library/multiprocessing.rst:1916 msgid "Create an array and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1906 +#: ../../library/multiprocessing.rst:1920 msgid "" "Create an object with a writable ``value`` attribute and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1913 +#: ../../library/multiprocessing.rst:1927 msgid "Create a shared :class:`dict` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1918 +#: ../../library/multiprocessing.rst:1932 msgid "Create a shared :class:`list` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1920 +#: ../../library/multiprocessing.rst:1934 msgid "" "Shared objects are capable of being nested. For example, a shared container " "object such as a shared list can contain other shared objects which will all " "be managed and synchronized by the :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1927 +#: ../../library/multiprocessing.rst:1941 msgid "A type that can register with :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1929 +#: ../../library/multiprocessing.rst:1943 msgid "" "A namespace object has no public methods, but does have writable attributes. " "Its representation shows the values of its attributes." msgstr "" -#: ../../library/multiprocessing.rst:1932 +#: ../../library/multiprocessing.rst:1946 msgid "" "However, when using a proxy for a namespace object, an attribute beginning " "with ``'_'`` will be an attribute of the proxy and not an attribute of the " "referent:" msgstr "" -#: ../../library/multiprocessing.rst:1949 +#: ../../library/multiprocessing.rst:1963 msgid "Customized managers" msgstr "" -#: ../../library/multiprocessing.rst:1951 +#: ../../library/multiprocessing.rst:1965 msgid "" "To create one's own manager, one creates a subclass of :class:`BaseManager` " "and uses the :meth:`~BaseManager.register` classmethod to register new types " "or callables with the manager class. For example::" msgstr "" -#: ../../library/multiprocessing.rst:1976 +#: ../../library/multiprocessing.rst:1990 msgid "Using a remote manager" msgstr "" -#: ../../library/multiprocessing.rst:1978 +#: ../../library/multiprocessing.rst:1992 msgid "" "It is possible to run a manager server on one machine and have clients use " "it from other machines (assuming that the firewalls involved allow it)." msgstr "" -#: ../../library/multiprocessing.rst:1981 +#: ../../library/multiprocessing.rst:1995 msgid "" "Running the following commands creates a server for a single shared queue " "which remote clients can access::" msgstr "" -#: ../../library/multiprocessing.rst:1993 +#: ../../library/multiprocessing.rst:2007 msgid "One client can access the server as follows::" msgstr "" -#: ../../library/multiprocessing.rst:2003 +#: ../../library/multiprocessing.rst:2017 msgid "Another client can also use it::" msgstr "" -#: ../../library/multiprocessing.rst:2014 +#: ../../library/multiprocessing.rst:2028 msgid "" "Local processes can also access that queue, using the code from above on the " "client to access it remotely::" msgstr "" -#: ../../library/multiprocessing.rst:2039 +#: ../../library/multiprocessing.rst:2053 msgid "Proxy Objects" msgstr "" -#: ../../library/multiprocessing.rst:2041 +#: ../../library/multiprocessing.rst:2055 msgid "" "A proxy is an object which *refers* to a shared object which lives " "(presumably) in a different process. The shared object is said to be the " "*referent* of the proxy. Multiple proxy objects may have the same referent." msgstr "" -#: ../../library/multiprocessing.rst:2045 +#: ../../library/multiprocessing.rst:2059 msgid "" "A proxy object has methods which invoke corresponding methods of its " "referent (although not every method of the referent will necessarily be " @@ -2264,14 +2295,14 @@ msgid "" "its referent can:" msgstr "" -#: ../../library/multiprocessing.rst:2063 +#: ../../library/multiprocessing.rst:2077 msgid "" "Notice that applying :func:`str` to a proxy will return the representation " "of the referent, whereas applying :func:`repr` will return the " "representation of the proxy." msgstr "" -#: ../../library/multiprocessing.rst:2067 +#: ../../library/multiprocessing.rst:2081 msgid "" "An important feature of proxy objects is that they are picklable so they can " "be passed between processes. As such, a referent can contain :ref:" @@ -2279,11 +2310,11 @@ msgid "" "lists, dicts, and other :ref:`multiprocessing-proxy_objects`:" msgstr "" -#: ../../library/multiprocessing.rst:2083 +#: ../../library/multiprocessing.rst:2097 msgid "Similarly, dict and list proxies may be nested inside one another::" msgstr "" -#: ../../library/multiprocessing.rst:2096 +#: ../../library/multiprocessing.rst:2110 msgid "" "If standard (non-proxy) :class:`list` or :class:`dict` objects are contained " "in a referent, modifications to those mutable values will not be propagated " @@ -2294,53 +2325,53 @@ msgid "" "assign the modified value to the container proxy::" msgstr "" -#: ../../library/multiprocessing.rst:2115 +#: ../../library/multiprocessing.rst:2129 msgid "" "This approach is perhaps less convenient than employing nested :ref:" "`multiprocessing-proxy_objects` for most use cases but also demonstrates a " "level of control over the synchronization." msgstr "" -#: ../../library/multiprocessing.rst:2121 +#: ../../library/multiprocessing.rst:2135 msgid "" "The proxy types in :mod:`multiprocessing` do nothing to support comparisons " "by value. So, for instance, we have:" msgstr "" -#: ../../library/multiprocessing.rst:2129 +#: ../../library/multiprocessing.rst:2143 msgid "" "One should just use a copy of the referent instead when making comparisons." msgstr "" -#: ../../library/multiprocessing.rst:2133 +#: ../../library/multiprocessing.rst:2147 msgid "Proxy objects are instances of subclasses of :class:`BaseProxy`." msgstr "" -#: ../../library/multiprocessing.rst:2137 +#: ../../library/multiprocessing.rst:2151 msgid "Call and return the result of a method of the proxy's referent." msgstr "" -#: ../../library/multiprocessing.rst:2139 +#: ../../library/multiprocessing.rst:2153 msgid "" "If ``proxy`` is a proxy whose referent is ``obj`` then the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2143 +#: ../../library/multiprocessing.rst:2157 msgid "will evaluate the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2147 +#: ../../library/multiprocessing.rst:2161 msgid "in the manager's process." msgstr "" -#: ../../library/multiprocessing.rst:2149 +#: ../../library/multiprocessing.rst:2163 msgid "" "The returned value will be a copy of the result of the call or a proxy to a " "new shared object -- see documentation for the *method_to_typeid* argument " "of :meth:`BaseManager.register`." msgstr "" -#: ../../library/multiprocessing.rst:2153 +#: ../../library/multiprocessing.rst:2167 msgid "" "If an exception is raised by the call, then is re-raised by :meth:" "`_callmethod`. If some other exception is raised in the manager's process " @@ -2348,79 +2379,79 @@ msgid "" "meth:`_callmethod`." msgstr "" -#: ../../library/multiprocessing.rst:2158 +#: ../../library/multiprocessing.rst:2172 msgid "" "Note in particular that an exception will be raised if *methodname* has not " "been *exposed*." msgstr "" -#: ../../library/multiprocessing.rst:2161 +#: ../../library/multiprocessing.rst:2175 msgid "An example of the usage of :meth:`_callmethod`:" msgstr "" -#: ../../library/multiprocessing.rst:2177 +#: ../../library/multiprocessing.rst:2191 msgid "Return a copy of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2179 +#: ../../library/multiprocessing.rst:2193 msgid "If the referent is unpicklable then this will raise an exception." msgstr "" -#: ../../library/multiprocessing.rst:2183 +#: ../../library/multiprocessing.rst:2197 msgid "Return a representation of the proxy object." msgstr "" -#: ../../library/multiprocessing.rst:2187 +#: ../../library/multiprocessing.rst:2201 msgid "Return the representation of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2191 +#: ../../library/multiprocessing.rst:2205 msgid "Cleanup" msgstr "" -#: ../../library/multiprocessing.rst:2193 +#: ../../library/multiprocessing.rst:2207 msgid "" "A proxy object uses a weakref callback so that when it gets garbage " "collected it deregisters itself from the manager which owns its referent." msgstr "" -#: ../../library/multiprocessing.rst:2196 +#: ../../library/multiprocessing.rst:2210 msgid "" "A shared object gets deleted from the manager process when there are no " "longer any proxies referring to it." msgstr "" -#: ../../library/multiprocessing.rst:2201 +#: ../../library/multiprocessing.rst:2215 msgid "Process Pools" msgstr "" -#: ../../library/multiprocessing.rst:2206 +#: ../../library/multiprocessing.rst:2220 msgid "" "One can create a pool of processes which will carry out tasks submitted to " "it with the :class:`Pool` class." msgstr "" -#: ../../library/multiprocessing.rst:2211 +#: ../../library/multiprocessing.rst:2225 msgid "" "A process pool object which controls a pool of worker processes to which " "jobs can be submitted. It supports asynchronous results with timeouts and " "callbacks and has a parallel map implementation." msgstr "" -#: ../../library/multiprocessing.rst:2215 +#: ../../library/multiprocessing.rst:2229 msgid "" "*processes* is the number of worker processes to use. If *processes* is " "``None`` then the number returned by :func:`os.cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2218 -#: ../../library/multiprocessing.rst:2779 +#: ../../library/multiprocessing.rst:2232 +#: ../../library/multiprocessing.rst:2793 msgid "" "If *initializer* is not ``None`` then each worker process will call " "``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:2221 +#: ../../library/multiprocessing.rst:2235 msgid "" "*maxtasksperchild* is the number of tasks a worker process can complete " "before it will exit and be replaced with a fresh worker process, to enable " @@ -2428,7 +2459,7 @@ msgid "" "which means worker processes will live as long as the pool." msgstr "" -#: ../../library/multiprocessing.rst:2226 +#: ../../library/multiprocessing.rst:2240 msgid "" "*context* can be used to specify the context used for starting the worker " "processes. Usually a pool is created using the function :func:" @@ -2436,13 +2467,13 @@ msgid "" "both cases *context* is set appropriately." msgstr "" -#: ../../library/multiprocessing.rst:2232 +#: ../../library/multiprocessing.rst:2246 msgid "" "Note that the methods of the pool object should only be called by the " "process which created the pool." msgstr "" -#: ../../library/multiprocessing.rst:2236 +#: ../../library/multiprocessing.rst:2250 msgid "" ":class:`multiprocessing.pool` objects have internal resources that need to " "be properly managed (like any other resource) by using the pool as a context " @@ -2450,22 +2481,22 @@ msgid "" "to do this can lead to the process hanging on finalization." msgstr "" -#: ../../library/multiprocessing.rst:2241 +#: ../../library/multiprocessing.rst:2255 msgid "" "Note that it is **not correct** to rely on the garbage collector to destroy " "the pool as CPython does not assure that the finalizer of the pool will be " "called (see :meth:`object.__del__` for more information)." msgstr "" -#: ../../library/multiprocessing.rst:2245 +#: ../../library/multiprocessing.rst:2259 msgid "Added the *maxtasksperchild* parameter." msgstr "新增 *maxtasksperchild* 參數。" -#: ../../library/multiprocessing.rst:2248 +#: ../../library/multiprocessing.rst:2262 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" -#: ../../library/multiprocessing.rst:2253 +#: ../../library/multiprocessing.rst:2267 msgid "" "Worker processes within a :class:`Pool` typically live for the complete " "duration of the Pool's work queue. A frequent pattern found in other systems " @@ -2476,7 +2507,7 @@ msgid "" "ability to the end user." msgstr "" -#: ../../library/multiprocessing.rst:2263 +#: ../../library/multiprocessing.rst:2277 msgid "" "Call *func* with arguments *args* and keyword arguments *kwds*. It blocks " "until the result is ready. Given this blocks, :meth:`apply_async` is better " @@ -2484,14 +2515,14 @@ msgid "" "executed in one of the workers of the pool." msgstr "" -#: ../../library/multiprocessing.rst:2270 +#: ../../library/multiprocessing.rst:2284 msgid "" "A variant of the :meth:`apply` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2273 -#: ../../library/multiprocessing.rst:2304 +#: ../../library/multiprocessing.rst:2287 +#: ../../library/multiprocessing.rst:2318 msgid "" "If *callback* is specified then it should be a callable which accepts a " "single argument. When the result becomes ready *callback* is applied to it, " @@ -2499,60 +2530,60 @@ msgid "" "applied instead." msgstr "" -#: ../../library/multiprocessing.rst:2278 -#: ../../library/multiprocessing.rst:2309 +#: ../../library/multiprocessing.rst:2292 +#: ../../library/multiprocessing.rst:2323 msgid "" "If *error_callback* is specified then it should be a callable which accepts " "a single argument. If the target function fails, then the *error_callback* " "is called with the exception instance." msgstr "" -#: ../../library/multiprocessing.rst:2282 -#: ../../library/multiprocessing.rst:2313 +#: ../../library/multiprocessing.rst:2296 +#: ../../library/multiprocessing.rst:2327 msgid "" "Callbacks should complete immediately since otherwise the thread which " "handles the results will get blocked." msgstr "" -#: ../../library/multiprocessing.rst:2287 +#: ../../library/multiprocessing.rst:2301 msgid "" "A parallel equivalent of the :func:`map` built-in function (it supports only " "one *iterable* argument though, for multiple iterables see :meth:`starmap`). " "It blocks until the result is ready." msgstr "" -#: ../../library/multiprocessing.rst:2291 +#: ../../library/multiprocessing.rst:2305 msgid "" "This method chops the iterable into a number of chunks which it submits to " "the process pool as separate tasks. The (approximate) size of these chunks " "can be specified by setting *chunksize* to a positive integer." msgstr "" -#: ../../library/multiprocessing.rst:2295 +#: ../../library/multiprocessing.rst:2309 msgid "" "Note that it may cause high memory usage for very long iterables. Consider " "using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize* " "option for better efficiency." msgstr "" -#: ../../library/multiprocessing.rst:2301 +#: ../../library/multiprocessing.rst:2315 msgid "" "A variant of the :meth:`.map` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2318 +#: ../../library/multiprocessing.rst:2332 msgid "A lazier version of :meth:`.map`." msgstr "" -#: ../../library/multiprocessing.rst:2320 +#: ../../library/multiprocessing.rst:2334 msgid "" "The *chunksize* argument is the same as the one used by the :meth:`.map` " "method. For very long iterables using a large value for *chunksize* can " "make the job complete **much** faster than using the default value of ``1``." msgstr "" -#: ../../library/multiprocessing.rst:2325 +#: ../../library/multiprocessing.rst:2339 msgid "" "Also if *chunksize* is ``1`` then the :meth:`!next` method of the iterator " "returned by the :meth:`imap` method has an optional *timeout* parameter: " @@ -2560,65 +2591,65 @@ msgid "" "result cannot be returned within *timeout* seconds." msgstr "" -#: ../../library/multiprocessing.rst:2332 +#: ../../library/multiprocessing.rst:2346 msgid "" "The same as :meth:`imap` except that the ordering of the results from the " "returned iterator should be considered arbitrary. (Only when there is only " "one worker process is the order guaranteed to be \"correct\".)" msgstr "" -#: ../../library/multiprocessing.rst:2338 +#: ../../library/multiprocessing.rst:2352 msgid "" "Like :meth:`~multiprocessing.pool.Pool.map` except that the elements of the " "*iterable* are expected to be iterables that are unpacked as arguments." msgstr "" -#: ../../library/multiprocessing.rst:2342 +#: ../../library/multiprocessing.rst:2356 msgid "" "Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2), " "func(3,4)]``." msgstr "" -#: ../../library/multiprocessing.rst:2349 +#: ../../library/multiprocessing.rst:2363 msgid "" "A combination of :meth:`starmap` and :meth:`map_async` that iterates over " "*iterable* of iterables and calls *func* with the iterables unpacked. " "Returns a result object." msgstr "" -#: ../../library/multiprocessing.rst:2357 +#: ../../library/multiprocessing.rst:2371 msgid "" "Prevents any more tasks from being submitted to the pool. Once all the " "tasks have been completed the worker processes will exit." msgstr "" -#: ../../library/multiprocessing.rst:2362 +#: ../../library/multiprocessing.rst:2376 msgid "" "Stops the worker processes immediately without completing outstanding work. " "When the pool object is garbage collected :meth:`terminate` will be called " "immediately." msgstr "" -#: ../../library/multiprocessing.rst:2368 +#: ../../library/multiprocessing.rst:2382 msgid "" "Wait for the worker processes to exit. One must call :meth:`close` or :meth:" "`terminate` before using :meth:`join`." msgstr "" -#: ../../library/multiprocessing.rst:2371 +#: ../../library/multiprocessing.rst:2385 msgid "" "Pool objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the pool " "object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`." msgstr "" -#: ../../library/multiprocessing.rst:2379 +#: ../../library/multiprocessing.rst:2393 msgid "" "The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool." "map_async`." msgstr "" -#: ../../library/multiprocessing.rst:2384 +#: ../../library/multiprocessing.rst:2398 msgid "" "Return the result when it arrives. If *timeout* is not ``None`` and the " "result does not arrive within *timeout* seconds then :exc:`multiprocessing." @@ -2626,41 +2657,41 @@ msgid "" "exception will be reraised by :meth:`get`." msgstr "" -#: ../../library/multiprocessing.rst:2391 +#: ../../library/multiprocessing.rst:2405 msgid "Wait until the result is available or until *timeout* seconds pass." msgstr "" -#: ../../library/multiprocessing.rst:2395 +#: ../../library/multiprocessing.rst:2409 msgid "Return whether the call has completed." msgstr "" -#: ../../library/multiprocessing.rst:2399 +#: ../../library/multiprocessing.rst:2413 msgid "" "Return whether the call completed without raising an exception. Will raise :" "exc:`ValueError` if the result is not ready." msgstr "" -#: ../../library/multiprocessing.rst:2402 +#: ../../library/multiprocessing.rst:2416 msgid "" "If the result is not ready, :exc:`ValueError` is raised instead of :exc:" "`AssertionError`." msgstr "" -#: ../../library/multiprocessing.rst:2406 +#: ../../library/multiprocessing.rst:2420 msgid "The following example demonstrates the use of a pool::" msgstr "" -#: ../../library/multiprocessing.rst:2433 +#: ../../library/multiprocessing.rst:2447 msgid "Listeners and Clients" msgstr "" -#: ../../library/multiprocessing.rst:2438 +#: ../../library/multiprocessing.rst:2452 msgid "" "Usually message passing between processes is done using queues or by using :" "class:`~Connection` objects returned by :func:`~multiprocessing.Pipe`." msgstr "" -#: ../../library/multiprocessing.rst:2442 +#: ../../library/multiprocessing.rst:2456 msgid "" "However, the :mod:`multiprocessing.connection` module allows some extra " "flexibility. It basically gives a high level message oriented API for " @@ -2669,46 +2700,46 @@ msgid "" "multiple connections at the same time." msgstr "" -#: ../../library/multiprocessing.rst:2451 +#: ../../library/multiprocessing.rst:2465 msgid "" "Send a randomly generated message to the other end of the connection and " "wait for a reply." msgstr "" -#: ../../library/multiprocessing.rst:2454 +#: ../../library/multiprocessing.rst:2468 msgid "" "If the reply matches the digest of the message using *authkey* as the key " "then a welcome message is sent to the other end of the connection. " "Otherwise :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2460 +#: ../../library/multiprocessing.rst:2474 msgid "" "Receive a message, calculate the digest of the message using *authkey* as " "the key, and then send the digest back." msgstr "" -#: ../../library/multiprocessing.rst:2463 +#: ../../library/multiprocessing.rst:2477 msgid "" "If a welcome message is not received, then :exc:`~multiprocessing." "AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2468 +#: ../../library/multiprocessing.rst:2482 msgid "" "Attempt to set up a connection to the listener which is using address " "*address*, returning a :class:`~Connection`." msgstr "" -#: ../../library/multiprocessing.rst:2471 +#: ../../library/multiprocessing.rst:2485 msgid "" "The type of the connection is determined by *family* argument, but this can " "generally be omitted since it can usually be inferred from the format of " "*address*. (See :ref:`multiprocessing-address-formats`)" msgstr "" -#: ../../library/multiprocessing.rst:2475 -#: ../../library/multiprocessing.rst:2510 +#: ../../library/multiprocessing.rst:2489 +#: ../../library/multiprocessing.rst:2524 msgid "" "If *authkey* is given and not ``None``, it should be a byte string and will " "be used as the secret key for an HMAC-based authentication challenge. No " @@ -2717,26 +2748,26 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:2483 +#: ../../library/multiprocessing.rst:2497 msgid "" "A wrapper for a bound socket or Windows named pipe which is 'listening' for " "connections." msgstr "" -#: ../../library/multiprocessing.rst:2486 +#: ../../library/multiprocessing.rst:2500 msgid "" "*address* is the address to be used by the bound socket or named pipe of the " "listener object." msgstr "" -#: ../../library/multiprocessing.rst:2491 +#: ../../library/multiprocessing.rst:2505 msgid "" "If an address of '0.0.0.0' is used, the address will not be a connectable " "end point on Windows. If you require a connectable end-point, you should use " "'127.0.0.1'." msgstr "" -#: ../../library/multiprocessing.rst:2495 +#: ../../library/multiprocessing.rst:2509 msgid "" "*family* is the type of socket (or named pipe) to use. This can be one of " "the strings ``'AF_INET'`` (for a TCP socket), ``'AF_UNIX'`` (for a Unix " @@ -2750,49 +2781,49 @@ msgid "" "using :func:`tempfile.mkstemp`." msgstr "" -#: ../../library/multiprocessing.rst:2506 +#: ../../library/multiprocessing.rst:2520 msgid "" "If the listener object uses a socket then *backlog* (1 by default) is passed " "to the :meth:`~socket.socket.listen` method of the socket once it has been " "bound." msgstr "" -#: ../../library/multiprocessing.rst:2518 +#: ../../library/multiprocessing.rst:2532 msgid "" "Accept a connection on the bound socket or named pipe of the listener object " "and return a :class:`~Connection` object. If authentication is attempted and " "fails, then :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2525 +#: ../../library/multiprocessing.rst:2539 msgid "" "Close the bound socket or named pipe of the listener object. This is called " "automatically when the listener is garbage collected. However it is " "advisable to call it explicitly." msgstr "" -#: ../../library/multiprocessing.rst:2529 +#: ../../library/multiprocessing.rst:2543 msgid "Listener objects have the following read-only properties:" msgstr "" -#: ../../library/multiprocessing.rst:2533 +#: ../../library/multiprocessing.rst:2547 msgid "The address which is being used by the Listener object." msgstr "" -#: ../../library/multiprocessing.rst:2537 +#: ../../library/multiprocessing.rst:2551 msgid "" "The address from which the last accepted connection came. If this is " "unavailable then it is ``None``." msgstr "" -#: ../../library/multiprocessing.rst:2540 +#: ../../library/multiprocessing.rst:2554 msgid "" "Listener objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "listener object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:2547 +#: ../../library/multiprocessing.rst:2561 msgid "" "Wait till an object in *object_list* is ready. Returns the list of those " "objects in *object_list* which are ready. If *timeout* is a float then the " @@ -2801,32 +2832,32 @@ msgid "" "zero timeout." msgstr "" -#: ../../library/multiprocessing.rst:2553 +#: ../../library/multiprocessing.rst:2567 msgid "" "For both POSIX and Windows, an object can appear in *object_list* if it is" msgstr "" -#: ../../library/multiprocessing.rst:2556 +#: ../../library/multiprocessing.rst:2570 msgid "a readable :class:`~multiprocessing.connection.Connection` object;" msgstr "" -#: ../../library/multiprocessing.rst:2557 +#: ../../library/multiprocessing.rst:2571 msgid "a connected and readable :class:`socket.socket` object; or" msgstr "" -#: ../../library/multiprocessing.rst:2558 +#: ../../library/multiprocessing.rst:2572 msgid "" "the :attr:`~multiprocessing.Process.sentinel` attribute of a :class:" "`~multiprocessing.Process` object." msgstr "" -#: ../../library/multiprocessing.rst:2561 +#: ../../library/multiprocessing.rst:2575 msgid "" "A connection or socket object is ready when there is data available to be " "read from it, or the other end has been closed." msgstr "" -#: ../../library/multiprocessing.rst:2564 +#: ../../library/multiprocessing.rst:2578 msgid "" "**POSIX**: ``wait(object_list, timeout)`` almost equivalent ``select." "select(object_list, [], [], timeout)``. The difference is that, if :func:" @@ -2834,7 +2865,7 @@ msgid "" "an error number of ``EINTR``, whereas :func:`wait` will not." msgstr "" -#: ../../library/multiprocessing.rst:2570 +#: ../../library/multiprocessing.rst:2584 msgid "" "**Windows**: An item in *object_list* must either be an integer handle which " "is waitable (according to the definition used by the documentation of the " @@ -2844,46 +2875,46 @@ msgid "" "handles.)" msgstr "" -#: ../../library/multiprocessing.rst:2580 +#: ../../library/multiprocessing.rst:2594 msgid "**Examples**" msgstr "" -#: ../../library/multiprocessing.rst:2582 +#: ../../library/multiprocessing.rst:2596 msgid "" "The following server code creates a listener which uses ``'secret " "password'`` as an authentication key. It then waits for a connection and " "sends some data to the client::" msgstr "" -#: ../../library/multiprocessing.rst:2601 +#: ../../library/multiprocessing.rst:2615 msgid "" "The following code connects to the server and receives some data from the " "server::" msgstr "" -#: ../../library/multiprocessing.rst:2618 +#: ../../library/multiprocessing.rst:2632 msgid "" "The following code uses :func:`~multiprocessing.connection.wait` to wait for " "messages from multiple processes at once::" msgstr "" -#: ../../library/multiprocessing.rst:2657 +#: ../../library/multiprocessing.rst:2671 msgid "Address Formats" msgstr "" -#: ../../library/multiprocessing.rst:2659 +#: ../../library/multiprocessing.rst:2673 msgid "" "An ``'AF_INET'`` address is a tuple of the form ``(hostname, port)`` where " "*hostname* is a string and *port* is an integer." msgstr "" -#: ../../library/multiprocessing.rst:2662 +#: ../../library/multiprocessing.rst:2676 msgid "" "An ``'AF_UNIX'`` address is a string representing a filename on the " "filesystem." msgstr "" -#: ../../library/multiprocessing.rst:2665 +#: ../../library/multiprocessing.rst:2679 msgid "" "An ``'AF_PIPE'`` address is a string of the form :samp:`r'\\\\\\\\\\\\.\\" "\\pipe\\\\\\\\{PipeName}'`. To use :func:`Client` to connect to a named " @@ -2892,17 +2923,17 @@ msgid "" "instead." msgstr "" -#: ../../library/multiprocessing.rst:2670 +#: ../../library/multiprocessing.rst:2684 msgid "" "Note that any string beginning with two backslashes is assumed by default to " "be an ``'AF_PIPE'`` address rather than an ``'AF_UNIX'`` address." msgstr "" -#: ../../library/multiprocessing.rst:2677 +#: ../../library/multiprocessing.rst:2691 msgid "Authentication keys" msgstr "" -#: ../../library/multiprocessing.rst:2679 +#: ../../library/multiprocessing.rst:2693 msgid "" "When one uses :meth:`Connection.recv `, the data received " "is automatically unpickled. Unfortunately unpickling data from an untrusted " @@ -2910,7 +2941,7 @@ msgid "" "use the :mod:`hmac` module to provide digest authentication." msgstr "" -#: ../../library/multiprocessing.rst:2685 +#: ../../library/multiprocessing.rst:2699 msgid "" "An authentication key is a byte string which can be thought of as a " "password: once a connection is established both ends will demand proof that " @@ -2918,7 +2949,7 @@ msgid "" "using the same key does **not** involve sending the key over the connection.)" msgstr "" -#: ../../library/multiprocessing.rst:2691 +#: ../../library/multiprocessing.rst:2705 msgid "" "If authentication is requested but no authentication key is specified then " "the return value of ``current_process().authkey`` is used (see :class:" @@ -2929,17 +2960,17 @@ msgid "" "setting up connections between themselves." msgstr "" -#: ../../library/multiprocessing.rst:2699 +#: ../../library/multiprocessing.rst:2713 msgid "" "Suitable authentication keys can also be generated by using :func:`os." "urandom`." msgstr "" -#: ../../library/multiprocessing.rst:2703 +#: ../../library/multiprocessing.rst:2717 msgid "Logging" msgstr "" -#: ../../library/multiprocessing.rst:2705 +#: ../../library/multiprocessing.rst:2719 msgid "" "Some support for logging is available. Note, however, that the :mod:" "`logging` package does not use process shared locks so it is possible " @@ -2947,27 +2978,27 @@ msgid "" "mixed up." msgstr "" -#: ../../library/multiprocessing.rst:2712 +#: ../../library/multiprocessing.rst:2726 msgid "" "Returns the logger used by :mod:`multiprocessing`. If necessary, a new one " "will be created." msgstr "" -#: ../../library/multiprocessing.rst:2715 +#: ../../library/multiprocessing.rst:2729 msgid "" "When first created the logger has level :const:`logging.NOTSET` and no " "default handler. Messages sent to this logger will not by default propagate " "to the root logger." msgstr "" -#: ../../library/multiprocessing.rst:2719 +#: ../../library/multiprocessing.rst:2733 msgid "" "Note that on Windows child processes will only inherit the level of the " "parent process's logger -- any other customization of the logger will not be " "inherited." msgstr "" -#: ../../library/multiprocessing.rst:2726 +#: ../../library/multiprocessing.rst:2740 msgid "" "This function performs a call to :func:`get_logger` but in addition to " "returning the logger created by get_logger, it adds a handler which sends " @@ -2976,25 +3007,25 @@ msgid "" "``level`` argument." msgstr "" -#: ../../library/multiprocessing.rst:2732 +#: ../../library/multiprocessing.rst:2746 msgid "Below is an example session with logging turned on::" msgstr "" -#: ../../library/multiprocessing.rst:2747 +#: ../../library/multiprocessing.rst:2761 msgid "For a full table of logging levels, see the :mod:`logging` module." msgstr "" -#: ../../library/multiprocessing.rst:2751 +#: ../../library/multiprocessing.rst:2765 msgid "The :mod:`multiprocessing.dummy` module" msgstr "" -#: ../../library/multiprocessing.rst:2756 +#: ../../library/multiprocessing.rst:2770 msgid "" ":mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` " "but is no more than a wrapper around the :mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:2761 +#: ../../library/multiprocessing.rst:2775 msgid "" "In particular, the ``Pool`` function provided by :mod:`multiprocessing." "dummy` returns an instance of :class:`ThreadPool`, which is a subclass of :" @@ -3002,7 +3033,7 @@ msgid "" "worker threads rather than worker processes." msgstr "" -#: ../../library/multiprocessing.rst:2769 +#: ../../library/multiprocessing.rst:2783 msgid "" "A thread pool object which controls a pool of worker threads to which jobs " "can be submitted. :class:`ThreadPool` instances are fully interface " @@ -3012,18 +3043,18 @@ msgid "" "pool.Pool.terminate` manually." msgstr "" -#: ../../library/multiprocessing.rst:2776 +#: ../../library/multiprocessing.rst:2790 msgid "" "*processes* is the number of worker threads to use. If *processes* is " "``None`` then the number returned by :func:`os.cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2782 +#: ../../library/multiprocessing.rst:2796 msgid "" "Unlike :class:`Pool`, *maxtasksperchild* and *context* cannot be provided." msgstr "" -#: ../../library/multiprocessing.rst:2786 +#: ../../library/multiprocessing.rst:2800 msgid "" "A :class:`ThreadPool` shares the same interface as :class:`Pool`, which is " "designed around a pool of processes and predates the introduction of the :" @@ -3033,7 +3064,7 @@ msgid "" "is not understood by any other libraries." msgstr "" -#: ../../library/multiprocessing.rst:2793 +#: ../../library/multiprocessing.rst:2807 msgid "" "Users should generally prefer to use :class:`concurrent.futures." "ThreadPoolExecutor`, which has a simpler interface that was designed around " @@ -3042,69 +3073,69 @@ msgid "" "`asyncio`." msgstr "" -#: ../../library/multiprocessing.rst:2803 +#: ../../library/multiprocessing.rst:2817 msgid "Programming guidelines" msgstr "" -#: ../../library/multiprocessing.rst:2805 +#: ../../library/multiprocessing.rst:2819 msgid "" "There are certain guidelines and idioms which should be adhered to when " "using :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:2810 +#: ../../library/multiprocessing.rst:2824 msgid "All start methods" msgstr "" -#: ../../library/multiprocessing.rst:2812 +#: ../../library/multiprocessing.rst:2826 msgid "The following applies to all start methods." msgstr "" -#: ../../library/multiprocessing.rst:2814 +#: ../../library/multiprocessing.rst:2828 msgid "Avoid shared state" msgstr "" -#: ../../library/multiprocessing.rst:2816 +#: ../../library/multiprocessing.rst:2830 msgid "" "As far as possible one should try to avoid shifting large amounts of data " "between processes." msgstr "" -#: ../../library/multiprocessing.rst:2819 +#: ../../library/multiprocessing.rst:2833 msgid "" "It is probably best to stick to using queues or pipes for communication " "between processes rather than using the lower level synchronization " "primitives." msgstr "" -#: ../../library/multiprocessing.rst:2823 +#: ../../library/multiprocessing.rst:2837 msgid "Picklability" msgstr "" -#: ../../library/multiprocessing.rst:2825 +#: ../../library/multiprocessing.rst:2839 msgid "Ensure that the arguments to the methods of proxies are picklable." msgstr "" -#: ../../library/multiprocessing.rst:2827 +#: ../../library/multiprocessing.rst:2841 msgid "Thread safety of proxies" msgstr "" -#: ../../library/multiprocessing.rst:2829 +#: ../../library/multiprocessing.rst:2843 msgid "" "Do not use a proxy object from more than one thread unless you protect it " "with a lock." msgstr "" -#: ../../library/multiprocessing.rst:2832 +#: ../../library/multiprocessing.rst:2846 msgid "" "(There is never a problem with different processes using the *same* proxy.)" msgstr "" -#: ../../library/multiprocessing.rst:2834 +#: ../../library/multiprocessing.rst:2848 msgid "Joining zombie processes" msgstr "" -#: ../../library/multiprocessing.rst:2836 +#: ../../library/multiprocessing.rst:2850 msgid "" "On POSIX when a process finishes but has not been joined it becomes a " "zombie. There should never be very many because each time a new process " @@ -3115,11 +3146,11 @@ msgid "" "explicitly join all the processes that you start." msgstr "" -#: ../../library/multiprocessing.rst:2844 +#: ../../library/multiprocessing.rst:2858 msgid "Better to inherit than pickle/unpickle" msgstr "" -#: ../../library/multiprocessing.rst:2846 +#: ../../library/multiprocessing.rst:2860 msgid "" "When using the *spawn* or *forkserver* start methods many types from :mod:" "`multiprocessing` need to be picklable so that child processes can use " @@ -3129,11 +3160,11 @@ msgid "" "inherit it from an ancestor process." msgstr "" -#: ../../library/multiprocessing.rst:2854 +#: ../../library/multiprocessing.rst:2868 msgid "Avoid terminating processes" msgstr "" -#: ../../library/multiprocessing.rst:2856 +#: ../../library/multiprocessing.rst:2870 msgid "" "Using the :meth:`Process.terminate ` " "method to stop a process is liable to cause any shared resources (such as " @@ -3141,18 +3172,18 @@ msgid "" "become broken or unavailable to other processes." msgstr "" -#: ../../library/multiprocessing.rst:2862 +#: ../../library/multiprocessing.rst:2876 msgid "" "Therefore it is probably best to only consider using :meth:`Process." "terminate ` on processes which never use " "any shared resources." msgstr "" -#: ../../library/multiprocessing.rst:2866 +#: ../../library/multiprocessing.rst:2880 msgid "Joining processes that use queues" msgstr "" -#: ../../library/multiprocessing.rst:2868 +#: ../../library/multiprocessing.rst:2882 msgid "" "Bear in mind that a process that has put items in a queue will wait before " "terminating until all the buffered items are fed by the \"feeder\" thread to " @@ -3161,7 +3192,7 @@ msgid "" "queue to avoid this behaviour.)" msgstr "" -#: ../../library/multiprocessing.rst:2874 +#: ../../library/multiprocessing.rst:2888 msgid "" "This means that whenever you use a queue you need to make sure that all " "items which have been put on the queue will eventually be removed before the " @@ -3170,21 +3201,21 @@ msgid "" "processes will be joined automatically." msgstr "" -#: ../../library/multiprocessing.rst:2880 +#: ../../library/multiprocessing.rst:2894 msgid "An example which will deadlock is the following::" msgstr "" -#: ../../library/multiprocessing.rst:2894 +#: ../../library/multiprocessing.rst:2908 msgid "" "A fix here would be to swap the last two lines (or simply remove the ``p." "join()`` line)." msgstr "" -#: ../../library/multiprocessing.rst:2897 +#: ../../library/multiprocessing.rst:2911 msgid "Explicitly pass resources to child processes" msgstr "" -#: ../../library/multiprocessing.rst:2899 +#: ../../library/multiprocessing.rst:2913 msgid "" "On POSIX using the *fork* start method, a child process can make use of a " "shared resource created in a parent process using a global resource. " @@ -3192,7 +3223,7 @@ msgid "" "for the child process." msgstr "" -#: ../../library/multiprocessing.rst:2904 +#: ../../library/multiprocessing.rst:2918 msgid "" "Apart from making the code (potentially) compatible with Windows and the " "other start methods this also ensures that as long as the child process is " @@ -3201,29 +3232,29 @@ msgid "" "collected in the parent process." msgstr "" -#: ../../library/multiprocessing.rst:2911 +#: ../../library/multiprocessing.rst:2925 msgid "So for instance ::" msgstr "" -#: ../../library/multiprocessing.rst:2923 +#: ../../library/multiprocessing.rst:2937 msgid "should be rewritten as ::" msgstr "" -#: ../../library/multiprocessing.rst:2935 +#: ../../library/multiprocessing.rst:2949 msgid "Beware of replacing :data:`sys.stdin` with a \"file like object\"" msgstr "" -#: ../../library/multiprocessing.rst:2937 +#: ../../library/multiprocessing.rst:2951 msgid ":mod:`multiprocessing` originally unconditionally called::" msgstr "" -#: ../../library/multiprocessing.rst:2941 +#: ../../library/multiprocessing.rst:2955 msgid "" "in the :meth:`multiprocessing.Process._bootstrap` method --- this resulted " "in issues with processes-in-processes. This has been changed to::" msgstr "" -#: ../../library/multiprocessing.rst:2947 +#: ../../library/multiprocessing.rst:2961 msgid "" "Which solves the fundamental issue of processes colliding with each other " "resulting in a bad file descriptor error, but introduces a potential danger " @@ -3233,33 +3264,33 @@ msgid "" "data being flushed to the object multiple times, resulting in corruption." msgstr "" -#: ../../library/multiprocessing.rst:2954 +#: ../../library/multiprocessing.rst:2968 msgid "" "If you write a file-like object and implement your own caching, you can make " "it fork-safe by storing the pid whenever you append to the cache, and " "discarding the cache when the pid changes. For example::" msgstr "" -#: ../../library/multiprocessing.rst:2966 +#: ../../library/multiprocessing.rst:2980 msgid "" "For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331`" msgstr "" -#: ../../library/multiprocessing.rst:2969 +#: ../../library/multiprocessing.rst:2983 msgid "The *spawn* and *forkserver* start methods" msgstr "" -#: ../../library/multiprocessing.rst:2971 +#: ../../library/multiprocessing.rst:2985 msgid "" "There are a few extra restrictions which don't apply to the *fork* start " "method." msgstr "" -#: ../../library/multiprocessing.rst:2974 +#: ../../library/multiprocessing.rst:2988 msgid "More picklability" msgstr "" -#: ../../library/multiprocessing.rst:2976 +#: ../../library/multiprocessing.rst:2990 msgid "" "Ensure that all arguments to :meth:`Process.__init__` are picklable. Also, " "if you subclass :class:`~multiprocessing.Process` then make sure that " @@ -3267,11 +3298,11 @@ msgid "" "Process.start>` method is called." msgstr "" -#: ../../library/multiprocessing.rst:2981 +#: ../../library/multiprocessing.rst:2995 msgid "Global variables" msgstr "" -#: ../../library/multiprocessing.rst:2983 +#: ../../library/multiprocessing.rst:2997 msgid "" "Bear in mind that if code run in a child process tries to access a global " "variable, then the value it sees (if any) may not be the same as the value " @@ -3279,66 +3310,66 @@ msgid "" "Process.start>` was called." msgstr "" -#: ../../library/multiprocessing.rst:2988 +#: ../../library/multiprocessing.rst:3002 msgid "" "However, global variables which are just module level constants cause no " "problems." msgstr "" -#: ../../library/multiprocessing.rst:2993 +#: ../../library/multiprocessing.rst:3007 msgid "Safe importing of main module" msgstr "" -#: ../../library/multiprocessing.rst:2995 +#: ../../library/multiprocessing.rst:3009 msgid "" "Make sure that the main module can be safely imported by a new Python " "interpreter without causing unintended side effects (such as starting a new " "process)." msgstr "" -#: ../../library/multiprocessing.rst:2999 +#: ../../library/multiprocessing.rst:3013 msgid "" "For example, using the *spawn* or *forkserver* start method running the " "following module would fail with a :exc:`RuntimeError`::" msgstr "" -#: ../../library/multiprocessing.rst:3011 +#: ../../library/multiprocessing.rst:3025 msgid "" "Instead one should protect the \"entry point\" of the program by using ``if " "__name__ == '__main__':`` as follows::" msgstr "" -#: ../../library/multiprocessing.rst:3025 +#: ../../library/multiprocessing.rst:3039 msgid "" "(The ``freeze_support()`` line can be omitted if the program will be run " "normally instead of frozen.)" msgstr "" -#: ../../library/multiprocessing.rst:3028 +#: ../../library/multiprocessing.rst:3042 msgid "" "This allows the newly spawned Python interpreter to safely import the module " "and then run the module's ``foo()`` function." msgstr "" -#: ../../library/multiprocessing.rst:3031 +#: ../../library/multiprocessing.rst:3045 msgid "" "Similar restrictions apply if a pool or manager is created in the main " "module." msgstr "" -#: ../../library/multiprocessing.rst:3038 +#: ../../library/multiprocessing.rst:3052 msgid "Examples" msgstr "範例" -#: ../../library/multiprocessing.rst:3040 +#: ../../library/multiprocessing.rst:3054 msgid "Demonstration of how to create and use customized managers and proxies:" msgstr "" -#: ../../library/multiprocessing.rst:3046 +#: ../../library/multiprocessing.rst:3060 msgid "Using :class:`~multiprocessing.pool.Pool`:" msgstr "" -#: ../../library/multiprocessing.rst:3052 +#: ../../library/multiprocessing.rst:3066 msgid "" "An example showing how to use queues to feed tasks to a collection of worker " "processes and collect the results:" diff --git a/library/pathlib.po b/library/pathlib.po index b6ee3951dd..64eb36d2a6 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-08 00:03+0000\n" +"POT-Creation-Date: 2024-06-30 00:03+0000\n" "PO-Revision-Date: 2024-02-29 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,7 +39,17 @@ msgstr "" "操作,另一種是\\ :ref:`實體路徑 (concrete paths) `,繼承自純" "路徑但也提供 IO 操作。" -#: ../../library/pathlib.rst:25 +#: ../../library/pathlib.rst:21 +msgid "" +"Inheritance diagram showing the classes available in pathlib. The\n" +"most basic class is PurePath, which has three direct subclasses:\n" +"PurePosixPath, PureWindowsPath, and Path. Further to these four\n" +"classes, there are two classes that use multiple inheritance:\n" +"PosixPath subclasses PurePosixPath and Path, and WindowsPath\n" +"subclasses PureWindowsPath and Path." +msgstr "" + +#: ../../library/pathlib.rst:31 msgid "" "If you've never used this module before or just aren't sure which class is " "right for your task, :class:`Path` is most likely what you need. It " @@ -50,11 +60,11 @@ msgstr "" "是 :class:`Path`。它針對程式執行所在的平台實例化一個\\ :ref:`實體路徑 " "`。" -#: ../../library/pathlib.rst:29 +#: ../../library/pathlib.rst:35 msgid "Pure paths are useful in some special cases; for example:" msgstr "純路徑在某些特殊情境下是有用的,例如:" -#: ../../library/pathlib.rst:31 +#: ../../library/pathlib.rst:37 msgid "" "If you want to manipulate Windows paths on a Unix machine (or vice versa). " "You cannot instantiate a :class:`WindowsPath` when running on Unix, but you " @@ -63,7 +73,7 @@ msgstr "" "如果你想在 Unix 機器上處理 Windows 路徑(或反過來),你無法在 Unix 上實例化 :" "class:`WindowsPath`,但你可以實例化 :class:`PureWindowsPath`。" -#: ../../library/pathlib.rst:34 +#: ../../library/pathlib.rst:40 msgid "" "You want to make sure that your code only manipulates paths without actually " "accessing the OS. In this case, instantiating one of the pure classes may be " @@ -72,49 +82,49 @@ msgstr "" "你想確保你的程式在操作路徑的時候不會真的存取到 OS。在這個情況下,實例化其中一" "種純路徑類別可能是有用的,因為它們不會有任何存取 OS 的操作。" -#: ../../library/pathlib.rst:39 +#: ../../library/pathlib.rst:45 msgid ":pep:`428`: The pathlib module -- object-oriented filesystem paths." msgstr ":pep:`428`:pathlib 模組 -- 物件導向檔案系統路徑。" -#: ../../library/pathlib.rst:42 +#: ../../library/pathlib.rst:48 msgid "" "For low-level path manipulation on strings, you can also use the :mod:`os." "path` module." msgstr "針對字串上的底層路徑操作,你也可以使用 :mod:`os.path` 模組。" -#: ../../library/pathlib.rst:47 +#: ../../library/pathlib.rst:53 msgid "Basic use" msgstr "基本用法" -#: ../../library/pathlib.rst:49 +#: ../../library/pathlib.rst:55 msgid "Importing the main class::" msgstr "匯入主要類別: ::" -#: ../../library/pathlib.rst:53 +#: ../../library/pathlib.rst:59 msgid "Listing subdirectories::" msgstr "列出子目錄: ::" -#: ../../library/pathlib.rst:60 +#: ../../library/pathlib.rst:66 msgid "Listing Python source files in this directory tree::" msgstr "在當前目錄樹下列出 Python 原始碼檔案: ::" -#: ../../library/pathlib.rst:67 +#: ../../library/pathlib.rst:73 msgid "Navigating inside a directory tree::" msgstr "瀏覽目錄樹內部: ::" -#: ../../library/pathlib.rst:76 +#: ../../library/pathlib.rst:82 msgid "Querying path properties::" msgstr "查詢路徑屬性: ::" -#: ../../library/pathlib.rst:83 +#: ../../library/pathlib.rst:89 msgid "Opening a file::" msgstr "開啟檔案: ::" -#: ../../library/pathlib.rst:93 +#: ../../library/pathlib.rst:99 msgid "Pure paths" msgstr "純路徑" -#: ../../library/pathlib.rst:95 +#: ../../library/pathlib.rst:101 msgid "" "Pure path objects provide path-handling operations which don't actually " "access a filesystem. There are three ways to access these classes, which we " @@ -123,7 +133,7 @@ msgstr "" "純路徑物件提供處理路徑的操作,實際上不會存取檔案系統。有三種方式可以存取這些" "類別,我們也稱之為\\ *類型 (flavours)*:" -#: ../../library/pathlib.rst:101 +#: ../../library/pathlib.rst:107 msgid "" "A generic class that represents the system's path flavour (instantiating it " "creates either a :class:`PurePosixPath` or a :class:`PureWindowsPath`)::" @@ -131,7 +141,7 @@ msgstr "" "一個通用的類別,表示系統的路徑類型(實例化時會建立一個 :class:" "`PurePosixPath` 或 :class:`PureWindowsPath`): ::" -#: ../../library/pathlib.rst:107 +#: ../../library/pathlib.rst:113 msgid "" "Each element of *pathsegments* can be either a string representing a path " "segment, or an object implementing the :class:`os.PathLike` interface where " @@ -142,11 +152,11 @@ msgstr "" "個物件,它實作了 :class:`os.PathLike` 介面且其中的 :meth:`~os.PathLike." "__fspath__` 方法會回傳字串,就像是另一個路徑物件: ::" -#: ../../library/pathlib.rst:117 +#: ../../library/pathlib.rst:123 msgid "When *pathsegments* is empty, the current directory is assumed::" msgstr "當沒有給 *pathsegments* 的時候,會假設是目前的目錄: ::" -#: ../../library/pathlib.rst:122 +#: ../../library/pathlib.rst:128 msgid "" "If a segment is an absolute path, all previous segments are ignored (like :" "func:`os.path.join`)::" @@ -154,7 +164,7 @@ msgstr "" "如果一個片段是絕對路徑,則所有之前的片段會被忽略(類似 :func:`os.path." "join`): ::" -#: ../../library/pathlib.rst:130 +#: ../../library/pathlib.rst:136 msgid "" "On Windows, the drive is not reset when a rooted relative path segment (e." "g., ``r'\\foo'``) is encountered::" @@ -162,7 +172,7 @@ msgstr "" "在 Windows 系統上,當遇到具有根目錄的相對路徑片段(例如 ``r'\\foo'``)時,磁" "碟機 (drive) 部分不會被重置: ::" -#: ../../library/pathlib.rst:136 +#: ../../library/pathlib.rst:142 msgid "" "Spurious slashes and single dots are collapsed, but double dots (``'..'``) " "and leading double slashes (``'//'``) are not, since this would change the " @@ -172,7 +182,7 @@ msgstr "" "被合併,因為這樣會因為各種原因改變路徑的意義(例如符號連結 (symbolic links)、" "UNC 路徑): ::" -#: ../../library/pathlib.rst:149 +#: ../../library/pathlib.rst:155 msgid "" "(a naïve approach would make ``PurePosixPath('foo/../bar')`` equivalent to " "``PurePosixPath('bar')``, which is wrong if ``foo`` is a symbolic link to " @@ -181,7 +191,7 @@ msgstr "" "(一個使得 ``PurePosixPath('foo/../bar')`` 等同於 ``PurePosixPath('bar')`` 的" "單純方法,但如果 ``foo`` 是指到另一個目錄的符號連結,就會是錯誤的。)" -#: ../../library/pathlib.rst:153 +#: ../../library/pathlib.rst:159 msgid "" "Pure path objects implement the :class:`os.PathLike` interface, allowing " "them to be used anywhere the interface is accepted." @@ -189,24 +199,24 @@ msgstr "" "純路徑物件實作了 :class:`os.PathLike` 介面,使得它們可以在任何接受該介面的地" "方使用。" -#: ../../library/pathlib.rst:156 +#: ../../library/pathlib.rst:162 msgid "Added support for the :class:`os.PathLike` interface." msgstr "新增了對於 :class:`os.PathLike` 介面的支援。" -#: ../../library/pathlib.rst:161 +#: ../../library/pathlib.rst:167 msgid "" "A subclass of :class:`PurePath`, this path flavour represents non-Windows " "filesystem paths::" msgstr "" ":class:`PurePath` 的一個子類別,該路徑類型表示非 Windows 檔案系統的路徑: ::" -#: ../../library/pathlib.rst:167 ../../library/pathlib.rst:179 -#: ../../library/pathlib.rst:752 ../../library/pathlib.rst:762 -#: ../../library/pathlib.rst:772 +#: ../../library/pathlib.rst:173 ../../library/pathlib.rst:185 +#: ../../library/pathlib.rst:758 ../../library/pathlib.rst:768 +#: ../../library/pathlib.rst:778 msgid "*pathsegments* is specified similarly to :class:`PurePath`." msgstr "*pathsegments* 的指定方式與 :class:`PurePath` 類似。" -#: ../../library/pathlib.rst:171 +#: ../../library/pathlib.rst:177 msgid "" "A subclass of :class:`PurePath`, this path flavour represents Windows " "filesystem paths, including `UNC paths`_::" @@ -214,7 +224,7 @@ msgstr "" ":class:`PurePath` 的一個子類別,該路徑類型表示 Windows 檔案系統的路徑,包括 " "`UNC paths`_: ::" -#: ../../library/pathlib.rst:183 +#: ../../library/pathlib.rst:189 msgid "" "Regardless of the system you're running on, you can instantiate all of these " "classes, since they don't provide any operation that does system calls." @@ -222,11 +232,11 @@ msgstr "" "不論你使用的是什麼系統,你都可以實例化這些類別,因為它們不提供任何涉及系統呼" "叫的操作。" -#: ../../library/pathlib.rst:188 +#: ../../library/pathlib.rst:194 msgid "General properties" msgstr "通用屬性" -#: ../../library/pathlib.rst:190 +#: ../../library/pathlib.rst:196 msgid "" "Paths are immutable and :term:`hashable`. Paths of a same flavour are " "comparable and orderable. These properties respect the flavour's case-" @@ -235,15 +245,15 @@ msgstr "" "路徑物件是不可變 (immutable) 且可雜湊 (:term:`hashable`) 的。相同類型的路徑物" "件可以被比較和排序。這些屬性遵守該類型的大小寫語意規則: ::" -#: ../../library/pathlib.rst:203 +#: ../../library/pathlib.rst:209 msgid "Paths of a different flavour compare unequal and cannot be ordered::" msgstr "不同類型的路徑物件在比較時視為不相等且無法被排序: ::" -#: ../../library/pathlib.rst:214 +#: ../../library/pathlib.rst:220 msgid "Operators" msgstr "運算子" -#: ../../library/pathlib.rst:216 +#: ../../library/pathlib.rst:222 msgid "" "The slash operator helps create child paths, like :func:`os.path.join`. If " "the argument is an absolute path, the previous path is ignored. On Windows, " @@ -254,14 +264,14 @@ msgstr "" "一樣。如果引數是絕對路徑,則忽略前一個路徑。在 Windows 系統上,當引數是具有根" "目錄的相對路徑(例如,``r'\\foo'``),磁碟機部分不會被重置: ::" -#: ../../library/pathlib.rst:234 +#: ../../library/pathlib.rst:240 msgid "" "A path object can be used anywhere an object implementing :class:`os." "PathLike` is accepted::" msgstr "" "路徑物件可以被用在任何可以接受實作 :class:`os.PathLike` 的物件的地方: ::" -#: ../../library/pathlib.rst:242 +#: ../../library/pathlib.rst:248 msgid "" "The string representation of a path is the raw filesystem path itself (in " "native form, e.g. with backslashes under Windows), which you can pass to any " @@ -270,7 +280,7 @@ msgstr "" "路徑的字串表示是原始的檔案系統路徑本身(以原生的形式,例如在 Windows 下是反斜" "線),你可以將其傳入任何將檔案路徑當作字串傳入的函式: ::" -#: ../../library/pathlib.rst:253 +#: ../../library/pathlib.rst:259 msgid "" "Similarly, calling :class:`bytes` on a path gives the raw filesystem path as " "a bytes object, as encoded by :func:`os.fsencode`::" @@ -278,7 +288,7 @@ msgstr "" "類似地,對路徑呼叫 :class:`bytes` 會得到原始檔案系統路徑的 bytes 物件,就像使" "用 :func:`os.fsencode` 編碼過的一樣: ::" -#: ../../library/pathlib.rst:260 +#: ../../library/pathlib.rst:266 msgid "" "Calling :class:`bytes` is only recommended under Unix. Under Windows, the " "unicode form is the canonical representation of filesystem paths." @@ -286,51 +296,51 @@ msgstr "" "只建議在 Unix 下呼叫 :class:`bytes`。在 Windows 裡,unicode 形式是檔案系統路" "徑的權威表示方式。" -#: ../../library/pathlib.rst:265 +#: ../../library/pathlib.rst:271 msgid "Accessing individual parts" msgstr "對個別組成的存取" -#: ../../library/pathlib.rst:267 +#: ../../library/pathlib.rst:273 msgid "" "To access the individual \"parts\" (components) of a path, use the following " "property:" msgstr "可以使用下列屬性來存取路徑的個別「組成」(parts, components):" -#: ../../library/pathlib.rst:272 +#: ../../library/pathlib.rst:278 msgid "A tuple giving access to the path's various components::" msgstr "一個可存取路徑的各組成的元組: ::" -#: ../../library/pathlib.rst:282 +#: ../../library/pathlib.rst:288 msgid "(note how the drive and local root are regrouped in a single part)" msgstr "(特別注意磁碟機跟本地根目錄是如何被重新組合成一個單一組成)" -#: ../../library/pathlib.rst:286 +#: ../../library/pathlib.rst:292 msgid "Methods and properties" msgstr "方法與屬性" -#: ../../library/pathlib.rst:292 +#: ../../library/pathlib.rst:298 msgid "Pure paths provide the following methods and properties:" msgstr "純路徑提供以下方法與屬性:" -#: ../../library/pathlib.rst:296 +#: ../../library/pathlib.rst:302 msgid "A string representing the drive letter or name, if any::" msgstr "" "若存在則為一個表示磁碟機字母 (drive letter) 或磁碟機名稱 (drive name) 的字" "串: ::" -#: ../../library/pathlib.rst:305 +#: ../../library/pathlib.rst:311 msgid "UNC shares are also considered drives::" msgstr "UNC shares 也被視為磁碟機: ::" -#: ../../library/pathlib.rst:312 +#: ../../library/pathlib.rst:318 msgid "A string representing the (local or global) root, if any::" msgstr "若存在則為一個表示(本地或全域)根目錄的字串: ::" -#: ../../library/pathlib.rst:321 +#: ../../library/pathlib.rst:327 msgid "UNC shares always have a root::" msgstr "UNC shares 都會有一個根目錄: ::" -#: ../../library/pathlib.rst:326 +#: ../../library/pathlib.rst:332 msgid "" "If the path starts with more than two successive slashes, :class:`~pathlib." "PurePosixPath` collapses them::" @@ -338,7 +348,7 @@ msgstr "" "如果路徑以超過兩個連續的斜線開頭,:class:`~pathlib.PurePosixPath` 會合併它" "們: ::" -#: ../../library/pathlib.rst:338 +#: ../../library/pathlib.rst:344 msgid "" "This behavior conforms to *The Open Group Base Specifications Issue 6*, " "paragraph `4.11 Pathname Resolution `_:" -#: ../../library/pathlib.rst:342 +#: ../../library/pathlib.rst:348 msgid "" "*\"A pathname that begins with two successive slashes may be interpreted in " "an implementation-defined manner, although more than two leading slashes " @@ -357,34 +367,34 @@ msgstr "" "*「以兩個連續斜線開頭的路徑名稱可以根據實作定義的方式來解讀,儘管如此,開頭超" "過兩個斜線應該視為單一斜線。」*" -#: ../../library/pathlib.rst:348 +#: ../../library/pathlib.rst:354 msgid "The concatenation of the drive and root::" msgstr "磁碟機與根目錄的結合: ::" -#: ../../library/pathlib.rst:362 +#: ../../library/pathlib.rst:368 msgid "" "An immutable sequence providing access to the logical ancestors of the path::" msgstr "一個不可變的序列,為路徑邏輯上的祖先 (logical ancestors) 提供存取: ::" -#: ../../library/pathlib.rst:373 +#: ../../library/pathlib.rst:379 msgid "" "The parents sequence now supports :term:`slices ` and negative index " "values." msgstr "父序列現在支援 :term:`slices ` 及負的索引值。" -#: ../../library/pathlib.rst:378 +#: ../../library/pathlib.rst:384 msgid "The logical parent of the path::" msgstr "邏輯上的父路徑: ::" -#: ../../library/pathlib.rst:384 +#: ../../library/pathlib.rst:390 msgid "You cannot go past an anchor, or empty path::" msgstr "你不能越過一個 anchor 或空路徑: ::" -#: ../../library/pathlib.rst:394 +#: ../../library/pathlib.rst:400 msgid "This is a purely lexical operation, hence the following behaviour::" msgstr "這是一個純粹字句上的 (lexical) 運算,因此會有以下行為: ::" -#: ../../library/pathlib.rst:400 +#: ../../library/pathlib.rst:406 msgid "" "If you want to walk an arbitrary filesystem path upwards, it is recommended " "to first call :meth:`Path.resolve` so as to resolve symlinks and eliminate " @@ -393,7 +403,7 @@ msgstr "" "如果你想要沿任意的檔案系統路徑往上走,建議要先呼叫 :meth:`Path.resolve` 來解" "析符號連結 (symlink) 及去除其中的 ``”..”``。" -#: ../../library/pathlib.rst:407 +#: ../../library/pathlib.rst:413 msgid "" "A string representing the final path component, excluding the drive and " "root, if any::" @@ -401,35 +411,35 @@ msgstr "" "最後的路徑組成 (final path component) 的字串表示,不包含任何磁碟機或根目" "錄: ::" -#: ../../library/pathlib.rst:413 +#: ../../library/pathlib.rst:419 msgid "UNC drive names are not considered::" msgstr "UNC 磁碟機名稱並沒有算在內: ::" -#: ../../library/pathlib.rst:423 +#: ../../library/pathlib.rst:429 msgid "The file extension of the final component, if any::" msgstr "若存在則為最後的路徑組成的檔案副檔名: ::" -#: ../../library/pathlib.rst:435 +#: ../../library/pathlib.rst:441 msgid "A list of the path's file extensions::" msgstr "路徑檔案副檔名的串列: ::" -#: ../../library/pathlib.rst:447 +#: ../../library/pathlib.rst:453 msgid "The final path component, without its suffix::" msgstr "最後的路徑組成,不包括後綴 (suffix): ::" -#: ../../library/pathlib.rst:459 +#: ../../library/pathlib.rst:465 msgid "" "Return a string representation of the path with forward slashes (``/``)::" msgstr "回傳一個使用正斜線 (``/``) 的路徑的字串表示: ::" -#: ../../library/pathlib.rst:470 +#: ../../library/pathlib.rst:476 msgid "" "Represent the path as a ``file`` URI. :exc:`ValueError` is raised if the " "path isn't absolute." msgstr "" "以 ``file`` URI 來表示一個路徑。如果不是絕對路徑會引發 :exc:`ValueError`。" -#: ../../library/pathlib.rst:483 +#: ../../library/pathlib.rst:489 msgid "" "Return whether the path is absolute or not. A path is considered absolute " "if it has both a root and (if the flavour allows) a drive::" @@ -437,11 +447,11 @@ msgstr "" "回傳一個路徑是否是絕對路徑。一個路徑被視為絕對路徑的條件是它同時有根目錄及" "(如果該系統類型允許的話)磁碟機: ::" -#: ../../library/pathlib.rst:503 +#: ../../library/pathlib.rst:509 msgid "Return whether or not this path is relative to the *other* path." msgstr "回傳此路徑是否為 *other* 路徑的相對路徑。" -#: ../../library/pathlib.rst:511 +#: ../../library/pathlib.rst:517 msgid "" "This method is string-based; it neither accesses the filesystem nor treats " "\"``..``\" segments specially. The following code is equivalent:" @@ -449,13 +459,13 @@ msgstr "" "該方法是基於字串的;它既不存取檔案系統,也不特別處理 \"``..``\" 片段。以下程" "式碼是等效的:" -#: ../../library/pathlib.rst:522 +#: ../../library/pathlib.rst:528 msgid "" "Passing additional arguments is deprecated; if supplied, they are joined " "with *other*." msgstr "額外引數的傳入已棄用;如果有的話,它們會與 *other* 連接在一起。" -#: ../../library/pathlib.rst:527 +#: ../../library/pathlib.rst:533 msgid "" "With :class:`PureWindowsPath`, return ``True`` if the path is considered " "reserved under Windows, ``False`` otherwise. With :class:`PurePosixPath`, " @@ -465,19 +475,19 @@ msgstr "" "``True``,否則回傳 ``False``。對 :class:`PurePosixPath` 來說,總是回傳 " "``False``。" -#: ../../library/pathlib.rst:536 +#: ../../library/pathlib.rst:542 msgid "" "File system calls on reserved paths can fail mysteriously or have unintended " "effects." msgstr "在保留路徑上的檔案系統呼叫會神秘地失敗或有意外的效果。" -#: ../../library/pathlib.rst:542 +#: ../../library/pathlib.rst:548 msgid "" "Calling this method is equivalent to combining the path with each of the " "given *pathsegments* in turn::" msgstr "呼叫此方法會依序結合每個所給定的 *pathsegments* 到路徑上: ::" -#: ../../library/pathlib.rst:557 +#: ../../library/pathlib.rst:563 msgid "" "Match this path against the provided glob-style pattern. Return ``True`` if " "matching is successful, ``False`` otherwise." @@ -485,7 +495,7 @@ msgstr "" "將路徑與 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回傳 " "``True``,否則回傳 ``False``。" -#: ../../library/pathlib.rst:560 +#: ../../library/pathlib.rst:566 msgid "" "If *pattern* is relative, the path can be either relative or absolute, and " "matching is done from the right::" @@ -493,43 +503,43 @@ msgstr "" "如果 *pattern* 是相對的,則路徑可以是相對或絕對的,而且會從右邊來完成比" "對: ::" -#: ../../library/pathlib.rst:570 +#: ../../library/pathlib.rst:576 msgid "" "If *pattern* is absolute, the path must be absolute, and the whole path must " "match::" msgstr "如果 *pattern* 是絕對的,則路徑必須是絕對的,且整個路徑都要比對到: ::" -#: ../../library/pathlib.rst:578 +#: ../../library/pathlib.rst:584 msgid "" "The *pattern* may be another path object; this speeds up matching the same " "pattern against multiple files::" msgstr "*pattern* 可以是另一個路徑物件;這會加速對多個檔案比對相同的樣式: ::" -#: ../../library/pathlib.rst:586 +#: ../../library/pathlib.rst:592 msgid "" "The recursive wildcard \"``**``\" isn't supported by this method (it acts " "like non-recursive \"``*``\".)" msgstr "" -#: ../../library/pathlib.rst:589 +#: ../../library/pathlib.rst:595 msgid "Accepts an object implementing the :class:`os.PathLike` interface." msgstr "接受一個有實作 :class:`os.PathLike` 介面的物件。" -#: ../../library/pathlib.rst:592 +#: ../../library/pathlib.rst:598 msgid "As with other methods, case-sensitivity follows platform defaults::" msgstr "像其它方法一樣,是否區分大小寫會遵循平台的預設行為: ::" -#: ../../library/pathlib.rst:599 +#: ../../library/pathlib.rst:605 msgid "" "Set *case_sensitive* to ``True`` or ``False`` to override this behaviour." msgstr "將 *case_sensitive* 設定成 ``True`` 或 ``False`` 會覆蓋這個行為。" -#: ../../library/pathlib.rst:601 ../../library/pathlib.rst:1113 -#: ../../library/pathlib.rst:1141 +#: ../../library/pathlib.rst:607 ../../library/pathlib.rst:1212 +#: ../../library/pathlib.rst:1240 msgid "The *case_sensitive* parameter was added." msgstr "新增 *case_sensitive* 參數。" -#: ../../library/pathlib.rst:607 +#: ../../library/pathlib.rst:613 msgid "" "Compute a version of this path relative to the path represented by *other*. " "If it's impossible, :exc:`ValueError` is raised::" @@ -537,7 +547,7 @@ msgstr "" "計算這個路徑相對於 *other* 所表示路徑的版本。如果做不到會引發 :exc:" "`ValueError`: ::" -#: ../../library/pathlib.rst:622 +#: ../../library/pathlib.rst:628 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 " @@ -548,7 +558,7 @@ msgstr "" "可能會加入 ``..`` 以組成相對路徑。在其他情況下,例如路徑參考到不同的磁碟機," "則會引發 :exc:`ValueError`: ::" -#: ../../library/pathlib.rst:637 +#: ../../library/pathlib.rst:643 msgid "" "This function is part of :class:`PurePath` and works with strings. It does " "not check or access the underlying file structure. This can impact the " @@ -559,19 +569,19 @@ msgstr "" "的檔案架構。這會影響到 *walk_up* 選項,因為它假設路徑中沒有符號連結;如果需要" "解析符號連結的話可以先呼叫 :meth:`~Path.resolve`。" -#: ../../library/pathlib.rst:643 +#: ../../library/pathlib.rst:649 msgid "" "The *walk_up* parameter was added (old behavior is the same as " "``walk_up=False``)." msgstr "加入 *walk_up* 參數(舊的行為和 ``walk_up=False`` 相同)。" -#: ../../library/pathlib.rst:648 +#: ../../library/pathlib.rst:654 msgid "" "Passing additional positional arguments is deprecated; if supplied, they are " "joined with *other*." msgstr "額外位置引數的傳入已棄用;如果有的話,它們會與 *other* 連接在一起。" -#: ../../library/pathlib.rst:653 +#: ../../library/pathlib.rst:659 msgid "" "Return a new path with the :attr:`name` changed. If the original path " "doesn't have a name, ValueError is raised::" @@ -579,7 +589,7 @@ msgstr "" "回傳一個修改 :attr:`name` 後的新路徑。如果原始路徑沒有名稱則引發 " "ValueError: ::" -#: ../../library/pathlib.rst:670 +#: ../../library/pathlib.rst:676 msgid "" "Return a new path with the :attr:`stem` changed. If the original path " "doesn't have a name, ValueError is raised::" @@ -587,7 +597,7 @@ msgstr "" "回傳一個修改 :attr:`stem` 後的新路徑。如果原始路徑沒有名稱則引發 " "ValueError: ::" -#: ../../library/pathlib.rst:694 +#: ../../library/pathlib.rst:700 msgid "" "Return a new path with the :attr:`suffix` changed. If the original path " "doesn't have a suffix, the new *suffix* is appended instead. If the " @@ -596,7 +606,7 @@ msgstr "" "回傳一個修改 :attr:`suffix` 後的新路徑。如果原始路徑沒有後綴,新的 *suffix* " "會附加在後面。如果 *suffix* 是一個空字串,原來的後綴會被移除: ::" -#: ../../library/pathlib.rst:711 +#: ../../library/pathlib.rst:717 msgid "" "Create a new path object of the same type by combining the given " "*pathsegments*. This method is called whenever a derivative path is created, " @@ -607,11 +617,11 @@ msgstr "" "建立的時候會呼叫這個方法,例如從 :attr:`parent` 和 :meth:`relative_to` 建立衍" "生路徑。子類別可以覆寫此方法來傳遞資訊給衍生路徑,例如: ::" -#: ../../library/pathlib.rst:737 +#: ../../library/pathlib.rst:743 msgid "Concrete paths" msgstr "實體路徑" -#: ../../library/pathlib.rst:739 +#: ../../library/pathlib.rst:745 msgid "" "Concrete paths are subclasses of the pure path classes. In addition to " "operations provided by the latter, they also provide methods to do system " @@ -620,7 +630,7 @@ msgstr "" "實體路徑是純路徑類別的子類別。除了後者本來就有提供的操作,它們也提供方法可以" "對路徑物件做系統呼叫。有三種方式可以實例化實體路徑:" -#: ../../library/pathlib.rst:745 +#: ../../library/pathlib.rst:751 msgid "" "A subclass of :class:`PurePath`, this class represents concrete paths of the " "system's path flavour (instantiating it creates either a :class:`PosixPath` " @@ -629,7 +639,7 @@ msgstr "" ":class:`PurePath` 的子類別,此類別表示系統的路徑類型的實體路徑(實例化時會建" "立一個 :class:`PosixPath` 或 :class:`WindowsPath`): ::" -#: ../../library/pathlib.rst:756 +#: ../../library/pathlib.rst:762 msgid "" "A subclass of :class:`Path` and :class:`PurePosixPath`, this class " "represents concrete non-Windows filesystem paths::" @@ -637,7 +647,7 @@ msgstr "" ":class:`Path` 和 :class:`PurePosixPath` 的子類別,此類別表示實體非 Windows 檔" "案系統路徑: ::" -#: ../../library/pathlib.rst:766 +#: ../../library/pathlib.rst:772 msgid "" "A subclass of :class:`Path` and :class:`PureWindowsPath`, this class " "represents concrete Windows filesystem paths::" @@ -645,7 +655,7 @@ msgstr "" ":class:`Path` 和 :class:`PureWindowsPath` 的子類別,此類別表示實體 Windows 檔" "案系統路徑: ::" -#: ../../library/pathlib.rst:774 +#: ../../library/pathlib.rst:780 msgid "" "You can only instantiate the class flavour that corresponds to your system " "(allowing system calls on non-compatible path flavours could lead to bugs or " @@ -654,18 +664,88 @@ msgstr "" "你只能實例化對應你的系統的類別類型(允許在不相容的路徑類型上做系統呼叫可能在" "你的應用程式導致漏洞或故障): ::" -#: ../../library/pathlib.rst:792 +#: ../../library/pathlib.rst:798 msgid "" "Some concrete path methods can raise an :exc:`OSError` if a system call " "fails (for example because the path doesn't exist)." msgstr "" "有些實體路徑方法會在系統呼叫失敗(例如因為路徑不存在)時引發 :exc:`OSError`" -#: ../../library/pathlib.rst:797 +#: ../../library/pathlib.rst:803 +msgid "Expanding and resolving paths" +msgstr "" + +#: ../../library/pathlib.rst:807 +msgid "" +"Return a new path object representing the user's home directory (as returned " +"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`。" + +#: ../../library/pathlib.rst:821 +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." +msgstr "" +"回傳一個展開 ``~`` 和 ``~user`` 構成的新路徑,像 :meth:`os.path.expanduser` " +"回傳的一樣。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" + +#: ../../library/pathlib.rst:836 +msgid "" +"Return a new path object representing the current directory (as returned by :" +"func:`os.getcwd`)::" +msgstr "" +"回傳一個代表目前目錄的新的路徑物件(像 :func:`os.getcwd` 回傳的一樣): ::" + +#: ../../library/pathlib.rst:845 +msgid "" +"Make the path absolute, without normalization or resolving symlinks. Returns " +"a new path object::" +msgstr "" +"將路徑轉換為絕對路徑,不進行標準化或解析符號連結。回傳一個新的路徑物件: ::" + +#: ../../library/pathlib.rst:857 +msgid "" +"Make the path absolute, resolving any symlinks. A new path object is " +"returned::" +msgstr "將路徑轉換為絕對路徑,解析所有符號連結。回傳一個新的路徑物件: ::" + +#: ../../library/pathlib.rst:866 +msgid "" +"\"``..``\" components are also eliminated (this is the only method to do " +"so)::" +msgstr "同時也會消除 \"``..``\" 的路徑組成(只有此方法這樣做): ::" + +#: ../../library/pathlib.rst:872 +msgid "" +"If the path doesn't exist and *strict* is ``True``, :exc:`FileNotFoundError` " +"is raised. If *strict* is ``False``, the path is resolved as far as " +"possible and any remainder is appended without checking whether it exists. " +"If an infinite loop is encountered along the resolution path, :exc:" +"`RuntimeError` is raised." +msgstr "" +"如果路徑不存在且 *strict* 為 ``True``,則引發 :exc:`FileNotFoundError`。如果 " +"*strict* 為 ``False``,則將盡可能解析該路徑,並將任何剩餘部分追加到路徑中,而" +"不檢查其是否存在。如果在解析過程中遇到無窮迴圈,則引發 :exc:`RuntimeError`。" + +#: ../../library/pathlib.rst:878 +msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." +msgstr "新增 *strict* 參數(在 3.6 版本之前的行為是嚴格的)。" + +#: ../../library/pathlib.rst:884 +msgid "" +"Return the path to which the symbolic link points (as returned by :func:`os." +"readlink`)::" +msgstr "回傳符號連結指向的路徑(如 :func:`os.readlink` 的回傳值): ::" + +#: ../../library/pathlib.rst:896 msgid "Querying file type and status" msgstr "" -#: ../../library/pathlib.rst:801 +#: ../../library/pathlib.rst:900 msgid "" ":meth:`~Path.exists()`, :meth:`~Path.is_dir()`, :meth:`~Path.is_file()`, :" "meth:`~Path.is_mount()`, :meth:`~Path.is_symlink()`, :meth:`~Path." @@ -680,7 +760,7 @@ msgstr "" "is_fifo()`、:meth:`~Path.is_socket()` 遇到路徑包含 OS 層無法表示的字元時現在" "會回傳 ``False`` 而不是引發例外。" -#: ../../library/pathlib.rst:811 +#: ../../library/pathlib.rst:910 msgid "" "Return a :class:`os.stat_result` object containing information about this " "path, like :func:`os.stat`. The result is looked up at each call to this " @@ -689,7 +769,7 @@ msgstr "" "回傳一個包含該路徑資訊的 :class:`os.stat_result` 物件,像 :func:`os.stat` 一" "樣。每次呼叫此方法都會重新查詢結果。" -#: ../../library/pathlib.rst:814 +#: ../../library/pathlib.rst:913 msgid "" "This method normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :meth:`~Path.lstat`." @@ -697,12 +777,12 @@ msgstr "" "此方法通常會跟隨 (follow) 符號連結;想要取得符號連結的資訊,可以加上引數 " "``follow_symlinks=False`` 或使用 :meth:`~Path.lstat`。" -#: ../../library/pathlib.rst:825 ../../library/pathlib.rst:853 -#: ../../library/pathlib.rst:1284 +#: ../../library/pathlib.rst:924 ../../library/pathlib.rst:952 +#: ../../library/pathlib.rst:1514 msgid "The *follow_symlinks* parameter was added." msgstr "新增 *follow_symlinks* 參數。" -#: ../../library/pathlib.rst:831 +#: ../../library/pathlib.rst:930 msgid "" "Like :meth:`Path.stat` but, if the path points to a symbolic link, return " "the symbolic link's information rather than its target's." @@ -710,11 +790,11 @@ msgstr "" "類似 :meth:`Path.stat`,但如果該路徑指向一個符號連結,則回傳符號連結的資訊而" "不是其指向的目標。" -#: ../../library/pathlib.rst:837 +#: ../../library/pathlib.rst:936 msgid "Return ``True`` if the path points to an existing file or directory." msgstr "如果路徑指向存在的檔案或目錄則回傳 ``True``。" -#: ../../library/pathlib.rst:839 +#: ../../library/pathlib.rst:938 msgid "" "This method normally follows symlinks; to check if a symlink exists, add the " "argument ``follow_symlinks=False``." @@ -722,7 +802,7 @@ msgstr "" "此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " "``follow_symlinks=False``。" -#: ../../library/pathlib.rst:859 +#: ../../library/pathlib.rst:958 msgid "" "Return ``True`` if the path points to a regular file (or a symbolic link " "pointing to a regular file), ``False`` if it points to another kind of file." @@ -730,9 +810,9 @@ msgstr "" "如果該路徑指向一個普通檔案(或者是一個指向普通檔案的符號連結)則回傳 " "``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:862 ../../library/pathlib.rst:871 -#: ../../library/pathlib.rst:913 ../../library/pathlib.rst:922 -#: ../../library/pathlib.rst:931 ../../library/pathlib.rst:940 +#: ../../library/pathlib.rst:961 ../../library/pathlib.rst:970 +#: ../../library/pathlib.rst:1012 ../../library/pathlib.rst:1021 +#: ../../library/pathlib.rst:1030 ../../library/pathlib.rst:1039 msgid "" "``False`` is also returned if the path doesn't exist or is a broken symlink; " "other errors (such as permission errors) are propagated." @@ -740,7 +820,7 @@ msgstr "" "如果路徑不存在或者是一個斷掉的符號連結則也會回傳 ``False``;其他錯誤(例如權" "限錯誤)則會傳遞出來。" -#: ../../library/pathlib.rst:868 +#: ../../library/pathlib.rst:967 msgid "" "Return ``True`` if the path points to a directory (or a symbolic link " "pointing to a directory), ``False`` if it points to another kind of file." @@ -748,19 +828,19 @@ msgstr "" "如果該路徑指向一個目錄(或者是一個指向目錄的符號連結)則回傳 ``True``,如果指" "向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:877 +#: ../../library/pathlib.rst:976 msgid "" "Return ``True`` if the path points to a symbolic link, ``False`` otherwise." msgstr "如果該路徑指向一個符號連結則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/pathlib.rst:879 +#: ../../library/pathlib.rst:978 msgid "" "``False`` is also returned if the path doesn't exist; other errors (such as " "permission errors) are propagated." msgstr "" "如果該路徑不存在也會回傳 ``False``;其他錯誤(例如權限錯誤)則會傳遞出來。" -#: ../../library/pathlib.rst:885 +#: ../../library/pathlib.rst:984 msgid "" "Return ``True`` if the path points to a junction, and ``False`` for any " "other type of file. Currently only Windows supports junctions." @@ -768,7 +848,7 @@ msgstr "" "如果該路徑指向一個連接點 (junction) 則回傳 ``True``,對其他類型的檔案則回傳 " "``False``。目前只有 Windows 支援連接點。" -#: ../../library/pathlib.rst:893 +#: ../../library/pathlib.rst:992 msgid "" "Return ``True`` if the path is a :dfn:`mount point`: a point in a file " "system where a different file system has been mounted. On POSIX, the " @@ -786,11 +866,11 @@ msgstr "" "Windows 上,一個掛載點被視為一個根磁碟機字母(例如 ``c:\\``)、一個 UNC share" "(例如 ``\\\\server\\share``)或是掛載的檔案系統目錄。" -#: ../../library/pathlib.rst:904 +#: ../../library/pathlib.rst:1003 msgid "Windows support was added." msgstr "加入對 Windows 的支援。" -#: ../../library/pathlib.rst:910 +#: ../../library/pathlib.rst:1009 msgid "" "Return ``True`` if the path points to a Unix socket (or a symbolic link " "pointing to a Unix socket), ``False`` if it points to another kind of file." @@ -798,7 +878,7 @@ msgstr "" "如果該路徑指向一個 Unix socket(或者是一個指向 Unix socket 的符號連結)則會回" "傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:919 +#: ../../library/pathlib.rst:1018 msgid "" "Return ``True`` if the path points to a FIFO (or a symbolic link pointing to " "a FIFO), ``False`` if it points to another kind of file." @@ -806,7 +886,7 @@ msgstr "" "如果該路徑指向一個 FIFO(或者是一個指向 FIFO 的符號連結)則會回傳 ``True``," "如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:928 +#: ../../library/pathlib.rst:1027 msgid "" "Return ``True`` if the path points to a block device (or a symbolic link " "pointing to a block device), ``False`` if it points to another kind of file." @@ -814,7 +894,7 @@ msgstr "" "如果該路徑指向一個區塊裝置 (block device)(或者是一個指向區塊裝置的符號連結)" "則會回傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:937 +#: ../../library/pathlib.rst:1036 msgid "" "Return ``True`` if the path points to a character device (or a symbolic link " "pointing to a character device), ``False`` if it points to another kind of " @@ -823,7 +903,7 @@ msgstr "" "如果該路徑指向一個字元裝置 (character device)(或者是一個指向字元裝置的符號連" "結)則會回傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:946 +#: ../../library/pathlib.rst:1045 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:" @@ -833,74 +913,74 @@ msgstr "" "物件或字串。其語義類似於 :func:`os.path.samefile` 和 :func:`os.path." "samestat`。" -#: ../../library/pathlib.rst:950 +#: ../../library/pathlib.rst:1049 msgid "" "An :exc:`OSError` can be raised if either file cannot be accessed for some " "reason." msgstr "若任何一個檔案因為某些原因無法存取,則引發 :exc:`OSError`。" -#: ../../library/pathlib.rst:966 +#: ../../library/pathlib.rst:1065 msgid "Reading and writing files" msgstr "" -#: ../../library/pathlib.rst:971 +#: ../../library/pathlib.rst:1070 msgid "" "Open the file pointed to by the path, like the built-in :func:`open` " "function does::" msgstr "開啟該路徑指向的檔案,像內建的 :func:`open` 函式做的一樣: ::" -#: ../../library/pathlib.rst:983 +#: ../../library/pathlib.rst:1082 msgid "Return the decoded contents of the pointed-to file as a string::" msgstr "將路徑指向的檔案的解碼內容以字串形式回傳: ::" -#: ../../library/pathlib.rst:991 +#: ../../library/pathlib.rst:1090 msgid "" "The file is opened and then closed. The optional parameters have the same " "meaning as in :func:`open`." msgstr "該檔案被打開並且隨後關閉。可選參數的含義與 :func:`open` 中的相同。" -#: ../../library/pathlib.rst:999 +#: ../../library/pathlib.rst:1098 msgid "Return the binary contents of the pointed-to file as a bytes object::" msgstr "將路徑指向的檔案的二進位內容以一個位元組物件回傳: ::" -#: ../../library/pathlib.rst:1012 +#: ../../library/pathlib.rst:1111 msgid "" "Open the file pointed to in text mode, write *data* to it, and close the " "file::" msgstr "以文字模式開啟指向的檔案,將 *data* 寫到檔案,並關閉檔案:: :" -#: ../../library/pathlib.rst:1021 +#: ../../library/pathlib.rst:1120 msgid "" "An existing file of the same name is overwritten. The optional parameters " "have the same meaning as in :func:`open`." msgstr "" "一個名稱相同的已存在檔案會被覆寫。可選參數和 :func:`open` 的參數有相同意義。" -#: ../../library/pathlib.rst:1026 +#: ../../library/pathlib.rst:1125 msgid "The *newline* parameter was added." msgstr "新增 *newline* 參數。" -#: ../../library/pathlib.rst:1032 +#: ../../library/pathlib.rst:1131 msgid "" "Open the file pointed to in bytes mode, write *data* to it, and close the " "file::" msgstr "以位元組模式開啟指向的檔案,將 *data* 寫到檔案,並關閉檔案:: :" -#: ../../library/pathlib.rst:1041 +#: ../../library/pathlib.rst:1140 msgid "An existing file of the same name is overwritten." msgstr "一個名稱相同的已存在檔案會被覆寫。" -#: ../../library/pathlib.rst:1047 +#: ../../library/pathlib.rst:1146 msgid "Reading directories" msgstr "讀取目錄" -#: ../../library/pathlib.rst:1051 +#: ../../library/pathlib.rst:1150 msgid "" "When the path points to a directory, yield path objects of the directory " "contents::" msgstr "當該路徑指向一個目錄,會 yield 目錄裡面的路徑物件: ::" -#: ../../library/pathlib.rst:1065 +#: ../../library/pathlib.rst:1164 msgid "" "The children are yielded in arbitrary order, and the special entries ``'.'`` " "and ``'..'`` are not included. If a file is removed from or added to the " @@ -911,13 +991,13 @@ msgstr "" "檔案在建立這個疊代器之後加到該目錄或從目錄刪除,這個檔案的路徑物件是否會被包" "含是沒有明定的。" -#: ../../library/pathlib.rst:1070 +#: ../../library/pathlib.rst:1169 msgid "" "If the path is not a directory or otherwise inaccessible, :exc:`OSError` is " "raised." msgstr "" -#: ../../library/pathlib.rst:1075 +#: ../../library/pathlib.rst:1174 msgid "" "Glob the given relative *pattern* in the directory represented by this path, " "yielding all matching files (of any kind)::" @@ -925,7 +1005,7 @@ msgstr "" "在該路徑表示的目錄裡,以 glob 方式比對所給定的相對 *pattern*,並 yield 所有比" "對到的檔案(任意類型): ::" -#: ../../library/pathlib.rst:1083 +#: ../../library/pathlib.rst:1182 msgid "" "Patterns are the same as for :mod:`fnmatch`, with the addition of \"``**``\" " "which means \"this directory and all subdirectories, recursively\". In " @@ -934,7 +1014,7 @@ msgstr "" "模式 (pattern) 和給 :mod:`fnmatch` 的一樣,加上 \"``**``\" 代表「目前目錄及所" "有遞迴的子目錄」。也就是說它能夠做遞迴的 glob 比對: ::" -#: ../../library/pathlib.rst:1094 +#: ../../library/pathlib.rst:1193 msgid "" "This method calls :meth:`Path.is_dir` on the top-level directory and " "propagates any :exc:`OSError` exception that is raised. Subsequent :exc:" @@ -943,7 +1023,7 @@ msgstr "" "此方法在頂層目錄上呼叫 :meth:`Path.is_dir` 並傳遞引發的任何 :exc:`OSError` 例" "外。將會抑制在目錄對於 :exc:`OSError` 例外的後續掃描。" -#: ../../library/pathlib.rst:1098 ../../library/pathlib.rst:1130 +#: ../../library/pathlib.rst:1197 ../../library/pathlib.rst:1229 msgid "" "By default, or when the *case_sensitive* keyword-only argument is set to " "``None``, this method matches paths using platform-specific casing rules: " @@ -955,13 +1035,13 @@ msgstr "" "在 Windows 上不區分大小寫。將 *case_sensitive* 設成 ``True`` 或 ``False`` 會" "覆寫這個行為。" -#: ../../library/pathlib.rst:1104 +#: ../../library/pathlib.rst:1203 msgid "" "Using the \"``**``\" pattern in large directory trees may consume an " "inordinate amount of time." msgstr "在很大的目錄樹裡使用 \"``**``\" 可能會耗費過多的時間。" -#: ../../library/pathlib.rst:1107 +#: ../../library/pathlib.rst:1206 msgid "" "Raises an :ref:`auditing event ` ``pathlib.Path.glob`` with " "arguments ``self``, ``pattern``." @@ -969,7 +1049,7 @@ msgstr "" "引發一個附帶引數 ``self``、``pattern`` 的\\ :ref:`稽核事件 ` " "``pathlib.Path.glob``。" -#: ../../library/pathlib.rst:1109 ../../library/pathlib.rst:1137 +#: ../../library/pathlib.rst:1208 ../../library/pathlib.rst:1236 msgid "" "Return only directories if *pattern* ends with a pathname components " "separator (:data:`~os.sep` or :data:`~os.altsep`)." @@ -977,7 +1057,7 @@ msgstr "" "如果 *pattern* 以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os." "altsep`)作結尾則只會回傳目錄。" -#: ../../library/pathlib.rst:1119 +#: ../../library/pathlib.rst:1218 msgid "" "Glob the given relative *pattern* recursively. This is like calling :func:" "`Path.glob` with \"``**/``\" added in front of the *pattern*, where " @@ -987,7 +1067,7 @@ msgstr "" "\"``**/``\" 並呼叫 :func:`Path.glob`,其中 *patterns* 和給 :mod:`fnmatch` 的" "相同: ::" -#: ../../library/pathlib.rst:1135 +#: ../../library/pathlib.rst:1234 msgid "" "Raises an :ref:`auditing event ` ``pathlib.Path.rglob`` with " "arguments ``self``, ``pattern``." @@ -995,13 +1075,13 @@ msgstr "" "引發一個附帶引數 ``self``、``pattern`` 的\\ :ref:`稽核事件 ` " "``pathlib.Path.rglob``。" -#: ../../library/pathlib.rst:1147 +#: ../../library/pathlib.rst:1246 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up." msgstr "透過由上而下或由下而上地走訪目錄樹產生目錄樹裡的檔案名稱。" -#: ../../library/pathlib.rst:1150 +#: ../../library/pathlib.rst:1249 msgid "" "For each directory in the directory tree rooted at *self* (including *self* " "but excluding '.' and '..'), the method yields a 3-tuple of ``(dirpath, " @@ -1010,7 +1090,7 @@ msgstr "" "對每個以 *self* 為根且在目錄樹裡的目錄(包含 *self* 但不包含 '.' 和 '..' )," "此方法會 yield 一個 ``(dirpath, dirnames, filenames)`` 的三元素元組。" -#: ../../library/pathlib.rst:1154 +#: ../../library/pathlib.rst:1253 msgid "" "*dirpath* is a :class:`Path` to the directory currently being walked, " "*dirnames* is a list of strings for the names of subdirectories in *dirpath* " @@ -1025,7 +1105,7 @@ msgstr "" "裡檔案或目錄的完整路徑(以 *self* 開頭),可以使用 ``dirpath / name``。會根據" "檔案系統來決定串列是否有排序。" -#: ../../library/pathlib.rst:1162 +#: ../../library/pathlib.rst:1261 msgid "" "If the optional argument *top_down* is true (which is the default), the " "triple for a directory is generated before the triples for any of its " @@ -1041,7 +1121,7 @@ msgstr "" "不論 *top_down* 的值是什麼,子目錄的串列會在走訪該目錄及其子目錄的三元素元組" "之前取得。" -#: ../../library/pathlib.rst:1170 +#: ../../library/pathlib.rst:1269 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." @@ -1061,7 +1141,7 @@ msgstr "" "*dirnames* 對 :meth:`Path.walk()` 的行為沒有影響,因為 *dirnames* 裡的目錄已" "經在 *dirnames* yield 給呼叫者之前被產生。" -#: ../../library/pathlib.rst:1180 +#: ../../library/pathlib.rst:1279 msgid "" "By default, errors from :func:`os.scandir` are ignored. If the optional " "argument *on_error* is specified, it should be a callable; it will be called " @@ -1074,7 +1154,7 @@ msgstr "" "這個可呼叫物件可以處理錯誤以繼續走訪,或者再次引發錯誤來停止走訪。注意,檔案" "名稱可以從例外物件的 ``filename`` 屬性來取得。" -#: ../../library/pathlib.rst:1186 +#: ../../library/pathlib.rst:1285 msgid "" "By default, :meth:`Path.walk` does not follow symbolic links, and instead " "adds them to the *filenames* list. Set *follow_symlinks* to true to resolve " @@ -1087,7 +1167,7 @@ msgstr "" "適當的 *dirnames* 和 *filenames*,而因此訪問到符號連結指向的目錄(在有支援符" "號連結的地方)。" -#: ../../library/pathlib.rst:1193 +#: ../../library/pathlib.rst:1292 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." @@ -1096,7 +1176,7 @@ msgstr "" "需要注意的是如果符號連結指向一個其本身的父目錄,則將 *follow_symlinks* 設定" "為 true 會導致無窮的遞迴。:meth:`Path.walk` 不會紀錄其已經訪問過的目錄。" -#: ../../library/pathlib.rst:1198 +#: ../../library/pathlib.rst:1297 msgid "" ":meth:`Path.walk` assumes the directories it walks are not modified during " "execution. For example, if a directory from *dirnames* has been replaced " @@ -1109,7 +1189,7 @@ msgstr "" "meth:`Path.walk` 依然會試著往下進入它。為了防止這樣的行為,可以從 *dirnames* " "適當地移除目錄。" -#: ../../library/pathlib.rst:1206 +#: ../../library/pathlib.rst:1305 msgid "" "Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in " "*filenames* if *follow_symlinks* is false." @@ -1117,7 +1197,7 @@ msgstr "" "如果 *follow_symlinks* 是 false,和 :func:`os.walk` 行為不同的是 :meth:`Path." "walk` 會將指向目錄的符號連結放在 *filenames* 串列。" -#: ../../library/pathlib.rst:1209 +#: ../../library/pathlib.rst:1308 msgid "" "This example displays the number of bytes used by all files in each " "directory, while ignoring ``__pycache__`` directories::" @@ -1125,7 +1205,7 @@ msgstr "" "這個範例會顯示在每個目錄裡所有檔案使用的位元組數量,同時間忽略 " "``__pycache__`` 目錄: ::" -#: ../../library/pathlib.rst:1225 +#: ../../library/pathlib.rst:1324 msgid "" "This next example is a simple implementation of :func:`shutil.rmtree`. " "Walking the tree bottom-up is essential as :func:`rmdir` doesn't allow " @@ -1134,75 +1214,39 @@ msgstr "" "下一個範例是 :func:`shutil.rmtree` 的一個簡單的實作方式。由下而上走訪目錄樹是" "必要的,因為 :func:`rmdir` 不允許在目錄為空之前刪除它: ::" -#: ../../library/pathlib.rst:1242 -msgid "Other methods" -msgstr "其他方法" - -#: ../../library/pathlib.rst:1246 -msgid "" -"Return a new path object representing the current directory (as returned by :" -"func:`os.getcwd`)::" -msgstr "" -"回傳一個代表目前目錄的新的路徑物件(像 :func:`os.getcwd` 回傳的一樣): ::" +#: ../../library/pathlib.rst:1341 +msgid "Creating files and directories" +msgstr "建立檔案與目錄" -#: ../../library/pathlib.rst:1255 +#: ../../library/pathlib.rst:1345 msgid "" -"Return a new path object representing the user's home directory (as returned " -"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`。" - -#: ../../library/pathlib.rst:1269 -msgid "Change the file mode and permissions, like :func:`os.chmod`." -msgstr "修改檔案模式 (file mode) 與權限,像 :func:`os.chmod` 一樣。" - -#: ../../library/pathlib.rst:1271 -msgid "" -"This method normally follows symlinks. Some Unix flavours support changing " -"permissions on the symlink itself; on these platforms you may add the " -"argument ``follow_symlinks=False``, or use :meth:`~Path.lchmod`." -msgstr "" -"此方法通常會跟隨符號連結。一些 Unix 類型支援修改符號連結本身的權限;在這些平" -"台上你可以加上引數 ``follow_symlinks=False`` 或使用 :meth:`~Path.lchmod`。" - -#: ../../library/pathlib.rst:1290 -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." -msgstr "" -"回傳一個展開 ``~`` 和 ``~user`` 構成的新路徑,像 :meth:`os.path.expanduser` " -"回傳的一樣。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" - -#: ../../library/pathlib.rst:1305 -msgid "" -"Return the name of the group owning the file. :exc:`KeyError` is raised if " -"the file's gid isn't found in the system database." +"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." msgstr "" -"回傳擁有該檔案的群組名稱。如果在系統資料庫裡找不到檔案的 gid 會引發 :exc:" -"`KeyError`。" +"根據給定路徑來建立一個檔案。如果 *mode* 有給定,它會與行程的 ``umask`` 值結" +"合,以確定檔案模式和存取旗標。當檔案已經存在時,若 *exist_ok* 為 true 則函式" +"不會失敗(其變更時間會被更新為當下時間),否則會引發 :exc:`FileExistsError`。" -#: ../../library/pathlib.rst:1311 +#: ../../library/pathlib.rst:1352 msgid "" -"Like :meth:`Path.chmod` but, if the path points to a symbolic link, the " -"symbolic link's mode is changed rather than its target's." +"The :meth:`~Path.open`, :meth:`~Path.write_text` and :meth:`~Path." +"write_bytes` methods are often used to create files." msgstr "" -"類似 :meth:`Path.chmod`,但如果該路徑指向一個符號連結,則符號連結的模式 " -"(mode) 會被改變而不是其指向的目標。" -#: ../../library/pathlib.rst:1317 +#: ../../library/pathlib.rst:1358 msgid "" "Create a new directory at this given path. If *mode* is given, it is " -"combined with the process' ``umask`` value to determine the file mode and " +"combined with the process's ``umask`` value to determine the file mode and " "access flags. If the path already exists, :exc:`FileExistsError` is raised." msgstr "" "在給定路徑下建立一個新的目錄。如果有給 *mode* 則會結合行程 (process) 的 " "``umask`` 值來決定檔案模式與存取旗標 (access flag)。如果路徑已經存在,會引" "發 :exc:`FileExistsError`。" -#: ../../library/pathlib.rst:1322 +#: ../../library/pathlib.rst:1363 msgid "" "If *parents* is true, any missing parents of this path are created as " "needed; they are created with the default permissions without taking *mode* " @@ -1211,7 +1255,7 @@ msgstr "" "如果 *parents* 是 true,則任何缺少的父路徑都會依需要被建立;它們不考慮 " "*mode* 而會以預設的權限來建立(模仿 POSIX 的 ``mkdir -p`` 指令)。" -#: ../../library/pathlib.rst:1326 +#: ../../library/pathlib.rst:1367 msgid "" "If *parents* is false (the default), a missing parent raises :exc:" "`FileNotFoundError`." @@ -1219,7 +1263,7 @@ msgstr "" "如果 *parents* 是 false(預設值),缺少的父路徑會引發 :exc:" "`FileNotFoundError`。" -#: ../../library/pathlib.rst:1329 +#: ../../library/pathlib.rst:1370 msgid "" "If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if " "the target directory already exists." @@ -1227,7 +1271,7 @@ msgstr "" "如果 *exist_ok* 是 false(預設值),則當目標目錄已經存在的話會引發 :exc:" "`FileExistsError`。" -#: ../../library/pathlib.rst:1332 +#: ../../library/pathlib.rst:1373 msgid "" "If *exist_ok* is true, :exc:`FileExistsError` will not be raised unless the " "given path already exists in the file system and is not a directory (same " @@ -1236,179 +1280,162 @@ msgstr "" "如果 *exist_ok* 是 true,只有當最後的路徑組成不是一個已存在的非目錄檔案,:" "exc:`FileExistsError` 例外會被忽略(與 POSIX 的 ``mkdir -p`` 指令行為相同)。" -#: ../../library/pathlib.rst:1336 +#: ../../library/pathlib.rst:1377 msgid "The *exist_ok* parameter was added." msgstr "新增 *exist_ok* 參數。" -#: ../../library/pathlib.rst:1342 +#: ../../library/pathlib.rst:1383 +msgid "Make this path a symbolic link pointing to *target*." +msgstr "使這個路徑成為一個指向 *target* 的符號連結。" + +#: ../../library/pathlib.rst:1385 msgid "" -"Return the name of the user owning the file. :exc:`KeyError` is raised if " -"the file's uid isn't found in the system database." +"On Windows, a symlink represents either a file or a directory, and does not " +"morph to the target dynamically. If the target is present, the type of the " +"symlink will be created to match. Otherwise, the symlink will be created as " +"a directory if *target_is_directory* is true or a file symlink (the default) " +"otherwise. On non-Windows platforms, *target_is_directory* is ignored." msgstr "" -"回傳擁有該檔案的用戶名稱。如果在系統資料庫中找不到該檔案的 uid,則會引發 :" -"exc:`KeyError`。" +"在 Windows 上,符號連結代表一個檔案或目錄,且不會隨著目標 (target) 動態改變。" +"如果目標存在,則符號連結的類型會被建立來符合其目標。否則如果 " +"*target_is_directory* 是 true,該符號連結會被建立成目錄,如果不是則建立成檔案" +"(預設值)。在非 Windows 平台上,*target_is_directory* 會被忽略。" -#: ../../library/pathlib.rst:1348 +#: ../../library/pathlib.rst:1403 msgid "" -"Return the path to which the symbolic link points (as returned by :func:`os." -"readlink`)::" -msgstr "回傳符號連結指向的路徑(如 :func:`os.readlink` 的回傳值): ::" +"The order of arguments (link, target) is the reverse of :func:`os.symlink`'s." +msgstr "引數的順序 (link, target) 和 :func:`os.symlink` 相反。" -#: ../../library/pathlib.rst:1361 +#: ../../library/pathlib.rst:1409 +msgid "Make this path a hard link to the same file as *target*." +msgstr "使這個路徑成為與 *target* 相同檔案的一個硬連結 (hard link)。" + +#: ../../library/pathlib.rst:1412 msgid "" -"Rename this file or directory to the given *target*, and return a new 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 " +"The order of arguments (link, target) is the reverse of :func:`os.link`'s." +msgstr "引數的順序 (link, target) 和 :func:`os.link` 相反。" + +#: ../../library/pathlib.rst:1419 +msgid "Renaming and deleting" +msgstr "" + +#: ../../library/pathlib.rst:1423 +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::" msgstr "" -"將此檔案或目錄重新命名為給定的 *target* ,並回傳一個新的路徑 (Path) 物件指向" -"該 *target* 。在 Unix 系統上,若 *target* 存在且為一個檔案,若使用者有權限," -"則會在不顯示訊息的情況下進行取代。在 Windows 系統上,若 *target* 存在,則會引" -"發 :exc:`FileExistsError` 錯誤。*target* 可以是字串或另一個路徑物件: ::" +"將此檔案或目錄重新命名為給定的 *target* ,並回傳一個新的 :class:`!Path` 實例" +"指向該 *target*。在 Unix 系統上,若 *target* 存在且為一個檔案,若使用者有權" +"限,則會在不顯示訊息的情況下進行取代。在 Windows 系統上,若 *target* 存在,則" +"會引發 :exc:`FileExistsError` 錯誤。*target* 可以是字串或另一個路徑物件: ::" -#: ../../library/pathlib.rst:1376 ../../library/pathlib.rst:1392 +#: ../../library/pathlib.rst:1438 ../../library/pathlib.rst:1454 msgid "" "The target path may be absolute or relative. Relative paths are interpreted " -"relative to the current working directory, *not* the directory of the Path " -"object." +"relative to the current working directory, *not* the directory of the :class:" +"`!Path` object." msgstr "" "目標路徑可以是絕對路徑或相對路徑。相對路徑會相對於當前的工作目錄進行解釋,*而" -"不是*\\ 相對於路徑物件所在的目錄。" +"不是*\\ 相對於 :class:`!Path` 物件所在的目錄。" -#: ../../library/pathlib.rst:1380 +#: ../../library/pathlib.rst:1442 msgid "" "It is implemented in terms of :func:`os.rename` and gives the same " "guarantees." msgstr "此功能是使用 :func:`os.rename` 實現的,並提供相同的保證。" -#: ../../library/pathlib.rst:1382 ../../library/pathlib.rst:1396 -msgid "Added return value, return the new Path instance." -msgstr "新增了回傳值,回傳新的路徑 (Path) 物件。" - -#: ../../library/pathlib.rst:1388 -msgid "" -"Rename this file or directory to the given *target*, and return a new Path " -"instance pointing to *target*. If *target* points to an existing file or " -"empty directory, it will be unconditionally replaced." -msgstr "" -"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的新路徑物" -"件。如果 *target* 指向一個現有的檔案或空目錄,它將被無條件地取代。" +#: ../../library/pathlib.rst:1444 ../../library/pathlib.rst:1458 +msgid "Added return value, return the new :class:`!Path` instance." +msgstr "新增了回傳值,回傳新的 :class:`!Path` 實例。" -#: ../../library/pathlib.rst:1402 +#: ../../library/pathlib.rst:1450 msgid "" -"Make the path absolute, without normalization or resolving symlinks. Returns " -"a new path object::" +"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* 指向一個現有的檔案或空目錄,它將被無條件地取代。" -#: ../../library/pathlib.rst:1414 +#: ../../library/pathlib.rst:1464 msgid "" -"Make the path absolute, resolving any symlinks. A new path object is " -"returned::" -msgstr "將路徑轉換為絕對路徑,解析所有符號連結。回傳一個新的路徑物件: ::" +"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:1423 +#: ../../library/pathlib.rst:1467 msgid "" -"\"``..``\" components are also eliminated (this is the only method to do " -"so)::" -msgstr "同時也會消除 \"``..``\" 的路徑組成(只有此方法這樣做): ::" +"If *missing_ok* is false (the default), :exc:`FileNotFoundError` is raised " +"if the path does not exist." +msgstr "" +"如果 *missing_ok* 是 false(預設值),:exc:`FileNotFoundError` 會在路徑不存在" +"時被引發。" -#: ../../library/pathlib.rst:1429 +#: ../../library/pathlib.rst:1470 msgid "" -"If the path doesn't exist and *strict* is ``True``, :exc:`FileNotFoundError` " -"is raised. If *strict* is ``False``, the path is resolved as far as " -"possible and any remainder is appended without checking whether it exists. " -"If an infinite loop is encountered along the resolution path, :exc:" -"`RuntimeError` is raised." +"If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be ignored " +"(same behavior as the POSIX ``rm -f`` command)." msgstr "" -"如果路徑不存在且 *strict* 為 ``True``,則引發 :exc:`FileNotFoundError`。如果 " -"*strict* 為 ``False``,則將盡可能解析該路徑,並將任何剩餘部分追加到路徑中,而" -"不檢查其是否存在。如果在解析過程中遇到無窮迴圈,則引發 :exc:`RuntimeError`。" +"如果 *missing_ok* 是 true,:exc:`FileNotFoundError` 例外會被忽略(行為與 " +"POSIX ``rm -f`` 指令相同)。" -#: ../../library/pathlib.rst:1435 -msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." -msgstr "新增 *strict* 參數(在 3.6 版本之前的行為是嚴格的)。" +#: ../../library/pathlib.rst:1473 +msgid "The *missing_ok* parameter was added." +msgstr "新增 *missing_ok* 參數。" -#: ../../library/pathlib.rst:1441 +#: ../../library/pathlib.rst:1479 msgid "Remove this directory. The directory must be empty." msgstr "移除此目錄。該目錄必須為空。" -#: ../../library/pathlib.rst:1446 -msgid "Make this path a symbolic link pointing to *target*." -msgstr "使這個路徑成為一個指向 *target* 的符號連結。" - -#: ../../library/pathlib.rst:1448 -msgid "" -"On Windows, a symlink represents either a file or a directory, and does not " -"morph to the target dynamically. If the target is present, the type of the " -"symlink will be created to match. Otherwise, the symlink will be created as " -"a directory if *target_is_directory* is ``True`` or a file symlink (the " -"default) otherwise. On non-Windows platforms, *target_is_directory* is " -"ignored." +#: ../../library/pathlib.rst:1483 +msgid "Permissions and ownership" msgstr "" -"在 Windows 上,符號連結代表一個檔案或目錄,且不會隨著目標 (target) 動態改變。" -"如果目標存在,則符號連結的類型會被建立來符合其目標。否則如果 " -"*target_is_directory* 是 ``True``,該符號連結會被建立成目錄,如果不是則建立成" -"檔案(預設值)。在非 Windows 平台上,*target_is_directory* 會被忽略。" - -#: ../../library/pathlib.rst:1466 -msgid "" -"The order of arguments (link, target) is the reverse of :func:`os.symlink`'s." -msgstr "引數的順序 (link, target) 和 :func:`os.symlink` 相反。" - -#: ../../library/pathlib.rst:1471 -msgid "Make this path a hard link to the same file as *target*." -msgstr "使這個路徑成為與 *target* 相同檔案的一個硬連結 (hard link)。" -#: ../../library/pathlib.rst:1474 +#: ../../library/pathlib.rst:1487 msgid "" -"The order of arguments (link, target) is the reverse of :func:`os.link`'s." -msgstr "引數的順序 (link, target) 和 :func:`os.link` 相反。" +"Return the name of the user owning the file. :exc:`KeyError` is raised if " +"the file's user identifier (UID) isn't found in the system database." +msgstr "" +"回傳擁有該檔案的用戶名稱。如果在系統資料庫中找不到該檔案的使用者識別字 " +"(UID),則會引發 :exc:`KeyError`。" -#: ../../library/pathlib.rst:1482 +#: ../../library/pathlib.rst:1493 msgid "" -"Create a file at this given path. If *mode* is given, it is combined with " -"the process' ``umask`` value to determine the file mode and access flags. " -"If the file already exists, the function succeeds if *exist_ok* is true (and " -"its modification time is updated to the current time), otherwise :exc:" -"`FileExistsError` is raised." +"Return the name of the group owning the file. :exc:`KeyError` is raised if " +"the file's group identifier (GID) isn't found in the system database." msgstr "" -"根據給定路徑來建立一個檔案。如果 *mode* 有給定,它會與行程的 ``umask`` 值結" -"合,以確定檔案模式和存取旗標。當檔案已經存在時,若 *exist_ok* 為 true 則函式" -"不會失敗(其變更時間會被更新為當下時間),否則會引發 :exc:`FileExistsError`。" +"回傳擁有該檔案的群組名稱。如果在系統資料庫裡找不到檔案的群組識別字 (GID) 會引" +"發 :exc:`KeyError`。" -#: ../../library/pathlib.rst:1491 -msgid "" -"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:1499 +msgid "Change the file mode and permissions, like :func:`os.chmod`." +msgstr "修改檔案模式 (file mode) 與權限,像 :func:`os.chmod` 一樣。" -#: ../../library/pathlib.rst:1494 +#: ../../library/pathlib.rst:1501 msgid "" -"If *missing_ok* is false (the default), :exc:`FileNotFoundError` is raised " -"if the path does not exist." +"This method normally follows symlinks. Some Unix flavours support changing " +"permissions on the symlink itself; on these platforms you may add the " +"argument ``follow_symlinks=False``, or use :meth:`~Path.lchmod`." msgstr "" -"如果 *missing_ok* 是 false(預設值),:exc:`FileNotFoundError` 會在路徑不存在" -"時被引發。" +"此方法通常會跟隨符號連結。一些 Unix 類型支援修改符號連結本身的權限;在這些平" +"台上你可以加上引數 ``follow_symlinks=False`` 或使用 :meth:`~Path.lchmod`。" -#: ../../library/pathlib.rst:1497 +#: ../../library/pathlib.rst:1520 msgid "" -"If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be ignored " -"(same behavior as the POSIX ``rm -f`` command)." +"Like :meth:`Path.chmod` but, if the path points to a symbolic link, the " +"symbolic link's mode is changed rather than its target's." msgstr "" -"如果 *missing_ok* 是 true,:exc:`FileNotFoundError` 例外會被忽略(行為與 " -"POSIX ``rm -f`` 指令相同)。" - -#: ../../library/pathlib.rst:1500 -msgid "The *missing_ok* parameter was added." -msgstr "新增 *missing_ok* 參數。" +"類似 :meth:`Path.chmod`,但如果該路徑指向一個符號連結,則符號連結的模式 " +"(mode) 會被改變而不是其指向的目標。" -#: ../../library/pathlib.rst:1505 +#: ../../library/pathlib.rst:1525 msgid "Correspondence to tools in the :mod:`os` module" msgstr "與 :mod:`os` 模組裡的工具的對應關係" -#: ../../library/pathlib.rst:1507 +#: ../../library/pathlib.rst:1527 msgid "" "Below is a table mapping various :mod:`os` functions to their corresponding :" "class:`PurePath`/:class:`Path` equivalent." @@ -1416,7 +1443,7 @@ msgstr "" "以下是一張表格,對應許多 :mod:`os` 函式及其相符於 :class:`PurePath`/:class:" "`Path` 的項目。" -#: ../../library/pathlib.rst:1512 +#: ../../library/pathlib.rst:1532 msgid "" "Not all pairs of functions/methods below are equivalent. Some of them, " "despite having some overlapping use-cases, have different semantics. They " @@ -1427,239 +1454,239 @@ msgstr "" "意。它們包含 :func:`os.path.abspath` 和 :meth:`Path.absolute`、:func:`os." "path.relpath` 和 :meth:`PurePath.relative_to`。" -#: ../../library/pathlib.rst:1518 +#: ../../library/pathlib.rst:1538 msgid ":mod:`os` and :mod:`os.path`" msgstr ":mod:`os` 和 :mod:`os.path`" -#: ../../library/pathlib.rst:1518 +#: ../../library/pathlib.rst:1538 msgid ":mod:`pathlib`" msgstr ":mod:`pathlib`" -#: ../../library/pathlib.rst:1520 +#: ../../library/pathlib.rst:1540 msgid ":func:`os.path.abspath`" msgstr ":func:`os.path.abspath`" -#: ../../library/pathlib.rst:1520 +#: ../../library/pathlib.rst:1540 msgid ":meth:`Path.absolute` [#]_" msgstr ":meth:`Path.absolute` [#]_" -#: ../../library/pathlib.rst:1521 +#: ../../library/pathlib.rst:1541 msgid ":func:`os.path.realpath`" msgstr ":func:`os.path.realpath`" -#: ../../library/pathlib.rst:1521 +#: ../../library/pathlib.rst:1541 msgid ":meth:`Path.resolve`" msgstr ":meth:`Path.resolve`" -#: ../../library/pathlib.rst:1522 +#: ../../library/pathlib.rst:1542 msgid ":func:`os.chmod`" msgstr ":func:`os.chmod`" -#: ../../library/pathlib.rst:1522 +#: ../../library/pathlib.rst:1542 msgid ":meth:`Path.chmod`" msgstr ":meth:`Path.chmod`" -#: ../../library/pathlib.rst:1523 +#: ../../library/pathlib.rst:1543 msgid ":func:`os.mkdir`" msgstr ":func:`os.mkdir`" -#: ../../library/pathlib.rst:1523 ../../library/pathlib.rst:1524 +#: ../../library/pathlib.rst:1543 ../../library/pathlib.rst:1544 msgid ":meth:`Path.mkdir`" msgstr ":meth:`Path.mkdir`" -#: ../../library/pathlib.rst:1524 +#: ../../library/pathlib.rst:1544 msgid ":func:`os.makedirs`" msgstr ":func:`os.makedirs`" -#: ../../library/pathlib.rst:1525 +#: ../../library/pathlib.rst:1545 msgid ":func:`os.rename`" msgstr ":func:`os.rename`" -#: ../../library/pathlib.rst:1525 +#: ../../library/pathlib.rst:1545 msgid ":meth:`Path.rename`" msgstr ":meth:`Path.rename`" -#: ../../library/pathlib.rst:1526 +#: ../../library/pathlib.rst:1546 msgid ":func:`os.replace`" msgstr ":func:`os.replace`" -#: ../../library/pathlib.rst:1526 +#: ../../library/pathlib.rst:1546 msgid ":meth:`Path.replace`" msgstr ":meth:`Path.replace`" -#: ../../library/pathlib.rst:1527 +#: ../../library/pathlib.rst:1547 msgid ":func:`os.rmdir`" msgstr ":func:`os.rmdir`" -#: ../../library/pathlib.rst:1527 +#: ../../library/pathlib.rst:1547 msgid ":meth:`Path.rmdir`" msgstr ":meth:`Path.rmdir`" -#: ../../library/pathlib.rst:1528 +#: ../../library/pathlib.rst:1548 msgid ":func:`os.remove`, :func:`os.unlink`" msgstr ":func:`os.remove`、:func:`os.unlink`" -#: ../../library/pathlib.rst:1528 +#: ../../library/pathlib.rst:1548 msgid ":meth:`Path.unlink`" msgstr ":meth:`Path.unlink`" -#: ../../library/pathlib.rst:1529 +#: ../../library/pathlib.rst:1549 msgid ":func:`os.getcwd`" msgstr ":func:`os.getcwd`" -#: ../../library/pathlib.rst:1529 +#: ../../library/pathlib.rst:1549 msgid ":func:`Path.cwd`" msgstr ":func:`Path.cwd`" -#: ../../library/pathlib.rst:1530 +#: ../../library/pathlib.rst:1550 msgid ":func:`os.path.exists`" msgstr ":func:`os.path.exists`" -#: ../../library/pathlib.rst:1530 +#: ../../library/pathlib.rst:1550 msgid ":meth:`Path.exists`" msgstr ":meth:`Path.exists`" -#: ../../library/pathlib.rst:1531 +#: ../../library/pathlib.rst:1551 msgid ":func:`os.path.expanduser`" msgstr ":func:`os.path.expanduser`" -#: ../../library/pathlib.rst:1531 +#: ../../library/pathlib.rst:1551 msgid ":meth:`Path.expanduser` and :meth:`Path.home`" msgstr ":meth:`Path.expanduser` 和 :meth:`Path.home`" -#: ../../library/pathlib.rst:1533 +#: ../../library/pathlib.rst:1553 msgid ":func:`os.listdir`" msgstr ":func:`os.listdir`" -#: ../../library/pathlib.rst:1533 +#: ../../library/pathlib.rst:1553 msgid ":meth:`Path.iterdir`" msgstr ":meth:`Path.iterdir`" -#: ../../library/pathlib.rst:1534 +#: ../../library/pathlib.rst:1554 msgid ":func:`os.walk`" msgstr ":func:`os.walk`" -#: ../../library/pathlib.rst:1534 +#: ../../library/pathlib.rst:1554 msgid ":meth:`Path.walk`" msgstr ":meth:`Path.walk`" -#: ../../library/pathlib.rst:1535 +#: ../../library/pathlib.rst:1555 msgid ":func:`os.path.isdir`" msgstr ":func:`os.path.isdir`" -#: ../../library/pathlib.rst:1535 +#: ../../library/pathlib.rst:1555 msgid ":meth:`Path.is_dir`" msgstr ":meth:`Path.is_dir`" -#: ../../library/pathlib.rst:1536 +#: ../../library/pathlib.rst:1556 msgid ":func:`os.path.isfile`" msgstr ":func:`os.path.isfile`" -#: ../../library/pathlib.rst:1536 +#: ../../library/pathlib.rst:1556 msgid ":meth:`Path.is_file`" msgstr ":meth:`Path.is_file`" -#: ../../library/pathlib.rst:1537 +#: ../../library/pathlib.rst:1557 msgid ":func:`os.path.islink`" msgstr ":func:`os.path.islink`" -#: ../../library/pathlib.rst:1537 +#: ../../library/pathlib.rst:1557 msgid ":meth:`Path.is_symlink`" msgstr ":meth:`Path.is_symlink`" -#: ../../library/pathlib.rst:1538 +#: ../../library/pathlib.rst:1558 msgid ":func:`os.link`" msgstr ":func:`os.link`" -#: ../../library/pathlib.rst:1538 +#: ../../library/pathlib.rst:1558 msgid ":meth:`Path.hardlink_to`" msgstr ":meth:`Path.hardlink_to`" -#: ../../library/pathlib.rst:1539 +#: ../../library/pathlib.rst:1559 msgid ":func:`os.symlink`" msgstr ":func:`os.symlink`" -#: ../../library/pathlib.rst:1539 +#: ../../library/pathlib.rst:1559 msgid ":meth:`Path.symlink_to`" msgstr ":meth:`Path.symlink_to`" -#: ../../library/pathlib.rst:1540 +#: ../../library/pathlib.rst:1560 msgid ":func:`os.readlink`" msgstr ":func:`os.readlink`" -#: ../../library/pathlib.rst:1540 +#: ../../library/pathlib.rst:1560 msgid ":meth:`Path.readlink`" msgstr ":meth:`Path.readlink`" -#: ../../library/pathlib.rst:1541 +#: ../../library/pathlib.rst:1561 msgid ":func:`os.path.relpath`" msgstr ":func:`os.path.relpath`" -#: ../../library/pathlib.rst:1541 +#: ../../library/pathlib.rst:1561 msgid ":meth:`PurePath.relative_to` [#]_" msgstr ":meth:`PurePath.relative_to` [#]_" -#: ../../library/pathlib.rst:1542 +#: ../../library/pathlib.rst:1562 msgid ":func:`os.stat`" msgstr ":func:`os.stat`" -#: ../../library/pathlib.rst:1542 +#: ../../library/pathlib.rst:1562 msgid ":meth:`Path.stat`, :meth:`Path.owner`, :meth:`Path.group`" msgstr ":meth:`Path.stat`、:meth:`Path.owner`、:meth:`Path.group`" -#: ../../library/pathlib.rst:1545 +#: ../../library/pathlib.rst:1565 msgid ":func:`os.path.isabs`" msgstr ":func:`os.path.isabs`" -#: ../../library/pathlib.rst:1545 +#: ../../library/pathlib.rst:1565 msgid ":meth:`PurePath.is_absolute`" msgstr ":meth:`PurePath.is_absolute`" -#: ../../library/pathlib.rst:1546 +#: ../../library/pathlib.rst:1566 msgid ":func:`os.path.join`" msgstr ":func:`os.path.join`" -#: ../../library/pathlib.rst:1546 +#: ../../library/pathlib.rst:1566 msgid ":func:`PurePath.joinpath`" msgstr ":func:`PurePath.joinpath`" -#: ../../library/pathlib.rst:1547 +#: ../../library/pathlib.rst:1567 msgid ":func:`os.path.basename`" msgstr ":func:`os.path.basename`" -#: ../../library/pathlib.rst:1547 +#: ../../library/pathlib.rst:1567 msgid ":attr:`PurePath.name`" msgstr ":attr:`PurePath.name`" -#: ../../library/pathlib.rst:1548 +#: ../../library/pathlib.rst:1568 msgid ":func:`os.path.dirname`" msgstr ":func:`os.path.dirname`" -#: ../../library/pathlib.rst:1548 +#: ../../library/pathlib.rst:1568 msgid ":attr:`PurePath.parent`" msgstr ":attr:`PurePath.parent`" -#: ../../library/pathlib.rst:1549 +#: ../../library/pathlib.rst:1569 msgid ":func:`os.path.samefile`" msgstr ":func:`os.path.samefile`" -#: ../../library/pathlib.rst:1549 +#: ../../library/pathlib.rst:1569 msgid ":meth:`Path.samefile`" msgstr ":meth:`Path.samefile`" -#: ../../library/pathlib.rst:1550 +#: ../../library/pathlib.rst:1570 msgid ":func:`os.path.splitext`" msgstr ":func:`os.path.splitext`" -#: ../../library/pathlib.rst:1550 +#: ../../library/pathlib.rst:1570 msgid ":attr:`PurePath.stem` and :attr:`PurePath.suffix`" msgstr ":attr:`PurePath.stem` 和 :attr:`PurePath.suffix`" -#: ../../library/pathlib.rst:1555 +#: ../../library/pathlib.rst:1575 msgid "Footnotes" msgstr "註解" -#: ../../library/pathlib.rst:1556 +#: ../../library/pathlib.rst:1576 msgid "" ":func:`os.path.abspath` normalizes the resulting path, which may change its " "meaning in the presence of symlinks, while :meth:`Path.absolute` does not." @@ -1667,7 +1694,7 @@ msgstr "" ":func:`os.path.abspath` 會標準化產生的路徑,因而當有符號連結的時候會改變其意" "義,但 :meth:`Path.absolute` 不會。" -#: ../../library/pathlib.rst:1557 +#: ../../library/pathlib.rst:1577 msgid "" ":meth:`PurePath.relative_to` requires ``self`` to be the subpath of the " "argument, but :func:`os.path.relpath` does not." @@ -1682,3 +1709,6 @@ msgstr "path(路徑)" #: ../../library/pathlib.rst:11 msgid "operations" msgstr "operations(操作)" + +#~ msgid "Other methods" +#~ msgstr "其他方法" diff --git a/library/pprint.po b/library/pprint.po index 57bdf3bcca..a1249a0071 100644 --- a/library/pprint.po +++ b/library/pprint.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-29 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,61 +59,97 @@ msgstr "" msgid "Functions" msgstr "" -#: ../../library/pprint.rst:40 +#: ../../library/pprint.rst:41 msgid "" -"Prints the formatted representation of *object* followed by a newline. If " -"*sort_dicts* is false (the default), dictionaries will be displayed with " -"their keys in insertion order, otherwise the dict keys will be sorted. " -"*args* and *kwargs* will be passed to :func:`~pprint.pprint` as formatting " -"parameters." +"Prints the formatted representation of *object*, followed by a newline. This " +"function may be used in the interactive interpreter instead of the :func:" +"`print` function for inspecting values. Tip: you can reassign ``print = " +"pprint.pp`` for use within a scope." +msgstr "" + +#: ../../library/pprint.rst:0 +msgid "Parameters" +msgstr "" + +#: ../../library/pprint.rst:46 +msgid "The object to be printed." +msgstr "" + +#: ../../library/pprint.rst:49 +msgid "" +"A file-like object to which the output will be written by calling its :meth:" +"`!write` method. If ``None`` (the default), :data:`sys.stdout` is used." +msgstr "" + +#: ../../library/pprint.rst:55 +msgid "The amount of indentation added for each nesting level." +msgstr "" + +#: ../../library/pprint.rst:58 +msgid "" +"The desired maximum number of characters per line in the output. If a " +"structure cannot be formatted within the width constraint, a best effort " +"will be made." msgstr "" #: ../../library/pprint.rst:63 msgid "" -"Prints the formatted representation of *object* on *stream*, followed by a " -"newline. If *stream* is ``None``, :data:`sys.stdout` is used. This may be " -"used in the interactive interpreter instead of the :func:`print` function " -"for inspecting values (you can even reassign ``print = pprint.pprint`` for " -"use within a scope)." +"The number of nesting levels which may be printed. If the data structure " +"being printed is too deep, the next contained level is replaced by ``...``. " +"If ``None`` (the default), there is no constraint on the depth of the " +"objects being formatted." msgstr "" -#: ../../library/pprint.rst:69 +#: ../../library/pprint.rst:71 msgid "" -"The configuration parameters *stream*, *indent*, *width*, *depth*, " -"*compact*, *sort_dicts* and *underscore_numbers* are passed to the :class:" -"`PrettyPrinter` constructor and their meanings are as described in its " -"documentation below." +"Control the way long :term:`sequences ` are formatted. If " +"``False`` (the default), each item of a sequence will be formatted on a " +"separate line, otherwise as many items as will fit within the *width* will " +"be formatted on each output line." msgstr "" -#: ../../library/pprint.rst:74 +#: ../../library/pprint.rst:78 msgid "" -"Note that *sort_dicts* is ``True`` by default and you might want to use :" -"func:`~pprint.pp` instead where it is ``False`` by default." +"If ``True``, dictionaries will be formatted with their keys sorted, " +"otherwise they will be displayed in insertion order (the default)." msgstr "" -#: ../../library/pprint.rst:80 +#: ../../library/pprint.rst:83 +msgid "" +"If ``True``, integers will be formatted with the ``_`` character for a " +"thousands separator, otherwise underscores are not displayed (the default)." +msgstr "" + +#: ../../library/pprint.rst:105 +msgid "" +"Alias for :func:`~pprint.pp` with *sort_dicts* set to ``True`` by default, " +"which would automatically sort the dictionaries' keys, you might want to " +"use :func:`~pprint.pp` instead where it is ``False`` by default." +msgstr "" + +#: ../../library/pprint.rst:113 msgid "" "Return the formatted representation of *object* as a string. *indent*, " "*width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* are " "passed to the :class:`PrettyPrinter` constructor as formatting parameters " -"and their meanings are as described in its documentation below." +"and their meanings are as described in the documentation above." msgstr "" -#: ../../library/pprint.rst:90 +#: ../../library/pprint.rst:123 msgid "" "Determine if the formatted representation of *object* is \"readable\", or " "can be used to reconstruct the value using :func:`eval`. This always " "returns ``False`` for recursive objects." msgstr "" -#: ../../library/pprint.rst:100 +#: ../../library/pprint.rst:133 msgid "" "Determine if *object* requires a recursive representation. This function is " "subject to the same limitations as noted in :func:`saferepr` below and may " "raise an :exc:`RecursionError` if it fails to detect a recursive object." msgstr "" -#: ../../library/pprint.rst:107 +#: ../../library/pprint.rst:140 msgid "" "Return a string representation of *object*, protected against recursion in " "some common data structures, namely instances of :class:`dict`, :class:" @@ -123,109 +159,53 @@ msgid "" "id=number>``. The representation is not otherwise formatted." msgstr "" -#: ../../library/pprint.rst:120 +#: ../../library/pprint.rst:153 msgid "PrettyPrinter Objects" msgstr "PrettyPrinter 物件" -#: ../../library/pprint.rst:122 -msgid "This module defines one class:" +#: ../../library/pprint.rst:160 +msgid "Construct a :class:`PrettyPrinter` instance." msgstr "" -#: ../../library/pprint.rst:132 -msgid "" -"Construct a :class:`PrettyPrinter` instance. This constructor understands " -"several keyword parameters." -msgstr "" - -#: ../../library/pprint.rst:135 -msgid "" -"*stream* (default :data:`!sys.stdout`) is a :term:`file-like object` to " -"which the output will be written by calling its :meth:`!write` method. If " -"both *stream* and :data:`!sys.stdout` are ``None``, then :meth:" -"`~PrettyPrinter.pprint` silently returns." -msgstr "" - -#: ../../library/pprint.rst:140 +#: ../../library/pprint.rst:162 msgid "" -"Other values configure the manner in which nesting of complex data " -"structures is displayed." +"Arguments have the same meaning as for :func:`~pprint.pp`. Note that they " +"are in a different order, and that *sort_dicts* defaults to ``True``." msgstr "" -#: ../../library/pprint.rst:143 -msgid "" -"*indent* (default 1) specifies the amount of indentation added for each " -"nesting level." -msgstr "" - -#: ../../library/pprint.rst:146 -msgid "" -"*depth* controls the number of nesting levels which may be printed; if the " -"data structure being printed is too deep, the next contained level is " -"replaced by ``...``. By default, there is no constraint on the depth of the " -"objects being formatted." -msgstr "" - -#: ../../library/pprint.rst:151 -msgid "" -"*width* (default 80) specifies the desired maximum number of characters per " -"line in the output. If a structure cannot be formatted within the width " -"constraint, a best effort will be made." -msgstr "" - -#: ../../library/pprint.rst:155 -msgid "" -"*compact* impacts the way that long sequences (lists, tuples, sets, etc) are " -"formatted. If *compact* is false (the default) then each item of a sequence " -"will be formatted on a separate line. If *compact* is true, as many items " -"as will fit within the *width* will be formatted on each output line." -msgstr "" - -#: ../../library/pprint.rst:161 -msgid "" -"If *sort_dicts* is true (the default), dictionaries will be formatted with " -"their keys sorted, otherwise they will display in insertion order." -msgstr "" - -#: ../../library/pprint.rst:164 -msgid "" -"If *underscore_numbers* is true, integers will be formatted with the ``_`` " -"character for a thousands separator, otherwise underscores are not displayed " -"(the default)." -msgstr "" - -#: ../../library/pprint.rst:168 +#: ../../library/pprint.rst:189 msgid "Added the *compact* parameter." msgstr "新增 *compact* 參數。" -#: ../../library/pprint.rst:171 +#: ../../library/pprint.rst:192 msgid "Added the *sort_dicts* parameter." msgstr "新增 *sort_dicts* 參數。" -#: ../../library/pprint.rst:174 +#: ../../library/pprint.rst:195 msgid "Added the *underscore_numbers* parameter." msgstr "新增 *underscore_numbers* 參數。" -#: ../../library/pprint.rst:177 +#: ../../library/pprint.rst:198 msgid "No longer attempts to write to :data:`!sys.stdout` if it is ``None``." msgstr "" -#: ../../library/pprint.rst:204 +#: ../../library/pprint.rst:202 msgid ":class:`PrettyPrinter` instances have the following methods:" msgstr "" -#: ../../library/pprint.rst:209 +#: ../../library/pprint.rst:207 msgid "" "Return the formatted representation of *object*. This takes into account " "the options passed to the :class:`PrettyPrinter` constructor." msgstr "" -#: ../../library/pprint.rst:215 +#: ../../library/pprint.rst:213 msgid "" "Print the formatted representation of *object* on the configured stream, " "followed by a newline." msgstr "" -#: ../../library/pprint.rst:218 +#: ../../library/pprint.rst:216 msgid "" "The following methods provide the implementations for the corresponding " "functions of the same names. Using these methods on an instance is slightly " @@ -233,7 +213,7 @@ msgid "" "created." msgstr "" -#: ../../library/pprint.rst:228 +#: ../../library/pprint.rst:226 msgid "" "Determine if the formatted representation of the object is \"readable,\" or " "can be used to reconstruct the value using :func:`eval`. Note that this " @@ -242,18 +222,18 @@ msgid "" "returns ``False``." msgstr "" -#: ../../library/pprint.rst:237 +#: ../../library/pprint.rst:235 msgid "Determine if the object requires a recursive representation." msgstr "" -#: ../../library/pprint.rst:239 +#: ../../library/pprint.rst:237 msgid "" "This method is provided as a hook to allow subclasses to modify the way " "objects are converted to strings. The default implementation uses the " "internals of the :func:`saferepr` implementation." msgstr "" -#: ../../library/pprint.rst:246 +#: ../../library/pprint.rst:244 msgid "" "Returns three values: the formatted version of *object* as a string, a flag " "indicating whether the result is readable, and a flag indicating whether " @@ -271,45 +251,45 @@ msgid "" "of the current call." msgstr "" -#: ../../library/pprint.rst:264 +#: ../../library/pprint.rst:262 msgid "Example" msgstr "範例" -#: ../../library/pprint.rst:266 +#: ../../library/pprint.rst:264 msgid "" "To demonstrate several uses of the :func:`~pprint.pp` function and its " "parameters, let's fetch information about a project from `PyPI `_::" msgstr "" -#: ../../library/pprint.rst:275 +#: ../../library/pprint.rst:273 msgid "In its basic form, :func:`~pprint.pp` shows the whole object::" msgstr "" -#: ../../library/pprint.rst:331 +#: ../../library/pprint.rst:329 msgid "" "The result can be limited to a certain *depth* (ellipsis is used for deeper " "contents)::" msgstr "" -#: ../../library/pprint.rst:377 +#: ../../library/pprint.rst:375 msgid "" "Additionally, maximum character *width* can be suggested. If a long object " "cannot be split, the specified width will be exceeded::" msgstr "" -#: ../../library/pprint.rst:88 ../../library/pprint.rst:226 +#: ../../library/pprint.rst:121 ../../library/pprint.rst:224 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/pprint.rst:88 ../../library/pprint.rst:226 +#: ../../library/pprint.rst:121 ../../library/pprint.rst:224 msgid "eval" msgstr "eval" -#: ../../library/pprint.rst:127 +#: ../../library/pprint.rst:155 msgid "..." msgstr "..." -#: ../../library/pprint.rst:127 +#: ../../library/pprint.rst:155 msgid "placeholder" msgstr "placeholder(佔位符號)" diff --git a/library/profile.po b/library/profile.po index 2a81cdfd7a..39f604d1ad 100644 --- a/library/profile.po +++ b/library/profile.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-18 00:04+0000\n" +"POT-Creation-Date: 2024-07-14 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -953,7 +953,7 @@ msgid "" "As the :class:`cProfile.Profile` class cannot be calibrated, custom timer " "functions should be used with care and should be as fast as possible. For " "the best results with a custom timer, it might be necessary to hard-code it " -"in the C source of the internal :mod:`_lsprof` module." +"in the C source of the internal :mod:`!_lsprof` module." msgstr "" #: ../../library/profile.rst:697 diff --git a/library/re.po b/library/re.po index 8112fe1e0f..adb77d54c4 100644 --- a/library/re.po +++ b/library/re.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-24 00:04+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:1606 +#: ../../library/re.rst:101 ../../library/re.rst:1638 msgid "``.``" msgstr "``.``" @@ -177,7 +177,7 @@ msgstr "``.``" msgid "" "(Dot.) In the default mode, this matches any character except a newline. " "If the :const:`DOTALL` flag has been specified, this matches any character " -"including a newline." +"including a newline. ``(?s:.)`` matches any character regardless of flags." msgstr "" #: ../../library/re.rst:108 @@ -1080,10 +1080,10 @@ msgid "" "Note that when the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in " "combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII " "letters and 4 additional non-ASCII letters: 'İ' (U+0130, Latin capital " -"letter I with dot above), 'ı' (U+0131, Latin small letter dotless i), 'ſ' " -"(U+017F, Latin small letter long s) and 'K' (U+212A, Kelvin sign). If the :" -"py:const:`~re.ASCII` flag is used, only letters 'a' to 'z' and 'A' to 'Z' " -"are matched." +"letter I with dot above), 'ı' (U+0131, Latin small letter dotless i), " +"'ſ' (U+017F, Latin small letter long s) and 'K' (U+212A, Kelvin sign). If " +"the :py:const:`~re.ASCII` flag is used, only letters 'a' to 'z' and 'A' to " +"'Z' are matched." msgstr "" #: ../../library/re.rst:778 @@ -1198,7 +1198,10 @@ msgid "" "match`, :func:`~Pattern.search` and other methods, described below." msgstr "" -#: ../../library/re.rst:882 +#: ../../library/re.rst:882 ../../library/re.rst:914 ../../library/re.rst:932 +#: ../../library/re.rst:943 ../../library/re.rst:989 ../../library/re.rst:1018 +#: ../../library/re.rst:1033 ../../library/re.rst:1092 +#: ../../library/re.rst:1131 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 " @@ -1237,7 +1240,7 @@ msgid "" "some point in the string." msgstr "" -#: ../../library/re.rst:917 +#: ../../library/re.rst:921 msgid "" "If zero or more characters at the beginning of *string* match the regular " "expression *pattern*, return a corresponding :class:`~re.Match`. Return " @@ -1245,26 +1248,26 @@ msgid "" "different from a zero-length match." msgstr "" -#: ../../library/re.rst:922 +#: ../../library/re.rst:926 msgid "" "Note that even in :const:`MULTILINE` mode, :func:`re.match` will only match " "at the beginning of the string and not at the beginning of each line." msgstr "" -#: ../../library/re.rst:925 +#: ../../library/re.rst:929 msgid "" "If you want to locate a match anywhere in *string*, use :func:`search` " "instead (see also :ref:`search-vs-match`)." msgstr "" -#: ../../library/re.rst:931 +#: ../../library/re.rst:939 msgid "" "If the whole *string* matches the regular expression *pattern*, 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:940 +#: ../../library/re.rst:952 msgid "" "Split *string* by the occurrences of *pattern*. If capturing parentheses " "are used in *pattern*, then the text of all groups in the pattern are also " @@ -1273,42 +1276,42 @@ msgid "" "final element of the list. ::" msgstr "" -#: ../../library/re.rst:955 +#: ../../library/re.rst:967 msgid "" "If there are capturing groups in the separator and it matches at the start " "of the string, the result will start with an empty string. The same holds " "for the end of the string::" msgstr "" -#: ../../library/re.rst:962 +#: ../../library/re.rst:974 msgid "" "That way, separator components are always found at the same relative indices " "within the result list." msgstr "" -#: ../../library/re.rst:965 +#: ../../library/re.rst:977 msgid "" "Empty matches for the pattern split the string only when not adjacent to a " "previous empty match." msgstr "" -#: ../../library/re.rst:977 ../../library/re.rst:1068 ../../library/re.rst:1097 +#: ../../library/re.rst:993 ../../library/re.rst:1096 ../../library/re.rst:1125 msgid "Added the optional flags argument." msgstr "新增可選的旗標引數。" -#: ../../library/re.rst:980 +#: ../../library/re.rst:996 msgid "" "Added support of splitting on a pattern that could match an empty string." msgstr "" -#: ../../library/re.rst:986 +#: ../../library/re.rst:1002 msgid "" "Return all non-overlapping matches of *pattern* in *string*, as a list of " "strings or tuples. The *string* is scanned left-to-right, and matches are " "returned in the order found. Empty matches are included in the result." msgstr "" -#: ../../library/re.rst:990 +#: ../../library/re.rst:1006 msgid "" "The result depends on the number of capturing groups in the pattern. If " "there are no groups, return a list of strings matching the whole pattern. " @@ -1318,11 +1321,11 @@ msgid "" "result." msgstr "" -#: ../../library/re.rst:1002 ../../library/re.rst:1013 +#: ../../library/re.rst:1022 ../../library/re.rst:1037 msgid "Non-empty matches can now start just after a previous empty match." msgstr "" -#: ../../library/re.rst:1008 +#: ../../library/re.rst:1028 msgid "" "Return an :term:`iterator` yielding :class:`~re.Match` objects over all non-" "overlapping matches for the RE *pattern* in *string*. The *string* is " @@ -1330,7 +1333,7 @@ msgid "" "matches are included in the result." msgstr "" -#: ../../library/re.rst:1019 +#: ../../library/re.rst:1043 msgid "" "Return the string obtained by replacing the leftmost non-overlapping " "occurrences of *pattern* in *string* by the replacement *repl*. If the " @@ -1344,18 +1347,18 @@ msgid "" "For example::" msgstr "" -#: ../../library/re.rst:1035 +#: ../../library/re.rst:1059 msgid "" "If *repl* is a function, it is called for every non-overlapping occurrence " "of *pattern*. The function takes a single :class:`~re.Match` argument, and " "returns the replacement string. For example::" msgstr "" -#: ../../library/re.rst:1048 +#: ../../library/re.rst:1072 msgid "The pattern may be a string or a :class:`~re.Pattern`." msgstr "" -#: ../../library/re.rst:1050 +#: ../../library/re.rst:1074 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, " @@ -1364,7 +1367,7 @@ msgid "" "'abxd')`` returns ``'-a-b--d-'``." msgstr "" -#: ../../library/re.rst:1058 +#: ../../library/re.rst:1082 msgid "" "In string-type *repl* arguments, in addition to the character escapes and " "backreferences described above, ``\\g`` will use the substring matched " @@ -1377,60 +1380,60 @@ msgid "" "RE." msgstr "" -#: ../../library/re.rst:1071 ../../library/re.rst:1100 -#: ../../library/re.rst:1344 +#: ../../library/re.rst:1099 ../../library/re.rst:1128 +#: ../../library/re.rst:1376 msgid "Unmatched groups are replaced with an empty string." msgstr "" -#: ../../library/re.rst:1074 +#: ../../library/re.rst:1102 msgid "" "Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now " "are errors." msgstr "" -#: ../../library/re.rst:1078 +#: ../../library/re.rst:1106 msgid "" "Unknown escapes in *repl* consisting of ``'\\'`` and an ASCII letter now are " "errors." msgstr "" -#: ../../library/re.rst:1082 +#: ../../library/re.rst:1110 msgid "" "Empty matches for the pattern are replaced when adjacent to a previous non-" "empty match." msgstr "" -#: ../../library/re.rst:1086 +#: ../../library/re.rst:1114 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` replacement " "strings, group *name* can only contain bytes in the ASCII range " "(``b'\\x00'``-``b'\\x7f'``)." msgstr "" -#: ../../library/re.rst:1094 +#: ../../library/re.rst:1122 msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." msgstr "" -#: ../../library/re.rst:1106 +#: ../../library/re.rst:1138 msgid "" "Escape special characters in *pattern*. This is useful if you want to match " "an arbitrary literal string that may have regular expression metacharacters " "in it. For example::" msgstr "" -#: ../../library/re.rst:1121 +#: ../../library/re.rst:1153 msgid "" "This function must not be used for the replacement string in :func:`sub` " "and :func:`subn`, only backslashes should be escaped. For example::" msgstr "" -#: ../../library/re.rst:1129 +#: ../../library/re.rst:1161 msgid "The ``'_'`` character is no longer escaped." msgstr "" -#: ../../library/re.rst:1132 +#: ../../library/re.rst:1164 msgid "" "Only characters that can have special meaning in a regular expression are " "escaped. As a result, ``'!'``, ``'\"'``, ``'%'``, ``\"'\"``, ``','``, " @@ -1438,15 +1441,15 @@ msgid "" "are no longer escaped." msgstr "" -#: ../../library/re.rst:1141 +#: ../../library/re.rst:1173 msgid "Clear the regular expression cache." msgstr "" -#: ../../library/re.rst:1145 +#: ../../library/re.rst:1177 msgid "Exceptions" msgstr "" -#: ../../library/re.rst:1149 +#: ../../library/re.rst:1181 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 " @@ -1455,45 +1458,45 @@ msgid "" "pattern. The error instance has the following additional attributes:" msgstr "" -#: ../../library/re.rst:1157 +#: ../../library/re.rst:1189 msgid "The unformatted error message." msgstr "" -#: ../../library/re.rst:1161 +#: ../../library/re.rst:1193 msgid "The regular expression pattern." msgstr "" -#: ../../library/re.rst:1165 +#: ../../library/re.rst:1197 msgid "The index in *pattern* where compilation failed (may be ``None``)." msgstr "" -#: ../../library/re.rst:1169 +#: ../../library/re.rst:1201 msgid "The line corresponding to *pos* (may be ``None``)." msgstr "" -#: ../../library/re.rst:1173 +#: ../../library/re.rst:1205 msgid "The column corresponding to *pos* (may be ``None``)." msgstr "" -#: ../../library/re.rst:1175 +#: ../../library/re.rst:1207 msgid "Added additional attributes." msgstr "新增額外屬性。" -#: ../../library/re.rst:1181 +#: ../../library/re.rst:1213 msgid "Regular Expression Objects" msgstr "" -#: ../../library/re.rst:1185 +#: ../../library/re.rst:1217 msgid "Compiled regular expression object returned by :func:`re.compile`." msgstr "" -#: ../../library/re.rst:1187 +#: ../../library/re.rst:1219 msgid "" ":py:class:`re.Pattern` supports ``[]`` to indicate a Unicode (str) or bytes " "pattern. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1193 +#: ../../library/re.rst:1225 msgid "" "Scan through *string* looking for the first location where this regular " "expression produces a match, and return a corresponding :class:`~re.Match`. " @@ -1502,7 +1505,7 @@ msgid "" "string." msgstr "" -#: ../../library/re.rst:1198 +#: ../../library/re.rst:1230 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 " @@ -1511,7 +1514,7 @@ msgid "" "necessarily at the index where the search is to start." msgstr "" -#: ../../library/re.rst:1204 +#: ../../library/re.rst:1236 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 " @@ -1521,7 +1524,7 @@ msgid "" "equivalent to ``rx.search(string[:50], 0)``. ::" msgstr "" -#: ../../library/re.rst:1219 +#: ../../library/re.rst:1251 msgid "" "If zero or more characters at the *beginning* of *string* match this regular " "expression, return a corresponding :class:`~re.Match`. Return ``None`` if " @@ -1529,101 +1532,101 @@ msgid "" "zero-length match." msgstr "" -#: ../../library/re.rst:1224 ../../library/re.rst:1242 +#: ../../library/re.rst:1256 ../../library/re.rst:1274 msgid "" "The optional *pos* and *endpos* parameters have the same meaning as for the :" "meth:`~Pattern.search` method. ::" msgstr "" -#: ../../library/re.rst:1232 +#: ../../library/re.rst:1264 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:1238 +#: ../../library/re.rst:1270 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:1256 +#: ../../library/re.rst:1288 msgid "Identical to the :func:`split` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1261 +#: ../../library/re.rst:1293 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:1268 +#: ../../library/re.rst:1300 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:1275 +#: ../../library/re.rst:1307 msgid "Identical to the :func:`sub` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1280 +#: ../../library/re.rst:1312 msgid "Identical to the :func:`subn` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1285 +#: ../../library/re.rst:1317 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:1292 +#: ../../library/re.rst:1324 msgid "The number of capturing groups in the pattern." msgstr "" -#: ../../library/re.rst:1297 +#: ../../library/re.rst:1329 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:1304 +#: ../../library/re.rst:1336 msgid "The pattern string from which the pattern object was compiled." msgstr "" -#: ../../library/re.rst:1307 +#: ../../library/re.rst:1339 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Compiled " "regular expression objects are considered atomic." msgstr "" -#: ../../library/re.rst:1315 +#: ../../library/re.rst:1347 msgid "Match Objects" msgstr "" -#: ../../library/re.rst:1317 +#: ../../library/re.rst:1349 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:1328 +#: ../../library/re.rst:1360 msgid "Match object returned by successful ``match``\\ es and ``search``\\ es." msgstr "" -#: ../../library/re.rst:1330 +#: ../../library/re.rst:1362 msgid "" ":py:class:`re.Match` supports ``[]`` to indicate a Unicode (str) or bytes " "match. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1336 +#: ../../library/re.rst:1368 msgid "" "Return the string obtained by doing backslash substitution on the template " "string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such " @@ -1633,7 +1636,7 @@ msgid "" "backreference ``\\g<0>`` will be replaced by the entire match." msgstr "" -#: ../../library/re.rst:1349 +#: ../../library/re.rst:1381 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 " @@ -1648,7 +1651,7 @@ msgid "" "the pattern that matched multiple times, the last match is returned. ::" msgstr "" -#: ../../library/re.rst:1371 +#: ../../library/re.rst:1403 msgid "" "If the regular expression uses the ``(?P...)`` syntax, the *groupN* " "arguments may also be strings identifying groups by their group name. If a " @@ -1656,54 +1659,54 @@ msgid "" "`IndexError` exception is raised." msgstr "" -#: ../../library/re.rst:1376 +#: ../../library/re.rst:1408 msgid "A moderately complicated example::" msgstr "" -#: ../../library/re.rst:1384 +#: ../../library/re.rst:1416 msgid "Named groups can also be referred to by their index::" msgstr "" -#: ../../library/re.rst:1391 +#: ../../library/re.rst:1423 msgid "If a group matches multiple times, only the last match is accessible::" msgstr "" -#: ../../library/re.rst:1400 +#: ../../library/re.rst:1432 msgid "" "This is identical to ``m.group(g)``. This allows easier access to an " "individual group from a match::" msgstr "" -#: ../../library/re.rst:1411 +#: ../../library/re.rst:1443 msgid "Named groups are supported as well::" msgstr "" -#: ../../library/re.rst:1424 +#: ../../library/re.rst:1456 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:1428 ../../library/re.rst:1653 +#: ../../library/re.rst:1460 ../../library/re.rst:1685 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/re.rst:1434 +#: ../../library/re.rst:1466 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:1447 +#: ../../library/re.rst:1479 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:1459 +#: ../../library/re.rst:1491 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 " @@ -1712,7 +1715,7 @@ msgid "" "matched by group *g* (equivalent to ``m.group(g)``) is ::" msgstr "" -#: ../../library/re.rst:1467 +#: ../../library/re.rst:1499 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." @@ -1720,32 +1723,32 @@ msgid "" "2, and ``m.start(2)`` raises an :exc:`IndexError` exception." msgstr "" -#: ../../library/re.rst:1472 +#: ../../library/re.rst:1504 msgid "An example that will remove *remove_this* from email addresses::" msgstr "" -#: ../../library/re.rst:1482 +#: ../../library/re.rst:1514 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:1489 +#: ../../library/re.rst:1521 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:1496 +#: ../../library/re.rst:1528 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:1503 +#: ../../library/re.rst:1535 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)" @@ -1754,43 +1757,43 @@ msgid "" "applied to the same string." msgstr "" -#: ../../library/re.rst:1512 +#: ../../library/re.rst:1544 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:1518 +#: ../../library/re.rst:1550 msgid "" "The :ref:`regular expression object ` whose :meth:`~Pattern." "match` or :meth:`~Pattern.search` method produced this match instance." msgstr "" -#: ../../library/re.rst:1524 +#: ../../library/re.rst:1556 msgid "The string passed to :meth:`~Pattern.match` or :meth:`~Pattern.search`." msgstr "" -#: ../../library/re.rst:1527 +#: ../../library/re.rst:1559 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Match objects " "are considered atomic." msgstr "" -#: ../../library/re.rst:1535 +#: ../../library/re.rst:1567 msgid "Regular Expression Examples" msgstr "" -#: ../../library/re.rst:1539 +#: ../../library/re.rst:1571 msgid "Checking for a Pair" msgstr "" -#: ../../library/re.rst:1541 +#: ../../library/re.rst:1573 msgid "" "In this example, we'll use the following helper function to display match " "objects a little more gracefully::" msgstr "" -#: ../../library/re.rst:1549 +#: ../../library/re.rst:1581 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 " @@ -1798,28 +1801,28 @@ msgid "" "\"2\" through \"9\" representing the card with that value." msgstr "" -#: ../../library/re.rst:1554 +#: ../../library/re.rst:1586 msgid "To see if a given string is a valid hand, one could do the following::" msgstr "" -#: ../../library/re.rst:1564 +#: ../../library/re.rst:1596 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:1574 +#: ../../library/re.rst:1606 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:1593 +#: ../../library/re.rst:1625 msgid "Simulating scanf()" msgstr "" -#: ../../library/re.rst:1597 +#: ../../library/re.rst:1629 msgid "" "Python does not currently have an equivalent to :c:func:`!scanf`. Regular " "expressions are generally more powerful, though also more verbose, than :c:" @@ -1828,124 +1831,124 @@ msgid "" "expressions." msgstr "" -#: ../../library/re.rst:1604 +#: ../../library/re.rst:1636 msgid ":c:func:`!scanf` Token" msgstr "" -#: ../../library/re.rst:1604 +#: ../../library/re.rst:1636 msgid "Regular Expression" msgstr "" -#: ../../library/re.rst:1606 +#: ../../library/re.rst:1638 msgid "``%c``" msgstr "``%c``" -#: ../../library/re.rst:1608 +#: ../../library/re.rst:1640 msgid "``%5c``" msgstr "``%5c``" -#: ../../library/re.rst:1608 +#: ../../library/re.rst:1640 msgid "``.{5}``" msgstr "``.{5}``" -#: ../../library/re.rst:1610 +#: ../../library/re.rst:1642 msgid "``%d``" msgstr "``%d``" -#: ../../library/re.rst:1610 +#: ../../library/re.rst:1642 msgid "``[-+]?\\d+``" msgstr "``[-+]?\\d+``" -#: ../../library/re.rst:1612 +#: ../../library/re.rst:1644 msgid "``%e``, ``%E``, ``%f``, ``%g``" msgstr "``%e``, ``%E``, ``%f``, ``%g``" -#: ../../library/re.rst:1612 +#: ../../library/re.rst:1644 msgid "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" msgstr "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" -#: ../../library/re.rst:1614 +#: ../../library/re.rst:1646 msgid "``%i``" msgstr "``%i``" -#: ../../library/re.rst:1614 +#: ../../library/re.rst:1646 msgid "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" msgstr "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" -#: ../../library/re.rst:1616 +#: ../../library/re.rst:1648 msgid "``%o``" msgstr "``%o``" -#: ../../library/re.rst:1616 +#: ../../library/re.rst:1648 msgid "``[-+]?[0-7]+``" msgstr "``[-+]?[0-7]+``" -#: ../../library/re.rst:1618 +#: ../../library/re.rst:1650 msgid "``%s``" msgstr "``%s``" -#: ../../library/re.rst:1618 +#: ../../library/re.rst:1650 msgid "``\\S+``" msgstr "``\\S+``" -#: ../../library/re.rst:1620 +#: ../../library/re.rst:1652 msgid "``%u``" msgstr "``%u``" -#: ../../library/re.rst:1620 +#: ../../library/re.rst:1652 msgid "``\\d+``" msgstr "``\\d+``" -#: ../../library/re.rst:1622 +#: ../../library/re.rst:1654 msgid "``%x``, ``%X``" msgstr "``%x``、``%X``" -#: ../../library/re.rst:1622 +#: ../../library/re.rst:1654 msgid "``[-+]?(0[xX])?[\\dA-Fa-f]+``" msgstr "``[-+]?(0[xX])?[\\dA-Fa-f]+``" -#: ../../library/re.rst:1625 +#: ../../library/re.rst:1657 msgid "To extract the filename and numbers from a string like ::" msgstr "" -#: ../../library/re.rst:1629 +#: ../../library/re.rst:1661 msgid "you would use a :c:func:`!scanf` format like ::" msgstr "" -#: ../../library/re.rst:1633 +#: ../../library/re.rst:1665 msgid "The equivalent regular expression would be ::" msgstr "" -#: ../../library/re.rst:1641 +#: ../../library/re.rst:1673 msgid "search() vs. match()" msgstr "" -#: ../../library/re.rst:1645 +#: ../../library/re.rst:1677 msgid "" "Python offers different primitive operations based on regular expressions:" msgstr "" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1679 msgid ":func:`re.match` checks for a match only at the beginning of the string" msgstr "" -#: ../../library/re.rst:1648 +#: ../../library/re.rst:1680 msgid "" ":func:`re.search` checks for a match anywhere in the string (this is what " "Perl does by default)" msgstr "" -#: ../../library/re.rst:1650 +#: ../../library/re.rst:1682 msgid ":func:`re.fullmatch` checks for entire string to be a match" msgstr "" -#: ../../library/re.rst:1662 +#: ../../library/re.rst:1694 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:1670 +#: ../../library/re.rst:1702 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 " @@ -1953,11 +1956,11 @@ msgid "" "line. ::" msgstr "" -#: ../../library/re.rst:1680 +#: ../../library/re.rst:1712 msgid "Making a Phonebook" msgstr "" -#: ../../library/re.rst:1682 +#: ../../library/re.rst:1714 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 " @@ -1965,37 +1968,37 @@ msgid "" "following example that creates a phonebook." msgstr "" -#: ../../library/re.rst:1687 +#: ../../library/re.rst:1719 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:1700 +#: ../../library/re.rst:1732 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:1713 +#: ../../library/re.rst:1745 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:1726 +#: ../../library/re.rst:1758 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:1741 +#: ../../library/re.rst:1773 msgid "Text Munging" msgstr "" -#: ../../library/re.rst:1743 +#: ../../library/re.rst:1775 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 " @@ -2003,11 +2006,11 @@ msgid "" "each word of a sentence except for the first and last characters::" msgstr "" -#: ../../library/re.rst:1761 +#: ../../library/re.rst:1793 msgid "Finding all Adverbs" msgstr "" -#: ../../library/re.rst:1763 +#: ../../library/re.rst:1795 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 " @@ -2015,11 +2018,11 @@ msgid "" "manner::" msgstr "" -#: ../../library/re.rst:1774 +#: ../../library/re.rst:1806 msgid "Finding all Adverbs and their Positions" msgstr "" -#: ../../library/re.rst:1776 +#: ../../library/re.rst:1808 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` " @@ -2028,11 +2031,11 @@ msgid "" "they would use :func:`finditer` in the following manner::" msgstr "" -#: ../../library/re.rst:1790 +#: ../../library/re.rst:1822 msgid "Raw String Notation" msgstr "" -#: ../../library/re.rst:1792 +#: ../../library/re.rst:1824 msgid "" "Raw string notation (``r\"text\"``) keeps regular expressions sane. Without " "it, every backslash (``'\\'``) in a regular expression would have to be " @@ -2040,7 +2043,7 @@ msgid "" "lines of code are functionally identical::" msgstr "" -#: ../../library/re.rst:1802 +#: ../../library/re.rst:1834 msgid "" "When one wants to match a literal backslash, it must be escaped in the " "regular expression. With raw string notation, this means ``r\"\\\\\"``. " @@ -2048,29 +2051,29 @@ msgid "" "following lines of code functionally identical::" msgstr "" -#: ../../library/re.rst:1814 +#: ../../library/re.rst:1846 msgid "Writing a Tokenizer" msgstr "" -#: ../../library/re.rst:1816 +#: ../../library/re.rst:1848 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:1820 +#: ../../library/re.rst:1852 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:1908 msgid "The tokenizer produces the following output::" msgstr "" -#: ../../library/re.rst:1899 +#: ../../library/re.rst:1931 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 " @@ -2095,7 +2098,7 @@ msgstr ". (點)" #: ../../library/re.rst:575 ../../library/re.rst:591 ../../library/re.rst:599 #: ../../library/re.rst:614 ../../library/re.rst:622 ../../library/re.rst:639 #: ../../library/re.rst:653 ../../library/re.rst:658 ../../library/re.rst:849 -#: ../../library/re.rst:1056 +#: ../../library/re.rst:1080 msgid "in regular expressions" msgstr "於正規表示式中" @@ -2295,11 +2298,11 @@ msgstr "\\\\" msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/re.rst:1056 +#: ../../library/re.rst:1080 msgid "\\g" msgstr "\\g" -#: ../../library/re.rst:1595 +#: ../../library/re.rst:1627 msgid "scanf (C function)" msgstr "scanf(C 函式)" diff --git a/library/smtplib.po b/library/smtplib.po index f30540c3f0..12a9f729a6 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-19 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -730,10 +730,10 @@ msgid "" "headers to be included with the message must be included in the message as " "entered; this example doesn't do any processing of the :rfc:`822` headers. " "In particular, the 'To' and 'From' addresses must be included in the message " -"headers explicitly. ::" +"headers explicitly::" msgstr "" -#: ../../library/smtplib.rst:591 +#: ../../library/smtplib.rst:590 msgid "" "In general, you will want to use the :mod:`email` package's features to " "construct an email message, which you can then send via :meth:`~smtplib.SMTP." diff --git a/library/ssl.po b/library/ssl.po index 5bbb0e9f97..40bebfaf25 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-27 00:03+0000\n" +"POT-Creation-Date: 2024-06-17 00:04+0000\n" "PO-Revision-Date: 2024-05-01 14:51+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -586,8 +586,8 @@ msgstr "" "`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。Trust 通過一" "組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 ``True``。" -#: ../../library/ssl.rst:426 ../../library/ssl.rst:1542 -#: ../../library/ssl.rst:1840 +#: ../../library/ssl.rst:426 ../../library/ssl.rst:1555 +#: ../../library/ssl.rst:1853 msgid "Example::" msgstr "範例: ::" @@ -643,7 +643,7 @@ msgstr "" "在伺服器模式下,不會從客戶端請求任何憑證,所以客戶端不用發送任何用於客戶端憑" "證身分驗證的憑證。" -#: ../../library/ssl.rst:470 ../../library/ssl.rst:2248 +#: ../../library/ssl.rst:470 ../../library/ssl.rst:2261 msgid "See the discussion of :ref:`ssl-security` below." msgstr "參閱下方 :ref:`ssl-security` 的討論。" @@ -1588,7 +1588,7 @@ msgid "" "this will return ``None``." msgstr "" -#: ../../library/ssl.rst:1274 ../../library/ssl.rst:1630 +#: ../../library/ssl.rst:1274 ../../library/ssl.rst:1643 msgid "NPN has been superseded by ALPN" msgstr "" @@ -1826,22 +1826,37 @@ msgid "" "use TLS 1.2 as minimum TLS version." msgstr "" -#: ../../library/ssl.rst:1432 +#: ../../library/ssl.rst:1433 +msgid "" +":class:`SSLContext` only supports limited mutation once it has been used by " +"a connection. Adding new certificates to the internal trust store is " +"allowed, but changing ciphers, verification settings, or mTLS certificates " +"may result in surprising behavior." +msgstr "" + +#: ../../library/ssl.rst:1440 +msgid "" +":class:`SSLContext` is designed to be shared and used by multiple " +"connections. Thus, it is thread-safe as long as it is not reconfigured after " +"being used by a connection." +msgstr "" + +#: ../../library/ssl.rst:1445 msgid ":class:`SSLContext` objects have the following methods and attributes:" msgstr "" -#: ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1449 msgid "" "Get statistics about quantities of loaded X.509 certificates, count of X.509 " "certificates flagged as CA certificates and certificate revocation lists as " "dictionary." msgstr "" -#: ../../library/ssl.rst:1440 +#: ../../library/ssl.rst:1453 msgid "Example for a context with one CA cert and one other cert::" msgstr "" -#: ../../library/ssl.rst:1450 +#: ../../library/ssl.rst:1463 msgid "" "Load a private key and the corresponding certificate. The *certfile* string " "must be the path to a single file in PEM format containing the certificate " @@ -1852,7 +1867,7 @@ msgid "" "more information on how the certificate is stored in the *certfile*." msgstr "" -#: ../../library/ssl.rst:1459 +#: ../../library/ssl.rst:1472 msgid "" "The *password* argument may be a function to call to get the password for " "decrypting the private key. It will only be called if the private key is " @@ -1864,24 +1879,24 @@ msgid "" "encrypted and no password is needed." msgstr "" -#: ../../library/ssl.rst:1468 +#: ../../library/ssl.rst:1481 msgid "" "If the *password* argument is not specified and a password is required, " "OpenSSL's built-in password prompting mechanism will be used to " "interactively prompt the user for a password." msgstr "" -#: ../../library/ssl.rst:1472 +#: ../../library/ssl.rst:1485 msgid "" "An :class:`SSLError` is raised if the private key doesn't match with the " "certificate." msgstr "" -#: ../../library/ssl.rst:1475 +#: ../../library/ssl.rst:1488 msgid "New optional argument *password*." msgstr "" -#: ../../library/ssl.rst:1480 +#: ../../library/ssl.rst:1493 msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " @@ -1890,7 +1905,7 @@ msgid "" "from other locations, too." msgstr "" -#: ../../library/ssl.rst:1486 +#: ../../library/ssl.rst:1499 msgid "" "The *purpose* flag specifies what kind of CA certificates are loaded. The " "default settings :const:`Purpose.SERVER_AUTH` loads certificates, that are " @@ -1899,28 +1914,28 @@ msgid "" "certificate verification on the server side." msgstr "" -#: ../../library/ssl.rst:1496 +#: ../../library/ssl.rst:1509 msgid "" "Load a set of \"certification authority\" (CA) certificates used to validate " "other peers' certificates when :data:`verify_mode` is other than :data:" "`CERT_NONE`. At least one of *cafile* or *capath* must be specified." msgstr "" -#: ../../library/ssl.rst:1500 +#: ../../library/ssl.rst:1513 msgid "" "This method can also load certification revocation lists (CRLs) in PEM or " "DER format. In order to make use of CRLs, :attr:`SSLContext.verify_flags` " "must be configured properly." msgstr "" -#: ../../library/ssl.rst:1504 +#: ../../library/ssl.rst:1517 msgid "" "The *cafile* string, if present, is the path to a file of concatenated CA " "certificates in PEM format. See the discussion of :ref:`ssl-certificates` " "for more information about how to arrange the certificates in this file." msgstr "" -#: ../../library/ssl.rst:1509 +#: ../../library/ssl.rst:1522 msgid "" "The *capath* string, if present, is the path to a directory containing " "several CA certificates in PEM format, following an `OpenSSL specific layout " @@ -1928,7 +1943,7 @@ msgid "" "html>`_." msgstr "" -#: ../../library/ssl.rst:1514 +#: ../../library/ssl.rst:1527 msgid "" "The *cadata* object, if present, is either an ASCII string of one or more " "PEM-encoded certificates or a :term:`bytes-like object` of DER-encoded " @@ -1936,11 +1951,11 @@ msgid "" "are ignored but at least one certificate must be present." msgstr "" -#: ../../library/ssl.rst:1519 +#: ../../library/ssl.rst:1532 msgid "New optional argument *cadata*" msgstr "" -#: ../../library/ssl.rst:1524 +#: ../../library/ssl.rst:1537 msgid "" "Get a list of loaded \"certification authority\" (CA) certificates. If the " "``binary_form`` parameter is :const:`False` each list entry is a dict like " @@ -1950,19 +1965,19 @@ msgid "" "a SSL connection." msgstr "" -#: ../../library/ssl.rst:1532 +#: ../../library/ssl.rst:1545 msgid "" "Certificates in a capath directory aren't loaded unless they have been used " "at least once." msgstr "" -#: ../../library/ssl.rst:1539 +#: ../../library/ssl.rst:1552 msgid "" "Get a list of enabled ciphers. The list is in order of cipher priority. See :" "meth:`SSLContext.set_ciphers`." msgstr "" -#: ../../library/ssl.rst:1576 +#: ../../library/ssl.rst:1589 msgid "" "Load a set of default \"certification authority\" (CA) certificates from a " "filesystem path defined when building the OpenSSL library. Unfortunately, " @@ -1972,7 +1987,7 @@ msgid "" "configured properly." msgstr "" -#: ../../library/ssl.rst:1585 +#: ../../library/ssl.rst:1598 msgid "" "Set the available ciphers for sockets created with this context. It should " "be a string in the `OpenSSL cipher list format `_" msgstr "" -#: ../../library/ssl.rst:1723 +#: ../../library/ssl.rst:1736 msgid "Vincent Bernat." msgstr "" -#: ../../library/ssl.rst:1729 +#: ../../library/ssl.rst:1742 msgid "" "Wrap an existing Python socket *sock* and return an instance of :attr:" "`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " @@ -2161,13 +2176,13 @@ msgid "" "a :const:`~socket.SOCK_STREAM` socket; other socket types are unsupported." msgstr "" -#: ../../library/ssl.rst:1735 +#: ../../library/ssl.rst:1748 msgid "" "The parameter ``server_side`` is a boolean which identifies whether server-" "side or client-side behavior is desired from this socket." msgstr "" -#: ../../library/ssl.rst:1738 +#: ../../library/ssl.rst:1751 msgid "" "For client-side sockets, the context construction is lazy; if the underlying " "socket isn't connected yet, the context construction will be performed " @@ -2178,7 +2193,7 @@ msgid "" "exc:`SSLError`." msgstr "" -#: ../../library/ssl.rst:1746 +#: ../../library/ssl.rst:1759 msgid "" "On client connections, the optional parameter *server_hostname* specifies " "the hostname of the service which we are connecting to. This allows a " @@ -2187,7 +2202,7 @@ msgid "" "*server_hostname* will raise a :exc:`ValueError` if *server_side* is true." msgstr "" -#: ../../library/ssl.rst:1752 +#: ../../library/ssl.rst:1765 msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " @@ -2197,7 +2212,7 @@ msgid "" "socket I/O involved in the handshake." msgstr "" -#: ../../library/ssl.rst:1759 +#: ../../library/ssl.rst:1772 msgid "" "The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." "recv` method should signal unexpected EOF from the other end of the " @@ -2207,40 +2222,40 @@ msgid "" "exceptions back to the caller." msgstr "" -#: ../../library/ssl.rst:1766 +#: ../../library/ssl.rst:1779 msgid "*session*, see :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:1768 +#: ../../library/ssl.rst:1781 msgid "" "To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, use :meth:" "`SSLContext.wrap_bio`." msgstr "" -#: ../../library/ssl.rst:1771 +#: ../../library/ssl.rst:1784 msgid "" "Always allow a server_hostname to be passed, even if OpenSSL does not have " "SNI." msgstr "" -#: ../../library/ssl.rst:1775 ../../library/ssl.rst:1801 +#: ../../library/ssl.rst:1788 ../../library/ssl.rst:1814 msgid "*session* argument was added." msgstr "新增 *session* 引數。" -#: ../../library/ssl.rst:1778 +#: ../../library/ssl.rst:1791 msgid "" "The method returns an instance of :attr:`SSLContext.sslsocket_class` instead " "of hard-coded :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1784 +#: ../../library/ssl.rst:1797 msgid "" "The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" "`SSLSocket`. The attribute can be overridden on instance of class in order " "to return a custom subclass of :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1793 +#: ../../library/ssl.rst:1806 msgid "" "Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" "attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " @@ -2248,26 +2263,26 @@ msgid "" "outgoing BIO." msgstr "" -#: ../../library/ssl.rst:1798 +#: ../../library/ssl.rst:1811 msgid "" "The *server_side*, *server_hostname* and *session* parameters have the same " "meaning as in :meth:`SSLContext.wrap_socket`." msgstr "" -#: ../../library/ssl.rst:1804 +#: ../../library/ssl.rst:1817 msgid "" "The method returns an instance of :attr:`SSLContext.sslobject_class` instead " "of hard-coded :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1810 +#: ../../library/ssl.rst:1823 msgid "" "The return type of :meth:`SSLContext.wrap_bio`, defaults to :class:" "`SSLObject`. The attribute can be overridden on instance of class in order " "to return a custom subclass of :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1818 +#: ../../library/ssl.rst:1831 msgid "" "Get statistics about the SSL sessions created or managed by this context. A " "dictionary is returned which maps the names of each `piece of information " @@ -2276,7 +2291,7 @@ msgid "" "misses in the session cache since the context was created::" msgstr "" -#: ../../library/ssl.rst:1829 +#: ../../library/ssl.rst:1842 msgid "" "Whether to match the peer cert's hostname in :meth:`SSLSocket.do_handshake`. " "The context's :attr:`~SSLContext.verify_mode` must be set to :data:" @@ -2289,7 +2304,7 @@ msgid "" "With other protocols, hostname checking must be enabled explicitly." msgstr "" -#: ../../library/ssl.rst:1857 +#: ../../library/ssl.rst:1870 msgid "" ":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" "`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." @@ -2297,7 +2312,7 @@ msgid "" "failed with a :exc:`ValueError`." msgstr "" -#: ../../library/ssl.rst:1864 +#: ../../library/ssl.rst:1877 msgid "" "Write TLS keys to a keylog file, whenever key material is generated or " "received. The keylog file is designed for debugging purposes only. The file " @@ -2306,7 +2321,7 @@ msgid "" "synchronized between threads, but not between processes." msgstr "" -#: ../../library/ssl.rst:1874 +#: ../../library/ssl.rst:1887 msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " @@ -2314,7 +2329,7 @@ msgid "" "`PROTOCOL_TLS_CLIENT`, and :attr:`PROTOCOL_TLS_SERVER`." msgstr "" -#: ../../library/ssl.rst:1879 +#: ../../library/ssl.rst:1892 msgid "" "The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." "minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " @@ -2324,38 +2339,38 @@ msgid "" "`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." msgstr "" -#: ../../library/ssl.rst:1892 +#: ../../library/ssl.rst:1905 msgid "" "Like :attr:`SSLContext.maximum_version` except it is the lowest supported " "version or :attr:`TLSVersion.MINIMUM_SUPPORTED`." msgstr "" -#: ../../library/ssl.rst:1899 +#: ../../library/ssl.rst:1912 msgid "" "Control the number of TLS 1.3 session tickets of a :attr:" "`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " "connections." msgstr "" -#: ../../library/ssl.rst:1907 +#: ../../library/ssl.rst:1920 msgid "" "An integer representing the set of SSL options enabled on this context. The " "default value is :data:`OP_ALL`, but you can specify other options such as :" "data:`OP_NO_SSLv2` by ORing them together." msgstr "" -#: ../../library/ssl.rst:1911 +#: ../../library/ssl.rst:1924 msgid ":attr:`SSLContext.options` returns :class:`Options` flags:" msgstr "" -#: ../../library/ssl.rst:1919 +#: ../../library/ssl.rst:1932 msgid "" "All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since " "Python 3.7. Use :attr:`SSLContext.minimum_version` and :attr:`SSLContext." "maximum_version` instead." msgstr "" -#: ../../library/ssl.rst:1925 +#: ../../library/ssl.rst:1938 msgid "" "Enable TLS 1.3 post-handshake client authentication. Post-handshake auth is " "disabled by default and a server can only request a TLS client certificate " @@ -2363,13 +2378,13 @@ msgid "" "client certificate at any time after the handshake." msgstr "" -#: ../../library/ssl.rst:1930 +#: ../../library/ssl.rst:1943 msgid "" "When enabled on client-side sockets, the client signals the server that it " "supports post-handshake authentication." msgstr "" -#: ../../library/ssl.rst:1933 +#: ../../library/ssl.rst:1946 msgid "" "When enabled on server-side sockets, :attr:`SSLContext.verify_mode` must be " "set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, too. The actual " @@ -2377,59 +2392,59 @@ msgid "" "verify_client_post_handshake` is called and some I/O is performed." msgstr "" -#: ../../library/ssl.rst:1943 +#: ../../library/ssl.rst:1956 msgid "" "The protocol version chosen when constructing the context. This attribute " "is read-only." msgstr "" -#: ../../library/ssl.rst:1948 +#: ../../library/ssl.rst:1961 msgid "" "Whether :attr:`~SSLContext.check_hostname` falls back to verify the cert's " "subject common name in the absence of a subject alternative name extension " "(default: true)." msgstr "" -#: ../../library/ssl.rst:1956 +#: ../../library/ssl.rst:1969 msgid "" "The flag had no effect with OpenSSL before version 1.1.1l. Python 3.8.9, " "3.9.3, and 3.10 include workarounds for previous versions." msgstr "" -#: ../../library/ssl.rst:1961 +#: ../../library/ssl.rst:1974 msgid "" "An integer representing the `security level `_ for the context. This " "attribute is read-only." msgstr "" -#: ../../library/ssl.rst:1969 +#: ../../library/ssl.rst:1982 msgid "" "The flags for certificate verification operations. You can set flags like :" "data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL does " "neither require nor verify certificate revocation lists (CRLs)." msgstr "" -#: ../../library/ssl.rst:1975 +#: ../../library/ssl.rst:1988 msgid ":attr:`SSLContext.verify_flags` returns :class:`VerifyFlags` flags:" msgstr "" -#: ../../library/ssl.rst:1983 +#: ../../library/ssl.rst:1996 msgid "" "Whether to try to verify other peers' certificates and how to behave if " "verification fails. This attribute must be one of :data:`CERT_NONE`, :data:" "`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." msgstr "" -#: ../../library/ssl.rst:1987 +#: ../../library/ssl.rst:2000 msgid ":attr:`SSLContext.verify_mode` returns :class:`VerifyMode` enum:" msgstr "" -#: ../../library/ssl.rst:2000 +#: ../../library/ssl.rst:2013 msgid "Certificates" msgstr "" -#: ../../library/ssl.rst:2002 +#: ../../library/ssl.rst:2015 msgid "" "Certificates in general are part of a public-key / private-key system. In " "this system, each *principal*, (which may be a machine, or a person, or an " @@ -2440,7 +2455,7 @@ msgid "" "other part, and **only** with the other part." msgstr "" -#: ../../library/ssl.rst:2010 +#: ../../library/ssl.rst:2023 msgid "" "A certificate contains information about two principals. It contains the " "name of a *subject*, and the subject's public key. It also contains a " @@ -2454,7 +2469,7 @@ msgid "" "as two fields, called \"notBefore\" and \"notAfter\"." msgstr "" -#: ../../library/ssl.rst:2020 +#: ../../library/ssl.rst:2033 msgid "" "In the Python use of certificates, a client or server can use a certificate " "to prove who they are. The other side of a network connection can also be " @@ -2467,18 +2482,18 @@ msgid "" "take place." msgstr "" -#: ../../library/ssl.rst:2030 +#: ../../library/ssl.rst:2043 msgid "" "Python uses files to contain certificates. They should be formatted as " "\"PEM\" (see :rfc:`1422`), which is a base-64 encoded form wrapped with a " "header line and a footer line::" msgstr "" -#: ../../library/ssl.rst:2039 +#: ../../library/ssl.rst:2052 msgid "Certificate chains" msgstr "" -#: ../../library/ssl.rst:2041 +#: ../../library/ssl.rst:2054 msgid "" "The Python files which contain certificates can contain a sequence of " "certificates, sometimes called a *certificate chain*. This chain should " @@ -2494,11 +2509,11 @@ msgid "" "agency which issued the certification authority's certificate::" msgstr "" -#: ../../library/ssl.rst:2065 +#: ../../library/ssl.rst:2078 msgid "CA certificates" msgstr "" -#: ../../library/ssl.rst:2067 +#: ../../library/ssl.rst:2080 msgid "" "If you are going to require validation of the other side of the connection's " "certificate, you need to provide a \"CA certs\" file, filled with the " @@ -2510,11 +2525,11 @@ msgid "" "create_default_context`." msgstr "" -#: ../../library/ssl.rst:2076 +#: ../../library/ssl.rst:2089 msgid "Combined key and certificate" msgstr "" -#: ../../library/ssl.rst:2078 +#: ../../library/ssl.rst:2091 msgid "" "Often the private key is stored in the same file as the certificate; in this " "case, only the ``certfile`` parameter to :meth:`SSLContext.load_cert_chain` " @@ -2522,11 +2537,11 @@ msgid "" "should come before the first certificate in the certificate chain::" msgstr "" -#: ../../library/ssl.rst:2092 +#: ../../library/ssl.rst:2105 msgid "Self-signed certificates" msgstr "" -#: ../../library/ssl.rst:2094 +#: ../../library/ssl.rst:2107 msgid "" "If you are going to create a server that provides SSL-encrypted connection " "services, you will need to acquire a certificate for that service. There " @@ -2536,51 +2551,51 @@ msgid "" "package, using something like the following::" msgstr "" -#: ../../library/ssl.rst:2123 +#: ../../library/ssl.rst:2136 msgid "" "The disadvantage of a self-signed certificate is that it is its own root " "certificate, and no one else will have it in their cache of known (and " "trusted) root certificates." msgstr "" -#: ../../library/ssl.rst:2129 +#: ../../library/ssl.rst:2142 msgid "Examples" msgstr "範例" -#: ../../library/ssl.rst:2132 +#: ../../library/ssl.rst:2145 msgid "Testing for SSL support" msgstr "" -#: ../../library/ssl.rst:2134 +#: ../../library/ssl.rst:2147 msgid "" "To test for the presence of SSL support in a Python installation, user code " "should use the following idiom::" msgstr "" -#: ../../library/ssl.rst:2145 +#: ../../library/ssl.rst:2158 msgid "Client-side operation" msgstr "" -#: ../../library/ssl.rst:2147 +#: ../../library/ssl.rst:2160 msgid "" "This example creates a SSL context with the recommended security settings " "for client sockets, including automatic certificate verification::" msgstr "" -#: ../../library/ssl.rst:2152 +#: ../../library/ssl.rst:2165 msgid "" "If you prefer to tune security settings yourself, you might create a context " "from scratch (but beware that you might not get the settings right)::" msgstr "" -#: ../../library/ssl.rst:2159 +#: ../../library/ssl.rst:2172 msgid "" "(this snippet assumes your operating system places a bundle of all CA " "certificates in ``/etc/ssl/certs/ca-bundle.crt``; if not, you'll get an " "error and have to adjust the location)" msgstr "" -#: ../../library/ssl.rst:2163 +#: ../../library/ssl.rst:2176 msgid "" "The :data:`PROTOCOL_TLS_CLIENT` protocol configures the context for cert " "validation and hostname verification. :attr:`~SSLContext.verify_mode` is set " @@ -2588,7 +2603,7 @@ msgid "" "``True``. All other protocols create SSL contexts with insecure defaults." msgstr "" -#: ../../library/ssl.rst:2168 +#: ../../library/ssl.rst:2181 msgid "" "When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" "attr:`~SSLContext.check_hostname` validate the server certificate: it " @@ -2597,27 +2612,27 @@ msgid "" "properties like validity and identity of the hostname::" msgstr "" -#: ../../library/ssl.rst:2178 +#: ../../library/ssl.rst:2191 msgid "You may then fetch the certificate::" msgstr "" -#: ../../library/ssl.rst:2182 +#: ../../library/ssl.rst:2195 msgid "" "Visual inspection shows that the certificate does identify the desired " "service (that is, the HTTPS host ``www.python.org``)::" msgstr "" -#: ../../library/ssl.rst:2225 +#: ../../library/ssl.rst:2238 msgid "" "Now the SSL channel is established and the certificate verified, you can " "proceed to talk with the server::" msgstr "" -#: ../../library/ssl.rst:2252 +#: ../../library/ssl.rst:2265 msgid "Server-side operation" msgstr "" -#: ../../library/ssl.rst:2254 +#: ../../library/ssl.rst:2267 msgid "" "For server operation, typically you'll need to have a server certificate, " "and private key, each in a file. You'll first create a context holding the " @@ -2626,20 +2641,20 @@ msgid "" "start waiting for clients to connect::" msgstr "" -#: ../../library/ssl.rst:2269 +#: ../../library/ssl.rst:2282 msgid "" "When a client connects, you'll call :meth:`accept` on the socket to get the " "new socket from the other end, and use the context's :meth:`SSLContext." "wrap_socket` method to create a server-side SSL socket for the connection::" msgstr "" -#: ../../library/ssl.rst:2282 +#: ../../library/ssl.rst:2295 msgid "" "Then you'll read data from the ``connstream`` and do something with it till " "you are finished with the client (or the client is finished with you)::" msgstr "" -#: ../../library/ssl.rst:2296 +#: ../../library/ssl.rst:2309 msgid "" "And go back to listening for new client connections (of course, a real " "server would probably handle each client connection in a separate thread, or " @@ -2647,18 +2662,18 @@ msgid "" "event loop)." msgstr "" -#: ../../library/ssl.rst:2304 +#: ../../library/ssl.rst:2317 msgid "Notes on non-blocking sockets" msgstr "" -#: ../../library/ssl.rst:2306 +#: ../../library/ssl.rst:2319 msgid "" "SSL sockets behave slightly different than regular sockets in non-blocking " "mode. When working with non-blocking sockets, there are thus several things " "you need to be aware of:" msgstr "" -#: ../../library/ssl.rst:2310 +#: ../../library/ssl.rst:2323 msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " @@ -2670,13 +2685,13 @@ msgid "" "require a prior *write* to the underlying socket." msgstr "" -#: ../../library/ssl.rst:2322 +#: ../../library/ssl.rst:2335 msgid "" "In earlier Python versions, the :meth:`!SSLSocket.send` method returned zero " "instead of raising :exc:`SSLWantWriteError` or :exc:`SSLWantReadError`." msgstr "" -#: ../../library/ssl.rst:2326 +#: ../../library/ssl.rst:2339 msgid "" "Calling :func:`~select.select` tells you that the OS-level socket can be " "read from (or written to), but it does not imply that there is sufficient " @@ -2686,7 +2701,7 @@ msgid "" "`~select.select`." msgstr "" -#: ../../library/ssl.rst:2333 +#: ../../library/ssl.rst:2346 msgid "" "Conversely, since the SSL layer has its own framing, a SSL socket may still " "have data available for reading without :func:`~select.select` being aware " @@ -2695,13 +2710,13 @@ msgid "" "call if still necessary." msgstr "" -#: ../../library/ssl.rst:2339 +#: ../../library/ssl.rst:2352 msgid "" "(of course, similar provisions apply when using other primitives such as :" "func:`~select.poll`, or those in the :mod:`selectors` module)" msgstr "" -#: ../../library/ssl.rst:2342 +#: ../../library/ssl.rst:2355 msgid "" "The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." "do_handshake` method has to be retried until it returns successfully. Here " @@ -2709,7 +2724,7 @@ msgid "" "readiness::" msgstr "" -#: ../../library/ssl.rst:2358 +#: ../../library/ssl.rst:2371 msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level API. It polls for events using " @@ -2718,26 +2733,26 @@ msgid "" "handshake asynchronously as well." msgstr "" -#: ../../library/ssl.rst:2367 +#: ../../library/ssl.rst:2380 msgid "Memory BIO Support" msgstr "" -#: ../../library/ssl.rst:2371 +#: ../../library/ssl.rst:2384 msgid "" "Ever since the SSL module was introduced in Python 2.6, the :class:" "`SSLSocket` class has provided two related but distinct areas of " "functionality:" msgstr "" -#: ../../library/ssl.rst:2374 +#: ../../library/ssl.rst:2387 msgid "SSL protocol handling" msgstr "" -#: ../../library/ssl.rst:2375 +#: ../../library/ssl.rst:2388 msgid "Network IO" msgstr "" -#: ../../library/ssl.rst:2377 +#: ../../library/ssl.rst:2390 msgid "" "The network IO API is identical to that provided by :class:`socket.socket`, " "from which :class:`SSLSocket` also inherits. This allows an SSL socket to be " @@ -2745,7 +2760,7 @@ msgid "" "add SSL support to an existing application." msgstr "" -#: ../../library/ssl.rst:2382 +#: ../../library/ssl.rst:2395 msgid "" "Combining SSL protocol handling and network IO usually works well, but there " "are some cases where it doesn't. An example is async IO frameworks that want " @@ -2757,7 +2772,7 @@ msgid "" "`SSLObject` is provided." msgstr "" -#: ../../library/ssl.rst:2393 +#: ../../library/ssl.rst:2406 msgid "" "A reduced-scope variant of :class:`SSLSocket` representing an SSL protocol " "instance that does not contain any network IO methods. This class is " @@ -2765,7 +2780,7 @@ msgid "" "for SSL through memory buffers." msgstr "" -#: ../../library/ssl.rst:2398 +#: ../../library/ssl.rst:2411 msgid "" "This class implements an interface on top of a low-level SSL object as " "implemented by OpenSSL. This object captures the state of an SSL connection " @@ -2773,7 +2788,7 @@ msgid "" "separate \"BIO\" objects which are OpenSSL's IO abstraction layer." msgstr "" -#: ../../library/ssl.rst:2403 +#: ../../library/ssl.rst:2416 msgid "" "This class has no public constructor. An :class:`SSLObject` instance must " "be created using the :meth:`~SSLContext.wrap_bio` method. This method will " @@ -2782,207 +2797,207 @@ msgid "" "instance, while the *outgoing* BIO is used to pass data the other way around." msgstr "" -#: ../../library/ssl.rst:2410 +#: ../../library/ssl.rst:2423 msgid "The following methods are available:" msgstr "" -#: ../../library/ssl.rst:2412 +#: ../../library/ssl.rst:2425 msgid ":attr:`~SSLSocket.context`" msgstr ":attr:`~SSLSocket.context`" -#: ../../library/ssl.rst:2413 +#: ../../library/ssl.rst:2426 msgid ":attr:`~SSLSocket.server_side`" msgstr ":attr:`~SSLSocket.server_side`" -#: ../../library/ssl.rst:2414 +#: ../../library/ssl.rst:2427 msgid ":attr:`~SSLSocket.server_hostname`" msgstr ":attr:`~SSLSocket.server_hostname`" -#: ../../library/ssl.rst:2415 +#: ../../library/ssl.rst:2428 msgid ":attr:`~SSLSocket.session`" msgstr ":attr:`~SSLSocket.session`" -#: ../../library/ssl.rst:2416 +#: ../../library/ssl.rst:2429 msgid ":attr:`~SSLSocket.session_reused`" msgstr ":attr:`~SSLSocket.session_reused`" -#: ../../library/ssl.rst:2417 +#: ../../library/ssl.rst:2430 msgid ":meth:`~SSLSocket.read`" msgstr ":meth:`~SSLSocket.read`" -#: ../../library/ssl.rst:2418 +#: ../../library/ssl.rst:2431 msgid ":meth:`~SSLSocket.write`" msgstr ":meth:`~SSLSocket.write`" -#: ../../library/ssl.rst:2419 +#: ../../library/ssl.rst:2432 msgid ":meth:`~SSLSocket.getpeercert`" msgstr ":meth:`~SSLSocket.getpeercert`" -#: ../../library/ssl.rst:2420 +#: ../../library/ssl.rst:2433 msgid ":meth:`~SSLSocket.selected_alpn_protocol`" msgstr ":meth:`~SSLSocket.selected_alpn_protocol`" -#: ../../library/ssl.rst:2421 +#: ../../library/ssl.rst:2434 msgid ":meth:`~SSLSocket.selected_npn_protocol`" msgstr ":meth:`~SSLSocket.selected_npn_protocol`" -#: ../../library/ssl.rst:2422 +#: ../../library/ssl.rst:2435 msgid ":meth:`~SSLSocket.cipher`" msgstr ":meth:`~SSLSocket.cipher`" -#: ../../library/ssl.rst:2423 +#: ../../library/ssl.rst:2436 msgid ":meth:`~SSLSocket.shared_ciphers`" msgstr ":meth:`~SSLSocket.shared_ciphers`" -#: ../../library/ssl.rst:2424 +#: ../../library/ssl.rst:2437 msgid ":meth:`~SSLSocket.compression`" msgstr ":meth:`~SSLSocket.compression`" -#: ../../library/ssl.rst:2425 +#: ../../library/ssl.rst:2438 msgid ":meth:`~SSLSocket.pending`" msgstr ":meth:`~SSLSocket.pending`" -#: ../../library/ssl.rst:2426 +#: ../../library/ssl.rst:2439 msgid ":meth:`~SSLSocket.do_handshake`" msgstr ":meth:`~SSLSocket.do_handshake`" -#: ../../library/ssl.rst:2427 +#: ../../library/ssl.rst:2440 msgid ":meth:`~SSLSocket.verify_client_post_handshake`" msgstr ":meth:`~SSLSocket.verify_client_post_handshake`" -#: ../../library/ssl.rst:2428 +#: ../../library/ssl.rst:2441 msgid ":meth:`~SSLSocket.unwrap`" msgstr ":meth:`~SSLSocket.unwrap`" -#: ../../library/ssl.rst:2429 +#: ../../library/ssl.rst:2442 msgid ":meth:`~SSLSocket.get_channel_binding`" msgstr ":meth:`~SSLSocket.get_channel_binding`" -#: ../../library/ssl.rst:2430 +#: ../../library/ssl.rst:2443 msgid ":meth:`~SSLSocket.version`" msgstr ":meth:`~SSLSocket.version`" -#: ../../library/ssl.rst:2432 +#: ../../library/ssl.rst:2445 msgid "" "When compared to :class:`SSLSocket`, this object lacks the following " "features:" msgstr "" -#: ../../library/ssl.rst:2435 +#: ../../library/ssl.rst:2448 msgid "" "Any form of network IO; ``recv()`` and ``send()`` read and write only to the " "underlying :class:`MemoryBIO` buffers." msgstr "" -#: ../../library/ssl.rst:2438 +#: ../../library/ssl.rst:2451 msgid "" "There is no *do_handshake_on_connect* machinery. You must always manually " "call :meth:`~SSLSocket.do_handshake` to start the handshake." msgstr "" -#: ../../library/ssl.rst:2441 +#: ../../library/ssl.rst:2454 msgid "" "There is no handling of *suppress_ragged_eofs*. All end-of-file conditions " "that are in violation of the protocol are reported via the :exc:" "`SSLEOFError` exception." msgstr "" -#: ../../library/ssl.rst:2445 +#: ../../library/ssl.rst:2458 msgid "" "The method :meth:`~SSLSocket.unwrap` call does not return anything, unlike " "for an SSL socket where it returns the underlying socket." msgstr "" -#: ../../library/ssl.rst:2448 +#: ../../library/ssl.rst:2461 msgid "" "The *server_name_callback* callback passed to :meth:`SSLContext." "set_servername_callback` will get an :class:`SSLObject` instance instead of " "a :class:`SSLSocket` instance as its first parameter." msgstr "" -#: ../../library/ssl.rst:2452 +#: ../../library/ssl.rst:2465 msgid "Some notes related to the use of :class:`SSLObject`:" msgstr "" -#: ../../library/ssl.rst:2454 +#: ../../library/ssl.rst:2467 msgid "" "All IO on an :class:`SSLObject` is :ref:`non-blocking `. " "This means that for example :meth:`~SSLSocket.read` will raise an :exc:" "`SSLWantReadError` if it needs more data than the incoming BIO has available." msgstr "" -#: ../../library/ssl.rst:2459 +#: ../../library/ssl.rst:2472 msgid "" ":class:`SSLObject` instances must be created with :meth:`~SSLContext." "wrap_bio`. In earlier versions, it was possible to create instances " "directly. This was never documented or officially supported." msgstr "" -#: ../../library/ssl.rst:2465 +#: ../../library/ssl.rst:2478 msgid "" "An SSLObject communicates with the outside world using memory buffers. The " "class :class:`MemoryBIO` provides a memory buffer that can be used for this " "purpose. It wraps an OpenSSL memory BIO (Basic IO) object:" msgstr "" -#: ../../library/ssl.rst:2471 +#: ../../library/ssl.rst:2484 msgid "" "A memory buffer that can be used to pass data between Python and an SSL " "protocol instance." msgstr "" -#: ../../library/ssl.rst:2476 +#: ../../library/ssl.rst:2489 msgid "Return the number of bytes currently in the memory buffer." msgstr "" -#: ../../library/ssl.rst:2480 +#: ../../library/ssl.rst:2493 msgid "" "A boolean indicating whether the memory BIO is current at the end-of-file " "position." msgstr "" -#: ../../library/ssl.rst:2485 +#: ../../library/ssl.rst:2498 msgid "" "Read up to *n* bytes from the memory buffer. If *n* is not specified or " "negative, all bytes are returned." msgstr "" -#: ../../library/ssl.rst:2490 +#: ../../library/ssl.rst:2503 msgid "" "Write the bytes from *buf* to the memory BIO. The *buf* argument must be an " "object supporting the buffer protocol." msgstr "" -#: ../../library/ssl.rst:2493 +#: ../../library/ssl.rst:2506 msgid "" "The return value is the number of bytes written, which is always equal to " "the length of *buf*." msgstr "" -#: ../../library/ssl.rst:2498 +#: ../../library/ssl.rst:2511 msgid "" "Write an EOF marker to the memory BIO. After this method has been called, it " "is illegal to call :meth:`~MemoryBIO.write`. The attribute :attr:`eof` will " "become true after all data currently in the buffer has been read." msgstr "" -#: ../../library/ssl.rst:2504 +#: ../../library/ssl.rst:2517 msgid "SSL session" msgstr "" -#: ../../library/ssl.rst:2510 +#: ../../library/ssl.rst:2523 msgid "Session object used by :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:2522 +#: ../../library/ssl.rst:2535 msgid "Security considerations" msgstr "" -#: ../../library/ssl.rst:2525 +#: ../../library/ssl.rst:2538 msgid "Best defaults" msgstr "" -#: ../../library/ssl.rst:2527 +#: ../../library/ssl.rst:2540 msgid "" "For **client use**, if you don't have any special requirements for your " "security policy, it is highly recommended that you use the :func:" @@ -2992,19 +3007,19 @@ msgid "" "settings." msgstr "" -#: ../../library/ssl.rst:2534 +#: ../../library/ssl.rst:2547 msgid "" "For example, here is how you would use the :class:`smtplib.SMTP` class to " "create a trusted, secure connection to a SMTP server::" msgstr "" -#: ../../library/ssl.rst:2543 +#: ../../library/ssl.rst:2556 msgid "" "If a client certificate is needed for the connection, it can be added with :" "meth:`SSLContext.load_cert_chain`." msgstr "" -#: ../../library/ssl.rst:2546 +#: ../../library/ssl.rst:2559 msgid "" "By contrast, if you create the SSL context by calling the :class:" "`SSLContext` constructor yourself, it will not have certificate validation " @@ -3012,15 +3027,15 @@ msgid "" "paragraphs below to achieve a good security level." msgstr "" -#: ../../library/ssl.rst:2552 +#: ../../library/ssl.rst:2565 msgid "Manual settings" msgstr "手動設定" -#: ../../library/ssl.rst:2555 +#: ../../library/ssl.rst:2568 msgid "Verifying certificates" msgstr "驗證憑證" -#: ../../library/ssl.rst:2557 +#: ../../library/ssl.rst:2570 msgid "" "When calling the :class:`SSLContext` constructor directly, :const:" "`CERT_NONE` is the default. Since it does not authenticate the other peer, " @@ -3035,13 +3050,13 @@ msgid "" "enabled." msgstr "" -#: ../../library/ssl.rst:2569 +#: ../../library/ssl.rst:2582 msgid "" "Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" "`match_hostname`." msgstr "" -#: ../../library/ssl.rst:2573 +#: ../../library/ssl.rst:2586 msgid "" "In server mode, if you want to authenticate your clients using the SSL layer " "(rather than using a higher-level authentication mechanism), you'll also " @@ -3049,11 +3064,11 @@ msgid "" "certificate." msgstr "" -#: ../../library/ssl.rst:2579 +#: ../../library/ssl.rst:2592 msgid "Protocol versions" msgstr "協定版本" -#: ../../library/ssl.rst:2581 +#: ../../library/ssl.rst:2594 msgid "" "SSL versions 2 and 3 are considered insecure and are therefore dangerous to " "use. If you want maximum compatibility between clients and servers, it is " @@ -3062,7 +3077,7 @@ msgid "" "by default." msgstr "" -#: ../../library/ssl.rst:2594 +#: ../../library/ssl.rst:2607 msgid "" "The SSL context created above will only allow TLSv1.3 and later (if " "supported by your system) connections to a server. :const:" @@ -3070,11 +3085,11 @@ msgid "" "default. You have to load certificates into the context." msgstr "" -#: ../../library/ssl.rst:2601 +#: ../../library/ssl.rst:2614 msgid "Cipher selection" msgstr "" -#: ../../library/ssl.rst:2603 +#: ../../library/ssl.rst:2616 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " "enabled when negotiating a SSL session is possible through the :meth:" @@ -3087,11 +3102,11 @@ msgid "" "ciphers`` command on your system." msgstr "" -#: ../../library/ssl.rst:2614 +#: ../../library/ssl.rst:2627 msgid "Multi-processing" msgstr "" -#: ../../library/ssl.rst:2616 +#: ../../library/ssl.rst:2629 msgid "" "If using this module as part of a multi-processed application (using, for " "example the :mod:`multiprocessing` or :mod:`concurrent.futures` modules), be " @@ -3102,17 +3117,17 @@ msgid "" "sufficient." msgstr "" -#: ../../library/ssl.rst:2628 +#: ../../library/ssl.rst:2641 msgid "TLS 1.3" msgstr "TLS 1.3" -#: ../../library/ssl.rst:2632 +#: ../../library/ssl.rst:2645 msgid "" "The TLS 1.3 protocol behaves slightly differently than previous version of " "TLS/SSL. Some new TLS 1.3 features are not yet available." msgstr "" -#: ../../library/ssl.rst:2635 +#: ../../library/ssl.rst:2648 msgid "" "TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 " "cipher suites are enabled by default. The method :meth:`SSLContext." @@ -3120,14 +3135,14 @@ msgid "" "`SSLContext.get_ciphers` returns them." msgstr "" -#: ../../library/ssl.rst:2639 +#: ../../library/ssl.rst:2652 msgid "" "Session tickets are no longer sent as part of the initial handshake and are " "handled differently. :attr:`SSLSocket.session` and :class:`SSLSession` are " "not compatible with TLS 1.3." msgstr "" -#: ../../library/ssl.rst:2642 +#: ../../library/ssl.rst:2655 msgid "" "Client-side certificates are also no longer verified during the initial " "handshake. A server can request a certificate at any time. Clients process " @@ -3135,21 +3150,21 @@ msgid "" "server." msgstr "" -#: ../../library/ssl.rst:2646 +#: ../../library/ssl.rst:2659 msgid "" "TLS 1.3 features like early data, deferred TLS client cert request, " "signature algorithm configuration, and rekeying are not supported yet." msgstr "" -#: ../../library/ssl.rst:2652 +#: ../../library/ssl.rst:2665 msgid "Class :class:`socket.socket`" msgstr ":class:`socket.socket` 類別" -#: ../../library/ssl.rst:2653 +#: ../../library/ssl.rst:2666 msgid "Documentation of underlying :mod:`socket` class" msgstr "底層 :mod:`socket` 類別的文件" -#: ../../library/ssl.rst:2655 +#: ../../library/ssl.rst:2668 msgid "" "`SSL/TLS Strong Encryption: An Introduction `_" @@ -3157,11 +3172,11 @@ msgstr "" "`SSL/TLS Strong Encryption: An Introduction `_" -#: ../../library/ssl.rst:2656 +#: ../../library/ssl.rst:2669 msgid "Intro from the Apache HTTP Server documentation" msgstr "Apache HTTP Server 文件的介紹" -#: ../../library/ssl.rst:2658 +#: ../../library/ssl.rst:2671 msgid "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" @@ -3169,19 +3184,19 @@ msgstr "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" -#: ../../library/ssl.rst:2659 +#: ../../library/ssl.rst:2672 msgid "Steve Kent" msgstr "Steve Kent" -#: ../../library/ssl.rst:2661 +#: ../../library/ssl.rst:2674 msgid ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" msgstr ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" -#: ../../library/ssl.rst:2662 +#: ../../library/ssl.rst:2675 msgid "Donald E., Jeffrey I. Schiller" msgstr "Donald E., Jeffrey I. Schiller" -#: ../../library/ssl.rst:2664 +#: ../../library/ssl.rst:2677 msgid "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" @@ -3189,11 +3204,11 @@ msgstr "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" -#: ../../library/ssl.rst:2665 +#: ../../library/ssl.rst:2678 msgid "D. Cooper" msgstr "D. Cooper" -#: ../../library/ssl.rst:2667 +#: ../../library/ssl.rst:2680 msgid "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" @@ -3201,19 +3216,19 @@ msgstr "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" -#: ../../library/ssl.rst:2668 +#: ../../library/ssl.rst:2681 msgid "T. Dierks et. al." msgstr "T. Dierks et. al." -#: ../../library/ssl.rst:2670 +#: ../../library/ssl.rst:2683 msgid ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" msgstr ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" -#: ../../library/ssl.rst:2671 +#: ../../library/ssl.rst:2684 msgid "D. Eastlake" msgstr "D. Eastlake" -#: ../../library/ssl.rst:2673 +#: ../../library/ssl.rst:2686 msgid "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" @@ -3221,11 +3236,11 @@ msgstr "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" -#: ../../library/ssl.rst:2674 +#: ../../library/ssl.rst:2687 msgid "IANA" msgstr "IANA" -#: ../../library/ssl.rst:2676 +#: ../../library/ssl.rst:2689 msgid "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" @@ -3233,11 +3248,11 @@ msgstr "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" -#: ../../library/ssl.rst:2677 +#: ../../library/ssl.rst:2690 msgid "IETF" msgstr "IETF" -#: ../../library/ssl.rst:2679 +#: ../../library/ssl.rst:2692 msgid "" "`Mozilla's Server Side TLS recommendations `_" @@ -3245,7 +3260,7 @@ msgstr "" "`Mozilla's Server Side TLS recommendations `_" -#: ../../library/ssl.rst:2680 +#: ../../library/ssl.rst:2693 msgid "Mozilla" msgstr "Mozilla" @@ -3273,10 +3288,10 @@ msgstr "Transport Layer Security(傳輸層安全)" msgid "Secure Sockets Layer" msgstr "Secure Sockets Layer(安全 socket 層)" -#: ../../library/ssl.rst:1993 +#: ../../library/ssl.rst:2006 msgid "certificates" msgstr "certificates(憑證)" -#: ../../library/ssl.rst:1995 +#: ../../library/ssl.rst:2008 msgid "X509 certificate" msgstr "X509 certificate(X509 憑證)" diff --git a/library/stdtypes.po b/library/stdtypes.po index 51e604c2e6..15704cc43d 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-07-06 00:03+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-" @@ -136,8 +136,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:2419 -#: ../../library/stdtypes.rst:3637 +#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2422 +#: ../../library/stdtypes.rst:3641 msgid "Notes" msgstr "註解" @@ -151,7 +151,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:967 #: ../../library/stdtypes.rst:970 ../../library/stdtypes.rst:1181 -#: ../../library/stdtypes.rst:2425 ../../library/stdtypes.rst:3643 +#: ../../library/stdtypes.rst:2428 ../../library/stdtypes.rst:3647 msgid "\\(1)" msgstr "\\(1)" @@ -165,8 +165,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:289 #: ../../library/stdtypes.rst:309 ../../library/stdtypes.rst:1209 -#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:2431 -#: ../../library/stdtypes.rst:3647 ../../library/stdtypes.rst:3649 +#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:2434 +#: ../../library/stdtypes.rst:3651 ../../library/stdtypes.rst:3653 msgid "\\(2)" msgstr "\\(2)" @@ -179,18 +179,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:2433 -#: ../../library/stdtypes.rst:2435 ../../library/stdtypes.rst:2437 -#: ../../library/stdtypes.rst:2439 ../../library/stdtypes.rst:3651 -#: ../../library/stdtypes.rst:3653 ../../library/stdtypes.rst:3655 -#: ../../library/stdtypes.rst:3657 +#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2436 +#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:2440 +#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3655 +#: ../../library/stdtypes.rst:3657 ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:3661 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:320 #: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:1016 -#: ../../library/stdtypes.rst:1220 ../../library/stdtypes.rst:2465 -#: ../../library/stdtypes.rst:3687 +#: ../../library/stdtypes.rst:1220 ../../library/stdtypes.rst:2468 +#: ../../library/stdtypes.rst:3691 msgid "Notes:" msgstr "註解:" @@ -237,9 +237,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2396 -#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3614 -#: ../../library/stdtypes.rst:3637 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2399 +#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3618 +#: ../../library/stdtypes.rst:3641 msgid "Meaning" msgstr "含義" @@ -560,7 +560,7 @@ msgid "" msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" #: ../../library/stdtypes.rst:302 ../../library/stdtypes.rst:1202 -#: ../../library/stdtypes.rst:2427 ../../library/stdtypes.rst:3674 +#: ../../library/stdtypes.rst:2430 ../../library/stdtypes.rst:3678 msgid "\\(6)" msgstr "\\(6)" @@ -598,9 +598,9 @@ msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313 #: ../../library/stdtypes.rst:1191 ../../library/stdtypes.rst:1194 -#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:2455 -#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3670 -#: ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:2455 ../../library/stdtypes.rst:2458 +#: ../../library/stdtypes.rst:2461 ../../library/stdtypes.rst:3674 +#: ../../library/stdtypes.rst:3681 msgid "\\(5)" msgstr "\\(5)" @@ -759,8 +759,8 @@ msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:418 ../../library/stdtypes.rst:421 #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1215 -#: ../../library/stdtypes.rst:2441 ../../library/stdtypes.rst:2445 -#: ../../library/stdtypes.rst:3659 ../../library/stdtypes.rst:3663 +#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:2448 +#: ../../library/stdtypes.rst:3663 ../../library/stdtypes.rst:3667 msgid "\\(4)" msgstr "\\(4)" @@ -1493,7 +1493,7 @@ msgid "" "before index *j*)" msgstr "" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3645 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3649 msgid "\\(8)" msgstr "\\(8)" @@ -1791,7 +1791,9 @@ msgid "reverses the items of *s* in place" msgstr "" #: ../../library/stdtypes.rst:1223 -msgid "*t* must have the same length as the slice it is replacing." +msgid "" +"If *k* is not equal to ``1``, *t* must have the same length as the slice it " +"is replacing." msgstr "" #: ../../library/stdtypes.rst:1226 @@ -2346,7 +2348,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1672 ../../library/stdtypes.rst:2811 +#: ../../library/stdtypes.rst:1672 ../../library/stdtypes.rst:2814 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -2368,11 +2370,11 @@ msgid "" "ref:`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:1687 ../../library/stdtypes.rst:2830 +#: ../../library/stdtypes.rst:1687 ../../library/stdtypes.rst:2833 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1690 ../../library/stdtypes.rst:2833 +#: ../../library/stdtypes.rst:1690 ../../library/stdtypes.rst:2836 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." @@ -2737,24 +2739,25 @@ 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 " -"(for example, ``'1<>2<>3'.split('<>')`` returns ``['1', '2', '3']``). " -"Splitting an empty string with a specified separator returns ``['']``." -msgstr "" - -#: ../../library/stdtypes.rst:2098 ../../library/stdtypes.rst:2114 -#: ../../library/stdtypes.rst:2166 ../../library/stdtypes.rst:2234 -#: ../../library/stdtypes.rst:2302 ../../library/stdtypes.rst:3149 -#: ../../library/stdtypes.rst:3165 ../../library/stdtypes.rst:3256 -#: ../../library/stdtypes.rst:3272 ../../library/stdtypes.rst:3297 -#: ../../library/stdtypes.rst:3311 ../../library/stdtypes.rst:3339 -#: ../../library/stdtypes.rst:3353 ../../library/stdtypes.rst:3371 -#: ../../library/stdtypes.rst:3398 ../../library/stdtypes.rst:3421 -#: ../../library/stdtypes.rst:3448 ../../library/stdtypes.rst:3490 -#: ../../library/stdtypes.rst:3514 +"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:2099 ../../library/stdtypes.rst:2117 +#: ../../library/stdtypes.rst:2169 ../../library/stdtypes.rst:2237 +#: ../../library/stdtypes.rst:2305 ../../library/stdtypes.rst:3151 +#: ../../library/stdtypes.rst:3169 ../../library/stdtypes.rst:3260 +#: ../../library/stdtypes.rst:3276 ../../library/stdtypes.rst:3301 +#: ../../library/stdtypes.rst:3315 ../../library/stdtypes.rst:3343 +#: ../../library/stdtypes.rst:3357 ../../library/stdtypes.rst:3375 +#: ../../library/stdtypes.rst:3402 ../../library/stdtypes.rst:3425 +#: ../../library/stdtypes.rst:3452 ../../library/stdtypes.rst:3494 +#: ../../library/stdtypes.rst:3518 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2107 +#: ../../library/stdtypes.rst:2110 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, " @@ -2764,131 +2767,131 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2129 +#: ../../library/stdtypes.rst:2132 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:2133 +#: ../../library/stdtypes.rst:2136 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2137 +#: ../../library/stdtypes.rst:2140 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2137 +#: ../../library/stdtypes.rst:2140 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2139 +#: ../../library/stdtypes.rst:2142 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2139 +#: ../../library/stdtypes.rst:2142 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2141 +#: ../../library/stdtypes.rst:2144 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2141 +#: ../../library/stdtypes.rst:2144 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2143 +#: ../../library/stdtypes.rst:2146 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2143 +#: ../../library/stdtypes.rst:2146 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2145 +#: ../../library/stdtypes.rst:2148 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2145 +#: ../../library/stdtypes.rst:2148 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2147 +#: ../../library/stdtypes.rst:2150 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2147 +#: ../../library/stdtypes.rst:2150 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2149 +#: ../../library/stdtypes.rst:2152 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2149 +#: ../../library/stdtypes.rst:2152 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2151 +#: ../../library/stdtypes.rst:2154 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2151 +#: ../../library/stdtypes.rst:2154 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2153 +#: ../../library/stdtypes.rst:2156 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2153 +#: ../../library/stdtypes.rst:2156 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2155 +#: ../../library/stdtypes.rst:2158 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2155 +#: ../../library/stdtypes.rst:2158 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2157 +#: ../../library/stdtypes.rst:2160 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2157 +#: ../../library/stdtypes.rst:2160 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2159 +#: ../../library/stdtypes.rst:2162 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2159 +#: ../../library/stdtypes.rst:2162 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2164 +#: ../../library/stdtypes.rst:2167 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2173 +#: ../../library/stdtypes.rst:2176 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:2182 +#: ../../library/stdtypes.rst:2185 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2192 +#: ../../library/stdtypes.rst:2195 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -2896,7 +2899,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2200 +#: ../../library/stdtypes.rst:2203 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 " @@ -2905,7 +2908,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2211 +#: ../../library/stdtypes.rst:2214 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -2913,20 +2916,20 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2224 +#: ../../library/stdtypes.rst:2227 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:2231 +#: ../../library/stdtypes.rst:2234 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:2239 ../../library/stdtypes.rst:3458 +#: ../../library/stdtypes.rst:2242 ../../library/stdtypes.rst:3462 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 " @@ -2934,19 +2937,19 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2247 +#: ../../library/stdtypes.rst:2250 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2250 +#: ../../library/stdtypes.rst:2253 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2265 +#: ../../library/stdtypes.rst:2268 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 " @@ -2958,19 +2961,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2274 +#: ../../library/stdtypes.rst:2277 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2277 +#: ../../library/stdtypes.rst:2280 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2283 +#: ../../library/stdtypes.rst:2286 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`` " @@ -2979,14 +2982,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2289 +#: ../../library/stdtypes.rst:2292 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2296 +#: ../../library/stdtypes.rst:2299 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 " @@ -2994,11 +2997,11 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2314 +#: ../../library/stdtypes.rst:2317 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2327 +#: ../../library/stdtypes.rst:2330 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 " @@ -3009,7 +3012,7 @@ msgid "" "or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2335 +#: ../../library/stdtypes.rst:2338 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -3019,7 +3022,7 @@ msgid "" "in the C language." msgstr "" -#: ../../library/stdtypes.rst:2341 +#: ../../library/stdtypes.rst:2344 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 " @@ -3027,36 +3030,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2351 ../../library/stdtypes.rst:3569 +#: ../../library/stdtypes.rst:2354 ../../library/stdtypes.rst:3573 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2354 ../../library/stdtypes.rst:3572 +#: ../../library/stdtypes.rst:2357 ../../library/stdtypes.rst:3576 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2356 ../../library/stdtypes.rst:3574 +#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3578 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3577 +#: ../../library/stdtypes.rst:2362 ../../library/stdtypes.rst:3581 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2362 ../../library/stdtypes.rst:3580 +#: ../../library/stdtypes.rst:2365 ../../library/stdtypes.rst:3584 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:2366 ../../library/stdtypes.rst:3584 +#: ../../library/stdtypes.rst:2369 ../../library/stdtypes.rst:3588 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -3064,15 +3067,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2371 ../../library/stdtypes.rst:3589 +#: ../../library/stdtypes.rst:2374 ../../library/stdtypes.rst:3593 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2373 ../../library/stdtypes.rst:3591 +#: ../../library/stdtypes.rst:2376 ../../library/stdtypes.rst:3595 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2375 +#: ../../library/stdtypes.rst:2378 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 " @@ -3080,279 +3083,279 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2384 ../../library/stdtypes.rst:3602 +#: ../../library/stdtypes.rst:2387 ../../library/stdtypes.rst:3606 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2387 ../../library/stdtypes.rst:3605 +#: ../../library/stdtypes.rst:2390 ../../library/stdtypes.rst:3609 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2396 ../../library/stdtypes.rst:3614 +#: ../../library/stdtypes.rst:2399 ../../library/stdtypes.rst:3618 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2398 ../../library/stdtypes.rst:3616 +#: ../../library/stdtypes.rst:2401 ../../library/stdtypes.rst:3620 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2398 ../../library/stdtypes.rst:3616 +#: ../../library/stdtypes.rst:2401 ../../library/stdtypes.rst:3620 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2401 ../../library/stdtypes.rst:3619 +#: ../../library/stdtypes.rst:2404 ../../library/stdtypes.rst:3623 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2401 ../../library/stdtypes.rst:3619 +#: ../../library/stdtypes.rst:2404 ../../library/stdtypes.rst:3623 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2403 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2406 ../../library/stdtypes.rst:3625 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2403 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2406 ../../library/stdtypes.rst:3625 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2406 ../../library/stdtypes.rst:3624 +#: ../../library/stdtypes.rst:2409 ../../library/stdtypes.rst:3628 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2406 ../../library/stdtypes.rst:3624 +#: ../../library/stdtypes.rst:2409 ../../library/stdtypes.rst:3628 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2409 ../../library/stdtypes.rst:3627 +#: ../../library/stdtypes.rst:2412 ../../library/stdtypes.rst:3631 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2409 ../../library/stdtypes.rst:3627 +#: ../../library/stdtypes.rst:2412 ../../library/stdtypes.rst:3631 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2413 ../../library/stdtypes.rst:3631 +#: ../../library/stdtypes.rst:2416 ../../library/stdtypes.rst:3635 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:2416 ../../library/stdtypes.rst:3634 +#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3638 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3637 +#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:2421 ../../library/stdtypes.rst:3639 +#: ../../library/stdtypes.rst:2424 ../../library/stdtypes.rst:3643 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2421 ../../library/stdtypes.rst:2423 -#: ../../library/stdtypes.rst:3639 ../../library/stdtypes.rst:3641 +#: ../../library/stdtypes.rst:2424 ../../library/stdtypes.rst:2426 +#: ../../library/stdtypes.rst:3643 ../../library/stdtypes.rst:3645 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2423 ../../library/stdtypes.rst:3641 +#: ../../library/stdtypes.rst:2426 ../../library/stdtypes.rst:3645 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2425 ../../library/stdtypes.rst:3643 +#: ../../library/stdtypes.rst:2428 ../../library/stdtypes.rst:3647 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2425 ../../library/stdtypes.rst:3643 +#: ../../library/stdtypes.rst:2428 ../../library/stdtypes.rst:3647 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2427 ../../library/stdtypes.rst:3645 +#: ../../library/stdtypes.rst:2430 ../../library/stdtypes.rst:3649 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2427 ../../library/stdtypes.rst:3645 +#: ../../library/stdtypes.rst:2430 ../../library/stdtypes.rst:3649 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3647 +#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3651 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3647 +#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3651 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2431 ../../library/stdtypes.rst:3649 +#: ../../library/stdtypes.rst:2434 ../../library/stdtypes.rst:3653 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2431 ../../library/stdtypes.rst:3649 +#: ../../library/stdtypes.rst:2434 ../../library/stdtypes.rst:3653 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2433 ../../library/stdtypes.rst:3651 +#: ../../library/stdtypes.rst:2436 ../../library/stdtypes.rst:3655 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2433 ../../library/stdtypes.rst:3651 +#: ../../library/stdtypes.rst:2436 ../../library/stdtypes.rst:3655 msgid "Floating point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2435 ../../library/stdtypes.rst:3653 +#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2435 ../../library/stdtypes.rst:3653 +#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 msgid "Floating point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2437 ../../library/stdtypes.rst:3655 +#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3659 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2437 ../../library/stdtypes.rst:2439 -#: ../../library/stdtypes.rst:3655 ../../library/stdtypes.rst:3657 +#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:2442 +#: ../../library/stdtypes.rst:3659 ../../library/stdtypes.rst:3661 msgid "Floating point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2439 ../../library/stdtypes.rst:3657 +#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3661 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2441 ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2441 ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 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:2445 ../../library/stdtypes.rst:3663 +#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2445 ../../library/stdtypes.rst:3663 +#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 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:2449 ../../library/stdtypes.rst:3667 +#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3671 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2449 +#: ../../library/stdtypes.rst:2452 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3680 +#: ../../library/stdtypes.rst:2455 ../../library/stdtypes.rst:3684 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2452 +#: ../../library/stdtypes.rst:2455 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2455 ../../library/stdtypes.rst:3674 +#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3678 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2455 +#: ../../library/stdtypes.rst:2458 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:2461 ../../library/stdtypes.rst:3681 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2458 +#: ../../library/stdtypes.rst:2461 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2461 ../../library/stdtypes.rst:3683 +#: ../../library/stdtypes.rst:2464 ../../library/stdtypes.rst:3687 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2461 ../../library/stdtypes.rst:3683 +#: ../../library/stdtypes.rst:2464 ../../library/stdtypes.rst:3687 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2468 ../../library/stdtypes.rst:3690 +#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3694 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2472 ../../library/stdtypes.rst:3694 +#: ../../library/stdtypes.rst:2475 ../../library/stdtypes.rst:3698 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:2476 ../../library/stdtypes.rst:3698 +#: ../../library/stdtypes.rst:2479 ../../library/stdtypes.rst:3702 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2479 ../../library/stdtypes.rst:3701 +#: ../../library/stdtypes.rst:2482 ../../library/stdtypes.rst:3705 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2483 ../../library/stdtypes.rst:3705 +#: ../../library/stdtypes.rst:2486 ../../library/stdtypes.rst:3709 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:2486 ../../library/stdtypes.rst:3708 +#: ../../library/stdtypes.rst:2489 ../../library/stdtypes.rst:3712 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2490 ../../library/stdtypes.rst:3712 +#: ../../library/stdtypes.rst:2493 ../../library/stdtypes.rst:3716 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2493 ../../library/stdtypes.rst:3721 +#: ../../library/stdtypes.rst:2496 ../../library/stdtypes.rst:3725 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2495 +#: ../../library/stdtypes.rst:2498 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:2500 +#: ../../library/stdtypes.rst:2503 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2511 +#: ../../library/stdtypes.rst:2514 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2519 +#: ../../library/stdtypes.rst:2522 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 :" @@ -3360,17 +3363,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2524 +#: ../../library/stdtypes.rst:2527 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:2530 +#: ../../library/stdtypes.rst:2533 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2534 +#: ../../library/stdtypes.rst:2537 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -3378,40 +3381,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2541 +#: ../../library/stdtypes.rst:2544 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:2544 +#: ../../library/stdtypes.rst:2547 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2545 +#: ../../library/stdtypes.rst:2548 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2546 +#: ../../library/stdtypes.rst:2549 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2548 +#: ../../library/stdtypes.rst:2551 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:2552 +#: ../../library/stdtypes.rst:2555 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:2556 +#: ../../library/stdtypes.rst:2559 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -3424,29 +3427,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2566 +#: ../../library/stdtypes.rst:2569 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2569 +#: ../../library/stdtypes.rst:2572 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2570 +#: ../../library/stdtypes.rst:2573 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2571 +#: ../../library/stdtypes.rst:2574 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2573 +#: ../../library/stdtypes.rst:2576 msgid "Also see the :ref:`bytes ` built-in." msgstr "" -#: ../../library/stdtypes.rst:2575 +#: ../../library/stdtypes.rst:2578 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -3454,32 +3457,32 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:2581 +#: ../../library/stdtypes.rst:2584 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:2588 +#: ../../library/stdtypes.rst:2591 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:2592 +#: ../../library/stdtypes.rst:2595 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2597 ../../library/stdtypes.rst:2682 +#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:2685 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:2603 +#: ../../library/stdtypes.rst:2606 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, " @@ -3488,13 +3491,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:2620 +#: ../../library/stdtypes.rst:2623 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:2624 +#: ../../library/stdtypes.rst:2627 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 " @@ -3502,58 +3505,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2629 +#: ../../library/stdtypes.rst:2632 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:2637 +#: ../../library/stdtypes.rst:2640 msgid "Bytearray Objects" msgstr "" -#: ../../library/stdtypes.rst:2641 +#: ../../library/stdtypes.rst:2644 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:2646 +#: ../../library/stdtypes.rst:2649 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:2649 +#: ../../library/stdtypes.rst:2652 msgid "Creating an empty instance: ``bytearray()``" msgstr "" -#: ../../library/stdtypes.rst:2650 +#: ../../library/stdtypes.rst:2653 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:2651 +#: ../../library/stdtypes.rst:2654 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2652 +#: ../../library/stdtypes.rst:2655 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:2654 +#: ../../library/stdtypes.rst:2657 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:2658 +#: ../../library/stdtypes.rst:2661 msgid "Also see the :ref:`bytearray ` built-in." msgstr "" -#: ../../library/stdtypes.rst:2660 +#: ../../library/stdtypes.rst:2663 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -3561,33 +3564,33 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:2666 +#: ../../library/stdtypes.rst:2669 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:2673 +#: ../../library/stdtypes.rst:2676 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:2677 +#: ../../library/stdtypes.rst:2680 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2690 +#: ../../library/stdtypes.rst:2693 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:2695 +#: ../../library/stdtypes.rst:2698 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 " @@ -3595,7 +3598,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2700 +#: ../../library/stdtypes.rst:2703 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -3603,11 +3606,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2709 +#: ../../library/stdtypes.rst:2712 msgid "Bytes and Bytearray Operations" msgstr "" -#: ../../library/stdtypes.rst:2714 +#: ../../library/stdtypes.rst:2717 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -3616,104 +3619,104 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:2722 +#: ../../library/stdtypes.rst:2725 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:2729 +#: ../../library/stdtypes.rst:2732 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:2734 +#: ../../library/stdtypes.rst:2737 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:2739 +#: ../../library/stdtypes.rst:2742 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:2742 +#: ../../library/stdtypes.rst:2745 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:2748 +#: ../../library/stdtypes.rst:2751 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:2752 ../../library/stdtypes.rst:2857 -#: ../../library/stdtypes.rst:2879 ../../library/stdtypes.rst:2945 -#: ../../library/stdtypes.rst:2958 +#: ../../library/stdtypes.rst:2755 ../../library/stdtypes.rst:2860 +#: ../../library/stdtypes.rst:2882 ../../library/stdtypes.rst:2948 +#: ../../library/stdtypes.rst:2961 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:2755 +#: ../../library/stdtypes.rst:2758 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:2758 ../../library/stdtypes.rst:2869 -#: ../../library/stdtypes.rst:2882 ../../library/stdtypes.rst:2948 -#: ../../library/stdtypes.rst:2961 +#: ../../library/stdtypes.rst:2761 ../../library/stdtypes.rst:2872 +#: ../../library/stdtypes.rst:2885 ../../library/stdtypes.rst:2951 +#: ../../library/stdtypes.rst:2964 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:2765 +#: ../../library/stdtypes.rst:2768 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:2774 +#: ../../library/stdtypes.rst:2777 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2778 ../../library/stdtypes.rst:2800 -#: ../../library/stdtypes.rst:2933 ../../library/stdtypes.rst:3026 -#: ../../library/stdtypes.rst:3040 ../../library/stdtypes.rst:3071 -#: ../../library/stdtypes.rst:3085 ../../library/stdtypes.rst:3127 -#: ../../library/stdtypes.rst:3197 ../../library/stdtypes.rst:3215 -#: ../../library/stdtypes.rst:3243 ../../library/stdtypes.rst:3382 -#: ../../library/stdtypes.rst:3437 ../../library/stdtypes.rst:3480 -#: ../../library/stdtypes.rst:3501 ../../library/stdtypes.rst:3523 -#: ../../library/stdtypes.rst:3725 +#: ../../library/stdtypes.rst:2781 ../../library/stdtypes.rst:2803 +#: ../../library/stdtypes.rst:2936 ../../library/stdtypes.rst:3029 +#: ../../library/stdtypes.rst:3043 ../../library/stdtypes.rst:3074 +#: ../../library/stdtypes.rst:3088 ../../library/stdtypes.rst:3130 +#: ../../library/stdtypes.rst:3201 ../../library/stdtypes.rst:3219 +#: ../../library/stdtypes.rst:3247 ../../library/stdtypes.rst:3386 +#: ../../library/stdtypes.rst:3441 ../../library/stdtypes.rst:3484 +#: ../../library/stdtypes.rst:3505 ../../library/stdtypes.rst:3527 +#: ../../library/stdtypes.rst:3729 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:2787 +#: ../../library/stdtypes.rst:2790 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:2796 +#: ../../library/stdtypes.rst:2799 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2809 +#: ../../library/stdtypes.rst:2812 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:2814 +#: ../../library/stdtypes.rst:2817 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -3721,21 +3724,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:2820 +#: ../../library/stdtypes.rst:2823 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:2826 +#: ../../library/stdtypes.rst:2829 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:2841 +#: ../../library/stdtypes.rst:2844 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -3743,11 +3746,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2846 +#: ../../library/stdtypes.rst:2849 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2852 +#: ../../library/stdtypes.rst:2855 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 " @@ -3755,20 +3758,20 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2862 +#: ../../library/stdtypes.rst:2865 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:2876 +#: ../../library/stdtypes.rst:2879 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:2889 +#: ../../library/stdtypes.rst:2892 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 " @@ -3778,7 +3781,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:2900 +#: ../../library/stdtypes.rst:2903 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 " @@ -3786,7 +3789,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:2911 +#: ../../library/stdtypes.rst:2914 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 " @@ -3795,24 +3798,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:2918 ../../library/stdtypes.rst:2975 +#: ../../library/stdtypes.rst:2921 ../../library/stdtypes.rst:2978 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2924 +#: ../../library/stdtypes.rst:2927 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:2928 +#: ../../library/stdtypes.rst:2931 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:2940 +#: ../../library/stdtypes.rst:2943 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -3820,13 +3823,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2955 +#: ../../library/stdtypes.rst:2958 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2968 +#: ../../library/stdtypes.rst:2971 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 " @@ -3835,7 +3838,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:2981 +#: ../../library/stdtypes.rst:2984 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -3843,11 +3846,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2986 +#: ../../library/stdtypes.rst:2989 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2992 +#: ../../library/stdtypes.rst:2995 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 " @@ -3855,22 +3858,22 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:2997 +#: ../../library/stdtypes.rst:3000 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3000 +#: ../../library/stdtypes.rst:3003 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3006 +#: ../../library/stdtypes.rst:3009 msgid "*delete* is now supported as a keyword argument." msgstr "" -#: ../../library/stdtypes.rst:3010 +#: ../../library/stdtypes.rst:3013 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 " @@ -3879,7 +3882,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3019 +#: ../../library/stdtypes.rst:3022 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). " @@ -3887,7 +3890,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3033 +#: ../../library/stdtypes.rst:3036 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). " @@ -3895,7 +3898,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3047 +#: ../../library/stdtypes.rst:3050 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 " @@ -3905,14 +3908,14 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3059 +#: ../../library/stdtypes.rst:3062 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:3078 +#: ../../library/stdtypes.rst:3081 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). " @@ -3920,7 +3923,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3092 +#: ../../library/stdtypes.rst:3095 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 " @@ -3930,7 +3933,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3103 +#: ../../library/stdtypes.rst:3106 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 " @@ -3940,14 +3943,14 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3115 +#: ../../library/stdtypes.rst:3118 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:3134 +#: ../../library/stdtypes.rst:3137 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 " @@ -3956,18 +3959,18 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3140 +#: ../../library/stdtypes.rst:3143 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',')`` " "returns ``[b'1', b'', b'2']``). The *sep* argument may consist of a " -"multibyte sequence (for example, ``b'1<>2<>3'.split(b'<>')`` returns " -"``[b'1', b'2', b'3']``). Splitting an empty sequence with a specified " -"separator returns ``[b'']`` or ``[bytearray(b'')]`` depending on the type of " -"object being split. The *sep* argument may be any :term:`bytes-like object`." +"multibyte sequence as a single delimiter. Splitting an empty sequence with a " +"specified separator returns ``[b'']`` or ``[bytearray(b'')]`` depending on " +"the type of object being split. The *sep* argument may be any :term:`bytes-" +"like object`." msgstr "" -#: ../../library/stdtypes.rst:3158 +#: ../../library/stdtypes.rst:3162 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 " @@ -3977,7 +3980,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3179 +#: ../../library/stdtypes.rst:3183 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 " @@ -3987,13 +3990,13 @@ msgid "" "a prefix or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3192 +#: ../../library/stdtypes.rst:3196 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3201 +#: ../../library/stdtypes.rst:3205 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 " @@ -4001,14 +4004,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3209 +#: ../../library/stdtypes.rst:3213 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:3222 +#: ../../library/stdtypes.rst:3226 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 " @@ -4024,7 +4027,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3250 +#: ../../library/stdtypes.rst:3254 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -4033,7 +4036,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3267 +#: ../../library/stdtypes.rst:3271 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -4041,35 +4044,35 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3283 +#: ../../library/stdtypes.rst:3287 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:3293 +#: ../../library/stdtypes.rst:3297 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:3308 +#: ../../library/stdtypes.rst:3312 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:3318 ../../library/stdtypes.rst:3360 -#: ../../library/stdtypes.rst:3376 ../../library/stdtypes.rst:3426 -#: ../../library/stdtypes.rst:3495 +#: ../../library/stdtypes.rst:3322 ../../library/stdtypes.rst:3364 +#: ../../library/stdtypes.rst:3380 ../../library/stdtypes.rst:3430 +#: ../../library/stdtypes.rst:3499 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:3326 +#: ../../library/stdtypes.rst:3330 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -4077,27 +4080,27 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3335 +#: ../../library/stdtypes.rst:3339 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:3350 +#: ../../library/stdtypes.rst:3354 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:3368 +#: ../../library/stdtypes.rst:3372 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3393 +#: ../../library/stdtypes.rst:3397 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 " @@ -4105,20 +4108,20 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3405 +#: ../../library/stdtypes.rst:3409 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:3418 +#: ../../library/stdtypes.rst:3422 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:3430 +#: ../../library/stdtypes.rst:3434 msgid "" "Unlike :func:`str.swapcase()`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -4126,14 +4129,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3444 +#: ../../library/stdtypes.rst:3448 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:3453 +#: ../../library/stdtypes.rst:3457 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -4141,18 +4144,18 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3466 +#: ../../library/stdtypes.rst:3470 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3487 +#: ../../library/stdtypes.rst:3491 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3508 +#: ../../library/stdtypes.rst:3512 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 " @@ -4161,11 +4164,11 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3530 +#: ../../library/stdtypes.rst:3534 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:3547 +#: ../../library/stdtypes.rst:3551 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 " @@ -4173,7 +4176,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:3552 +#: ../../library/stdtypes.rst:3556 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -4183,7 +4186,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:3559 +#: ../../library/stdtypes.rst:3563 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 " @@ -4191,7 +4194,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3593 +#: ../../library/stdtypes.rst:3597 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 " @@ -4199,73 +4202,73 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3667 +#: ../../library/stdtypes.rst:3671 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:3670 +#: ../../library/stdtypes.rst:3674 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:3670 +#: ../../library/stdtypes.rst:3674 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:3674 +#: ../../library/stdtypes.rst:3678 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:3681 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:3680 +#: ../../library/stdtypes.rst:3684 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3680 +#: ../../library/stdtypes.rst:3684 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:3715 +#: ../../library/stdtypes.rst:3719 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "" -#: ../../library/stdtypes.rst:3718 +#: ../../library/stdtypes.rst:3722 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "" -#: ../../library/stdtypes.rst:3730 +#: ../../library/stdtypes.rst:3734 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:3737 +#: ../../library/stdtypes.rst:3741 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:3739 +#: ../../library/stdtypes.rst:3743 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:3745 +#: ../../library/stdtypes.rst:3749 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:3749 +#: ../../library/stdtypes.rst:3753 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 " @@ -4273,32 +4276,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:3754 +#: ../../library/stdtypes.rst:3758 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:3758 +#: ../../library/stdtypes.rst:3762 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:3761 +#: ../../library/stdtypes.rst:3765 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:3764 +#: ../../library/stdtypes.rst:3768 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:3777 +#: ../../library/stdtypes.rst:3781 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 " @@ -4309,82 +4312,82 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:3786 +#: ../../library/stdtypes.rst:3790 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:3798 +#: ../../library/stdtypes.rst:3802 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:3819 +#: ../../library/stdtypes.rst:3823 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:3831 +#: ../../library/stdtypes.rst:3835 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:3835 +#: ../../library/stdtypes.rst:3839 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:3839 +#: ../../library/stdtypes.rst:3843 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:3842 +#: ../../library/stdtypes.rst:3846 msgid ":class:`memoryview` has several methods:" msgstr "" -#: ../../library/stdtypes.rst:3846 +#: ../../library/stdtypes.rst:3850 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:3850 +#: ../../library/stdtypes.rst:3854 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:3869 +#: ../../library/stdtypes.rst:3873 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:3885 +#: ../../library/stdtypes.rst:3889 msgid "" "Note that, as with floating point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:3888 +#: ../../library/stdtypes.rst:3892 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:3894 +#: ../../library/stdtypes.rst:3898 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:3903 +#: ../../library/stdtypes.rst:3907 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -4392,7 +4395,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:3908 +#: ../../library/stdtypes.rst:3912 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' " @@ -4401,36 +4404,36 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:3917 +#: ../../library/stdtypes.rst:3921 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:3926 +#: ../../library/stdtypes.rst:3930 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:3933 +#: ../../library/stdtypes.rst:3937 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:3943 +#: ../../library/stdtypes.rst:3947 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:3950 +#: ../../library/stdtypes.rst:3954 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:3969 +#: ../../library/stdtypes.rst:3973 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 :" @@ -4439,20 +4442,20 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:3975 +#: ../../library/stdtypes.rst:3979 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:3986 +#: ../../library/stdtypes.rst:3990 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4002 +#: ../../library/stdtypes.rst:4006 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 " @@ -4461,7 +4464,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4008 +#: ../../library/stdtypes.rst:4012 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 " @@ -4469,50 +4472,50 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4014 +#: ../../library/stdtypes.rst:4018 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4037 +#: ../../library/stdtypes.rst:4041 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4050 +#: ../../library/stdtypes.rst:4054 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4076 +#: ../../library/stdtypes.rst:4080 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4090 +#: ../../library/stdtypes.rst:4094 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4093 +#: ../../library/stdtypes.rst:4097 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4097 +#: ../../library/stdtypes.rst:4101 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4108 +#: ../../library/stdtypes.rst:4112 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:4127 +#: ../../library/stdtypes.rst:4131 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4144 +#: ../../library/stdtypes.rst:4148 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4148 +#: ../../library/stdtypes.rst:4152 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 " @@ -4520,59 +4523,59 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4153 +#: ../../library/stdtypes.rst:4157 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:4159 +#: ../../library/stdtypes.rst:4163 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4172 +#: ../../library/stdtypes.rst:4176 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4177 +#: ../../library/stdtypes.rst:4181 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:4180 ../../library/stdtypes.rst:4188 +#: ../../library/stdtypes.rst:4184 ../../library/stdtypes.rst:4192 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4185 +#: ../../library/stdtypes.rst:4189 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:4193 +#: ../../library/stdtypes.rst:4197 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4197 +#: ../../library/stdtypes.rst:4201 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4203 +#: ../../library/stdtypes.rst:4207 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4209 +#: ../../library/stdtypes.rst:4213 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4217 +#: ../../library/stdtypes.rst:4221 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4221 +#: ../../library/stdtypes.rst:4225 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -4582,7 +4585,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4228 +#: ../../library/stdtypes.rst:4232 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 " @@ -4590,7 +4593,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4233 +#: ../../library/stdtypes.rst:4237 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -4602,18 +4605,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:4241 +#: ../../library/stdtypes.rst:4245 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:4245 +#: ../../library/stdtypes.rst:4249 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4250 +#: ../../library/stdtypes.rst:4254 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 " @@ -4621,92 +4624,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4256 +#: ../../library/stdtypes.rst:4260 msgid "Sets can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4258 +#: ../../library/stdtypes.rst:4262 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4259 +#: ../../library/stdtypes.rst:4263 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4260 +#: ../../library/stdtypes.rst:4264 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4262 +#: ../../library/stdtypes.rst:4266 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4267 +#: ../../library/stdtypes.rst:4271 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4271 +#: ../../library/stdtypes.rst:4275 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4275 +#: ../../library/stdtypes.rst:4279 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4279 +#: ../../library/stdtypes.rst:4283 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:4285 +#: ../../library/stdtypes.rst:4289 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4289 +#: ../../library/stdtypes.rst:4293 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4295 +#: ../../library/stdtypes.rst:4299 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4299 +#: ../../library/stdtypes.rst:4303 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4305 +#: ../../library/stdtypes.rst:4309 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4310 +#: ../../library/stdtypes.rst:4314 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4315 +#: ../../library/stdtypes.rst:4319 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4320 +#: ../../library/stdtypes.rst:4324 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4324 +#: ../../library/stdtypes.rst:4328 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4327 +#: ../../library/stdtypes.rst:4331 msgid "" "Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" "meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" @@ -4716,7 +4719,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4334 +#: ../../library/stdtypes.rst:4338 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 " @@ -4726,14 +4729,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4341 +#: ../../library/stdtypes.rst:4345 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:4345 +#: ../../library/stdtypes.rst:4349 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 " @@ -4741,71 +4744,71 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4350 +#: ../../library/stdtypes.rst:4354 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:4353 +#: ../../library/stdtypes.rst:4357 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4355 +#: ../../library/stdtypes.rst:4359 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:4359 +#: ../../library/stdtypes.rst:4363 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4365 +#: ../../library/stdtypes.rst:4369 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4370 +#: ../../library/stdtypes.rst:4374 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4375 +#: ../../library/stdtypes.rst:4379 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4380 +#: ../../library/stdtypes.rst:4384 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4384 +#: ../../library/stdtypes.rst:4388 msgid "Add element *elem* to the set." msgstr "" -#: ../../library/stdtypes.rst:4388 +#: ../../library/stdtypes.rst:4392 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4393 +#: ../../library/stdtypes.rst:4397 msgid "Remove element *elem* from the set if it is present." msgstr "" -#: ../../library/stdtypes.rst:4397 +#: ../../library/stdtypes.rst:4401 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4402 +#: ../../library/stdtypes.rst:4406 msgid "Remove all elements from the set." msgstr "" -#: ../../library/stdtypes.rst:4405 +#: ../../library/stdtypes.rst:4409 msgid "" "Note, the non-operator versions of the :meth:`update`, :meth:" "`intersection_update`, :meth:`difference_update`, and :meth:" @@ -4813,18 +4816,18 @@ msgid "" "argument." msgstr "" -#: ../../library/stdtypes.rst:4410 +#: ../../library/stdtypes.rst:4414 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:4419 +#: ../../library/stdtypes.rst:4423 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4429 +#: ../../library/stdtypes.rst:4433 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -4833,7 +4836,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4439 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -4842,33 +4845,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4446 +#: ../../library/stdtypes.rst:4450 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4449 +#: ../../library/stdtypes.rst:4453 msgid "Dictionaries can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4451 +#: ../../library/stdtypes.rst:4455 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:4453 +#: ../../library/stdtypes.rst:4457 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4454 +#: ../../library/stdtypes.rst:4458 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4457 +#: ../../library/stdtypes.rst:4461 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it is a mapping object, a dictionary is " @@ -4880,7 +4883,7 @@ msgid "" "value for that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4467 +#: ../../library/stdtypes.rst:4471 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 " @@ -4888,39 +4891,39 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4472 +#: ../../library/stdtypes.rst:4476 msgid "" "To illustrate, the following examples all return a dictionary equal to " "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4484 +#: ../../library/stdtypes.rst:4488 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:4488 +#: ../../library/stdtypes.rst:4492 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4493 +#: ../../library/stdtypes.rst:4497 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4497 +#: ../../library/stdtypes.rst:4501 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4501 +#: ../../library/stdtypes.rst:4505 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4506 +#: ../../library/stdtypes.rst:4510 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 " @@ -4931,51 +4934,51 @@ msgid "" "an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4525 +#: ../../library/stdtypes.rst:4529 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:4531 +#: ../../library/stdtypes.rst:4535 msgid "Set ``d[key]`` to *value*." msgstr "" -#: ../../library/stdtypes.rst:4535 +#: ../../library/stdtypes.rst:4539 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "" -#: ../../library/stdtypes.rst:4540 +#: ../../library/stdtypes.rst:4544 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "" -#: ../../library/stdtypes.rst:4544 +#: ../../library/stdtypes.rst:4548 msgid "Equivalent to ``not key in d``." msgstr "" -#: ../../library/stdtypes.rst:4548 +#: ../../library/stdtypes.rst:4552 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4553 +#: ../../library/stdtypes.rst:4557 msgid "Remove all items from the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4557 +#: ../../library/stdtypes.rst:4561 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4561 +#: ../../library/stdtypes.rst:4565 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4563 +#: ../../library/stdtypes.rst:4567 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 " @@ -4984,70 +4987,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4571 +#: ../../library/stdtypes.rst:4575 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:4577 +#: ../../library/stdtypes.rst:4581 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4582 +#: ../../library/stdtypes.rst:4586 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4587 +#: ../../library/stdtypes.rst:4591 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:4593 +#: ../../library/stdtypes.rst:4597 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:4596 +#: ../../library/stdtypes.rst:4600 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:4600 +#: ../../library/stdtypes.rst:4604 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4606 +#: ../../library/stdtypes.rst:4610 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4613 +#: ../../library/stdtypes.rst:4617 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:4619 +#: ../../library/stdtypes.rst:4623 msgid "" "Update the dictionary with the key/value pairs from *other*, overwriting " "existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4622 +#: ../../library/stdtypes.rst:4626 msgid "" ":meth:`update` accepts either another dictionary object or an iterable of " "key/value pairs (as tuples or other iterables of length two). If keyword " @@ -5055,71 +5058,71 @@ msgid "" "pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4629 +#: ../../library/stdtypes.rst:4633 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4632 +#: ../../library/stdtypes.rst:4636 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:4642 +#: ../../library/stdtypes.rst:4646 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:4650 +#: ../../library/stdtypes.rst:4654 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:4656 +#: ../../library/stdtypes.rst:4660 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " "'>') raise :exc:`TypeError`." msgstr "" -#: ../../library/stdtypes.rst:4660 +#: ../../library/stdtypes.rst:4664 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:4678 +#: ../../library/stdtypes.rst:4682 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4682 +#: ../../library/stdtypes.rst:4686 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4694 +#: ../../library/stdtypes.rst:4698 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4699 +#: ../../library/stdtypes.rst:4703 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4706 +#: ../../library/stdtypes.rst:4710 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4708 +#: ../../library/stdtypes.rst:4712 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 " @@ -5127,23 +5130,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4713 +#: ../../library/stdtypes.rst:4717 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4718 +#: ../../library/stdtypes.rst:4722 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4722 +#: ../../library/stdtypes.rst:4726 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4725 +#: ../../library/stdtypes.rst:4729 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -5151,39 +5154,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4730 +#: ../../library/stdtypes.rst:4734 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:4733 +#: ../../library/stdtypes.rst:4737 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4738 +#: ../../library/stdtypes.rst:4742 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:4743 +#: ../../library/stdtypes.rst:4747 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:4746 +#: ../../library/stdtypes.rst:4750 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4751 +#: ../../library/stdtypes.rst:4755 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4756 +#: ../../library/stdtypes.rst:4760 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 " @@ -5197,15 +5200,15 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:4768 +#: ../../library/stdtypes.rst:4772 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4812 +#: ../../library/stdtypes.rst:4816 msgid "Context Manager Types" msgstr "" -#: ../../library/stdtypes.rst:4819 +#: ../../library/stdtypes.rst:4823 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 " @@ -5213,7 +5216,7 @@ msgid "" "before the statement body is executed and exited when the statement ends:" msgstr "" -#: ../../library/stdtypes.rst:4827 +#: ../../library/stdtypes.rst:4831 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 " @@ -5221,14 +5224,14 @@ msgid "" "using this context manager." msgstr "" -#: ../../library/stdtypes.rst:4832 +#: ../../library/stdtypes.rst:4836 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." msgstr "" -#: ../../library/stdtypes.rst:4836 +#: ../../library/stdtypes.rst:4840 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 " @@ -5238,7 +5241,7 @@ msgid "" "the :keyword:`!with` statement." msgstr "" -#: ../../library/stdtypes.rst:4846 +#: ../../library/stdtypes.rst:4850 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -5247,7 +5250,7 @@ msgid "" "arguments are ``None``." msgstr "" -#: ../../library/stdtypes.rst:4851 +#: ../../library/stdtypes.rst:4855 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -5258,7 +5261,7 @@ msgid "" "statement." msgstr "" -#: ../../library/stdtypes.rst:4858 +#: ../../library/stdtypes.rst:4862 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -5267,7 +5270,7 @@ msgid "" "__exit__` method has actually failed." msgstr "" -#: ../../library/stdtypes.rst:4864 +#: ../../library/stdtypes.rst:4868 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -5276,7 +5279,7 @@ msgid "" "management protocol. See the :mod:`contextlib` module for some examples." msgstr "" -#: ../../library/stdtypes.rst:4870 +#: ../../library/stdtypes.rst:4874 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -5286,7 +5289,7 @@ msgid "" "rather than the iterator produced by an undecorated generator function." msgstr "" -#: ../../library/stdtypes.rst:4877 +#: ../../library/stdtypes.rst:4881 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 " @@ -5295,23 +5298,23 @@ msgid "" "a single class dictionary lookup is negligible." msgstr "" -#: ../../library/stdtypes.rst:4885 +#: ../../library/stdtypes.rst:4889 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" msgstr "" -#: ../../library/stdtypes.rst:4890 +#: ../../library/stdtypes.rst:4894 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." msgstr "" -#: ../../library/stdtypes.rst:4897 +#: ../../library/stdtypes.rst:4901 msgid "Generic Alias Type" msgstr "" -#: ../../library/stdtypes.rst:4903 +#: ../../library/stdtypes.rst:4907 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -5321,19 +5324,19 @@ msgid "" "are intended primarily for use with :term:`type annotations `." msgstr "" -#: ../../library/stdtypes.rst:4913 +#: ../../library/stdtypes.rst:4917 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." msgstr "" -#: ../../library/stdtypes.rst:4916 +#: ../../library/stdtypes.rst:4920 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." msgstr "" -#: ../../library/stdtypes.rst:4919 +#: ../../library/stdtypes.rst:4923 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 " @@ -5342,7 +5345,7 @@ msgid "" "`bytes`." msgstr "" -#: ../../library/stdtypes.rst:4925 +#: ../../library/stdtypes.rst:4929 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 " @@ -5351,7 +5354,7 @@ msgid "" "the :class:`str` data type and the :class:`bytes` data type:" msgstr "" -#: ../../library/stdtypes.rst:4931 +#: ../../library/stdtypes.rst:4935 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 " @@ -5359,7 +5362,7 @@ msgid "" "annotations with the ``GenericAlias`` ``re.Match[str]``." msgstr "" -#: ../../library/stdtypes.rst:4937 +#: ../../library/stdtypes.rst:4941 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." @@ -5368,21 +5371,21 @@ msgid "" "objects>` objects with ``re.Match[bytes]``." msgstr "" -#: ../../library/stdtypes.rst:4943 +#: ../../library/stdtypes.rst:4947 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " "directly." msgstr "" -#: ../../library/stdtypes.rst:4949 +#: ../../library/stdtypes.rst:4953 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 "" -#: ../../library/stdtypes.rst:4957 +#: ../../library/stdtypes.rst:4961 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 " @@ -5390,13 +5393,13 @@ msgid "" "of type :class:`str` and values of type :class:`int`::" msgstr "" -#: ../../library/stdtypes.rst:4965 +#: ../../library/stdtypes.rst:4969 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" msgstr "" -#: ../../library/stdtypes.rst:4973 +#: ../../library/stdtypes.rst:4977 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -5405,331 +5408,331 @@ msgid "" "discouraged, but will run without errors::" msgstr "" -#: ../../library/stdtypes.rst:4983 +#: ../../library/stdtypes.rst:4987 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "" -#: ../../library/stdtypes.rst:4994 +#: ../../library/stdtypes.rst:4998 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "" -#: ../../library/stdtypes.rst:5002 +#: ../../library/stdtypes.rst:5006 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" msgstr "" -#: ../../library/stdtypes.rst:5010 +#: ../../library/stdtypes.rst:5014 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 "" -#: ../../library/stdtypes.rst:5021 +#: ../../library/stdtypes.rst:5025 msgid "Standard Generic Classes" msgstr "" -#: ../../library/stdtypes.rst:5023 +#: ../../library/stdtypes.rst:5027 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "" -#: ../../library/stdtypes.rst:5026 +#: ../../library/stdtypes.rst:5030 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5027 +#: ../../library/stdtypes.rst:5031 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5028 +#: ../../library/stdtypes.rst:5032 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5029 +#: ../../library/stdtypes.rst:5033 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5030 +#: ../../library/stdtypes.rst:5034 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5031 +#: ../../library/stdtypes.rst:5035 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5032 +#: ../../library/stdtypes.rst:5036 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5033 +#: ../../library/stdtypes.rst:5037 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5034 +#: ../../library/stdtypes.rst:5038 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5035 +#: ../../library/stdtypes.rst:5039 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5036 +#: ../../library/stdtypes.rst:5040 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5037 +#: ../../library/stdtypes.rst:5041 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5038 +#: ../../library/stdtypes.rst:5042 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5039 +#: ../../library/stdtypes.rst:5043 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5040 +#: ../../library/stdtypes.rst:5044 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5041 +#: ../../library/stdtypes.rst:5045 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5042 +#: ../../library/stdtypes.rst:5046 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5047 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5044 +#: ../../library/stdtypes.rst:5048 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5045 +#: ../../library/stdtypes.rst:5049 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5046 +#: ../../library/stdtypes.rst:5050 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5047 +#: ../../library/stdtypes.rst:5051 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5048 +#: ../../library/stdtypes.rst:5052 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5049 +#: ../../library/stdtypes.rst:5053 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5050 +#: ../../library/stdtypes.rst:5054 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:5055 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5052 +#: ../../library/stdtypes.rst:5056 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5053 +#: ../../library/stdtypes.rst:5057 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5054 +#: ../../library/stdtypes.rst:5058 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5055 +#: ../../library/stdtypes.rst:5059 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5060 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5057 +#: ../../library/stdtypes.rst:5061 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5058 +#: ../../library/stdtypes.rst:5062 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5059 +#: ../../library/stdtypes.rst:5063 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5064 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5065 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5062 +#: ../../library/stdtypes.rst:5066 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5063 +#: ../../library/stdtypes.rst:5067 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5064 +#: ../../library/stdtypes.rst:5068 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5069 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5066 +#: ../../library/stdtypes.rst:5070 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5067 +#: ../../library/stdtypes.rst:5071 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5068 +#: ../../library/stdtypes.rst:5072 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5069 +#: ../../library/stdtypes.rst:5073 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5070 +#: ../../library/stdtypes.rst:5074 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5071 +#: ../../library/stdtypes.rst:5075 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5072 +#: ../../library/stdtypes.rst:5076 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5077 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5074 +#: ../../library/stdtypes.rst:5078 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5075 +#: ../../library/stdtypes.rst:5079 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5076 +#: ../../library/stdtypes.rst:5080 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5077 +#: ../../library/stdtypes.rst:5081 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5078 +#: ../../library/stdtypes.rst:5082 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5079 +#: ../../library/stdtypes.rst:5083 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5084 +#: ../../library/stdtypes.rst:5088 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "" -#: ../../library/stdtypes.rst:5086 +#: ../../library/stdtypes.rst:5090 msgid "All parameterized generics implement special read-only attributes." msgstr "" -#: ../../library/stdtypes.rst:5090 +#: ../../library/stdtypes.rst:5094 msgid "This attribute points at the non-parameterized generic class::" msgstr "" -#: ../../library/stdtypes.rst:5098 +#: ../../library/stdtypes.rst:5102 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 "" -#: ../../library/stdtypes.rst:5108 +#: ../../library/stdtypes.rst:5112 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" msgstr "" -#: ../../library/stdtypes.rst:5119 +#: ../../library/stdtypes.rst:5123 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." msgstr "" -#: ../../library/stdtypes.rst:5126 +#: ../../library/stdtypes.rst:5130 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." msgstr "" -#: ../../library/stdtypes.rst:5134 +#: ../../library/stdtypes.rst:5138 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../library/stdtypes.rst:5135 +#: ../../library/stdtypes.rst:5139 msgid "Introducing Python's framework for type annotations." msgstr "" -#: ../../library/stdtypes.rst:5137 +#: ../../library/stdtypes.rst:5141 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr "" -#: ../../library/stdtypes.rst:5138 +#: ../../library/stdtypes.rst:5142 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." "__class_getitem__`." msgstr "" -#: ../../library/stdtypes.rst:5142 +#: ../../library/stdtypes.rst:5146 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" msgstr "" -#: ../../library/stdtypes.rst:5143 +#: ../../library/stdtypes.rst:5147 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../library/stdtypes.rst:5152 +#: ../../library/stdtypes.rst:5156 msgid "Union Type" msgstr "" -#: ../../library/stdtypes.rst:5158 +#: ../../library/stdtypes.rst:5162 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -5738,7 +5741,7 @@ msgid "" "Union`." msgstr "" -#: ../../library/stdtypes.rst:5165 +#: ../../library/stdtypes.rst:5169 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 " @@ -5746,7 +5749,7 @@ msgid "" "class:`float`::" msgstr "" -#: ../../library/stdtypes.rst:5175 +#: ../../library/stdtypes.rst:5179 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 " @@ -5755,76 +5758,76 @@ msgid "" "a string, e.g. ``\"int | Foo\"``." msgstr "" -#: ../../library/stdtypes.rst:5183 +#: ../../library/stdtypes.rst:5187 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "" -#: ../../library/stdtypes.rst:5185 +#: ../../library/stdtypes.rst:5189 msgid "Unions of unions are flattened::" msgstr "" -#: ../../library/stdtypes.rst:5189 +#: ../../library/stdtypes.rst:5193 msgid "Redundant types are removed::" msgstr "" -#: ../../library/stdtypes.rst:5193 +#: ../../library/stdtypes.rst:5197 msgid "When comparing unions, the order is ignored::" msgstr "" -#: ../../library/stdtypes.rst:5197 +#: ../../library/stdtypes.rst:5201 msgid "It is compatible with :data:`typing.Union`::" msgstr "" -#: ../../library/stdtypes.rst:5201 +#: ../../library/stdtypes.rst:5205 msgid "Optional types can be spelled as a union with ``None``::" msgstr "" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5212 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "" -#: ../../library/stdtypes.rst:5214 +#: ../../library/stdtypes.rst:5218 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" -#: ../../library/stdtypes.rst:5224 +#: ../../library/stdtypes.rst:5228 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::" msgstr "" -#: ../../library/stdtypes.rst:5237 +#: ../../library/stdtypes.rst:5241 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 " "override it:" msgstr "" -#: ../../library/stdtypes.rst:5257 +#: ../../library/stdtypes.rst:5261 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr "" -#: ../../library/stdtypes.rst:5265 +#: ../../library/stdtypes.rst:5269 msgid "Other Built-in Types" msgstr "" -#: ../../library/stdtypes.rst:5267 +#: ../../library/stdtypes.rst:5271 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5274 +#: ../../library/stdtypes.rst:5278 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5276 +#: ../../library/stdtypes.rst:5280 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 " @@ -5835,7 +5838,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5283 +#: ../../library/stdtypes.rst:5287 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -5846,32 +5849,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5291 +#: ../../library/stdtypes.rst:5295 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:5299 +#: ../../library/stdtypes.rst:5303 msgid "Classes and Class Instances" msgstr "" -#: ../../library/stdtypes.rst:5301 +#: ../../library/stdtypes.rst:5305 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "" -#: ../../library/stdtypes.rst:5307 +#: ../../library/stdtypes.rst:5311 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5309 +#: ../../library/stdtypes.rst:5313 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:5312 +#: ../../library/stdtypes.rst:5316 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -5879,15 +5882,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5316 +#: ../../library/stdtypes.rst:5320 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5322 +#: ../../library/stdtypes.rst:5326 msgid "Methods" msgstr "" -#: ../../library/stdtypes.rst:5326 +#: ../../library/stdtypes.rst:5330 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -5895,7 +5898,7 @@ msgid "" "Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5331 +#: ../../library/stdtypes.rst:5335 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:" @@ -5908,7 +5911,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5342 +#: ../../library/stdtypes.rst:5346 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -5919,15 +5922,15 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5369 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5373 +#: ../../library/stdtypes.rst:5377 msgid "Code Objects" msgstr "" -#: ../../library/stdtypes.rst:5379 +#: ../../library/stdtypes.rst:5383 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -5937,7 +5940,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5386 +#: ../../library/stdtypes.rst:5390 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -5946,21 +5949,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5393 +#: ../../library/stdtypes.rst:5397 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:5396 +#: ../../library/stdtypes.rst:5400 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5402 +#: ../../library/stdtypes.rst:5406 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5408 +#: ../../library/stdtypes.rst:5412 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 " @@ -5968,30 +5971,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5413 +#: ../../library/stdtypes.rst:5417 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:5423 msgid "The Null Object" msgstr "" -#: ../../library/stdtypes.rst:5421 +#: ../../library/stdtypes.rst:5425 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:5425 +#: ../../library/stdtypes.rst:5429 msgid "It is written as ``None``." msgstr "" -#: ../../library/stdtypes.rst:5432 +#: ../../library/stdtypes.rst:5436 msgid "The Ellipsis Object" msgstr "" -#: ../../library/stdtypes.rst:5434 +#: ../../library/stdtypes.rst:5438 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " "no special operations. There is exactly one ellipsis object, named :const:" @@ -5999,15 +6002,15 @@ msgid "" "`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5439 +#: ../../library/stdtypes.rst:5443 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "" -#: ../../library/stdtypes.rst:5445 +#: ../../library/stdtypes.rst:5449 msgid "The NotImplemented Object" msgstr "" -#: ../../library/stdtypes.rst:5447 +#: ../../library/stdtypes.rst:5451 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 " @@ -6015,88 +6018,88 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5452 +#: ../../library/stdtypes.rst:5456 msgid "It is written as :code:`NotImplemented`." msgstr "" -#: ../../library/stdtypes.rst:5458 +#: ../../library/stdtypes.rst:5462 msgid "Internal Objects" msgstr "" -#: ../../library/stdtypes.rst:5460 +#: ../../library/stdtypes.rst:5464 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5468 +#: ../../library/stdtypes.rst:5472 msgid "Special Attributes" msgstr "" -#: ../../library/stdtypes.rst:5470 +#: ../../library/stdtypes.rst:5474 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:5477 +#: ../../library/stdtypes.rst:5481 msgid "" "A dictionary or other mapping object used to store an object's (writable) " "attributes." msgstr "" -#: ../../library/stdtypes.rst:5483 +#: ../../library/stdtypes.rst:5487 msgid "The class to which a class instance belongs." msgstr "" -#: ../../library/stdtypes.rst:5488 +#: ../../library/stdtypes.rst:5492 msgid "The tuple of base classes of a class object." msgstr "" -#: ../../library/stdtypes.rst:5493 +#: ../../library/stdtypes.rst:5497 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5499 +#: ../../library/stdtypes.rst:5503 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5507 +#: ../../library/stdtypes.rst:5511 msgid "" "The :ref:`type parameters ` of generic classes, functions, and :" "ref:`type aliases `." msgstr "" -#: ../../library/stdtypes.rst:5515 +#: ../../library/stdtypes.rst:5519 msgid "" "This attribute is a tuple of classes that are considered when looking for " "base classes during method resolution." msgstr "" -#: ../../library/stdtypes.rst:5521 +#: ../../library/stdtypes.rst:5525 msgid "" "This method can be overridden by a metaclass to customize the method " "resolution order for its instances. It is called at class instantiation, " "and its result is stored in :attr:`~class.__mro__`." msgstr "" -#: ../../library/stdtypes.rst:5528 +#: ../../library/stdtypes.rst:5532 msgid "" "Each class keeps a list of weak references to its immediate subclasses. " "This method returns a list of all those references still alive. The list is " "in definition order. Example::" msgstr "" -#: ../../library/stdtypes.rst:5539 +#: ../../library/stdtypes.rst:5543 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5541 +#: ../../library/stdtypes.rst:5545 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 " @@ -6104,7 +6107,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5550 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 " @@ -6114,24 +6117,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5553 +#: ../../library/stdtypes.rst:5557 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5555 +#: ../../library/stdtypes.rst:5559 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:5559 +#: ../../library/stdtypes.rst:5563 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5581 +#: ../../library/stdtypes.rst:5585 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -6139,94 +6142,94 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5586 +#: ../../library/stdtypes.rst:5590 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5601 +#: ../../library/stdtypes.rst:5605 msgid "Affected APIs" msgstr "" -#: ../../library/stdtypes.rst:5603 +#: ../../library/stdtypes.rst:5607 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5606 +#: ../../library/stdtypes.rst:5610 msgid "``int(string)`` with default base 10." msgstr "" -#: ../../library/stdtypes.rst:5607 +#: ../../library/stdtypes.rst:5611 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5608 +#: ../../library/stdtypes.rst:5612 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5609 +#: ../../library/stdtypes.rst:5613 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5610 +#: ../../library/stdtypes.rst:5614 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5613 +#: ../../library/stdtypes.rst:5617 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5615 +#: ../../library/stdtypes.rst:5619 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5616 +#: ../../library/stdtypes.rst:5620 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr "" -#: ../../library/stdtypes.rst:5617 +#: ../../library/stdtypes.rst:5621 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr "" -#: ../../library/stdtypes.rst:5618 +#: ../../library/stdtypes.rst:5622 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5619 +#: ../../library/stdtypes.rst:5623 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5620 +#: ../../library/stdtypes.rst:5624 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5623 +#: ../../library/stdtypes.rst:5627 msgid "Configuring the limit" msgstr "" -#: ../../library/stdtypes.rst:5625 +#: ../../library/stdtypes.rst:5629 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:5628 +#: ../../library/stdtypes.rst:5632 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:5631 +#: ../../library/stdtypes.rst:5635 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" msgstr "" -#: ../../library/stdtypes.rst:5633 +#: ../../library/stdtypes.rst:5637 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 " @@ -6235,38 +6238,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:5639 +#: ../../library/stdtypes.rst:5643 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5642 +#: ../../library/stdtypes.rst:5646 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:5646 +#: ../../library/stdtypes.rst:5650 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5648 +#: ../../library/stdtypes.rst:5652 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5650 +#: ../../library/stdtypes.rst:5654 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:5657 +#: ../../library/stdtypes.rst:5661 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 " @@ -6278,7 +6281,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5666 +#: ../../library/stdtypes.rst:5670 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 " @@ -6286,11 +6289,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5672 +#: ../../library/stdtypes.rst:5676 msgid "Recommended configuration" msgstr "" -#: ../../library/stdtypes.rst:5674 +#: ../../library/stdtypes.rst:5678 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 " @@ -6298,42 +6301,42 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5679 +#: ../../library/stdtypes.rst:5683 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5695 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5695 +#: ../../library/stdtypes.rst:5699 msgid "Footnotes" msgstr "註解" -#: ../../library/stdtypes.rst:5696 +#: ../../library/stdtypes.rst:5700 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5699 +#: ../../library/stdtypes.rst:5703 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5702 +#: ../../library/stdtypes.rst:5706 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5704 +#: ../../library/stdtypes.rst:5708 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:5707 +#: ../../library/stdtypes.rst:5711 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -6346,13 +6349,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:4421 -#: ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4425 +#: ../../library/stdtypes.rst:5408 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:4425 msgid "statement" msgstr "statement(陳述式)" @@ -6474,11 +6477,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:1259 #: ../../library/stdtypes.rst:1338 ../../library/stdtypes.rst:1382 #: ../../library/stdtypes.rst:1503 ../../library/stdtypes.rst:1539 -#: ../../library/stdtypes.rst:2513 ../../library/stdtypes.rst:2532 -#: ../../library/stdtypes.rst:2639 ../../library/stdtypes.rst:4219 -#: ../../library/stdtypes.rst:4421 ../../library/stdtypes.rst:4899 -#: ../../library/stdtypes.rst:5154 ../../library/stdtypes.rst:5324 -#: ../../library/stdtypes.rst:5368 +#: ../../library/stdtypes.rst:2516 ../../library/stdtypes.rst:2535 +#: ../../library/stdtypes.rst:2642 ../../library/stdtypes.rst:4223 +#: ../../library/stdtypes.rst:4425 ../../library/stdtypes.rst:4903 +#: ../../library/stdtypes.rst:5158 ../../library/stdtypes.rst:5328 +#: ../../library/stdtypes.rst:5372 msgid "object" msgstr "object(物件)" @@ -6570,9 +6573,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:950 -#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4421 -#: ../../library/stdtypes.rst:5375 ../../library/stdtypes.rst:5389 -#: ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4425 +#: ../../library/stdtypes.rst:5379 ../../library/stdtypes.rst:5393 +#: ../../library/stdtypes.rst:5408 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -6588,8 +6591,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2389 -#: ../../library/stdtypes.rst:3607 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:3611 msgid "+ (plus)" msgstr "+ (加號)" @@ -6601,13 +6604,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2389 -#: ../../library/stdtypes.rst:3607 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:3611 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2346 -#: ../../library/stdtypes.rst:3564 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2349 +#: ../../library/stdtypes.rst:3568 msgid "* (asterisk)" msgstr "* (星號)" @@ -6619,8 +6622,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2316 -#: ../../library/stdtypes.rst:3532 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2319 +#: ../../library/stdtypes.rst:3536 msgid "% (percent)" msgstr "% (百分號)" @@ -6630,7 +6633,7 @@ msgstr "**" #: ../../library/stdtypes.rst:316 ../../library/stdtypes.rst:393 #: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:4425 msgid "operations on" msgstr "operations on(操作於)" @@ -6639,7 +6642,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1605 -#: ../../library/stdtypes.rst:2513 ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:2516 ../../library/stdtypes.rst:5408 msgid "module" msgstr "模組" @@ -6707,7 +6710,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4814 +#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4818 msgid "protocol" msgstr "protocol(協定)" @@ -6733,7 +6736,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4425 msgid "len" msgstr "len" @@ -6810,14 +6813,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2513 -#: ../../library/stdtypes.rst:2639 ../../library/stdtypes.rst:2711 -#: ../../library/stdtypes.rst:3532 +#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2516 +#: ../../library/stdtypes.rst:2642 ../../library/stdtypes.rst:2714 +#: ../../library/stdtypes.rst:3536 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4421 -#: ../../library/stdtypes.rst:5154 ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4425 +#: ../../library/stdtypes.rst:5158 ../../library/stdtypes.rst:5408 msgid "type" msgstr "type(型別)" @@ -6825,7 +6828,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4425 msgid "del" msgstr "del" @@ -6866,7 +6869,7 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1503 ../../library/stdtypes.rst:1552 -#: ../../library/stdtypes.rst:1597 ../../library/stdtypes.rst:2316 +#: ../../library/stdtypes.rst:1597 ../../library/stdtypes.rst:2319 msgid "string" msgstr "string(字串)" @@ -6887,17 +6890,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1570 ../../library/stdtypes.rst:2505 +#: ../../library/stdtypes.rst:1570 ../../library/stdtypes.rst:2508 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1570 ../../library/stdtypes.rst:2513 -#: ../../library/stdtypes.rst:2532 ../../library/stdtypes.rst:2711 -#: ../../library/stdtypes.rst:3532 +#: ../../library/stdtypes.rst:1570 ../../library/stdtypes.rst:2516 +#: ../../library/stdtypes.rst:2535 ../../library/stdtypes.rst:2714 +#: ../../library/stdtypes.rst:3536 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1597 ../../library/stdtypes.rst:2711 +#: ../../library/stdtypes.rst:1597 ../../library/stdtypes.rst:2714 msgid "methods" msgstr "methods(方法)" @@ -6905,183 +6908,183 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2124 ../../library/stdtypes.rst:3386 +#: ../../library/stdtypes.rst:2127 ../../library/stdtypes.rst:3390 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2124 +#: ../../library/stdtypes.rst:2127 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2316 +#: ../../library/stdtypes.rst:2319 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2316 +#: ../../library/stdtypes.rst:2319 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2316 +#: ../../library/stdtypes.rst:2319 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2316 +#: ../../library/stdtypes.rst:2319 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2316 ../../library/stdtypes.rst:3532 +#: ../../library/stdtypes.rst:2319 ../../library/stdtypes.rst:3536 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2316 ../../library/stdtypes.rst:3532 +#: ../../library/stdtypes.rst:2319 ../../library/stdtypes.rst:3536 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2346 ../../library/stdtypes.rst:3564 +#: ../../library/stdtypes.rst:2349 ../../library/stdtypes.rst:3568 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2346 ../../library/stdtypes.rst:2389 -#: ../../library/stdtypes.rst:3564 ../../library/stdtypes.rst:3607 +#: ../../library/stdtypes.rst:2349 ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:3568 ../../library/stdtypes.rst:3611 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2346 ../../library/stdtypes.rst:3564 +#: ../../library/stdtypes.rst:2349 ../../library/stdtypes.rst:3568 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2389 ../../library/stdtypes.rst:3607 +#: ../../library/stdtypes.rst:2392 ../../library/stdtypes.rst:3611 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2389 ../../library/stdtypes.rst:3607 +#: ../../library/stdtypes.rst:2392 ../../library/stdtypes.rst:3611 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2505 +#: ../../library/stdtypes.rst:2508 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2513 +#: ../../library/stdtypes.rst:2516 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2513 +#: ../../library/stdtypes.rst:2516 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3386 +#: ../../library/stdtypes.rst:3390 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3386 +#: ../../library/stdtypes.rst:3390 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3532 +#: ../../library/stdtypes.rst:3536 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3532 +#: ../../library/stdtypes.rst:3536 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3532 +#: ../../library/stdtypes.rst:3536 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3532 +#: ../../library/stdtypes.rst:3536 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4219 +#: ../../library/stdtypes.rst:4223 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:4425 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:4425 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:4504 +#: ../../library/stdtypes.rst:4508 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:4814 +#: ../../library/stdtypes.rst:4818 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:4814 +#: ../../library/stdtypes.rst:4818 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:4814 +#: ../../library/stdtypes.rst:4818 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:4887 +#: ../../library/stdtypes.rst:4891 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:4887 +#: ../../library/stdtypes.rst:4891 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:4899 +#: ../../library/stdtypes.rst:4903 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:4899 +#: ../../library/stdtypes.rst:4903 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:4899 +#: ../../library/stdtypes.rst:4903 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5154 +#: ../../library/stdtypes.rst:5158 msgid "Union" msgstr "Union(聯集)" -#: ../../library/stdtypes.rst:5154 +#: ../../library/stdtypes.rst:5158 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5324 +#: ../../library/stdtypes.rst:5328 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5368 +#: ../../library/stdtypes.rst:5372 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5368 +#: ../../library/stdtypes.rst:5372 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5375 +#: ../../library/stdtypes.rst:5379 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5375 +#: ../../library/stdtypes.rst:5379 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5393 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5393 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5428 +#: ../../library/stdtypes.rst:5432 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5428 +#: ../../library/stdtypes.rst:5432 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" diff --git a/library/symtable.po b/library/symtable.po index 26958fe1da..40023613eb 100644 --- a/library/symtable.po +++ b/library/symtable.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-21 00:03+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -171,54 +171,78 @@ msgid "A namespace of a class. This class inherits from :class:`SymbolTable`." msgstr "一個類別的命名空間。該類別繼承自 :class:`SymbolTable`。" #: ../../library/symtable.rst:130 -msgid "Return a tuple containing the names of methods declared in the class." -msgstr "回傳一個包含類別中聲明的方法名稱的元組。" +msgid "" +"Return a tuple containing the names of method-like functions declared in the " +"class." +msgstr "回傳一個包含類別中聲明的類似方法之函式名稱的元組。" + +#: ../../library/symtable.rst:133 +msgid "" +"Here, the term 'method' designates *any* function defined in the class body " +"via :keyword:`def` or :keyword:`async def`." +msgstr "" + +#: ../../library/symtable.rst:136 +msgid "" +"Functions defined in a deeper scope (e.g., in an inner class) are not picked " +"up by :meth:`get_methods`." +msgstr "" + +#: ../../library/symtable.rst:139 +msgid "For example:" +msgstr "舉例來說:" -#: ../../library/symtable.rst:135 +#: ../../library/symtable.rst:161 +msgid "" +"Although ``A().f()`` raises :exc:`TypeError` at runtime, ``A.f`` is still " +"considered as a method-like function." +msgstr "" + +#: ../../library/symtable.rst:166 msgid "" "An entry in a :class:`SymbolTable` corresponding to an identifier in the " "source. The constructor is not public." msgstr "" ":class:`SymbolTable` 中的條目對應於來源中的識別器。建構函式不是公開的。" -#: ../../library/symtable.rst:140 +#: ../../library/symtable.rst:171 msgid "Return the symbol's name." msgstr "回傳符號的名稱。" -#: ../../library/symtable.rst:144 +#: ../../library/symtable.rst:175 msgid "Return ``True`` if the symbol is used in its block." msgstr "如果該符號在其區塊中使用,則回傳 ``True``。" -#: ../../library/symtable.rst:148 +#: ../../library/symtable.rst:179 msgid "Return ``True`` if the symbol is created from an import statement." msgstr "如果符號是從 import 陳述式建立的,則回傳 ``True``。" -#: ../../library/symtable.rst:152 +#: ../../library/symtable.rst:183 msgid "Return ``True`` if the symbol is a parameter." msgstr "如果符號是一個參數,則回傳 ``True``。" -#: ../../library/symtable.rst:156 +#: ../../library/symtable.rst:187 msgid "Return ``True`` if the symbol is global." msgstr "如果符號是全域的,則回傳 ``True``。" -#: ../../library/symtable.rst:160 +#: ../../library/symtable.rst:191 msgid "Return ``True`` if the symbol is nonlocal." msgstr "如果符號是非區域的,則回傳 ``True``。" -#: ../../library/symtable.rst:164 +#: ../../library/symtable.rst:195 msgid "" "Return ``True`` if the symbol is declared global with a global statement." msgstr "如果使用全域陳述式將符號聲明為全域的,則回傳 ``True``。" -#: ../../library/symtable.rst:168 +#: ../../library/symtable.rst:199 msgid "Return ``True`` if the symbol is local to its block." msgstr "如果符號是其區塊的區域符號,則回傳 ``True``。" -#: ../../library/symtable.rst:172 +#: ../../library/symtable.rst:203 msgid "Return ``True`` if the symbol is annotated." msgstr "如果符號有被註釋,則回傳 ``True``。" -#: ../../library/symtable.rst:178 +#: ../../library/symtable.rst:209 msgid "" "Return ``True`` if the symbol is referenced in its block, but not assigned " "to." @@ -226,25 +250,25 @@ msgstr "" "如果該符號在其區塊中被參照 (referenced) 但未被賦值 (assigned),則回傳 " "``True``。" -#: ../../library/symtable.rst:183 +#: ../../library/symtable.rst:214 msgid "Return ``True`` if the symbol is assigned to in its block." msgstr "如果該符號被賦值到其區塊中,則回傳 ``True``。" -#: ../../library/symtable.rst:187 +#: ../../library/symtable.rst:218 msgid "Return ``True`` if name binding introduces new namespace." msgstr "如果名稱綁定引入 (introduce) 新的命名空間,則回傳 ``True``。" -#: ../../library/symtable.rst:189 +#: ../../library/symtable.rst:220 msgid "" "If the name is used as the target of a function or class statement, this " "will be true." msgstr "如果名稱用作函式或類別陳述式的目標,則這將會是 true。" -#: ../../library/symtable.rst:192 +#: ../../library/symtable.rst:223 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/symtable.rst:198 +#: ../../library/symtable.rst:229 msgid "" "Note that a single name can be bound to multiple objects. If the result is " "``True``, the name may also be bound to other objects, like an int or list, " @@ -253,11 +277,11 @@ msgstr "" "請注意,單個名稱可以綁定到多個物件。如果結果為 ``True``,則該名稱也可能被綁定" "到其他物件,例如 int 或 list,而不會引入新的命名空間。" -#: ../../library/symtable.rst:204 +#: ../../library/symtable.rst:235 msgid "Return a list of namespaces bound to this name." msgstr "回傳綁定到該名稱的命名空間的串列。" -#: ../../library/symtable.rst:208 +#: ../../library/symtable.rst:239 msgid "" "Return the namespace bound to this name. If more than one or no namespace is " "bound to this name, a :exc:`ValueError` is raised." diff --git a/library/typing.po b/library/typing.po index 0aa572f17d..dadfdde9f9 100644 --- a/library/typing.po +++ b/library/typing.po @@ -45,16 +45,16 @@ msgstr "動腦筋思考下面的函式: ::" #: ../../library/typing.rst:33 msgid "" -"The function ``moon_weight`` takes an argument expected to be an instance " -"of :class:`float`, as indicated by the *type hint* ``earth_weight: float``. " -"The function is expected to return an instance of :class:`str`, as indicated " -"by the ``-> str`` hint." +"The function ``surface_area_of_cube`` takes an argument expected to be an " +"instance of :class:`float`, as indicated by the :term:`type hint` " +"``edge_length: float``. The function is expected to return an instance of :" +"class:`str`, as indicated by the ``-> str`` hint." msgstr "" -"函式 ``moon_weight`` 需要一個引數且預期是一個 :class:`float` 的實例,如 " -"``earth_weight: float`` 所指出的\\ *型別提示*。這個函式預期會回傳一個 :class:" -"`str` 的實例,如 ``-> str`` 所指出的提示。" +"函式 ``surface_area_of_cube`` 需要一個引數且預期是一個 :class:`float` 的實" +"例,如 ``edge_length: float`` 所指出的\\ :term:`型別提示 `。這個函" +"式預期會回傳一個 :class:`str` 的實例,如 ``-> str`` 所指出的提示。" -#: ../../library/typing.rst:37 +#: ../../library/typing.rst:38 msgid "" "While type hints can be simple classes like :class:`float` or :class:`str`, " "they can also be more complex. The :mod:`typing` module provides a " @@ -63,7 +63,7 @@ msgstr "" "儘管型別提示可以是簡單類別,像是 :class:`float` 或 :class:`str`,他們也可以變" "得更為複雜。模組 :mod:`typing` 提供一組更高階的型別提示詞彙。" -#: ../../library/typing.rst:41 +#: ../../library/typing.rst:42 msgid "" "New features are frequently added to the ``typing`` module. The :pypi:" "`typing_extensions` package provides backports of these new features to " @@ -72,7 +72,7 @@ msgstr "" "新功能會頻繁的新增至 ``typing`` 模組中。:pypi:`typing_extensions` 套件為這些" "新功能提供了 backport(向後移植的)版本,提供給舊版本的 Python 使用。" -#: ../../library/typing.rst:47 +#: ../../library/typing.rst:48 msgid "" "`\"Typing cheat sheet\" `_" @@ -80,11 +80,11 @@ msgstr "" "`\"型別小抄 (Typing cheat sheet)\" `_" -#: ../../library/typing.rst:48 +#: ../../library/typing.rst:49 msgid "A quick overview of type hints (hosted at the mypy docs)" msgstr "型別提示的快速預覽(發布於 mypy 的文件中)" -#: ../../library/typing.rst:50 +#: ../../library/typing.rst:51 msgid "" "\"Type System Reference\" section of `the mypy docs `_" @@ -92,7 +92,7 @@ msgstr "" "`mypy 文件 `_\\ 的 \"型別系" "統參考資料 (Type System Reference)\" 章節" -#: ../../library/typing.rst:51 +#: ../../library/typing.rst:52 msgid "" "The Python typing system is standardised via PEPs, so this reference should " "broadly apply to most Python type checkers. (Some parts may still be " @@ -101,14 +101,14 @@ msgstr "" "Python 的加註型別系統是基於 PEPs 進行標準化,所以這個參照 (reference) 應該在" "多數 Python 型別檢查器中廣為使用。(某些部分依然是特定給 mypy 使用。)" -#: ../../library/typing.rst:55 +#: ../../library/typing.rst:56 msgid "" "`\"Static Typing with Python\" `_" msgstr "" "`\"Python 的靜態型別 (Static Typing)\" `_" -#: ../../library/typing.rst:56 +#: ../../library/typing.rst:57 msgid "" "Type-checker-agnostic documentation written by the community detailing type " "system features, useful typing related tools and typing best practices." @@ -116,11 +116,11 @@ msgstr "" "由社群編寫的跨平台型別檢查器文件 (type-checker-agnostic) 詳細描述加註型別系統" "的功能、實用的加註型別衍伸工具、以及加註型別的最佳實踐 (best practice)。" -#: ../../library/typing.rst:63 +#: ../../library/typing.rst:64 msgid "Specification for the Python Type System" msgstr "Python 型別系統的技術規範" -#: ../../library/typing.rst:65 +#: ../../library/typing.rst:66 msgid "" "The canonical, up-to-date specification of the Python type system can be " "found at `\"Specification for the Python type system\" `_\\ 找到。" -#: ../../library/typing.rst:71 +#: ../../library/typing.rst:72 msgid "Type aliases" msgstr "型別別名" -#: ../../library/typing.rst:73 +#: ../../library/typing.rst:74 msgid "" "A type alias is defined using the :keyword:`type` statement, which creates " "an instance of :class:`TypeAliasType`. In this example, ``Vector`` and " @@ -144,7 +144,7 @@ msgstr "" "`TypeAliasType` 的實例。在這個範例中,``Vector`` 及 ``list[float]`` 會被當作" "和靜態型別檢查器一樣同等對待: ::" -#: ../../library/typing.rst:86 +#: ../../library/typing.rst:87 msgid "" "Type aliases are useful for simplifying complex type signatures. For " "example::" @@ -152,7 +152,7 @@ msgstr "" "型別別名對於簡化複雜的型別簽名 (complex type signature) 非常好用。舉例來" "說: ::" -#: ../../library/typing.rst:104 +#: ../../library/typing.rst:106 msgid "" "The :keyword:`type` statement is new in Python 3.12. For backwards " "compatibility, type aliases can also be created through simple assignment::" @@ -160,7 +160,7 @@ msgstr "" ":keyword:`type` 陳述式是 Python 3.12 的新功能。為了向後相容性,型別別名可以透" "過簡單的賦值來建立: ::" -#: ../../library/typing.rst:109 +#: ../../library/typing.rst:111 msgid "" "Or marked with :data:`TypeAlias` to make it explicit that this is a type " "alias, not a normal variable assignment::" @@ -168,15 +168,15 @@ msgstr "" "或是用 :data:`TypeAlias` 標記,讓它明確的表示這是一個型別別名,而非一般的變數" "賦值: ::" -#: ../../library/typing.rst:119 +#: ../../library/typing.rst:121 msgid "NewType" msgstr "NewType" -#: ../../library/typing.rst:121 +#: ../../library/typing.rst:123 msgid "Use the :class:`NewType` helper to create distinct types::" msgstr "使用 :class:`NewType` 輔助工具 (helper) 建立獨特型別: ::" -#: ../../library/typing.rst:128 +#: ../../library/typing.rst:130 msgid "" "The static type checker will treat the new type as if it were a subclass of " "the original type. This is useful in helping catch logical errors::" @@ -184,7 +184,7 @@ msgstr "" "若它是原本型別的子類別,靜態型別檢查器會將其視為一個新的型別。這對於幫助擷取" "邏輯性錯誤非常有用: ::" -#: ../../library/typing.rst:140 +#: ../../library/typing.rst:142 msgid "" "You may still perform all ``int`` operations on a variable of type " "``UserId``, but the result will always be of type ``int``. This lets you " @@ -195,7 +195,7 @@ msgstr "" "預期接受 ``int`` 的地方傳遞一個 ``UserId``,還能預防你意外使用無效的方法建立" "一個 ``UserId``: ::" -#: ../../library/typing.rst:148 +#: ../../library/typing.rst:150 msgid "" "Note that these checks are enforced only by the static type checker. At " "runtime, the statement ``Derived = NewType('Derived', Base)`` will make " @@ -208,7 +208,7 @@ msgstr "" "呼叫物件),會立即回傳任何你傳遞的引數。這意味著 expression (運算式)\\ " "``Derived(some_value)`` 不會建立一個新的類別或過度引入原有的函式呼叫。" -#: ../../library/typing.rst:154 +#: ../../library/typing.rst:156 msgid "" "More precisely, the expression ``some_value is Derived(some_value)`` is " "always true at runtime." @@ -216,26 +216,26 @@ msgstr "" "更精確地說,expression ``some_value is Derived(some_value)`` 在 runtime 永遠" "為 true。" -#: ../../library/typing.rst:157 +#: ../../library/typing.rst:159 msgid "It is invalid to create a subtype of ``Derived``::" msgstr "這會無法建立一個 ``Derived`` 的子型別: ::" -#: ../../library/typing.rst:166 +#: ../../library/typing.rst:168 msgid "" "However, it is possible to create a :class:`NewType` based on a 'derived' " "``NewType``::" msgstr "" "無論如何,這有辦法基於 '衍生的' ``NewType`` 建立一個 :class:`NewType`: ::" -#: ../../library/typing.rst:174 +#: ../../library/typing.rst:176 msgid "and typechecking for ``ProUserId`` will work as expected." msgstr "以及針對 ``ProUserId`` 的型別檢查會如期運作。" -#: ../../library/typing.rst:176 +#: ../../library/typing.rst:178 msgid "See :pep:`484` for more details." msgstr "更多細節請見 :pep:`484`。" -#: ../../library/typing.rst:180 +#: ../../library/typing.rst:182 msgid "" "Recall that the use of a type alias declares two types to be *equivalent* to " "one another. Doing ``type Alias = Original`` will make the static type " @@ -246,7 +246,7 @@ msgstr "" "Original`` 則會讓靜態型別檢查器在任何情況之下將 ``Alias`` 視為與 " "``Original`` \\ *完全相等*。這當你想把複雜的型別簽名進行簡化時,非常好用。" -#: ../../library/typing.rst:185 +#: ../../library/typing.rst:187 msgid "" "In contrast, ``NewType`` declares one type to be a *subtype* of another. " "Doing ``Derived = NewType('Derived', Original)`` will make the static type " @@ -261,7 +261,7 @@ msgstr "" "預期接收到型別 ``Derived`` 的值的區域。這當你想用最小的 runtime 成本預防邏輯" "性錯誤而言,非常有用。" -#: ../../library/typing.rst:194 +#: ../../library/typing.rst:196 msgid "" "``NewType`` is now a class rather than a function. As a result, there is " "some additional runtime cost when calling ``NewType`` over a regular " @@ -270,17 +270,17 @@ msgstr "" "現在的 ``NewType`` 比起一個函式更像一個類別。因此,比起一般的函式,呼叫 " "``NewType`` 需要額外的 runtime 成本。" -#: ../../library/typing.rst:199 +#: ../../library/typing.rst:201 msgid "" "The performance of calling ``NewType`` has been restored to its level in " "Python 3.9." msgstr "呼叫 ``NewType`` 的效能已經恢復與 Python 3.9 相同的水準。" -#: ../../library/typing.rst:206 +#: ../../library/typing.rst:208 msgid "Annotating callable objects" msgstr "註釋 callable 物件" -#: ../../library/typing.rst:208 +#: ../../library/typing.rst:210 msgid "" "Functions -- or other :term:`callable` objects -- can be annotated using :" "class:`collections.abc.Callable` or :data:`typing.Callable`. " @@ -291,12 +291,12 @@ msgstr "" "Callable` 或 :data:`typing.Callable` 進行註釋。 ``Callable[[int], str]`` 象徵" "為一個函式,可以接受一個型別為 :class:`int` 的引數,並回傳一個 :class:`str`。" -#: ../../library/typing.rst:213 ../../library/typing.rst:2829 -#: ../../library/typing.rst:2975 +#: ../../library/typing.rst:215 ../../library/typing.rst:2831 +#: ../../library/typing.rst:2977 msgid "For example:" msgstr "舉例來說:" -#: ../../library/typing.rst:231 +#: ../../library/typing.rst:233 msgid "" "The subscription syntax must always be used with exactly two values: the " "argument list and the return type. The argument list must be a list of " @@ -307,7 +307,7 @@ msgstr "" "傳類別。引數串列必須為一個型別串列::class:`ParamSpec`、:data:`Concatenate` " "或是一個刪節號 (ellipsis)。回傳類別必為一個單一類別。" -#: ../../library/typing.rst:236 +#: ../../library/typing.rst:238 msgid "" "If a literal ellipsis ``...`` is given as the argument list, it indicates " "that a callable with any arbitrary parameter list would be acceptable:" @@ -315,7 +315,7 @@ msgstr "" "若刪節號文字 ``...`` 被當作引數串列給定,其指出一個具任何、任意參數列表的 " "callable 會被接受: ::" -#: ../../library/typing.rst:248 +#: ../../library/typing.rst:250 msgid "" "``Callable`` cannot express complex signatures such as functions that take a " "variadic number of arguments, :ref:`overloaded functions `, or " @@ -328,7 +328,7 @@ msgstr "" "過定義一個具有 :meth:`~object.__call__` 方法的 :class:`Protocol` 類別進行表" "示:" -#: ../../library/typing.rst:275 +#: ../../library/typing.rst:277 msgid "" "Callables which take other callables as arguments may indicate that their " "parameter types are dependent on each other using :class:`ParamSpec`. " @@ -345,7 +345,7 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:283 ../../library/typing.rst:3501 +#: ../../library/typing.rst:285 ../../library/typing.rst:3503 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." @@ -353,7 +353,7 @@ msgstr "" "``Callable`` 現已支援 :class:`ParamSpec` 以及 :data:`Concatenate`。請參閱 :" "pep:`612` 閱讀詳細內容。" -#: ../../library/typing.rst:288 +#: ../../library/typing.rst:290 msgid "" "The documentation for :class:`ParamSpec` and :class:`Concatenate` provides " "examples of usage in ``Callable``." @@ -361,11 +361,11 @@ msgstr "" ":class:`ParamSpec` 以及 :class:`Concatenate` 的文件中,提供範例如何在 " "``Callable`` 中使用。" -#: ../../library/typing.rst:294 +#: ../../library/typing.rst:296 msgid "Generics" msgstr "泛型" -#: ../../library/typing.rst:296 +#: ../../library/typing.rst:298 msgid "" "Since type information about objects kept in containers cannot be statically " "inferred in a generic way, many container classes in the standard library " @@ -375,7 +375,7 @@ msgstr "" "(statically inferred),許多標準函式庫的容器類別支援以下標來表示容器內預期的元" "素。" -#: ../../library/typing.rst:313 +#: ../../library/typing.rst:315 msgid "" "Generic functions and classes can be parameterized by using :ref:`type " "parameter syntax `::" @@ -383,19 +383,19 @@ msgstr "" "泛型函式及類別可以使用\\ :ref:`型別參數語法 (type parameter syntax) ` 進行參數化 (parameterize) : ::" -#: ../../library/typing.rst:321 +#: ../../library/typing.rst:323 msgid "Or by using the :class:`TypeVar` factory directly::" msgstr "或是直接使用 :class:`TypeVar` 工廠 (factory): ::" -#: ../../library/typing.rst:331 +#: ../../library/typing.rst:333 msgid "Syntactic support for generics is new in Python 3.12." msgstr "在 Python 3.12 中,泛型的語法支援是全新功能。" -#: ../../library/typing.rst:337 +#: ../../library/typing.rst:339 msgid "Annotating tuples" msgstr "註釋元組 (tuple)" -#: ../../library/typing.rst:339 +#: ../../library/typing.rst:341 msgid "" "For most containers in Python, the typing system assumes that all elements " "in the container will be of the same type. For example::" @@ -403,7 +403,7 @@ msgstr "" "在 Python 大多數的容器當中,加註型別系統認為容器內的所有元素會是相同型別。舉" "例來說: ::" -#: ../../library/typing.rst:354 +#: ../../library/typing.rst:356 msgid "" ":class:`list` only accepts one type argument, so a type checker would emit " "an error on the ``y`` assignment above. Similarly, :class:`~collections.abc." @@ -415,7 +415,7 @@ msgstr "" "個型別引數:第一個引數指出 keys(鍵)的型別;第二個引數指出 values(值)的型" "別。" -#: ../../library/typing.rst:360 +#: ../../library/typing.rst:362 msgid "" "Unlike most other Python containers, however, it is common in idiomatic " "Python code for tuples to have elements which are not all of the same type. " @@ -427,7 +427,7 @@ msgstr "" "統中是個特例 (special-cased)。:class:`tuple` 接受\\ *任何數量*\\ 的型別引" "數: ::" -#: ../../library/typing.rst:376 +#: ../../library/typing.rst:378 msgid "" "To denote a tuple which could be of *any* length, and in which all elements " "are of the same type ``T``, use ``tuple[T, ...]``. To denote an empty tuple, " @@ -438,11 +438,11 @@ msgstr "" "``tuple[T, ...]`` 進行標示。為了標示一個空元組,請使用 ``tuple[()]``。單純使" "用 ``tuple`` 作為註釋,會與使用 ``tuple[Any, ...]`` 是相等的: ::" -#: ../../library/typing.rst:399 +#: ../../library/typing.rst:401 msgid "The type of class objects" msgstr "類別物件的型別" -#: ../../library/typing.rst:401 +#: ../../library/typing.rst:403 msgid "" "A variable annotated with ``C`` may accept a value of type ``C``. In " "contrast, a variable annotated with ``type[C]`` (or :class:`typing.Type[C] " @@ -453,11 +453,11 @@ msgstr "" "為 ``type[C]`` \\ (或 :class:`typing.Type[C] `)\\ 可以接受本身為該類" "別的值 -- 具體來說,他可能會接受 ``C`` 的\\ *類別物件*\\。舉例來說: ::" -#: ../../library/typing.rst:411 +#: ../../library/typing.rst:413 msgid "Note that ``type[C]`` is covariant::" msgstr "請記得 ``type[C]`` 是共變 (covariant) 的: ::" -#: ../../library/typing.rst:427 +#: ../../library/typing.rst:429 msgid "" "The only legal parameters for :class:`type` are classes, :data:`Any`, :ref:" "`type variables `, and unions of any of these types. For example::" @@ -465,7 +465,7 @@ msgstr "" ":class:`type` 僅有的合法參數是類別、:data:`Any`、:ref:`型別變數 " "`\\ 以及這些型別任意組合成的聯集。舉例來說: ::" -#: ../../library/typing.rst:439 +#: ../../library/typing.rst:441 msgid "" "``type[Any]`` is equivalent to :class:`type`, which is the root of Python's :" "ref:`metaclass hierarchy `." @@ -473,15 +473,15 @@ msgstr "" "``type[Any]`` 等價於 :class:`type` ,其為 Python :ref:`metaclass 階層結構 " "(hierachy) `。" -#: ../../library/typing.rst:445 +#: ../../library/typing.rst:447 msgid "User-defined generic types" msgstr "使用者定義泛型型別" -#: ../../library/typing.rst:447 +#: ../../library/typing.rst:449 msgid "A user-defined class can be defined as a generic class." msgstr "一個使用者定義的類別可以被定義成一個泛型類別。" -#: ../../library/typing.rst:470 +#: ../../library/typing.rst:472 msgid "" "This syntax indicates that the class ``LoggedVar`` is parameterised around a " "single :ref:`type variable ` ``T`` . This also makes ``T`` valid as " @@ -490,7 +490,7 @@ msgstr "" "這個語法指出類別 ``LoggedVar`` 透過一個單一的 :ref:`型別變數 ` " "``T`` 進行參數化 (parameterised)。這使得 ``T`` 在類別中有效的成為型別。" -#: ../../library/typing.rst:474 +#: ../../library/typing.rst:476 msgid "" "Generic classes implicitly inherit from :class:`Generic`. For compatibility " "with Python 3.11 and lower, it is also possible to inherit explicitly from :" @@ -499,7 +499,7 @@ msgstr "" "泛型類別隱性繼承了 :class:`Generic`。為了相容 Python 3.11 及更早版本,也可以" "明確的繼承 :class:`Generic` 並指出是一個泛型類別: ::" -#: ../../library/typing.rst:485 +#: ../../library/typing.rst:487 msgid "" "Generic classes have :meth:`~object.__class_getitem__` methods, meaning they " "can be parameterised at runtime (e.g. ``LoggedVar[int]`` below)::" @@ -507,7 +507,7 @@ msgstr "" "泛型類別有 :meth:`~object.__class_getitem__` 方法,其意味著可以在 runtime 進" "行參數化(如下述的 ``LoggedVar[int]``): ::" -#: ../../library/typing.rst:494 +#: ../../library/typing.rst:496 msgid "" "A generic type can have any number of type variables. All varieties of :" "class:`TypeVar` are permissible as parameters for a generic type::" @@ -515,26 +515,26 @@ msgstr "" "一個泛型型別可以有任意數量的型別變數。所有種類的 :class:`TypeVar` 都可以作為" "泛型型別的參數: ::" -#: ../../library/typing.rst:509 +#: ../../library/typing.rst:511 msgid "" "Each type variable argument to :class:`Generic` must be distinct. This is " "thus invalid::" msgstr ":class:`Generic` 的每個型別變數引數必不相同。因此以下是無效的: ::" -#: ../../library/typing.rst:523 +#: ../../library/typing.rst:525 msgid "Generic classes can also inherit from other classes::" msgstr "泛型類別亦可以繼承其他類別: ::" -#: ../../library/typing.rst:530 +#: ../../library/typing.rst:532 msgid "" "When inheriting from generic classes, some type parameters could be fixed::" msgstr "當繼承泛型類別時,部份的型別參數可固定: ::" -#: ../../library/typing.rst:537 +#: ../../library/typing.rst:539 msgid "In this case ``MyDict`` has a single parameter, ``T``." msgstr "在這種情況下 ``MyDict`` 有一個單一的參數 ``T``。" -#: ../../library/typing.rst:539 +#: ../../library/typing.rst:541 msgid "" "Using a generic class without specifying type parameters assumes :data:`Any` " "for each position. In the following example, ``MyIterable`` is not generic " @@ -543,21 +543,21 @@ msgstr "" "若使用泛型類別卻沒有特指型別參數,則會將每個位置視為 :data:`Any`。在下列的範" "例中 ``MyIterable`` 不是泛型,但隱性繼承了 ``Iterable[Any]``: ::" -#: ../../library/typing.rst:550 +#: ../../library/typing.rst:552 msgid "User-defined generic type aliases are also supported. Examples::" msgstr "使用者定義的泛型型別別名也有支援。例如: ::" -#: ../../library/typing.rst:565 +#: ../../library/typing.rst:567 msgid "" "For backward compatibility, generic type aliases can also be created through " "a simple assignment::" msgstr "為了向後相容性,泛型型別別名可以透過簡單的賦值來建立: ::" -#: ../../library/typing.rst:574 +#: ../../library/typing.rst:576 msgid ":class:`Generic` no longer has a custom metaclass." msgstr ":class:`Generic` 不再是一個自訂的 metaclass。" -#: ../../library/typing.rst:577 +#: ../../library/typing.rst:579 msgid "" "Syntactic support for generics and type aliases is new in version 3.12. " "Previously, generic classes had to explicitly inherit from :class:`Generic` " @@ -566,7 +566,7 @@ msgstr "" "在版本 3.12 新增了泛型及型別別名的語法支援。在之前的版本中,泛型類別必須顯性" "繼承 :class:`Generic` 或是包含一個型別變數在基底類別 (base) 當中。" -#: ../../library/typing.rst:582 +#: ../../library/typing.rst:584 msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``[**P]``. The behavior is " @@ -580,7 +580,7 @@ msgstr "" "別模組視為一個特定的型別變數。對此,其中一個例外是一個型別列表可以替代 :" "class:`ParamSpec`: ::" -#: ../../library/typing.rst:593 +#: ../../library/typing.rst:595 msgid "" "Classes generic over a :class:`ParamSpec` can also be created using explicit " "inheritance from :class:`Generic`. In this case, ``**`` is not used::" @@ -588,7 +588,7 @@ msgstr "" "具有 :class:`ParamSpec` 的泛型類別可以透過顯性繼承 :class:`Generic` 進行建" "立。在這種情況下,不需要使用 ``**``: ::" -#: ../../library/typing.rst:603 +#: ../../library/typing.rst:605 msgid "" "Another difference between :class:`TypeVar` and :class:`ParamSpec` is that a " "generic with only one parameter specification variable will accept parameter " @@ -601,7 +601,7 @@ msgstr "" "``X[Type1, Type2, ...]`` 的參數列表。在內部中,後者會被轉換為前者,所以在下方" "的範例中為相等的: ::" -#: ../../library/typing.rst:616 +#: ../../library/typing.rst:618 msgid "" "Note that generics with :class:`ParamSpec` may not have correct " "``__parameters__`` after substitution in some cases because they are " @@ -610,7 +610,7 @@ msgstr "" "請記得,具有 :class:`ParamSpec` 的泛型在某些情況下替換之後可能不會有正確的 " "``__parameters__``,因為參數規格主要還是用於靜態型別檢查。" -#: ../../library/typing.rst:620 +#: ../../library/typing.rst:622 msgid "" ":class:`Generic` can now be parameterized over parameter expressions. See :" "class:`ParamSpec` and :pep:`612` for more details." @@ -618,7 +618,7 @@ msgstr "" ":class:`Generic` 現在可以透過參數運算式來進行參數化。詳細內容請見 :class:" "`ParamSpec` 以及 :pep:`612`。" -#: ../../library/typing.rst:624 +#: ../../library/typing.rst:626 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " @@ -629,11 +629,11 @@ msgstr "" "突。泛型的 metaclass 則不支援。參數化泛型的輸出將被存為快取,而在型別模組中多" "數的型別皆為 :term:`hashable` 且可以比較相等性。" -#: ../../library/typing.rst:631 +#: ../../library/typing.rst:633 msgid "The :data:`Any` type" msgstr ":data:`Any` 型別" -#: ../../library/typing.rst:633 +#: ../../library/typing.rst:635 msgid "" "A special kind of type is :data:`Any`. A static type checker will treat " "every type as being compatible with :data:`Any` and :data:`Any` as being " @@ -642,7 +642,7 @@ msgstr "" ":data:`Any` 是一種特別的型別。一個靜態型別檢查器會將每個型別視為可相容於 :" "data:`Any` 且 :data:`Any` 也可以相容於每個型別。" -#: ../../library/typing.rst:637 +#: ../../library/typing.rst:639 msgid "" "This means that it is possible to perform any operation or method call on a " "value of type :data:`Any` and assign it to any variable::" @@ -650,7 +650,7 @@ msgstr "" "這意味著如果在一個為 :data:`Any` 的值上執行任何操作或呼叫方法是可行的,且可以" "賦值給任意變數: ::" -#: ../../library/typing.rst:655 +#: ../../library/typing.rst:657 msgid "" "Notice that no type checking is performed when assigning a value of type :" "data:`Any` to a more precise type. For example, the static type checker did " @@ -662,13 +662,13 @@ msgstr "" "舉例來說,靜態型別檢查器不會在 runtime 中,將 ``a`` 賦值給 ``s`` 的情況下回報" "錯誤,儘管 ``s`` 是被宣告為型別 :class:`str` 卻接收到 :class:`int` 的值!" -#: ../../library/typing.rst:661 +#: ../../library/typing.rst:663 msgid "" "Furthermore, all functions without a return type or parameter types will " "implicitly default to using :data:`Any`::" msgstr "另外,所有缺少回傳型別或參數型別的函式將會隱性預設為 :data:`Any`: ::" -#: ../../library/typing.rst:674 +#: ../../library/typing.rst:676 msgid "" "This behavior allows :data:`Any` to be used as an *escape hatch* when you " "need to mix dynamically and statically typed code." @@ -676,7 +676,7 @@ msgstr "" "當你需要混和動態及靜態的型別程式碼,這個行為允許 :data:`Any` 被當作一個\\ *緊" "急出口 (escape hatch)*\\使用。" -#: ../../library/typing.rst:677 +#: ../../library/typing.rst:679 msgid "" "Contrast the behavior of :data:`Any` with the behavior of :class:`object`. " "Similar to :data:`Any`, every type is a subtype of :class:`object`. However, " @@ -687,7 +687,7 @@ msgstr "" "別會作為 :class:`object` 的子型別。然而,不像 :data:`Any`,反之不亦然::" "class:`object` 並\\ *不是*\\一個其他型別的子型別。" -#: ../../library/typing.rst:682 +#: ../../library/typing.rst:684 msgid "" "That means when the type of a value is :class:`object`, a type checker will " "reject almost all operations on it, and assigning it to a variable (or using " @@ -698,7 +698,7 @@ msgstr "" "並將賦予這個值到一個特定型別變數(或是當作回傳值使用)視為一個型別錯誤。舉例" "來說: ::" -#: ../../library/typing.rst:704 +#: ../../library/typing.rst:706 msgid "" "Use :class:`object` to indicate that a value could be any type in a typesafe " "manner. Use :data:`Any` to indicate that a value is dynamically typed." @@ -706,11 +706,11 @@ msgstr "" "使用 :class:`object` ,將指出在型別安全 (typesafe) 的習慣之下一個值可以為任意" "型別。使用 :data:`Any`,將指出這個值是個動態型別。" -#: ../../library/typing.rst:709 +#: ../../library/typing.rst:711 msgid "Nominal vs structural subtyping" msgstr "標稱 (nominal) 子型別 vs 結構子型別" -#: ../../library/typing.rst:711 +#: ../../library/typing.rst:713 msgid "" "Initially :pep:`484` defined the Python static type system as using *nominal " "subtyping*. This means that a class ``A`` is allowed where a class ``B`` is " @@ -719,7 +719,7 @@ msgstr "" "最初 :pep:`484` 定義 Python 靜態型別系統使用\\ *標稱子型別*。這意味著只有 " "``A`` 為 ``B`` 的子類別時,``A`` 才被允許使用在預期是類別 ``B`` 出現的地方。" -#: ../../library/typing.rst:715 +#: ../../library/typing.rst:717 msgid "" "This requirement previously also applied to abstract base classes, such as :" "class:`~collections.abc.Iterable`. The problem with this approach is that a " @@ -732,7 +732,7 @@ msgstr "" "格,也不像一個常見的慣用動態型別 Python 程式碼。舉例來說,下列程式碼符合 :" "pep:`484`: ::" -#: ../../library/typing.rst:728 +#: ../../library/typing.rst:730 msgid "" ":pep:`544` allows to solve this problem by allowing users to write the above " "code without explicit base classes in the class definition, allowing " @@ -745,7 +745,7 @@ msgstr "" "``Iterable[int]`` 兩者的子型別。這就是眾所周知的\\ *結構子型別*\\ (或是靜態" "鴨子型別): ::" -#: ../../library/typing.rst:744 +#: ../../library/typing.rst:746 msgid "" "Moreover, by subclassing a special class :class:`Protocol`, a user can " "define new custom protocols to fully enjoy structural subtyping (see " @@ -754,43 +754,43 @@ msgstr "" "而且,基於一個特別的型別 :class:`Protocol` 建立子型別時,使用者可以定義新的" "協定並充份發揮結構子型別的優勢(請見下方範例)。" -#: ../../library/typing.rst:749 +#: ../../library/typing.rst:751 msgid "Module contents" msgstr "模組內容" -#: ../../library/typing.rst:751 +#: ../../library/typing.rst:753 msgid "" "The ``typing`` module defines the following classes, functions and " "decorators." msgstr "模組 ``typing`` 定義了下列的類別、函式以及裝飾器。" -#: ../../library/typing.rst:754 +#: ../../library/typing.rst:756 msgid "Special typing primitives" msgstr "特別型別原語 (primitive)" -#: ../../library/typing.rst:757 +#: ../../library/typing.rst:759 msgid "Special types" msgstr "特別型別" -#: ../../library/typing.rst:759 +#: ../../library/typing.rst:761 msgid "" "These can be used as types in annotations. They do not support subscription " "using ``[]``." msgstr "這些可以在註釋中做為型別。他們並不支援 ``[]`` 的下標使用。" -#: ../../library/typing.rst:764 +#: ../../library/typing.rst:766 msgid "Special type indicating an unconstrained type." msgstr "特別型別,指出一個不受約束 (unconstrained) 的型別。" -#: ../../library/typing.rst:766 +#: ../../library/typing.rst:768 msgid "Every type is compatible with :data:`Any`." msgstr "所有型別皆與 :data:`Any` 相容。" -#: ../../library/typing.rst:767 +#: ../../library/typing.rst:769 msgid ":data:`Any` is compatible with every type." msgstr ":data:`Any` 相容於所有型別。" -#: ../../library/typing.rst:769 +#: ../../library/typing.rst:771 msgid "" ":data:`Any` can now be used as a base class. This can be useful for avoiding " "type checker errors with classes that can duck type anywhere or are highly " @@ -799,15 +799,15 @@ msgstr "" ":data:`Any` 可以作為一個基礎類別。這對於在任何地方使用鴨子型別或是高度動態的" "型別,避免型別檢查器的錯誤是非常有用的。" -#: ../../library/typing.rst:776 +#: ../../library/typing.rst:778 msgid "A :ref:`constrained type variable `." msgstr "一個\\ :ref:`不受約束的型別變數 `。" -#: ../../library/typing.rst:778 +#: ../../library/typing.rst:780 msgid "Definition::" msgstr "定義: ::" -#: ../../library/typing.rst:782 +#: ../../library/typing.rst:784 msgid "" "``AnyStr`` is meant to be used for functions that may accept :class:`str` " "or :class:`bytes` arguments but cannot allow the two to mix." @@ -815,14 +815,14 @@ msgstr "" "``AnyStr`` 是對於函式有用的,他可以接受 :class:`str` 或 :class:`bytes` 引數但" "不可以將此兩種混合。" -#: ../../library/typing.rst:785 ../../library/typing.rst:893 -#: ../../library/typing.rst:950 ../../library/typing.rst:1116 -#: ../../library/typing.rst:1173 ../../library/typing.rst:1382 -#: ../../library/typing.rst:2769 +#: ../../library/typing.rst:787 ../../library/typing.rst:895 +#: ../../library/typing.rst:952 ../../library/typing.rst:1118 +#: ../../library/typing.rst:1175 ../../library/typing.rst:1384 +#: ../../library/typing.rst:2771 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:794 +#: ../../library/typing.rst:796 msgid "" "Note that, despite its name, ``AnyStr`` has nothing to do with the :class:" "`Any` type, nor does it mean \"any string\". In particular, ``AnyStr`` and " @@ -832,11 +832,11 @@ msgstr "" "何字串」的意思。尤其,``AnyStr`` 與 ``str | bytes`` 兩者不同且具有不同的使用" "情境: ::" -#: ../../library/typing.rst:811 +#: ../../library/typing.rst:813 msgid "Special type that includes only literal strings." msgstr "特別型別,只包含文本字串。" -#: ../../library/typing.rst:813 +#: ../../library/typing.rst:815 msgid "" "Any string literal is compatible with ``LiteralString``, as is another " "``LiteralString``. However, an object typed as just ``str`` is not. A string " @@ -847,11 +847,11 @@ msgstr "" "此。然而,若是一個型別僅為 ``str`` 的物件則不相容。一個字串若是透過組合多個 " "``LiteralString`` 型別的物件建立,則此字串也可以視為 ``LiteralString``。" -#: ../../library/typing.rst:819 ../../library/typing.rst:1897 +#: ../../library/typing.rst:821 ../../library/typing.rst:1899 msgid "Example:" msgstr "舉例來說: ::" -#: ../../library/typing.rst:835 +#: ../../library/typing.rst:837 msgid "" "``LiteralString`` is useful for sensitive APIs where arbitrary user-" "generated strings could generate problems. For example, the two cases above " @@ -862,11 +862,11 @@ msgstr "" "會產生問題。舉例來說,上面兩個案例中產生的型別檢查器錯誤是脆弱的且容易受到 " "SQL 注入攻擊。" -#: ../../library/typing.rst:840 +#: ../../library/typing.rst:842 msgid "See :pep:`675` for more details." msgstr "更多細節請見 :pep:`675`。" -#: ../../library/typing.rst:847 +#: ../../library/typing.rst:849 msgid "" ":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." @@ -874,13 +874,13 @@ msgstr "" ":data:`!Never` 和 :data:`!NoReturn` 表示\\ `底部型別 (bottom type) `_,為一個沒有任何成員的型別。" -#: ../../library/typing.rst:851 +#: ../../library/typing.rst:853 msgid "" "They can be used to indicate that a function never returns, such as :func:" "`sys.exit`::" msgstr "它們可以被用來代表一個不會回傳的函式,像是 :func:`sys.exit`: ::" -#: ../../library/typing.rst:859 +#: ../../library/typing.rst:861 msgid "" "Or to define a function that should never be called, as there are no valid " "arguments, such as :func:`assert_never`::" @@ -888,7 +888,7 @@ msgstr "" "或被用來定義一個不應被呼叫的函式,因為不會有有效的引數,、像是 :func:" "`assert_never`: ::" -#: ../../library/typing.rst:878 +#: ../../library/typing.rst:880 msgid "" ":data:`!Never` and :data:`!NoReturn` have the same meaning in the type " "system and static type checkers treat both equivalently." @@ -896,25 +896,25 @@ msgstr "" ":data:`!Never` 以及 :data:`!NoReturn` 在型別系統中具有相同的意義且靜態型別檢" "查器會將兩者視為相等。" -#: ../../library/typing.rst:883 +#: ../../library/typing.rst:885 msgid "Added :data:`NoReturn`." msgstr "新增 :data:`NoReturn`。" -#: ../../library/typing.rst:887 +#: ../../library/typing.rst:889 msgid "Added :data:`Never`." msgstr "新增 :data:`Never`。" -#: ../../library/typing.rst:891 +#: ../../library/typing.rst:893 msgid "Special type to represent the current enclosed class." msgstr "特別型別,用來表示當前類別之內 (enclosed class)。" -#: ../../library/typing.rst:907 +#: ../../library/typing.rst:909 msgid "" "This annotation is semantically equivalent to the following, albeit in a " "more succinct fashion::" msgstr "這個註釋在語意上相等於下列內容,且形式更為簡潔: ::" -#: ../../library/typing.rst:919 +#: ../../library/typing.rst:921 msgid "" "In general, if something returns ``self``, as in the above examples, you " "should use ``Self`` as the return annotation. If ``Foo.return_self`` was " @@ -927,11 +927,11 @@ msgstr "" "器應該推論這個從 ``SubclassOfFoo.return_self`` 回傳的物件為 ``Foo`` 型別,而" "並非回傳 ``SubclassOfFoo`` 型別。" -#: ../../library/typing.rst:925 +#: ../../library/typing.rst:927 msgid "Other common use cases include:" msgstr "其他常見的使用案例包含: ::" -#: ../../library/typing.rst:927 +#: ../../library/typing.rst:929 msgid "" ":class:`classmethod`\\s that are used as alternative constructors and return " "instances of the ``cls`` parameter." @@ -939,11 +939,11 @@ msgstr "" ":class:`classmethod` 被用來作為替代的建構函式 (constructor) 並回傳 ``cls`` 參" "數的實例。" -#: ../../library/typing.rst:929 +#: ../../library/typing.rst:931 msgid "Annotating an :meth:`~object.__enter__` method which returns self." msgstr "註釋一個回傳自己的 :meth:`~object.__enter__` 方法。" -#: ../../library/typing.rst:931 +#: ../../library/typing.rst:933 msgid "" "You should not use ``Self`` as the return annotation if the method is not " "guaranteed to return an instance of a subclass when the class is subclassed::" @@ -951,17 +951,17 @@ msgstr "" "當類別被子類別化時,若方法不保證回傳一個子類別的實例,你不應該使用 ``Self`` " "作為回傳註釋: ::" -#: ../../library/typing.rst:942 +#: ../../library/typing.rst:944 msgid "See :pep:`673` for more details." msgstr "更多細節請見 :pep:`673`。" -#: ../../library/typing.rst:948 +#: ../../library/typing.rst:950 msgid "" "Special annotation for explicitly declaring a :ref:`type alias `." msgstr "做為明確宣告一個\\ :ref:`型別別名 ` 的特別註釋。" -#: ../../library/typing.rst:956 +#: ../../library/typing.rst:958 msgid "" "``TypeAlias`` is particularly useful on older Python versions for annotating " "aliases that make use of forward references, as it can be hard for type " @@ -971,11 +971,11 @@ msgstr "" "(forward reference),因為對於型別檢查器來說,分辨這些別名與一般的變數賦值相當" "困難: ::" -#: ../../library/typing.rst:976 +#: ../../library/typing.rst:978 msgid "See :pep:`613` for more details." msgstr "更多細節請見 :pep:`613`。" -#: ../../library/typing.rst:980 +#: ../../library/typing.rst:982 msgid "" ":data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement, " "which creates instances of :class:`TypeAliasType` and which natively " @@ -991,11 +991,11 @@ msgstr "" "是不同的,且後者不是前者的型別。現在還沒有移除 :data:`TypeAlias` 的計畫,但鼓" "勵使用者們遷移 (migrate) 至 :keyword:`type` 陳述式。" -#: ../../library/typing.rst:991 +#: ../../library/typing.rst:993 msgid "Special forms" msgstr "特別型式" -#: ../../library/typing.rst:993 +#: ../../library/typing.rst:995 msgid "" "These can be used as types in annotations. They all support subscription " "using ``[]``, but each has a unique syntax." @@ -1003,14 +1003,14 @@ msgstr "" "這些在註釋中可以當作型別使用。他們全都支援 ``[]`` 的下標使用,但每個都具有獨" "特的語法。" -#: ../../library/typing.rst:998 +#: ../../library/typing.rst:1000 msgid "" "Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or " "Y." msgstr "" "聯集型別;``Union[X, Y]`` 與 ``X | Y`` 是相等的,且都意味著 X 或 Y 兩者其一。" -#: ../../library/typing.rst:1000 +#: ../../library/typing.rst:1002 msgid "" "To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | " "str``. Using that shorthand is recommended. Details:" @@ -1018,50 +1018,50 @@ msgstr "" "為了定義聯集,例如可以使用 ``Union[int, str]`` 或是使用簡寫 (shorthand) " "``int | str``。使用這種簡寫是非常推薦的。詳細請看: ::" -#: ../../library/typing.rst:1002 +#: ../../library/typing.rst:1004 msgid "The arguments must be types and there must be at least one." msgstr "引數必須為型別且必須有至少一個。" -#: ../../library/typing.rst:1004 +#: ../../library/typing.rst:1006 msgid "Unions of unions are flattened, e.g.::" msgstr "聯集中的聯集會是扁平化的 (flattened),舉例來說: ::" -#: ../../library/typing.rst:1008 +#: ../../library/typing.rst:1010 msgid "Unions of a single argument vanish, e.g.::" msgstr "單一引數的聯集會消失不見,舉例來說: ::" -#: ../../library/typing.rst:1012 +#: ../../library/typing.rst:1014 msgid "Redundant arguments are skipped, e.g.::" msgstr "多餘的引數會被略過,舉例來說: ::" -#: ../../library/typing.rst:1016 +#: ../../library/typing.rst:1018 msgid "When comparing unions, the argument order is ignored, e.g.::" msgstr "當比較聯集時,引數的順序會被忽略,舉例來說: ::" -#: ../../library/typing.rst:1020 +#: ../../library/typing.rst:1022 msgid "You cannot subclass or instantiate a ``Union``." msgstr "你不能建立 ``Union`` 的子類別或是實例。" -#: ../../library/typing.rst:1022 +#: ../../library/typing.rst:1024 msgid "You cannot write ``Union[X][Y]``." msgstr "你不能寫成 ``Union[X][Y]``。" -#: ../../library/typing.rst:1024 +#: ../../library/typing.rst:1026 msgid "Don't remove explicit subclasses from unions at runtime." msgstr "請勿在 runtime 中將顯性子類別從聯集中移除。" -#: ../../library/typing.rst:1027 +#: ../../library/typing.rst:1029 msgid "" "Unions can now be written as ``X | Y``. See :ref:`union type " "expressions`." msgstr "" "現在可以將聯集寫成 ``X | Y``。請見\\ :ref:`聯集型別運算式 `。" -#: ../../library/typing.rst:1033 +#: ../../library/typing.rst:1035 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "``Optional[X]`` 與 ``X | None`` 是相等的(或是 ``Union[X, None]``)。" -#: ../../library/typing.rst:1035 +#: ../../library/typing.rst:1037 msgid "" "Note that this is not the same concept as an optional argument, which is one " "that has a default. An optional argument with a default does not require " @@ -1072,7 +1072,7 @@ msgstr "" "有預設值的選擇性引數的型別註釋中不具有 ``Optional`` 限定符 (qualifier),單純" "的因為它就是選擇性的。舉例來說: ::" -#: ../../library/typing.rst:1043 +#: ../../library/typing.rst:1045 msgid "" "On the other hand, if an explicit value of ``None`` is allowed, the use of " "``Optional`` is appropriate, whether the argument is optional or not. For " @@ -1081,7 +1081,7 @@ msgstr "" "另一方面,如果一個顯性的值 ``None`` 是被允許的,不論引數是不是選擇性的," "``Optional`` 都適用。舉例來說: ::" -#: ../../library/typing.rst:1050 +#: ../../library/typing.rst:1052 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." @@ -1089,11 +1089,11 @@ msgstr "" "現在可以將 Optional 寫成 ``X | None``。請見\\ :ref:`聯集型別運算式 `。" -#: ../../library/typing.rst:1056 +#: ../../library/typing.rst:1058 msgid "Special form for annotating higher-order functions." msgstr "用於註釋高階函式的特別型式。" -#: ../../library/typing.rst:1058 +#: ../../library/typing.rst:1060 msgid "" "``Concatenate`` can be used in conjunction with :ref:`Callable ` and :class:`ParamSpec` to annotate a higher-order callable which " @@ -1111,7 +1111,7 @@ msgstr "" "效。``Concatenate`` 的最後一個參數必須為一個 :class:`ParamSpec` 或是刪節號 " "(``...``)。" -#: ../../library/typing.rst:1067 +#: ../../library/typing.rst:1069 msgid "" "For example, to annotate a decorator ``with_lock`` which provides a :class:" "`threading.Lock` to the decorated function, ``Concatenate`` can be used to " @@ -1127,32 +1127,32 @@ msgstr "" "Callable 物件。在這種情況下,:class:`ParamSpec` 指出回傳的 Callable 物件的參" "數型別會依賴傳遞的 Callable 物件的參數型別: ::" -#: ../../library/typing.rst:1103 ../../library/typing.rst:1865 +#: ../../library/typing.rst:1105 ../../library/typing.rst:1867 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" msgstr ":pep:`612` -- 參數技術規範變數" -#: ../../library/typing.rst:1105 +#: ../../library/typing.rst:1107 msgid ":class:`ParamSpec`" msgstr ":class:`ParamSpec`" -#: ../../library/typing.rst:1106 ../../library/typing.rst:1868 +#: ../../library/typing.rst:1108 ../../library/typing.rst:1870 msgid ":ref:`annotating-callables`" msgstr ":ref:`annotating-callables`" -#: ../../library/typing.rst:1110 +#: ../../library/typing.rst:1112 msgid "Special typing form to define \"literal types\"." msgstr "特殊型別格式,用於定義「文本型別 (literal type)」。" -#: ../../library/typing.rst:1112 +#: ../../library/typing.rst:1114 msgid "" "``Literal`` can be used to indicate to type checkers that the annotated " "object has a value equivalent to one of the provided literals." msgstr "" "``Literal`` 可以用於型別檢查器並指出註釋物件具有一個與提供的文本相同的值。" -#: ../../library/typing.rst:1128 +#: ../../library/typing.rst:1130 msgid "" "``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is " "allowed as type argument to ``Literal[...]``, but type checkers may impose " @@ -1162,22 +1162,22 @@ msgstr "" "``Literal[...]`` 的型別引數,但型別檢查器可能會加強限制。更多有關文本型別的詳" "細資訊請看 :pep:`586`。" -#: ../../library/typing.rst:1134 +#: ../../library/typing.rst:1136 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " "now raise a :exc:`TypeError` exception during equality comparisons if one of " "their parameters are not :term:`hashable`." msgstr "" -"``Literal``現在可以刪除重複 (de-deplicate) 的參數。``Literal`` 物件的相等性比" -"較不再依照相依性排序。``Literal`` 物件現在會在相等性比較期間,若任一個其中的" -"參數無法 :term:`hashable` 時,則會引發一個 :exc:`TypeError` 例外。" +"``Literal`` 現在可以刪除重複 (de-deplicate) 的參數。``Literal`` 物件的相等性" +"比較不再依照相依性排序。``Literal`` 物件現在會在相等性比較期間,若任一個其中" +"的參數無法 :term:`hashable` 時,則會引發一個 :exc:`TypeError` 例外。" -#: ../../library/typing.rst:1142 +#: ../../library/typing.rst:1144 msgid "Special type construct to mark class variables." msgstr "特殊型別建構,用來標記類別變數。" -#: ../../library/typing.rst:1144 +#: ../../library/typing.rst:1146 msgid "" "As introduced in :pep:`526`, a variable annotation wrapped in ClassVar " "indicates that a given attribute is intended to be used as a class variable " @@ -1187,11 +1187,11 @@ msgstr "" "定的屬性 (attribute) 意圖被當作類別變數使用,且不該被設定成該類別的實例。使用" "方法如下: ::" -#: ../../library/typing.rst:1152 +#: ../../library/typing.rst:1154 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr ":data:`ClassVar` 只接受型別請不得使用下標。" -#: ../../library/typing.rst:1154 +#: ../../library/typing.rst:1156 msgid "" ":data:`ClassVar` is not a class itself, and should not be used with :func:" "`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python " @@ -1203,11 +1203,11 @@ msgstr "" "但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方的程" "式碼為一個錯誤: ::" -#: ../../library/typing.rst:1168 +#: ../../library/typing.rst:1170 msgid "Special typing construct to indicate final names to type checkers." msgstr "特殊型別建構,用來指出最終名稱給型別檢查器。" -#: ../../library/typing.rst:1170 +#: ../../library/typing.rst:1172 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." @@ -1215,18 +1215,18 @@ msgstr "" "最終名稱不可以在任何作用域 (scope) 中重新賦值。在類別作用域中宣告的最終名稱," "不得在子類別中進行覆寫 (override)。" -#: ../../library/typing.rst:1184 ../../library/typing.rst:2785 +#: ../../library/typing.rst:1186 ../../library/typing.rst:2787 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" "這些屬性 (property) 不會在 runtime 時進行檢查。更多詳細資訊請看 :pep:`591`。" -#: ../../library/typing.rst:1191 +#: ../../library/typing.rst:1193 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是必須的。" -#: ../../library/typing.rst:1193 +#: ../../library/typing.rst:1195 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." @@ -1234,21 +1234,21 @@ msgstr "" "主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :" "pep:`655`。" -#: ../../library/typing.rst:1200 +#: ../../library/typing.rst:1202 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是可能消失的。" -#: ../../library/typing.rst:1203 +#: ../../library/typing.rst:1205 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" -#: ../../library/typing.rst:1209 +#: ../../library/typing.rst:1211 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" -#: ../../library/typing.rst:1211 +#: ../../library/typing.rst:1213 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " @@ -1256,7 +1256,7 @@ msgid "" "a :attr:`!__metadata__` attribute." msgstr "" -#: ../../library/typing.rst:1216 +#: ../../library/typing.rst:1218 msgid "" "If a library or tool encounters an annotation ``Annotated[T, x]`` and has no " "special logic for the metadata, it should ignore the metadata and simply " @@ -1265,7 +1265,7 @@ msgid "" "system." msgstr "" -#: ../../library/typing.rst:1222 +#: ../../library/typing.rst:1224 msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " @@ -1275,7 +1275,7 @@ msgid "" "for a function or class." msgstr "" -#: ../../library/typing.rst:1229 +#: ../../library/typing.rst:1231 msgid "" "The responsibility of how to interpret the metadata lies with the tool or " "library encountering an ``Annotated`` annotation. A tool or library " @@ -1283,105 +1283,105 @@ msgid "" "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -#: ../../library/typing.rst:1237 +#: ../../library/typing.rst:1239 msgid "" "Here is an example of how you might use ``Annotated`` to add metadata to " "type annotations if you were doing range analysis:" msgstr "" -#: ../../library/typing.rst:1250 +#: ../../library/typing.rst:1252 msgid "Details of the syntax:" msgstr "" -#: ../../library/typing.rst:1252 +#: ../../library/typing.rst:1254 msgid "The first argument to ``Annotated`` must be a valid type" msgstr "" -#: ../../library/typing.rst:1254 +#: ../../library/typing.rst:1256 msgid "" "Multiple metadata elements can be supplied (``Annotated`` supports variadic " "arguments)::" msgstr "" -#: ../../library/typing.rst:1263 +#: ../../library/typing.rst:1265 msgid "" "It is up to the tool consuming the annotations to decide whether the client " "is allowed to add multiple metadata elements to one annotation and how to " "merge those annotations." msgstr "" -#: ../../library/typing.rst:1267 +#: ../../library/typing.rst:1269 msgid "" "``Annotated`` must be subscripted with at least two arguments " "( ``Annotated[int]`` is not valid)" msgstr "" -#: ../../library/typing.rst:1270 +#: ../../library/typing.rst:1272 msgid "" "The order of the metadata elements is preserved and matters for equality " "checks::" msgstr "" -#: ../../library/typing.rst:1277 +#: ../../library/typing.rst:1279 msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:1284 +#: ../../library/typing.rst:1286 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: ../../library/typing.rst:1290 +#: ../../library/typing.rst:1292 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: ../../library/typing.rst:1304 +#: ../../library/typing.rst:1306 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: ../../library/typing.rst:1308 +#: ../../library/typing.rst:1310 msgid "This would be equivalent to::" msgstr "這會等價於: ::" -#: ../../library/typing.rst:1312 +#: ../../library/typing.rst:1314 msgid "" "where ``T1``, ``T2``, etc. are :class:`TypeVars `. This would be " "invalid: only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1315 +#: ../../library/typing.rst:1317 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" -#: ../../library/typing.rst:1328 +#: ../../library/typing.rst:1330 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1342 +#: ../../library/typing.rst:1344 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1343 +#: ../../library/typing.rst:1345 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1350 +#: ../../library/typing.rst:1352 msgid "Special typing construct for marking user-defined type guard functions." msgstr "" -#: ../../library/typing.rst:1352 +#: ../../library/typing.rst:1354 msgid "" "``TypeGuard`` can be used to annotate the return type of a user-defined type " "guard function. ``TypeGuard`` only accepts a single type argument. At " "runtime, functions marked this way should return a boolean." msgstr "" -#: ../../library/typing.rst:1356 +#: ../../library/typing.rst:1358 msgid "" "``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -1390,44 +1390,44 @@ msgid "" "conditional expression here is sometimes referred to as a \"type guard\"::" msgstr "" -#: ../../library/typing.rst:1371 +#: ../../library/typing.rst:1373 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " "type guard. Such a function should use ``TypeGuard[...]`` as its return " "type to alert static type checkers to this intention." msgstr "" -#: ../../library/typing.rst:1375 +#: ../../library/typing.rst:1377 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1378 +#: ../../library/typing.rst:1380 msgid "The return value is a boolean." msgstr "" -#: ../../library/typing.rst:1379 +#: ../../library/typing.rst:1381 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1396 +#: ../../library/typing.rst:1398 msgid "" "If ``is_str_list`` is a class or instance method, then the type in " -"``TypeGuard`` maps to the type of the second parameter after ``cls`` or " -"``self``." +"``TypeGuard`` maps to the type of the second parameter (after ``cls`` or " +"``self``)." msgstr "" -#: ../../library/typing.rst:1400 +#: ../../library/typing.rst:1402 msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeGuard[TypeB]: ...``, means " "that if ``foo(arg)`` returns ``True``, then ``arg`` narrows from ``TypeA`` " "to ``TypeB``." msgstr "" -#: ../../library/typing.rst:1406 +#: ../../library/typing.rst:1408 msgid "" "``TypeB`` need not be a narrower form of ``TypeA`` -- it can even be a wider " "form. The main reason is to allow for things like narrowing ``list[object]`` " @@ -1436,24 +1436,24 @@ msgid "" "guards is left to the user." msgstr "" -#: ../../library/typing.rst:1412 +#: ../../library/typing.rst:1414 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1419 +#: ../../library/typing.rst:1421 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1421 +#: ../../library/typing.rst:1423 msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1430 +#: ../../library/typing.rst:1432 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -1461,29 +1461,29 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1444 +#: ../../library/typing.rst:1446 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: ../../library/typing.rst:1457 +#: ../../library/typing.rst:1459 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: ../../library/typing.rst:1462 +#: ../../library/typing.rst:1464 msgid "Building generic types and type aliases" msgstr "" -#: ../../library/typing.rst:1464 +#: ../../library/typing.rst:1466 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types and " "type aliases." msgstr "" -#: ../../library/typing.rst:1468 +#: ../../library/typing.rst:1470 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -1491,62 +1491,62 @@ msgid "" "syntax, as documented below." msgstr "" -#: ../../library/typing.rst:1475 +#: ../../library/typing.rst:1477 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1477 +#: ../../library/typing.rst:1479 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: ../../library/typing.rst:1485 +#: ../../library/typing.rst:1487 msgid "" "Such a class implicitly inherits from ``Generic``. The runtime semantics of " "this syntax are discussed in the :ref:`Language Reference `." msgstr "" -#: ../../library/typing.rst:1489 +#: ../../library/typing.rst:1491 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1497 +#: ../../library/typing.rst:1499 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: ../../library/typing.rst:1500 +#: ../../library/typing.rst:1502 msgid "" "For backwards compatibility, generic classes can also be declared by " "explicitly inheriting from ``Generic``. In this case, the type parameters " "must be declared separately::" msgstr "" -#: ../../library/typing.rst:1517 +#: ../../library/typing.rst:1519 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1519 +#: ../../library/typing.rst:1521 msgid "" "The preferred way to construct a type variable is via the dedicated syntax " "for :ref:`generic functions `, :ref:`generic classes " "`, and :ref:`generic type aliases `::" msgstr "" -#: ../../library/typing.rst:1527 +#: ../../library/typing.rst:1529 msgid "" "This syntax can also be used to create bound and constrained type variables::" msgstr "" -#: ../../library/typing.rst:1537 +#: ../../library/typing.rst:1539 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: ../../library/typing.rst:1543 +#: ../../library/typing.rst:1545 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -1554,13 +1554,13 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1564 +#: ../../library/typing.rst:1566 msgid "" "Note that type variables can be *bound*, *constrained*, or neither, but " "cannot be both bound *and* constrained." msgstr "" -#: ../../library/typing.rst:1567 +#: ../../library/typing.rst:1569 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -1570,92 +1570,92 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:1575 +#: ../../library/typing.rst:1577 msgid "" "Bound type variables and constrained type variables have different semantics " "in several important ways. Using a *bound* type variable means that the " "``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1590 +#: ../../library/typing.rst:1592 msgid "" "Type variables can be bound to concrete types, abstract types (ABCs or " "protocols), and even unions of types::" msgstr "" -#: ../../library/typing.rst:1602 +#: ../../library/typing.rst:1604 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1613 +#: ../../library/typing.rst:1615 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "" -#: ../../library/typing.rst:1617 +#: ../../library/typing.rst:1619 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1621 +#: ../../library/typing.rst:1623 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: ../../library/typing.rst:1625 +#: ../../library/typing.rst:1627 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: ../../library/typing.rst:1629 +#: ../../library/typing.rst:1631 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: ../../library/typing.rst:1635 +#: ../../library/typing.rst:1637 msgid "The bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1639 +#: ../../library/typing.rst:1641 msgid "" "For type variables created through :ref:`type parameter syntax `, the bound is evaluated only when the attribute is accessed, not " "when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1645 +#: ../../library/typing.rst:1647 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1649 +#: ../../library/typing.rst:1651 msgid "" "For type variables created through :ref:`type parameter syntax `, the constraints are evaluated only when the attribute is accessed, " "not when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1655 +#: ../../library/typing.rst:1657 msgid "" "Type variables can now be declared using the :ref:`type parameter ` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" -#: ../../library/typing.rst:1663 +#: ../../library/typing.rst:1665 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1666 +#: ../../library/typing.rst:1668 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: ../../library/typing.rst:1672 +#: ../../library/typing.rst:1674 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: ../../library/typing.rst:1680 +#: ../../library/typing.rst:1682 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -1663,7 +1663,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1702 +#: ../../library/typing.rst:1704 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -1673,36 +1673,36 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1710 +#: ../../library/typing.rst:1712 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1717 +#: ../../library/typing.rst:1719 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: ../../library/typing.rst:1725 +#: ../../library/typing.rst:1727 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:1741 +#: ../../library/typing.rst:1743 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: ../../library/typing.rst:1748 +#: ../../library/typing.rst:1750 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:1758 +#: ../../library/typing.rst:1760 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -1711,39 +1711,39 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:1765 +#: ../../library/typing.rst:1767 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:1769 +#: ../../library/typing.rst:1771 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:1775 +#: ../../library/typing.rst:1777 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:1780 +#: ../../library/typing.rst:1782 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: ../../library/typing.rst:1783 +#: ../../library/typing.rst:1785 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: ../../library/typing.rst:1788 +#: ../../library/typing.rst:1790 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: ../../library/typing.rst:1793 +#: ../../library/typing.rst:1795 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -1753,7 +1753,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:1800 +#: ../../library/typing.rst:1802 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -1761,27 +1761,27 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:1820 +#: ../../library/typing.rst:1822 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this " "causes two problems:" msgstr "" -#: ../../library/typing.rst:1824 +#: ../../library/typing.rst:1826 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:1826 +#: ../../library/typing.rst:1828 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:1833 +#: ../../library/typing.rst:1835 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -1794,11 +1794,11 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:1845 +#: ../../library/typing.rst:1847 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:1847 +#: ../../library/typing.rst:1849 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -1807,23 +1807,23 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:1857 +#: ../../library/typing.rst:1859 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:1861 +#: ../../library/typing.rst:1863 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:1867 +#: ../../library/typing.rst:1869 msgid ":data:`Concatenate`" msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:1873 +#: ../../library/typing.rst:1875 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -1831,72 +1831,72 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:1878 +#: ../../library/typing.rst:1880 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:1895 +#: ../../library/typing.rst:1897 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: ../../library/typing.rst:1909 +#: ../../library/typing.rst:1911 msgid "The name of the type alias:" msgstr "" -#: ../../library/typing.rst:1919 +#: ../../library/typing.rst:1921 msgid "The module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:1927 +#: ../../library/typing.rst:1929 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: ../../library/typing.rst:1941 +#: ../../library/typing.rst:1943 msgid "" "The type alias's value. This is :ref:`lazily evaluated `, " "so names used in the definition of the alias are not resolved until the " "``__value__`` attribute is accessed:" msgstr "" -#: ../../library/typing.rst:1959 +#: ../../library/typing.rst:1961 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:1961 +#: ../../library/typing.rst:1963 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: ../../library/typing.rst:1967 +#: ../../library/typing.rst:1969 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:1969 ../../library/typing.rst:2046 -#: ../../library/typing.rst:3015 +#: ../../library/typing.rst:1971 ../../library/typing.rst:2048 +#: ../../library/typing.rst:3017 msgid "Usage::" msgstr "" -#: ../../library/typing.rst:1975 +#: ../../library/typing.rst:1977 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../library/typing.rst:1979 +#: ../../library/typing.rst:1981 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:1988 +#: ../../library/typing.rst:1990 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:1990 +#: ../../library/typing.rst:1992 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -1905,83 +1905,83 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:1996 +#: ../../library/typing.rst:1998 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:2006 +#: ../../library/typing.rst:2008 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:2012 +#: ../../library/typing.rst:2014 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:2022 +#: ../../library/typing.rst:2024 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:2025 +#: ../../library/typing.rst:2027 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:2028 +#: ../../library/typing.rst:2030 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:2032 +#: ../../library/typing.rst:2034 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:2036 +#: ../../library/typing.rst:2038 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:2041 +#: ../../library/typing.rst:2043 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:2043 +#: ../../library/typing.rst:2045 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:2053 +#: ../../library/typing.rst:2055 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2057 +#: ../../library/typing.rst:2059 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:2061 +#: ../../library/typing.rst:2063 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:2065 +#: ../../library/typing.rst:2067 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:2070 +#: ../../library/typing.rst:2072 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:2072 +#: ../../library/typing.rst:2074 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:2078 +#: ../../library/typing.rst:2080 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:2090 +#: ../../library/typing.rst:2092 msgid "" "See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " @@ -1989,21 +1989,21 @@ msgid "" "signatures." msgstr "" -#: ../../library/typing.rst:2095 +#: ../../library/typing.rst:2097 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:2101 +#: ../../library/typing.rst:2103 msgid "" "In code that needs to be compatible with Python 3.11 or older, generic " "Protocols can be written as follows::" msgstr "" -#: ../../library/typing.rst:2114 +#: ../../library/typing.rst:2116 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:2116 +#: ../../library/typing.rst:2118 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This raises :exc:`TypeError` when applied to a non-protocol class. This " @@ -2012,7 +2012,7 @@ msgid "" "Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2136 +#: ../../library/typing.rst:2138 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " "methods or attributes, not their type signatures or types. For example, :" @@ -2023,7 +2023,7 @@ msgid "" "(instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2147 +#: ../../library/typing.rst:2149 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -2031,7 +2031,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:2155 +#: ../../library/typing.rst:2157 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -2041,7 +2041,7 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: ../../library/typing.rst:2164 +#: ../../library/typing.rst:2166 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " @@ -2050,13 +2050,13 @@ msgid "" "`\"What's new in Python 3.12\" ` for more details." msgstr "" -#: ../../library/typing.rst:2175 +#: ../../library/typing.rst:2177 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:2178 +#: ../../library/typing.rst:2180 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -2064,53 +2064,53 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:2194 +#: ../../library/typing.rst:2196 msgid "" "To allow using this feature with older versions of Python that do not " "support :pep:`526`, ``TypedDict`` supports two additional equivalent " "syntactic forms:" msgstr "" -#: ../../library/typing.rst:2198 +#: ../../library/typing.rst:2200 msgid "Using a literal :class:`dict` as the second argument::" msgstr "" -#: ../../library/typing.rst:2202 +#: ../../library/typing.rst:2204 msgid "Using keyword arguments::" msgstr "" -#: ../../library/typing.rst:2209 +#: ../../library/typing.rst:2211 msgid "" "The keyword-argument syntax is deprecated in 3.11 and will be removed in " "3.13. It may also be unsupported by static type checkers." msgstr "" -#: ../../library/typing.rst:2210 +#: ../../library/typing.rst:2212 msgid "" "The functional syntax should also be used when any of the keys are not " "valid :ref:`identifiers `, for example because they are " "keywords or contain hyphens. Example::" msgstr "" -#: ../../library/typing.rst:2222 +#: ../../library/typing.rst:2224 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: ../../library/typing.rst:2233 +#: ../../library/typing.rst:2235 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2236 +#: ../../library/typing.rst:2238 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2246 +#: ../../library/typing.rst:2248 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -2118,53 +2118,53 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2251 +#: ../../library/typing.rst:2253 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2266 +#: ../../library/typing.rst:2268 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:2273 +#: ../../library/typing.rst:2275 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2281 +#: ../../library/typing.rst:2283 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2296 +#: ../../library/typing.rst:2298 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: ../../library/typing.rst:2302 +#: ../../library/typing.rst:2304 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: ../../library/typing.rst:2313 +#: ../../library/typing.rst:2315 msgid "" "A ``TypedDict`` can be introspected via annotations dicts (see :ref:" "`annotations-howto` for more information on annotations best practices), :" "attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2319 +#: ../../library/typing.rst:2321 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2335 +#: ../../library/typing.rst:2337 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -2175,21 +2175,21 @@ msgid "" "introspection." msgstr "" -#: ../../library/typing.rst:2348 +#: ../../library/typing.rst:2350 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2351 +#: ../../library/typing.rst:2353 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: ../../library/typing.rst:2354 +#: ../../library/typing.rst:2356 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -2198,7 +2198,7 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2379 +#: ../../library/typing.rst:2381 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -2207,130 +2207,130 @@ msgid "" "attributes may be incorrect." msgstr "" -#: ../../library/typing.rst:2385 +#: ../../library/typing.rst:2387 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:2389 +#: ../../library/typing.rst:2391 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2393 +#: ../../library/typing.rst:2395 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2397 +#: ../../library/typing.rst:2399 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2399 +#: ../../library/typing.rst:2401 msgid "" "The following protocols are provided by the typing module. All are decorated " "with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2404 +#: ../../library/typing.rst:2406 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2409 +#: ../../library/typing.rst:2411 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2413 +#: ../../library/typing.rst:2415 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2417 +#: ../../library/typing.rst:2419 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2421 +#: ../../library/typing.rst:2423 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2427 +#: ../../library/typing.rst:2429 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2431 +#: ../../library/typing.rst:2433 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2435 +#: ../../library/typing.rst:2437 msgid "ABCs for working with IO" msgstr "" -#: ../../library/typing.rst:2441 +#: ../../library/typing.rst:2443 msgid "" "Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " "by :func:`open`." msgstr "" -#: ../../library/typing.rst:2447 +#: ../../library/typing.rst:2449 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2451 +#: ../../library/typing.rst:2453 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2453 +#: ../../library/typing.rst:2455 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2460 +#: ../../library/typing.rst:2462 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2462 +#: ../../library/typing.rst:2464 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: ../../library/typing.rst:2465 +#: ../../library/typing.rst:2467 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" -#: ../../library/typing.rst:2472 +#: ../../library/typing.rst:2474 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: ../../library/typing.rst:2486 +#: ../../library/typing.rst:2488 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2488 +#: ../../library/typing.rst:2490 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:2499 +#: ../../library/typing.rst:2501 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: ../../library/typing.rst:2504 +#: ../../library/typing.rst:2506 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -2340,47 +2340,47 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2512 +#: ../../library/typing.rst:2514 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2515 +#: ../../library/typing.rst:2517 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about " "exhaustiveness checking with static typing." msgstr "" -#: ../../library/typing.rst:2523 +#: ../../library/typing.rst:2525 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: ../../library/typing.rst:2525 +#: ../../library/typing.rst:2527 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2531 +#: ../../library/typing.rst:2533 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2534 +#: ../../library/typing.rst:2536 msgid "" "At runtime, this function prints the runtime type of its argument to :data:" "`sys.stderr` and returns the argument unchanged (allowing the call to be " "used within an expression)::" msgstr "" -#: ../../library/typing.rst:2541 +#: ../../library/typing.rst:2543 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" -#: ../../library/typing.rst:2544 +#: ../../library/typing.rst:2546 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -2388,13 +2388,13 @@ msgid "" "clearly." msgstr "" -#: ../../library/typing.rst:2555 +#: ../../library/typing.rst:2557 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: ../../library/typing.rst:2558 +#: ../../library/typing.rst:2560 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -2403,19 +2403,19 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:2565 +#: ../../library/typing.rst:2567 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:2579 +#: ../../library/typing.rst:2581 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:2588 +#: ../../library/typing.rst:2590 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:2599 +#: ../../library/typing.rst:2601 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " "similarly to classes created with :func:`@dataclasses.dataclass `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:2739 +#: ../../library/typing.rst:2741 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -2633,32 +2633,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:2746 +#: ../../library/typing.rst:2748 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:2754 +#: ../../library/typing.rst:2756 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:2756 +#: ../../library/typing.rst:2758 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:2763 +#: ../../library/typing.rst:2765 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:2765 +#: ../../library/typing.rst:2767 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: ../../library/typing.rst:2790 +#: ../../library/typing.rst:2792 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -2668,11 +2668,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:2801 +#: ../../library/typing.rst:2803 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:2803 +#: ../../library/typing.rst:2805 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -2680,38 +2680,38 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:2809 +#: ../../library/typing.rst:2811 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:2813 +#: ../../library/typing.rst:2815 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:2815 +#: ../../library/typing.rst:2817 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:2821 +#: ../../library/typing.rst:2823 msgid "" "Decorator to indicate that a method in a subclass is intended to override a " "method or attribute in a superclass." msgstr "" -#: ../../library/typing.rst:2824 +#: ../../library/typing.rst:2826 msgid "" "Type checkers should emit an error if a method decorated with ``@override`` " "does not, in fact, override anything. This helps prevent bugs that may occur " "when a base class is changed without an equivalent change to a child class." msgstr "" -#: ../../library/typing.rst:2846 +#: ../../library/typing.rst:2848 msgid "There is no runtime checking of this property." msgstr "" -#: ../../library/typing.rst:2848 +#: ../../library/typing.rst:2850 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -2721,44 +2721,44 @@ msgid "" "without raising an exception." msgstr "" -#: ../../library/typing.rst:2855 +#: ../../library/typing.rst:2857 msgid "See :pep:`698` for more details." msgstr "更多細節請見 :pep:`698`。" -#: ../../library/typing.rst:2862 +#: ../../library/typing.rst:2864 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:2864 +#: ../../library/typing.rst:2866 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:2875 +#: ../../library/typing.rst:2877 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:2879 +#: ../../library/typing.rst:2881 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:2883 +#: ../../library/typing.rst:2885 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:2886 +#: ../../library/typing.rst:2888 msgid "" "This is often the same as ``obj.__annotations__``, but this function makes " "the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:2889 +#: ../../library/typing.rst:2891 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -2767,17 +2767,17 @@ msgid "" "inferred from *obj*." msgstr "" -#: ../../library/typing.rst:2894 +#: ../../library/typing.rst:2896 msgid "``None`` is replaced with :class:`types.NoneType`." msgstr "" -#: ../../library/typing.rst:2895 +#: ../../library/typing.rst:2897 msgid "" "If :func:`@no_type_check ` has been applied to *obj*, an " "empty dictionary is returned." msgstr "" -#: ../../library/typing.rst:2897 +#: ../../library/typing.rst:2899 msgid "" "If *obj* is a class ``C``, the function returns a dictionary that merges " "annotations from ``C``'s base classes with those on ``C`` directly. This is " @@ -2787,20 +2787,20 @@ msgid "" "annotations on classes appearing later in the method resolution order." msgstr "" -#: ../../library/typing.rst:2903 +#: ../../library/typing.rst:2905 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]`` " "with ``T``, unless *include_extras* is set to ``True`` (see :class:" "`Annotated` for more information)." msgstr "" -#: ../../library/typing.rst:2907 +#: ../../library/typing.rst:2909 msgid "" "See also :func:`inspect.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:2912 +#: ../../library/typing.rst:2914 msgid "" "If any forward references in the annotations of *obj* are not resolvable or " "are not valid Python code, this function will raise an exception such as :" @@ -2809,7 +2809,7 @@ msgid "" "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:2918 +#: ../../library/typing.rst:2920 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." @@ -2817,20 +2817,20 @@ msgstr "" "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" "`Annotated` 的文件。" -#: ../../library/typing.rst:2922 +#: ../../library/typing.rst:2924 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:2929 +#: ../../library/typing.rst:2931 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:2932 +#: ../../library/typing.rst:2934 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " "it will be normalized to the original class. If ``X`` is an instance of :" @@ -2838,17 +2838,17 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:2938 ../../library/typing.rst:2961 +#: ../../library/typing.rst:2940 ../../library/typing.rst:2963 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:2953 +#: ../../library/typing.rst:2955 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:2956 +#: ../../library/typing.rst:2958 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -2856,40 +2856,40 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:2973 +#: ../../library/typing.rst:2975 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:2994 +#: ../../library/typing.rst:2996 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:2996 +#: ../../library/typing.rst:2998 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3001 +#: ../../library/typing.rst:3003 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:3008 +#: ../../library/typing.rst:3010 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3012 +#: ../../library/typing.rst:3014 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3023 +#: ../../library/typing.rst:3025 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -2897,7 +2897,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:3030 +#: ../../library/typing.rst:3032 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " @@ -2905,11 +2905,11 @@ msgid "" "annotation (see :pep:`563`)." msgstr "" -#: ../../library/typing.rst:3042 +#: ../../library/typing.rst:3044 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3044 +#: ../../library/typing.rst:3046 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the typing module in " @@ -2918,7 +2918,7 @@ msgid "" "existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3051 +#: ../../library/typing.rst:3053 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " @@ -2926,7 +2926,7 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3056 +#: ../../library/typing.rst:3058 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " @@ -2934,188 +2934,188 @@ msgid "" "typing module without deprecation warnings until at least Python 3.14." msgstr "" -#: ../../library/typing.rst:3061 +#: ../../library/typing.rst:3063 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" -#: ../../library/typing.rst:3067 +#: ../../library/typing.rst:3069 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3071 +#: ../../library/typing.rst:3073 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3073 +#: ../../library/typing.rst:3075 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`Mapping` rather than to use :class:`dict` " "or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:3077 ../../library/typing.rst:3316 +#: ../../library/typing.rst:3079 ../../library/typing.rst:3318 msgid "This type can be used as follows::" msgstr "" -#: ../../library/typing.rst:3082 +#: ../../library/typing.rst:3084 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3088 +#: ../../library/typing.rst:3090 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3090 +#: ../../library/typing.rst:3092 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`Sequence` or :class:`Iterable` rather than " "to use :class:`list` or :class:`!typing.List`." msgstr "" -#: ../../library/typing.rst:3094 +#: ../../library/typing.rst:3096 msgid "This type may be used as follows::" msgstr "" -#: ../../library/typing.rst:3102 +#: ../../library/typing.rst:3104 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3108 +#: ../../library/typing.rst:3110 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3110 +#: ../../library/typing.rst:3112 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`AbstractSet` rather than to use :class:`set` " "or :class:`!typing.Set`." msgstr "" -#: ../../library/typing.rst:3114 +#: ../../library/typing.rst:3116 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3120 +#: ../../library/typing.rst:3122 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3122 +#: ../../library/typing.rst:3124 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3129 +#: ../../library/typing.rst:3131 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3131 +#: ../../library/typing.rst:3133 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3134 +#: ../../library/typing.rst:3136 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3140 +#: ../../library/typing.rst:3142 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3142 +#: ../../library/typing.rst:3144 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3147 +#: ../../library/typing.rst:3149 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3154 +#: ../../library/typing.rst:3156 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3158 +#: ../../library/typing.rst:3160 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3162 +#: ../../library/typing.rst:3164 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3168 +#: ../../library/typing.rst:3170 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3172 +#: ../../library/typing.rst:3174 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3178 +#: ../../library/typing.rst:3180 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3182 +#: ../../library/typing.rst:3184 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3188 +#: ../../library/typing.rst:3190 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3192 +#: ../../library/typing.rst:3194 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3198 +#: ../../library/typing.rst:3200 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3202 +#: ../../library/typing.rst:3204 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3209 +#: ../../library/typing.rst:3211 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3214 +#: ../../library/typing.rst:3216 msgid "" "The ``typing.io`` namespace is deprecated and will be removed. These types " "should be directly imported from ``typing`` instead." msgstr "" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3220 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3221 +#: ../../library/typing.rst:3223 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -3123,391 +3123,391 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3229 +#: ../../library/typing.rst:3231 msgid "" "The ``typing.re`` namespace is deprecated and will be removed. These types " "should be directly imported from ``typing`` instead." msgstr "" -#: ../../library/typing.rst:3230 +#: ../../library/typing.rst:3232 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3236 +#: ../../library/typing.rst:3238 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3238 +#: ../../library/typing.rst:3240 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:3242 +#: ../../library/typing.rst:3244 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:3250 +#: ../../library/typing.rst:3252 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:3260 +#: ../../library/typing.rst:3262 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3264 +#: ../../library/typing.rst:3266 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3266 +#: ../../library/typing.rst:3268 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3272 +#: ../../library/typing.rst:3274 msgid "" "This type represents the types :class:`bytes`, :class:`bytearray`, and :" "class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:3276 +#: ../../library/typing.rst:3278 msgid "" "Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " "| memoryview``." msgstr "" -#: ../../library/typing.rst:3280 +#: ../../library/typing.rst:3282 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3284 +#: ../../library/typing.rst:3286 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3290 +#: ../../library/typing.rst:3292 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3292 +#: ../../library/typing.rst:3294 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3298 +#: ../../library/typing.rst:3300 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3300 +#: ../../library/typing.rst:3302 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3306 +#: ../../library/typing.rst:3308 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3308 +#: ../../library/typing.rst:3310 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3314 +#: ../../library/typing.rst:3316 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3321 +#: ../../library/typing.rst:3323 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3327 +#: ../../library/typing.rst:3329 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3329 +#: ../../library/typing.rst:3331 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3335 +#: ../../library/typing.rst:3337 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3337 +#: ../../library/typing.rst:3339 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3344 +#: ../../library/typing.rst:3346 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3346 +#: ../../library/typing.rst:3348 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3353 +#: ../../library/typing.rst:3355 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3355 +#: ../../library/typing.rst:3357 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3361 +#: ../../library/typing.rst:3363 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3363 +#: ../../library/typing.rst:3365 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3369 +#: ../../library/typing.rst:3371 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3371 +#: ../../library/typing.rst:3373 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3378 +#: ../../library/typing.rst:3380 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3382 +#: ../../library/typing.rst:3384 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3384 +#: ../../library/typing.rst:3386 msgid "" "The variance and order of type variables correspond to those of :class:" "`Generator`, for example::" msgstr "" -#: ../../library/typing.rst:3395 +#: ../../library/typing.rst:3397 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3401 +#: ../../library/typing.rst:3403 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3403 +#: ../../library/typing.rst:3405 msgid "" "An async generator can be annotated by the generic type " "``AsyncGenerator[YieldType, SendType]``. For example::" msgstr "" -#: ../../library/typing.rst:3412 +#: ../../library/typing.rst:3414 msgid "" "Unlike normal generators, async generators cannot return a value, so there " "is no ``ReturnType`` type parameter. As with :class:`Generator`, the " "``SendType`` behaves contravariantly." msgstr "" -#: ../../library/typing.rst:3416 +#: ../../library/typing.rst:3418 msgid "" "If your generator will only yield values, set the ``SendType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:3424 +#: ../../library/typing.rst:3426 msgid "" "Alternatively, annotate your generator as having a return type of either " "``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:3434 +#: ../../library/typing.rst:3436 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3441 +#: ../../library/typing.rst:3443 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3445 +#: ../../library/typing.rst:3447 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3451 +#: ../../library/typing.rst:3453 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3455 +#: ../../library/typing.rst:3457 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3461 +#: ../../library/typing.rst:3463 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3465 +#: ../../library/typing.rst:3467 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3472 +#: ../../library/typing.rst:3474 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3476 +#: ../../library/typing.rst:3478 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3478 +#: ../../library/typing.rst:3480 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3484 +#: ../../library/typing.rst:3486 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3486 +#: ../../library/typing.rst:3488 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3492 +#: ../../library/typing.rst:3494 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3494 +#: ../../library/typing.rst:3496 msgid "" "See :ref:`annotating-callables` for details on how to use :class:" "`collections.abc.Callable` and ``typing.Callable`` in type annotations." msgstr "" -#: ../../library/typing.rst:3497 +#: ../../library/typing.rst:3499 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3507 +#: ../../library/typing.rst:3509 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3509 +#: ../../library/typing.rst:3511 msgid "" "A generator can be annotated by the generic type ``Generator[YieldType, " "SendType, ReturnType]``. For example::" msgstr "" -#: ../../library/typing.rst:3518 +#: ../../library/typing.rst:3520 msgid "" "Note that unlike many other generics in the typing module, the ``SendType`` " "of :class:`Generator` behaves contravariantly, not covariantly or " "invariantly." msgstr "" -#: ../../library/typing.rst:3522 +#: ../../library/typing.rst:3524 msgid "" "If your generator will only yield values, set the ``SendType`` and " "``ReturnType`` to ``None``::" msgstr "" -#: ../../library/typing.rst:3530 +#: ../../library/typing.rst:3532 msgid "" "Alternatively, annotate your generator as having a return type of either " "``Iterable[YieldType]`` or ``Iterator[YieldType]``::" msgstr "" -#: ../../library/typing.rst:3538 +#: ../../library/typing.rst:3540 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3544 +#: ../../library/typing.rst:3546 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:3546 +#: ../../library/typing.rst:3548 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:3551 +#: ../../library/typing.rst:3553 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:3553 +#: ../../library/typing.rst:3555 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3559 +#: ../../library/typing.rst:3561 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:3561 +#: ../../library/typing.rst:3563 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:3567 +#: ../../library/typing.rst:3569 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:3571 +#: ../../library/typing.rst:3573 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:3575 +#: ../../library/typing.rst:3577 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3582 +#: ../../library/typing.rst:3584 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:3586 +#: ../../library/typing.rst:3588 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3592 +#: ../../library/typing.rst:3594 msgid "Deprecation Timeline of Major Features" msgstr "" -#: ../../library/typing.rst:3594 +#: ../../library/typing.rst:3596 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -3515,100 +3515,100 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:3601 +#: ../../library/typing.rst:3603 msgid "Feature" msgstr "" -#: ../../library/typing.rst:3602 +#: ../../library/typing.rst:3604 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:3603 +#: ../../library/typing.rst:3605 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:3604 +#: ../../library/typing.rst:3606 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:3605 +#: ../../library/typing.rst:3607 msgid "``typing.io`` and ``typing.re`` submodules" msgstr "``typing.io`` 和 ``typing.re`` 子模組" -#: ../../library/typing.rst:3606 +#: ../../library/typing.rst:3608 msgid "3.8" msgstr "3.8" -#: ../../library/typing.rst:3607 +#: ../../library/typing.rst:3609 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:3608 +#: ../../library/typing.rst:3610 msgid ":issue:`38291`" msgstr ":issue:`38291`" -#: ../../library/typing.rst:3609 +#: ../../library/typing.rst:3611 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:3610 ../../library/typing.rst:3614 +#: ../../library/typing.rst:3612 ../../library/typing.rst:3616 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:3611 +#: ../../library/typing.rst:3613 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:3612 +#: ../../library/typing.rst:3614 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:3613 +#: ../../library/typing.rst:3615 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:3615 +#: ../../library/typing.rst:3617 msgid "3.14" msgstr "3.14" -#: ../../library/typing.rst:3616 +#: ../../library/typing.rst:3618 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:3617 +#: ../../library/typing.rst:3619 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:3618 +#: ../../library/typing.rst:3620 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:3619 ../../library/typing.rst:3623 -#: ../../library/typing.rst:3627 +#: ../../library/typing.rst:3621 ../../library/typing.rst:3625 +#: ../../library/typing.rst:3629 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:3620 +#: ../../library/typing.rst:3622 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:3621 +#: ../../library/typing.rst:3623 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:3622 ../../library/typing.rst:3626 +#: ../../library/typing.rst:3624 ../../library/typing.rst:3628 msgid "3.12" msgstr "" -#: ../../library/typing.rst:3624 +#: ../../library/typing.rst:3626 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:3625 +#: ../../library/typing.rst:3627 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:3628 +#: ../../library/typing.rst:3630 msgid ":pep:`695`" msgstr ":pep:`695`" diff --git a/library/urllib.parse.po b/library/urllib.parse.po index 5f1b7abcc5..f0a6a05b82 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-24 00:04+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -297,7 +297,7 @@ msgstr "新增剖析 IPv6 URL 的能力。" #: ../../library/urllib.parse.rst:175 msgid "" -"The fragment is now parsed for all URL schemes (unless *allow_fragment* is " +"The fragment is now parsed for all URL schemes (unless *allow_fragments* is " "false), in accordance with :rfc:`3986`. Previously, an allowlist of schemes " "that support fragments existed." msgstr "" diff --git a/library/xml.etree.elementtree.po b/library/xml.etree.elementtree.po index e2c3bb76fd..9d460925a9 100644 --- a/library/xml.etree.elementtree.po +++ b/library/xml.etree.elementtree.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-06-12 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -500,7 +500,7 @@ msgstr "" #: ../../library/xml.etree.elementtree.rst:510 msgid "" "Canonicalization is a way to normalise XML output in a way that allows byte-" -"by-byte comparisons and digital signatures. It reduced the freedom that XML " +"by-byte comparisons and digital signatures. It reduces the freedom that XML " "serializers have and instead generates a more constrained XML " "representation. The main restrictions regard the placement of namespace " "declarations, the ordering of attributes, and ignorable whitespace." diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 07cebfd460..47476a5737 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-18 00:04+0000\n" +"POT-Creation-Date: 2024-06-20 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -204,23 +204,26 @@ msgid "" "for an exception handler is started. This search inspects the :keyword:`!" "except` clauses in turn until one is found that matches the exception. An " "expression-less :keyword:`!except` clause, if present, must be last; it " -"matches any exception. For an :keyword:`!except` clause with an expression, " -"that expression is evaluated, and the clause matches the exception if the " -"resulting object is \"compatible\" with the exception. An object is " -"compatible with an exception if the object is the class or a :term:`non-" -"virtual base class ` of the exception object, or a " -"tuple containing an item that is the class or a non-virtual base class of " -"the exception object." +"matches any exception." msgstr "" -#: ../../reference/compound_stmts.rst:256 +#: ../../reference/compound_stmts.rst:249 +msgid "" +"For an :keyword:`!except` clause with an expression, the expression must " +"evaluate to an exception type or a tuple of exception types. The raised " +"exception matches an :keyword:`!except` clause whose expression evaluates to " +"the class or a :term:`non-virtual base class ` of the " +"exception object, or to a tuple that contains such a class." +msgstr "" + +#: ../../reference/compound_stmts.rst:255 msgid "" "If no :keyword:`!except` clause matches the exception, the search for an " "exception handler continues in the surrounding code and on the invocation " "stack. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:260 +#: ../../reference/compound_stmts.rst:259 msgid "" "If the evaluation of an expression in the header of an :keyword:`!except` " "clause raises an exception, the original search for a handler is canceled " @@ -229,7 +232,7 @@ msgid "" "the exception)." msgstr "" -#: ../../reference/compound_stmts.rst:268 +#: ../../reference/compound_stmts.rst:267 msgid "" "When a matching :keyword:`!except` clause is found, the exception is " "assigned to the target specified after the :keyword:`!as` keyword in that :" @@ -242,17 +245,17 @@ msgid "" "handle the exception.)" msgstr "" -#: ../../reference/compound_stmts.rst:279 +#: ../../reference/compound_stmts.rst:278 msgid "" "When an exception has been assigned using ``as target``, it is cleared at " "the end of the :keyword:`!except` clause. This is as if ::" msgstr "" -#: ../../reference/compound_stmts.rst:285 +#: ../../reference/compound_stmts.rst:284 msgid "was translated to ::" msgstr "" -#: ../../reference/compound_stmts.rst:293 +#: ../../reference/compound_stmts.rst:292 msgid "" "This means the exception must be assigned to a different name to be able to " "refer to it after the :keyword:`!except` clause. Exceptions are cleared " @@ -261,7 +264,7 @@ msgid "" "garbage collection occurs." msgstr "" -#: ../../reference/compound_stmts.rst:303 +#: ../../reference/compound_stmts.rst:302 msgid "" "Before an :keyword:`!except` clause's suite is executed, the exception is " "stored in the :mod:`sys` module, where it can be accessed from within the " @@ -270,11 +273,11 @@ msgid "" "is reset to its previous value::" msgstr "" -#: ../../reference/compound_stmts.rst:334 +#: ../../reference/compound_stmts.rst:333 msgid ":keyword:`!except*` clause" msgstr "" -#: ../../reference/compound_stmts.rst:336 +#: ../../reference/compound_stmts.rst:335 msgid "" "The :keyword:`!except*` clause(s) are used for handling :exc:" "`ExceptionGroup`\\s. The exception type for matching is interpreted as in " @@ -287,7 +290,7 @@ msgid "" "that matches it. ::" msgstr "" -#: ../../reference/compound_stmts.rst:364 +#: ../../reference/compound_stmts.rst:363 msgid "" "Any remaining exceptions that were not handled by any :keyword:`!except*` " "clause are re-raised at the end, along with all exceptions that were raised " @@ -295,27 +298,32 @@ msgid "" "one exception to reraise, they are combined into an exception group." msgstr "" -#: ../../reference/compound_stmts.rst:370 +#: ../../reference/compound_stmts.rst:369 msgid "" "If the raised exception is not an exception group and its type matches one " "of the :keyword:`!except*` clauses, it is caught and wrapped by an exception " "group with an empty message string. ::" msgstr "" -#: ../../reference/compound_stmts.rst:381 +#: ../../reference/compound_stmts.rst:380 +msgid "" +"An :keyword:`!except*` clause must have a matching expression; it cannot be " +"``except*:``. Furthermore, this expression cannot contain exception group " +"types, because that would have ambiguous semantics." +msgstr "" + +#: ../../reference/compound_stmts.rst:384 msgid "" -"An :keyword:`!except*` clause must have a matching type, and this type " -"cannot be a subclass of :exc:`BaseExceptionGroup`. It is not possible to " -"mix :keyword:`except` and :keyword:`!except*` in the same :keyword:`try`. :" -"keyword:`break`, :keyword:`continue` and :keyword:`return` cannot appear in " -"an :keyword:`!except*` clause." +"It is not possible to mix :keyword:`except` and :keyword:`!except*` in the " +"same :keyword:`try`. :keyword:`break`, :keyword:`continue` and :keyword:" +"`return` cannot appear in an :keyword:`!except*` clause." msgstr "" -#: ../../reference/compound_stmts.rst:398 +#: ../../reference/compound_stmts.rst:399 msgid ":keyword:`!else` clause" msgstr "" -#: ../../reference/compound_stmts.rst:400 +#: ../../reference/compound_stmts.rst:401 msgid "" "The optional :keyword:`!else` clause is executed if the control flow leaves " "the :keyword:`try` suite, no exception was raised, and no :keyword:" @@ -324,11 +332,11 @@ msgid "" "keyword:`except` clauses." msgstr "" -#: ../../reference/compound_stmts.rst:412 +#: ../../reference/compound_stmts.rst:413 msgid ":keyword:`!finally` clause" msgstr "" -#: ../../reference/compound_stmts.rst:414 +#: ../../reference/compound_stmts.rst:415 msgid "" "If :keyword:`!finally` is present, it specifies a 'cleanup' handler. The :" "keyword:`try` clause is executed, including any :keyword:`except` and :" @@ -342,13 +350,13 @@ msgid "" "exception is discarded::" msgstr "" -#: ../../reference/compound_stmts.rst:433 +#: ../../reference/compound_stmts.rst:434 msgid "" "The exception information is not available to the program during execution " "of the :keyword:`!finally` clause." msgstr "" -#: ../../reference/compound_stmts.rst:441 +#: ../../reference/compound_stmts.rst:442 msgid "" "When a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement " "is executed in the :keyword:`try` suite of a :keyword:`!try`...\\ :keyword:`!" @@ -356,7 +364,7 @@ msgid "" "way out.'" msgstr "" -#: ../../reference/compound_stmts.rst:445 +#: ../../reference/compound_stmts.rst:446 msgid "" "The return value of a function is determined by the last :keyword:`return` " "statement executed. Since the :keyword:`!finally` clause always executes, " @@ -364,17 +372,17 @@ msgid "" "will always be the last one executed::" msgstr "" -#: ../../reference/compound_stmts.rst:459 +#: ../../reference/compound_stmts.rst:460 msgid "" "Prior to Python 3.8, a :keyword:`continue` statement was illegal in the :" "keyword:`!finally` clause due to a problem with the implementation." msgstr "" -#: ../../reference/compound_stmts.rst:468 +#: ../../reference/compound_stmts.rst:469 msgid "The :keyword:`!with` statement" msgstr "" -#: ../../reference/compound_stmts.rst:477 +#: ../../reference/compound_stmts.rst:478 msgid "" "The :keyword:`with` statement is used to wrap the execution of a block with " "methods defined by a context manager (see section :ref:`context-managers`). " @@ -382,38 +390,38 @@ msgid "" "`finally` usage patterns to be encapsulated for convenient reuse." msgstr "" -#: ../../reference/compound_stmts.rst:487 +#: ../../reference/compound_stmts.rst:488 msgid "" "The execution of the :keyword:`with` statement with one \"item\" proceeds as " "follows:" msgstr "" -#: ../../reference/compound_stmts.rst:489 +#: ../../reference/compound_stmts.rst:490 msgid "" "The context expression (the expression given in the :token:`~python-grammar:" "with_item`) is evaluated to obtain a context manager." msgstr "" -#: ../../reference/compound_stmts.rst:492 +#: ../../reference/compound_stmts.rst:493 msgid "" "The context manager's :meth:`~object.__enter__` is loaded for later use." msgstr "" -#: ../../reference/compound_stmts.rst:494 +#: ../../reference/compound_stmts.rst:495 msgid "The context manager's :meth:`~object.__exit__` is loaded for later use." msgstr "" -#: ../../reference/compound_stmts.rst:496 +#: ../../reference/compound_stmts.rst:497 msgid "The context manager's :meth:`~object.__enter__` method is invoked." msgstr "" -#: ../../reference/compound_stmts.rst:498 +#: ../../reference/compound_stmts.rst:499 msgid "" "If a target was included in the :keyword:`with` statement, the return value " "from :meth:`~object.__enter__` is assigned to it." msgstr "" -#: ../../reference/compound_stmts.rst:503 +#: ../../reference/compound_stmts.rst:504 msgid "" "The :keyword:`with` statement guarantees that if the :meth:`~object." "__enter__` method returns without an error, then :meth:`~object.__exit__` " @@ -422,11 +430,11 @@ msgid "" "suite would be. See step 7 below." msgstr "" -#: ../../reference/compound_stmts.rst:509 +#: ../../reference/compound_stmts.rst:510 msgid "The suite is executed." msgstr "" -#: ../../reference/compound_stmts.rst:511 +#: ../../reference/compound_stmts.rst:512 msgid "" "The context manager's :meth:`~object.__exit__` method is invoked. If an " "exception caused the suite to be exited, its type, value, and traceback are " @@ -434,7 +442,7 @@ msgid "" "`None` arguments are supplied." msgstr "" -#: ../../reference/compound_stmts.rst:516 +#: ../../reference/compound_stmts.rst:517 msgid "" "If the suite was exited due to an exception, and the return value from the :" "meth:`~object.__exit__` method was false, the exception is reraised. If the " @@ -442,119 +450,119 @@ msgid "" "with the statement following the :keyword:`with` statement." msgstr "" -#: ../../reference/compound_stmts.rst:521 +#: ../../reference/compound_stmts.rst:522 msgid "" "If the suite was exited for any reason other than an exception, the return " "value from :meth:`~object.__exit__` is ignored, and execution proceeds at " "the normal location for the kind of exit that was taken." msgstr "" -#: ../../reference/compound_stmts.rst:525 -#: ../../reference/compound_stmts.rst:1540 -#: ../../reference/compound_stmts.rst:1581 +#: ../../reference/compound_stmts.rst:526 +#: ../../reference/compound_stmts.rst:1541 +#: ../../reference/compound_stmts.rst:1582 msgid "The following code::" msgstr "" -#: ../../reference/compound_stmts.rst:530 -#: ../../reference/compound_stmts.rst:555 -#: ../../reference/compound_stmts.rst:1586 +#: ../../reference/compound_stmts.rst:531 +#: ../../reference/compound_stmts.rst:556 +#: ../../reference/compound_stmts.rst:1587 msgid "is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:549 +#: ../../reference/compound_stmts.rst:550 msgid "" "With more than one item, the context managers are processed as if multiple :" "keyword:`with` statements were nested::" msgstr "" -#: ../../reference/compound_stmts.rst:561 +#: ../../reference/compound_stmts.rst:562 msgid "" "You can also write multi-item context managers in multiple lines if the " "items are surrounded by parentheses. For example::" msgstr "" -#: ../../reference/compound_stmts.rst:570 +#: ../../reference/compound_stmts.rst:571 msgid "Support for multiple context expressions." msgstr "" -#: ../../reference/compound_stmts.rst:573 +#: ../../reference/compound_stmts.rst:574 msgid "" "Support for using grouping parentheses to break the statement in multiple " "lines." msgstr "" -#: ../../reference/compound_stmts.rst:578 +#: ../../reference/compound_stmts.rst:579 msgid ":pep:`343` - The \"with\" statement" msgstr "" -#: ../../reference/compound_stmts.rst:579 +#: ../../reference/compound_stmts.rst:580 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:586 msgid "The :keyword:`!match` statement" msgstr "" -#: ../../reference/compound_stmts.rst:599 +#: ../../reference/compound_stmts.rst:600 msgid "The match statement is used for pattern matching. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:608 +#: ../../reference/compound_stmts.rst:609 msgid "" "This section uses single quotes to denote :ref:`soft keywords `." msgstr "" -#: ../../reference/compound_stmts.rst:611 +#: ../../reference/compound_stmts.rst:612 msgid "" "Pattern matching takes a pattern as input (following ``case``) and a subject " "value (following ``match``). The pattern (which may contain subpatterns) is " "matched against the subject value. The outcomes are:" msgstr "" -#: ../../reference/compound_stmts.rst:615 +#: ../../reference/compound_stmts.rst:616 msgid "A match success or failure (also termed a pattern success or failure)." msgstr "" -#: ../../reference/compound_stmts.rst:617 +#: ../../reference/compound_stmts.rst:618 msgid "" "Possible binding of matched values to a name. The prerequisites for this " "are further discussed below." msgstr "" -#: ../../reference/compound_stmts.rst:620 +#: ../../reference/compound_stmts.rst:621 msgid "" "The ``match`` and ``case`` keywords are :ref:`soft keywords `." msgstr "" -#: ../../reference/compound_stmts.rst:624 -#: ../../reference/compound_stmts.rst:1181 +#: ../../reference/compound_stmts.rst:625 +#: ../../reference/compound_stmts.rst:1182 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../reference/compound_stmts.rst:625 -#: ../../reference/compound_stmts.rst:1182 +#: ../../reference/compound_stmts.rst:626 +#: ../../reference/compound_stmts.rst:1183 msgid ":pep:`636` -- Structural Pattern Matching: Tutorial" msgstr "" -#: ../../reference/compound_stmts.rst:629 +#: ../../reference/compound_stmts.rst:630 msgid "Overview" msgstr "" -#: ../../reference/compound_stmts.rst:631 +#: ../../reference/compound_stmts.rst:632 msgid "Here's an overview of the logical flow of a match statement:" msgstr "" -#: ../../reference/compound_stmts.rst:634 +#: ../../reference/compound_stmts.rst:635 msgid "" "The subject expression ``subject_expr`` is evaluated and a resulting subject " "value obtained. If the subject expression contains a comma, a tuple is " "constructed using :ref:`the standard rules `." msgstr "" -#: ../../reference/compound_stmts.rst:638 +#: ../../reference/compound_stmts.rst:639 msgid "" "Each pattern in a ``case_block`` is attempted to match with the subject " "value. The specific rules for success or failure are described below. The " @@ -564,7 +572,7 @@ msgid "" "outlive the executed block and can be used after the match statement**." msgstr "" -#: ../../reference/compound_stmts.rst:647 +#: ../../reference/compound_stmts.rst:648 msgid "" "During failed pattern matches, some subpatterns may succeed. Do not rely on " "bindings being made for a failed match. Conversely, do not rely on " @@ -573,87 +581,87 @@ msgid "" "made to allow different implementations to add optimizations." msgstr "" -#: ../../reference/compound_stmts.rst:654 +#: ../../reference/compound_stmts.rst:655 msgid "" "If the pattern succeeds, the corresponding guard (if present) is evaluated. " "In this case all name bindings are guaranteed to have happened." msgstr "" -#: ../../reference/compound_stmts.rst:657 +#: ../../reference/compound_stmts.rst:658 msgid "" "If the guard evaluates as true or is missing, the ``block`` inside " "``case_block`` is executed." msgstr "" -#: ../../reference/compound_stmts.rst:660 +#: ../../reference/compound_stmts.rst:661 msgid "Otherwise, the next ``case_block`` is attempted as described above." msgstr "" -#: ../../reference/compound_stmts.rst:662 +#: ../../reference/compound_stmts.rst:663 msgid "If there are no further case blocks, the match statement is completed." msgstr "" -#: ../../reference/compound_stmts.rst:666 +#: ../../reference/compound_stmts.rst:667 msgid "" "Users should generally never rely on a pattern being evaluated. Depending " "on implementation, the interpreter may cache values or use other " "optimizations which skip repeated evaluations." msgstr "" -#: ../../reference/compound_stmts.rst:670 +#: ../../reference/compound_stmts.rst:671 msgid "A sample match statement::" msgstr "" -#: ../../reference/compound_stmts.rst:686 +#: ../../reference/compound_stmts.rst:687 msgid "" "In this case, ``if flag`` is a guard. Read more about that in the next " "section." msgstr "" -#: ../../reference/compound_stmts.rst:689 +#: ../../reference/compound_stmts.rst:690 msgid "Guards" msgstr "" -#: ../../reference/compound_stmts.rst:696 +#: ../../reference/compound_stmts.rst:697 msgid "" "A ``guard`` (which is part of the ``case``) must succeed for code inside the " "``case`` block to execute. It takes the form: :keyword:`if` followed by an " "expression." msgstr "" -#: ../../reference/compound_stmts.rst:701 +#: ../../reference/compound_stmts.rst:702 msgid "The logical flow of a ``case`` block with a ``guard`` follows:" msgstr "" -#: ../../reference/compound_stmts.rst:703 +#: ../../reference/compound_stmts.rst:704 msgid "" "Check that the pattern in the ``case`` block succeeded. If the pattern " "failed, the ``guard`` is not evaluated and the next ``case`` block is " "checked." msgstr "" -#: ../../reference/compound_stmts.rst:707 +#: ../../reference/compound_stmts.rst:708 msgid "If the pattern succeeded, evaluate the ``guard``." msgstr "" -#: ../../reference/compound_stmts.rst:709 +#: ../../reference/compound_stmts.rst:710 msgid "" "If the ``guard`` condition evaluates as true, the case block is selected." msgstr "" -#: ../../reference/compound_stmts.rst:712 +#: ../../reference/compound_stmts.rst:713 msgid "" "If the ``guard`` condition evaluates as false, the case block is not " "selected." msgstr "" -#: ../../reference/compound_stmts.rst:715 +#: ../../reference/compound_stmts.rst:716 msgid "" "If the ``guard`` raises an exception during evaluation, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:718 +#: ../../reference/compound_stmts.rst:719 msgid "" "Guards are allowed to have side effects as they are expressions. Guard " "evaluation must proceed from the first to the last case block, one at a " @@ -662,17 +670,17 @@ msgid "" "block is selected." msgstr "" -#: ../../reference/compound_stmts.rst:728 +#: ../../reference/compound_stmts.rst:729 msgid "Irrefutable Case Blocks" msgstr "" -#: ../../reference/compound_stmts.rst:732 +#: ../../reference/compound_stmts.rst:733 msgid "" "An irrefutable case block is a match-all case block. A match statement may " "have at most one irrefutable case block, and it must be last." msgstr "" -#: ../../reference/compound_stmts.rst:735 +#: ../../reference/compound_stmts.rst:736 msgid "" "A case block is considered irrefutable if it has no guard and its pattern is " "irrefutable. A pattern is considered irrefutable if we can prove from its " @@ -680,47 +688,47 @@ msgid "" "irrefutable:" msgstr "" -#: ../../reference/compound_stmts.rst:740 +#: ../../reference/compound_stmts.rst:741 msgid ":ref:`as-patterns` whose left-hand side is irrefutable" msgstr "" -#: ../../reference/compound_stmts.rst:742 +#: ../../reference/compound_stmts.rst:743 msgid ":ref:`or-patterns` containing at least one irrefutable pattern" msgstr "" -#: ../../reference/compound_stmts.rst:744 +#: ../../reference/compound_stmts.rst:745 msgid ":ref:`capture-patterns`" msgstr ":ref:`capture-patterns`" -#: ../../reference/compound_stmts.rst:746 +#: ../../reference/compound_stmts.rst:747 msgid ":ref:`wildcard-patterns`" msgstr ":ref:`wildcard-patterns`" -#: ../../reference/compound_stmts.rst:748 +#: ../../reference/compound_stmts.rst:749 msgid "parenthesized irrefutable patterns" msgstr "" -#: ../../reference/compound_stmts.rst:752 +#: ../../reference/compound_stmts.rst:753 msgid "Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:759 +#: ../../reference/compound_stmts.rst:760 msgid "This section uses grammar notations beyond standard EBNF:" msgstr "" -#: ../../reference/compound_stmts.rst:761 +#: ../../reference/compound_stmts.rst:762 msgid "the notation ``SEP.RULE+`` is shorthand for ``RULE (SEP RULE)*``" msgstr "" -#: ../../reference/compound_stmts.rst:763 +#: ../../reference/compound_stmts.rst:764 msgid "the notation ``!RULE`` is shorthand for a negative lookahead assertion" msgstr "" -#: ../../reference/compound_stmts.rst:766 +#: ../../reference/compound_stmts.rst:767 msgid "The top-level syntax for ``patterns`` is:" msgstr "" -#: ../../reference/compound_stmts.rst:780 +#: ../../reference/compound_stmts.rst:781 msgid "" "The descriptions below will include a description \"in simple terms\" of " "what a pattern does for illustration purposes (credits to Raymond Hettinger " @@ -730,70 +738,70 @@ msgid "" "forms." msgstr "" -#: ../../reference/compound_stmts.rst:790 +#: ../../reference/compound_stmts.rst:791 msgid "OR Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:792 +#: ../../reference/compound_stmts.rst:793 msgid "" "An OR pattern is two or more patterns separated by vertical bars ``|``. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:798 +#: ../../reference/compound_stmts.rst:799 msgid "" "Only the final subpattern may be :ref:`irrefutable `, and " "each subpattern must bind the same set of names to avoid ambiguity." msgstr "" -#: ../../reference/compound_stmts.rst:801 +#: ../../reference/compound_stmts.rst:802 msgid "" "An OR pattern matches each of its subpatterns in turn to the subject value, " "until one succeeds. The OR pattern is then considered successful. " "Otherwise, if none of the subpatterns succeed, the OR pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:805 +#: ../../reference/compound_stmts.rst:806 msgid "" "In simple terms, ``P1 | P2 | ...`` will try to match ``P1``, if it fails it " "will try to match ``P2``, succeeding immediately if any succeeds, failing " "otherwise." msgstr "" -#: ../../reference/compound_stmts.rst:811 +#: ../../reference/compound_stmts.rst:812 msgid "AS Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:813 +#: ../../reference/compound_stmts.rst:814 msgid "" "An AS pattern matches an OR pattern on the left of the :keyword:`as` keyword " "against a subject. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:819 +#: ../../reference/compound_stmts.rst:820 msgid "" "If the OR pattern fails, the AS pattern fails. Otherwise, the AS pattern " "binds the subject to the name on the right of the as keyword and succeeds. " "``capture_pattern`` cannot be a ``_``." msgstr "" -#: ../../reference/compound_stmts.rst:823 +#: ../../reference/compound_stmts.rst:824 msgid "" "In simple terms ``P as NAME`` will match with ``P``, and on success it will " "set ``NAME = ``." msgstr "" -#: ../../reference/compound_stmts.rst:830 +#: ../../reference/compound_stmts.rst:831 msgid "Literal Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:832 +#: ../../reference/compound_stmts.rst:833 msgid "" "A literal pattern corresponds to most :ref:`literals ` in Python. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:845 +#: ../../reference/compound_stmts.rst:846 msgid "" "The rule ``strings`` and the token ``NUMBER`` are defined in the :doc:" "`standard Python grammar <./grammar>`. Triple-quoted strings are " @@ -801,42 +809,42 @@ msgid "" "are not supported." msgstr "" -#: ../../reference/compound_stmts.rst:850 +#: ../../reference/compound_stmts.rst:851 msgid "" "The forms ``signed_number '+' NUMBER`` and ``signed_number '-' NUMBER`` are " "for expressing :ref:`complex numbers `; they require a real " "number on the left and an imaginary number on the right. E.g. ``3 + 4j``." msgstr "" -#: ../../reference/compound_stmts.rst:854 +#: ../../reference/compound_stmts.rst:855 msgid "" "In simple terms, ``LITERAL`` will succeed only if `` == LITERAL``. " "For the singletons ``None``, ``True`` and ``False``, the :keyword:`is` " "operator is used." msgstr "" -#: ../../reference/compound_stmts.rst:860 +#: ../../reference/compound_stmts.rst:861 msgid "Capture Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:862 +#: ../../reference/compound_stmts.rst:863 msgid "A capture pattern binds the subject value to a name. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:868 +#: ../../reference/compound_stmts.rst:869 msgid "" "A single underscore ``_`` is not a capture pattern (this is what ``!'_'`` " "expresses). It is instead treated as a :token:`~python-grammar:" "wildcard_pattern`." msgstr "" -#: ../../reference/compound_stmts.rst:872 +#: ../../reference/compound_stmts.rst:873 msgid "" "In a given pattern, a given name can only be bound once. E.g. ``case x, " "x: ...`` is invalid while ``case [x] | x: ...`` is allowed." msgstr "" -#: ../../reference/compound_stmts.rst:875 +#: ../../reference/compound_stmts.rst:876 msgid "" "Capture patterns always succeed. The binding follows scoping rules " "established by the assignment expression operator in :pep:`572`; the name " @@ -844,55 +852,55 @@ msgid "" "there's an applicable :keyword:`global` or :keyword:`nonlocal` statement." msgstr "" -#: ../../reference/compound_stmts.rst:880 +#: ../../reference/compound_stmts.rst:881 msgid "" "In simple terms ``NAME`` will always succeed and it will set ``NAME = " "``." msgstr "" -#: ../../reference/compound_stmts.rst:885 +#: ../../reference/compound_stmts.rst:886 msgid "Wildcard Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:887 +#: ../../reference/compound_stmts.rst:888 msgid "" "A wildcard pattern always succeeds (matches anything) and binds no name. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:893 +#: ../../reference/compound_stmts.rst:894 msgid "" "``_`` is a :ref:`soft keyword ` within any pattern, but only " "within patterns. It is an identifier, as usual, even within ``match`` " "subject expressions, ``guard``\\ s, and ``case`` blocks." msgstr "" -#: ../../reference/compound_stmts.rst:897 +#: ../../reference/compound_stmts.rst:898 msgid "In simple terms, ``_`` will always succeed." msgstr "" -#: ../../reference/compound_stmts.rst:902 +#: ../../reference/compound_stmts.rst:903 msgid "Value Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:904 +#: ../../reference/compound_stmts.rst:905 msgid "A value pattern represents a named value in Python. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:912 +#: ../../reference/compound_stmts.rst:913 msgid "" "The dotted name in the pattern is looked up using standard Python :ref:`name " "resolution rules `. The pattern succeeds if the value found " "compares equal to the subject value (using the ``==`` equality operator)." msgstr "" -#: ../../reference/compound_stmts.rst:917 +#: ../../reference/compound_stmts.rst:918 msgid "" "In simple terms ``NAME1.NAME2`` will succeed only if `` == NAME1." "NAME2``" msgstr "" -#: ../../reference/compound_stmts.rst:921 +#: ../../reference/compound_stmts.rst:922 msgid "" "If the same value occurs multiple times in the same match statement, the " "interpreter may cache the first value found and reuse it rather than repeat " @@ -900,44 +908,44 @@ msgid "" "given match statement." msgstr "" -#: ../../reference/compound_stmts.rst:929 +#: ../../reference/compound_stmts.rst:930 msgid "Group Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:931 +#: ../../reference/compound_stmts.rst:932 msgid "" "A group pattern allows users to add parentheses around patterns to emphasize " "the intended grouping. Otherwise, it has no additional syntax. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:938 +#: ../../reference/compound_stmts.rst:939 msgid "In simple terms ``(P)`` has the same effect as ``P``." msgstr "" -#: ../../reference/compound_stmts.rst:943 +#: ../../reference/compound_stmts.rst:944 msgid "Sequence Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:945 +#: ../../reference/compound_stmts.rst:946 msgid "" "A sequence pattern contains several subpatterns to be matched against " "sequence elements. The syntax is similar to the unpacking of a list or tuple." msgstr "" -#: ../../reference/compound_stmts.rst:956 +#: ../../reference/compound_stmts.rst:957 msgid "" "There is no difference if parentheses or square brackets are used for " "sequence patterns (i.e. ``(...)`` vs ``[...]`` )." msgstr "" -#: ../../reference/compound_stmts.rst:960 +#: ../../reference/compound_stmts.rst:961 msgid "" "A single pattern enclosed in parentheses without a trailing comma (e.g. ``(3 " "| 4)``) is a :ref:`group pattern `. While a single pattern " "enclosed in square brackets (e.g. ``[3 | 4]``) is still a sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:965 +#: ../../reference/compound_stmts.rst:966 msgid "" "At most one star subpattern may be in a sequence pattern. The star " "subpattern may occur in any position. If no star subpattern is present, the " @@ -945,40 +953,40 @@ msgid "" "variable-length sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:970 +#: ../../reference/compound_stmts.rst:971 msgid "" "The following is the logical flow for matching a sequence pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:973 +#: ../../reference/compound_stmts.rst:974 msgid "" "If the subject value is not a sequence [#]_, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:976 +#: ../../reference/compound_stmts.rst:977 msgid "" "If the subject value is an instance of ``str``, ``bytes`` or ``bytearray`` " "the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:979 +#: ../../reference/compound_stmts.rst:980 msgid "" "The subsequent steps depend on whether the sequence pattern is fixed or " "variable-length." msgstr "" -#: ../../reference/compound_stmts.rst:982 +#: ../../reference/compound_stmts.rst:983 msgid "If the sequence pattern is fixed-length:" msgstr "" -#: ../../reference/compound_stmts.rst:984 +#: ../../reference/compound_stmts.rst:985 msgid "" "If the length of the subject sequence is not equal to the number of " "subpatterns, the sequence pattern fails" msgstr "" -#: ../../reference/compound_stmts.rst:987 +#: ../../reference/compound_stmts.rst:988 msgid "" "Subpatterns in the sequence pattern are matched to their corresponding items " "in the subject sequence from left to right. Matching stops as soon as a " @@ -986,118 +994,118 @@ msgid "" "corresponding item, the sequence pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:992 +#: ../../reference/compound_stmts.rst:993 msgid "Otherwise, if the sequence pattern is variable-length:" msgstr "" -#: ../../reference/compound_stmts.rst:994 +#: ../../reference/compound_stmts.rst:995 msgid "" "If the length of the subject sequence is less than the number of non-star " "subpatterns, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:997 +#: ../../reference/compound_stmts.rst:998 msgid "" "The leading non-star subpatterns are matched to their corresponding items as " "for fixed-length sequences." msgstr "" -#: ../../reference/compound_stmts.rst:1000 +#: ../../reference/compound_stmts.rst:1001 msgid "" "If the previous step succeeds, the star subpattern matches a list formed of " "the remaining subject items, excluding the remaining items corresponding to " "non-star subpatterns following the star subpattern." msgstr "" -#: ../../reference/compound_stmts.rst:1004 +#: ../../reference/compound_stmts.rst:1005 msgid "" "Remaining non-star subpatterns are matched to their corresponding subject " "items, as for a fixed-length sequence." msgstr "" -#: ../../reference/compound_stmts.rst:1007 +#: ../../reference/compound_stmts.rst:1008 msgid "" "The length of the subject sequence is obtained via :func:`len` (i.e. via " "the :meth:`__len__` protocol). This length may be cached by the interpreter " "in a similar manner as :ref:`value patterns `." msgstr "" -#: ../../reference/compound_stmts.rst:1013 +#: ../../reference/compound_stmts.rst:1014 msgid "" "In simple terms ``[P1, P2, P3,`` ... ``, P]`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1016 +#: ../../reference/compound_stmts.rst:1017 msgid "check ```` is a sequence" msgstr "" -#: ../../reference/compound_stmts.rst:1017 +#: ../../reference/compound_stmts.rst:1018 msgid "``len(subject) == ``" msgstr "``len(subject) == ``" -#: ../../reference/compound_stmts.rst:1018 +#: ../../reference/compound_stmts.rst:1019 msgid "" "``P1`` matches ``[0]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:1019 +#: ../../reference/compound_stmts.rst:1020 msgid "" "``P2`` matches ``[1]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:1020 +#: ../../reference/compound_stmts.rst:1021 msgid "... and so on for the corresponding pattern/element." msgstr "" -#: ../../reference/compound_stmts.rst:1025 +#: ../../reference/compound_stmts.rst:1026 msgid "Mapping Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:1027 +#: ../../reference/compound_stmts.rst:1028 msgid "" "A mapping pattern contains one or more key-value patterns. The syntax is " "similar to the construction of a dictionary. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:1038 +#: ../../reference/compound_stmts.rst:1039 msgid "" "At most one double star pattern may be in a mapping pattern. The double " "star pattern must be the last subpattern in the mapping pattern." msgstr "" -#: ../../reference/compound_stmts.rst:1041 +#: ../../reference/compound_stmts.rst:1042 msgid "" "Duplicate keys in mapping patterns are disallowed. Duplicate literal keys " "will raise a :exc:`SyntaxError`. Two keys that otherwise have the same value " "will raise a :exc:`ValueError` at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1045 +#: ../../reference/compound_stmts.rst:1046 msgid "" "The following is the logical flow for matching a mapping pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:1048 +#: ../../reference/compound_stmts.rst:1049 msgid "If the subject value is not a mapping [#]_,the mapping pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:1050 +#: ../../reference/compound_stmts.rst:1051 msgid "" "If every key given in the mapping pattern is present in the subject mapping, " "and the pattern for each key matches the corresponding item of the subject " "mapping, the mapping pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1054 +#: ../../reference/compound_stmts.rst:1055 msgid "" "If duplicate keys are detected in the mapping pattern, the pattern is " "considered invalid. A :exc:`SyntaxError` is raised for duplicate literal " "values; or a :exc:`ValueError` for named keys of the same value." msgstr "" -#: ../../reference/compound_stmts.rst:1058 +#: ../../reference/compound_stmts.rst:1059 msgid "" "Key-value pairs are matched using the two-argument form of the mapping " "subject's ``get()`` method. Matched key-value pairs must already be present " @@ -1105,256 +1113,256 @@ msgid "" "`~object.__getitem__`." msgstr "" -#: ../../reference/compound_stmts.rst:1063 +#: ../../reference/compound_stmts.rst:1064 msgid "" "In simple terms ``{KEY1: P1, KEY2: P2, ... }`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1066 +#: ../../reference/compound_stmts.rst:1067 msgid "check ```` is a mapping" msgstr "" -#: ../../reference/compound_stmts.rst:1067 +#: ../../reference/compound_stmts.rst:1068 msgid "``KEY1 in ``" msgstr "``KEY1 in ``" -#: ../../reference/compound_stmts.rst:1068 +#: ../../reference/compound_stmts.rst:1069 msgid "``P1`` matches ``[KEY1]``" msgstr "" -#: ../../reference/compound_stmts.rst:1069 +#: ../../reference/compound_stmts.rst:1070 msgid "... and so on for the corresponding KEY/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1075 +#: ../../reference/compound_stmts.rst:1076 msgid "Class Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:1077 +#: ../../reference/compound_stmts.rst:1078 msgid "" "A class pattern represents a class and its positional and keyword arguments " "(if any). Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:1088 +#: ../../reference/compound_stmts.rst:1089 msgid "The same keyword should not be repeated in class patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1090 +#: ../../reference/compound_stmts.rst:1091 msgid "" "The following is the logical flow for matching a class pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:1093 +#: ../../reference/compound_stmts.rst:1094 msgid "" "If ``name_or_attr`` is not an instance of the builtin :class:`type` , raise :" "exc:`TypeError`." msgstr "" -#: ../../reference/compound_stmts.rst:1096 +#: ../../reference/compound_stmts.rst:1097 msgid "" "If the subject value is not an instance of ``name_or_attr`` (tested via :" "func:`isinstance`), the class pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:1099 +#: ../../reference/compound_stmts.rst:1100 msgid "" "If no pattern arguments are present, the pattern succeeds. Otherwise, the " "subsequent steps depend on whether keyword or positional argument patterns " "are present." msgstr "" -#: ../../reference/compound_stmts.rst:1103 +#: ../../reference/compound_stmts.rst:1104 msgid "" "For a number of built-in types (specified below), a single positional " "subpattern is accepted which will match the entire subject; for these types " "keyword patterns also work as for other types." msgstr "" -#: ../../reference/compound_stmts.rst:1107 +#: ../../reference/compound_stmts.rst:1108 msgid "" "If only keyword patterns are present, they are processed as follows, one by " "one:" msgstr "" -#: ../../reference/compound_stmts.rst:1110 +#: ../../reference/compound_stmts.rst:1111 msgid "I. The keyword is looked up as an attribute on the subject." msgstr "" -#: ../../reference/compound_stmts.rst:1112 +#: ../../reference/compound_stmts.rst:1113 msgid "" "If this raises an exception other than :exc:`AttributeError`, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1115 +#: ../../reference/compound_stmts.rst:1116 msgid "If this raises :exc:`AttributeError`, the class pattern has failed." msgstr "" -#: ../../reference/compound_stmts.rst:1117 +#: ../../reference/compound_stmts.rst:1118 msgid "" "Else, the subpattern associated with the keyword pattern is matched against " "the subject's attribute value. If this fails, the class pattern fails; if " "this succeeds, the match proceeds to the next keyword." msgstr "" -#: ../../reference/compound_stmts.rst:1122 +#: ../../reference/compound_stmts.rst:1123 msgid "II. If all keyword patterns succeed, the class pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1124 +#: ../../reference/compound_stmts.rst:1125 msgid "" "If any positional patterns are present, they are converted to keyword " "patterns using the :data:`~object.__match_args__` attribute on the class " "``name_or_attr`` before matching:" msgstr "" -#: ../../reference/compound_stmts.rst:1128 +#: ../../reference/compound_stmts.rst:1129 msgid "" "I. The equivalent of ``getattr(cls, \"__match_args__\", ())`` is called." msgstr "" -#: ../../reference/compound_stmts.rst:1130 +#: ../../reference/compound_stmts.rst:1131 msgid "If this raises an exception, the exception bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1132 +#: ../../reference/compound_stmts.rst:1133 msgid "" "If the returned value is not a tuple, the conversion fails and :exc:" "`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1135 +#: ../../reference/compound_stmts.rst:1136 msgid "" "If there are more positional patterns than ``len(cls.__match_args__)``, :exc:" "`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1138 +#: ../../reference/compound_stmts.rst:1139 msgid "" "Otherwise, positional pattern ``i`` is converted to a keyword pattern using " "``__match_args__[i]`` as the keyword. ``__match_args__[i]`` must be a " "string; if not :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1142 +#: ../../reference/compound_stmts.rst:1143 msgid "If there are duplicate keywords, :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1144 +#: ../../reference/compound_stmts.rst:1145 msgid ":ref:`class-pattern-matching`" msgstr ":ref:`class-pattern-matching`" -#: ../../reference/compound_stmts.rst:1146 +#: ../../reference/compound_stmts.rst:1147 msgid "" "II. Once all positional patterns have been converted to keyword patterns," msgstr "" -#: ../../reference/compound_stmts.rst:1147 +#: ../../reference/compound_stmts.rst:1148 msgid "the match proceeds as if there were only keyword patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1149 +#: ../../reference/compound_stmts.rst:1150 msgid "" "For the following built-in types the handling of positional subpatterns is " "different:" msgstr "" -#: ../../reference/compound_stmts.rst:1152 +#: ../../reference/compound_stmts.rst:1153 msgid ":class:`bool`" msgstr ":class:`bool`" -#: ../../reference/compound_stmts.rst:1153 +#: ../../reference/compound_stmts.rst:1154 msgid ":class:`bytearray`" msgstr ":class:`bytearray`" -#: ../../reference/compound_stmts.rst:1154 +#: ../../reference/compound_stmts.rst:1155 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../reference/compound_stmts.rst:1155 +#: ../../reference/compound_stmts.rst:1156 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../reference/compound_stmts.rst:1156 +#: ../../reference/compound_stmts.rst:1157 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../reference/compound_stmts.rst:1157 +#: ../../reference/compound_stmts.rst:1158 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../reference/compound_stmts.rst:1158 +#: ../../reference/compound_stmts.rst:1159 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../reference/compound_stmts.rst:1159 -#: ../../reference/compound_stmts.rst:1856 +#: ../../reference/compound_stmts.rst:1160 +#: ../../reference/compound_stmts.rst:1857 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../reference/compound_stmts.rst:1160 +#: ../../reference/compound_stmts.rst:1161 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../reference/compound_stmts.rst:1161 +#: ../../reference/compound_stmts.rst:1162 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../reference/compound_stmts.rst:1162 -#: ../../reference/compound_stmts.rst:1859 +#: ../../reference/compound_stmts.rst:1163 +#: ../../reference/compound_stmts.rst:1860 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../reference/compound_stmts.rst:1164 +#: ../../reference/compound_stmts.rst:1165 msgid "" "These classes accept a single positional argument, and the pattern there is " "matched against the whole object rather than an attribute. For example " "``int(0|1)`` matches the value ``0``, but not the value ``0.0``." msgstr "" -#: ../../reference/compound_stmts.rst:1168 +#: ../../reference/compound_stmts.rst:1169 msgid "" "In simple terms ``CLS(P1, attr=P2)`` matches only if the following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1170 +#: ../../reference/compound_stmts.rst:1171 msgid "``isinstance(, CLS)``" msgstr "``isinstance(, CLS)``" -#: ../../reference/compound_stmts.rst:1171 +#: ../../reference/compound_stmts.rst:1172 msgid "convert ``P1`` to a keyword pattern using ``CLS.__match_args__``" msgstr "" -#: ../../reference/compound_stmts.rst:1172 +#: ../../reference/compound_stmts.rst:1173 msgid "For each keyword argument ``attr=P2``:" msgstr "" -#: ../../reference/compound_stmts.rst:1174 +#: ../../reference/compound_stmts.rst:1175 msgid "``hasattr(, \"attr\")``" msgstr "``hasattr(, \"attr\")``" -#: ../../reference/compound_stmts.rst:1175 +#: ../../reference/compound_stmts.rst:1176 msgid "``P2`` matches ``.attr``" msgstr "" -#: ../../reference/compound_stmts.rst:1177 +#: ../../reference/compound_stmts.rst:1178 msgid "... and so on for the corresponding keyword argument/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1193 msgid "Function definitions" msgstr "函式定義" -#: ../../reference/compound_stmts.rst:1207 +#: ../../reference/compound_stmts.rst:1208 msgid "" "A function definition defines a user-defined function object (see section :" "ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1226 +#: ../../reference/compound_stmts.rst:1227 msgid "" "A function definition is an executable statement. Its execution binds the " "function name in the current local namespace to a function object (a wrapper " @@ -1363,13 +1371,13 @@ msgid "" "used when the function is called." msgstr "" -#: ../../reference/compound_stmts.rst:1232 +#: ../../reference/compound_stmts.rst:1233 msgid "" "The function definition does not execute the function body; this gets " "executed only when the function is called. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:1238 +#: ../../reference/compound_stmts.rst:1239 msgid "" "A function definition may be wrapped by one or more :term:`decorator` " "expressions. Decorator expressions are evaluated when the function is " @@ -1380,25 +1388,25 @@ msgid "" "example, the following code ::" msgstr "" -#: ../../reference/compound_stmts.rst:1249 -#: ../../reference/compound_stmts.rst:1439 +#: ../../reference/compound_stmts.rst:1250 +#: ../../reference/compound_stmts.rst:1440 msgid "is roughly equivalent to ::" msgstr "大致等價於: ::" -#: ../../reference/compound_stmts.rst:1254 +#: ../../reference/compound_stmts.rst:1255 msgid "" "except that the original function is not temporarily bound to the name " "``func``." msgstr "" -#: ../../reference/compound_stmts.rst:1256 +#: ../../reference/compound_stmts.rst:1257 msgid "" "Functions may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1261 +#: ../../reference/compound_stmts.rst:1262 msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets between the function's name and the opening parenthesis for its " @@ -1408,12 +1416,12 @@ msgid "" "functions` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1268 -#: ../../reference/compound_stmts.rst:1458 +#: ../../reference/compound_stmts.rst:1269 +#: ../../reference/compound_stmts.rst:1459 msgid "Type parameter lists are new in Python 3.12." msgstr "" -#: ../../reference/compound_stmts.rst:1276 +#: ../../reference/compound_stmts.rst:1277 msgid "" "When one or more :term:`parameters ` have the form *parameter* " "``=`` *expression*, the function is said to have \"default parameter values." @@ -1424,7 +1432,7 @@ msgid "" "syntactic restriction that is not expressed by the grammar." msgstr "" -#: ../../reference/compound_stmts.rst:1284 +#: ../../reference/compound_stmts.rst:1285 msgid "" "**Default parameter values are evaluated from left to right when the " "function definition is executed.** This means that the expression is " @@ -1437,7 +1445,7 @@ msgid "" "the default, and explicitly test for it in the body of the function, e.g.::" msgstr "" -#: ../../reference/compound_stmts.rst:1305 +#: ../../reference/compound_stmts.rst:1306 msgid "" "Function call semantics are described in more detail in section :ref:" "`calls`. A function call always assigns values to all parameters mentioned " @@ -1453,13 +1461,13 @@ msgid "" "positional arguments." msgstr "" -#: ../../reference/compound_stmts.rst:1317 +#: ../../reference/compound_stmts.rst:1318 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1326 +#: ../../reference/compound_stmts.rst:1327 msgid "" "Parameters may have an :term:`annotation ` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " @@ -1476,7 +1484,7 @@ msgid "" "different order than they appear in the source code." msgstr "" -#: ../../reference/compound_stmts.rst:1341 +#: ../../reference/compound_stmts.rst:1342 msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " @@ -1488,7 +1496,7 @@ msgid "" "execution of multiple statements and annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1349 +#: ../../reference/compound_stmts.rst:1350 msgid "" "**Programmer's note:** Functions are first-class objects. A \"``def``\" " "statement executed inside a function definition defines a local function " @@ -1497,61 +1505,61 @@ msgid "" "See section :ref:`naming` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1357 +#: ../../reference/compound_stmts.rst:1358 msgid ":pep:`3107` - Function Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1358 +#: ../../reference/compound_stmts.rst:1359 msgid "The original specification for function annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1360 +#: ../../reference/compound_stmts.rst:1361 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/compound_stmts.rst:1361 +#: ../../reference/compound_stmts.rst:1362 msgid "Definition of a standard meaning for annotations: type hints." msgstr "" -#: ../../reference/compound_stmts.rst:1363 +#: ../../reference/compound_stmts.rst:1364 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1364 +#: ../../reference/compound_stmts.rst:1365 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables." msgstr "" -#: ../../reference/compound_stmts.rst:1367 +#: ../../reference/compound_stmts.rst:1368 msgid ":pep:`563` - Postponed Evaluation of Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1368 +#: ../../reference/compound_stmts.rst:1369 msgid "" "Support for forward references within annotations by preserving annotations " "in a string form at runtime instead of eager evaluation." msgstr "" -#: ../../reference/compound_stmts.rst:1371 +#: ../../reference/compound_stmts.rst:1372 msgid ":pep:`318` - Decorators for Functions and Methods" msgstr "" -#: ../../reference/compound_stmts.rst:1372 +#: ../../reference/compound_stmts.rst:1373 msgid "" "Function and method decorators were introduced. Class decorators were " "introduced in :pep:`3129`." msgstr "" -#: ../../reference/compound_stmts.rst:1378 +#: ../../reference/compound_stmts.rst:1379 msgid "Class definitions" msgstr "" -#: ../../reference/compound_stmts.rst:1393 +#: ../../reference/compound_stmts.rst:1394 msgid "A class definition defines a class object (see section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1400 +#: ../../reference/compound_stmts.rst:1401 msgid "" "A class definition is an executable statement. The inheritance list usually " "gives a list of base classes (see :ref:`metaclasses` for more advanced " @@ -1560,11 +1568,11 @@ msgid "" "default, from the base class :class:`object`; hence, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1409 +#: ../../reference/compound_stmts.rst:1410 msgid "is equivalent to ::" msgstr "" -#: ../../reference/compound_stmts.rst:1414 +#: ../../reference/compound_stmts.rst:1415 msgid "" "The class's suite is then executed in a new execution frame (see :ref:" "`naming`), using a newly created local namespace and the original global " @@ -1576,7 +1584,7 @@ msgid "" "original local namespace." msgstr "" -#: ../../reference/compound_stmts.rst:1423 +#: ../../reference/compound_stmts.rst:1424 msgid "" "The order in which attributes are defined in the class body is preserved in " "the new class's ``__dict__``. Note that this is reliable only right after " @@ -1584,30 +1592,30 @@ msgid "" "definition syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1428 +#: ../../reference/compound_stmts.rst:1429 msgid "" "Class creation can be customized heavily using :ref:`metaclasses " "`." msgstr "" -#: ../../reference/compound_stmts.rst:1433 +#: ../../reference/compound_stmts.rst:1434 msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1444 +#: ../../reference/compound_stmts.rst:1445 msgid "" "The evaluation rules for the decorator expressions are the same as for " "function decorators. The result is then bound to the class name." msgstr "" -#: ../../reference/compound_stmts.rst:1447 +#: ../../reference/compound_stmts.rst:1448 msgid "" "Classes may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1452 +#: ../../reference/compound_stmts.rst:1453 msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets immediately after the class's name. This indicates to static type " @@ -1616,7 +1624,7 @@ msgid "" "classes` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1461 +#: ../../reference/compound_stmts.rst:1462 msgid "" "**Programmer's note:** Variables defined in the class definition are class " "attributes; they are shared by instances. Instance attributes can be set in " @@ -1629,35 +1637,35 @@ msgid "" "implementation details." msgstr "" -#: ../../reference/compound_stmts.rst:1473 +#: ../../reference/compound_stmts.rst:1474 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/compound_stmts.rst:1474 +#: ../../reference/compound_stmts.rst:1475 msgid "" "The proposal that changed the declaration of metaclasses to the current " "syntax, and the semantics for how classes with metaclasses are constructed." msgstr "" -#: ../../reference/compound_stmts.rst:1478 +#: ../../reference/compound_stmts.rst:1479 msgid ":pep:`3129` - Class Decorators" msgstr "" -#: ../../reference/compound_stmts.rst:1479 +#: ../../reference/compound_stmts.rst:1480 msgid "" "The proposal that added class decorators. Function and method decorators " "were introduced in :pep:`318`." msgstr "" -#: ../../reference/compound_stmts.rst:1486 +#: ../../reference/compound_stmts.rst:1487 msgid "Coroutines" msgstr "協程" -#: ../../reference/compound_stmts.rst:1494 +#: ../../reference/compound_stmts.rst:1495 msgid "Coroutine function definition" msgstr "" -#: ../../reference/compound_stmts.rst:1504 +#: ../../reference/compound_stmts.rst:1505 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " @@ -1665,104 +1673,104 @@ msgid "" "function." msgstr "" -#: ../../reference/compound_stmts.rst:1508 +#: ../../reference/compound_stmts.rst:1509 msgid "" "Functions defined with ``async def`` syntax are always coroutine functions, " "even if they do not contain ``await`` or ``async`` keywords." msgstr "" -#: ../../reference/compound_stmts.rst:1511 +#: ../../reference/compound_stmts.rst:1512 msgid "" "It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1514 +#: ../../reference/compound_stmts.rst:1515 msgid "An example of a coroutine function::" msgstr "一個協程韓式函式範例: ::" -#: ../../reference/compound_stmts.rst:1520 +#: ../../reference/compound_stmts.rst:1521 msgid "" "``await`` and ``async`` are now keywords; previously they were only treated " "as such inside the body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1528 +#: ../../reference/compound_stmts.rst:1529 msgid "The :keyword:`!async for` statement" msgstr "" -#: ../../reference/compound_stmts.rst:1533 +#: ../../reference/compound_stmts.rst:1534 msgid "" "An :term:`asynchronous iterable` provides an ``__aiter__`` method that " "directly returns an :term:`asynchronous iterator`, which can call " "asynchronous code in its ``__anext__`` method." msgstr "" -#: ../../reference/compound_stmts.rst:1537 +#: ../../reference/compound_stmts.rst:1538 msgid "" "The ``async for`` statement allows convenient iteration over asynchronous " "iterables." msgstr "" -#: ../../reference/compound_stmts.rst:1547 +#: ../../reference/compound_stmts.rst:1548 msgid "Is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1563 +#: ../../reference/compound_stmts.rst:1564 msgid "" "See also :meth:`~object.__aiter__` and :meth:`~object.__anext__` for details." msgstr "更多細節請見 :meth:`~object.__aiter__` 與 :meth:`~object.__anext__`。" -#: ../../reference/compound_stmts.rst:1565 +#: ../../reference/compound_stmts.rst:1566 msgid "" "It is a :exc:`SyntaxError` to use an ``async for`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1573 +#: ../../reference/compound_stmts.rst:1574 msgid "The :keyword:`!async with` statement" msgstr "" -#: ../../reference/compound_stmts.rst:1578 +#: ../../reference/compound_stmts.rst:1579 msgid "" "An :term:`asynchronous context manager` is a :term:`context manager` that is " "able to suspend execution in its *enter* and *exit* methods." msgstr "" -#: ../../reference/compound_stmts.rst:1605 +#: ../../reference/compound_stmts.rst:1606 msgid "" "See also :meth:`~object.__aenter__` and :meth:`~object.__aexit__` for " "details." msgstr "更多細節請見 :meth:`~object.__aenter__` 與 :meth:`~object.__aexit__`。" -#: ../../reference/compound_stmts.rst:1607 +#: ../../reference/compound_stmts.rst:1608 msgid "" "It is a :exc:`SyntaxError` to use an ``async with`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1612 +#: ../../reference/compound_stmts.rst:1613 msgid ":pep:`492` - Coroutines with async and await syntax" msgstr "" -#: ../../reference/compound_stmts.rst:1613 +#: ../../reference/compound_stmts.rst:1614 msgid "" "The proposal that made coroutines a proper standalone concept in Python, and " "added supporting syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1619 +#: ../../reference/compound_stmts.rst:1620 msgid "Type parameter lists" msgstr "" -#: ../../reference/compound_stmts.rst:1633 +#: ../../reference/compound_stmts.rst:1634 msgid "" ":ref:`Functions ` (including :ref:`coroutines `), :ref:" "`classes ` and :ref:`type aliases ` may contain a type " "parameter list::" msgstr "" -#: ../../reference/compound_stmts.rst:1652 +#: ../../reference/compound_stmts.rst:1653 msgid "" "Semantically, this indicates that the function, class, or type alias is " "generic over a type variable. This information is primarily used by static " @@ -1770,7 +1778,7 @@ msgid "" "generic counterparts." msgstr "" -#: ../../reference/compound_stmts.rst:1657 +#: ../../reference/compound_stmts.rst:1658 msgid "" "Type parameters are declared in square brackets (``[]``) immediately after " "the name of the function, class, or type alias. The type parameters are " @@ -1782,36 +1790,36 @@ msgid "" "wraps the creation of the generic object." msgstr "" -#: ../../reference/compound_stmts.rst:1666 +#: ../../reference/compound_stmts.rst:1667 msgid "" "Generic functions, classes, and type aliases have a :attr:`!__type_params__` " "attribute listing their type parameters." msgstr "" -#: ../../reference/compound_stmts.rst:1669 +#: ../../reference/compound_stmts.rst:1670 msgid "Type parameters come in three kinds:" msgstr "" -#: ../../reference/compound_stmts.rst:1671 +#: ../../reference/compound_stmts.rst:1672 msgid "" ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). " "Semantically, this represents a single type to a type checker." msgstr "" -#: ../../reference/compound_stmts.rst:1673 +#: ../../reference/compound_stmts.rst:1674 msgid "" ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single " "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any " "number of types." msgstr "" -#: ../../reference/compound_stmts.rst:1676 +#: ../../reference/compound_stmts.rst:1677 msgid "" ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks " "(e.g., ``**P``). Semantically, this stands for the parameters of a callable." msgstr "" -#: ../../reference/compound_stmts.rst:1679 +#: ../../reference/compound_stmts.rst:1680 msgid "" ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* " "with a colon (``:``) followed by an expression. A single expression after " @@ -1823,7 +1831,7 @@ msgid "" "variables can only take on one of the types in the list of constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1688 +#: ../../reference/compound_stmts.rst:1689 msgid "" "For :data:`!typing.TypeVar`\\ s declared using the type parameter list " "syntax, the bound and constraints are not evaluated when the generic object " @@ -1833,32 +1841,32 @@ msgid "" "`." msgstr "" -#: ../../reference/compound_stmts.rst:1694 +#: ../../reference/compound_stmts.rst:1695 msgid "" ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have " "bounds or constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1697 +#: ../../reference/compound_stmts.rst:1698 msgid "" "The following example indicates the full set of allowed type parameter " "declarations::" msgstr "" -#: ../../reference/compound_stmts.rst:1715 +#: ../../reference/compound_stmts.rst:1716 msgid "Generic functions" msgstr "" -#: ../../reference/compound_stmts.rst:1717 +#: ../../reference/compound_stmts.rst:1718 msgid "Generic functions are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1721 -#: ../../reference/compound_stmts.rst:1781 +#: ../../reference/compound_stmts.rst:1722 +#: ../../reference/compound_stmts.rst:1782 msgid "This syntax is equivalent to::" msgstr "語法大致等價於: ::" -#: ../../reference/compound_stmts.rst:1730 +#: ../../reference/compound_stmts.rst:1731 msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope `, which is not actually bound to any name at runtime. (One other " @@ -1867,47 +1875,47 @@ msgid "" "data:`typing.TypeVar` directly.)" msgstr "" -#: ../../reference/compound_stmts.rst:1736 +#: ../../reference/compound_stmts.rst:1737 msgid "" "The annotations of generic functions are evaluated within the annotation " "scope used for declaring the type parameters, but the function's defaults " "and decorators are not." msgstr "" -#: ../../reference/compound_stmts.rst:1740 +#: ../../reference/compound_stmts.rst:1741 msgid "" "The following example illustrates the scoping rules for these cases, as well " "as for additional flavors of type parameters::" msgstr "" -#: ../../reference/compound_stmts.rst:1747 +#: ../../reference/compound_stmts.rst:1748 msgid "" "Except for the :ref:`lazy evaluation ` of the :class:" "`~typing.TypeVar` bound, this is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1769 +#: ../../reference/compound_stmts.rst:1770 msgid "" "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at " "runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1775 +#: ../../reference/compound_stmts.rst:1776 msgid "Generic classes" msgstr "" -#: ../../reference/compound_stmts.rst:1777 +#: ../../reference/compound_stmts.rst:1778 msgid "Generic classes are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1791 +#: ../../reference/compound_stmts.rst:1792 msgid "" "Here again ``annotation-def`` (not a real keyword) indicates an :ref:" "`annotation scope `, and the name ``TYPE_PARAMS_OF_Bag`` " "is not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1795 +#: ../../reference/compound_stmts.rst:1796 msgid "" "Generic classes implicitly inherit from :data:`typing.Generic`. The base " "classes and keyword arguments of generic classes are evaluated within the " @@ -1915,125 +1923,125 @@ msgid "" "that scope. This is illustrated by this example::" msgstr "" -#: ../../reference/compound_stmts.rst:1804 +#: ../../reference/compound_stmts.rst:1805 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../reference/compound_stmts.rst:1817 +#: ../../reference/compound_stmts.rst:1818 msgid "Generic type aliases" msgstr "" -#: ../../reference/compound_stmts.rst:1819 +#: ../../reference/compound_stmts.rst:1820 msgid "" "The :keyword:`type` statement can also be used to create a generic type " "alias::" msgstr "" -#: ../../reference/compound_stmts.rst:1823 +#: ../../reference/compound_stmts.rst:1824 msgid "" "Except for the :ref:`lazy evaluation ` of the value, this " "is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1835 +#: ../../reference/compound_stmts.rst:1836 msgid "" "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation " "scope `. The capitalized names like " "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1840 +#: ../../reference/compound_stmts.rst:1841 msgid "Footnotes" msgstr "註解" -#: ../../reference/compound_stmts.rst:1841 +#: ../../reference/compound_stmts.rst:1842 msgid "" "The exception is propagated to the invocation stack unless there is a :" "keyword:`finally` clause which happens to raise another exception. That new " "exception causes the old one to be lost." msgstr "" -#: ../../reference/compound_stmts.rst:1845 +#: ../../reference/compound_stmts.rst:1846 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1847 +#: ../../reference/compound_stmts.rst:1848 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1848 +#: ../../reference/compound_stmts.rst:1849 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1849 +#: ../../reference/compound_stmts.rst:1850 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1850 -#: ../../reference/compound_stmts.rst:1869 +#: ../../reference/compound_stmts.rst:1851 +#: ../../reference/compound_stmts.rst:1870 msgid "a class that inherits from any of the above" msgstr "" -#: ../../reference/compound_stmts.rst:1852 +#: ../../reference/compound_stmts.rst:1853 msgid "The following standard library classes are sequences:" msgstr "" -#: ../../reference/compound_stmts.rst:1854 +#: ../../reference/compound_stmts.rst:1855 msgid ":class:`array.array`" msgstr ":class:`array.array`" -#: ../../reference/compound_stmts.rst:1855 +#: ../../reference/compound_stmts.rst:1856 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../reference/compound_stmts.rst:1857 +#: ../../reference/compound_stmts.rst:1858 msgid ":class:`memoryview`" msgstr ":class:`memoryview`" -#: ../../reference/compound_stmts.rst:1858 +#: ../../reference/compound_stmts.rst:1859 msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1861 +#: ../../reference/compound_stmts.rst:1862 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1864 +#: ../../reference/compound_stmts.rst:1865 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1866 +#: ../../reference/compound_stmts.rst:1867 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1867 +#: ../../reference/compound_stmts.rst:1868 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1868 +#: ../../reference/compound_stmts.rst:1869 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1871 +#: ../../reference/compound_stmts.rst:1872 msgid "" "The standard library classes :class:`dict` and :class:`types." "MappingProxyType` are mappings." msgstr "" -#: ../../reference/compound_stmts.rst:1874 +#: ../../reference/compound_stmts.rst:1875 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's :attr:`~function.__doc__` attribute and " "therefore the function's :term:`docstring`." msgstr "" -#: ../../reference/compound_stmts.rst:1878 +#: ../../reference/compound_stmts.rst:1879 msgid "" "A string literal appearing as the first statement in the class body is " "transformed into the namespace's ``__doc__`` item and therefore the class's :" @@ -2050,15 +2058,15 @@ msgstr "compound(複合)" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:169 #: ../../reference/compound_stmts.rst:207 -#: ../../reference/compound_stmts.rst:389 -#: ../../reference/compound_stmts.rst:436 -#: ../../reference/compound_stmts.rst:470 -#: ../../reference/compound_stmts.rst:587 -#: ../../reference/compound_stmts.rst:1194 -#: ../../reference/compound_stmts.rst:1380 -#: ../../reference/compound_stmts.rst:1490 -#: ../../reference/compound_stmts.rst:1524 -#: ../../reference/compound_stmts.rst:1569 +#: ../../reference/compound_stmts.rst:390 +#: ../../reference/compound_stmts.rst:437 +#: ../../reference/compound_stmts.rst:471 +#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1491 +#: ../../reference/compound_stmts.rst:1525 +#: ../../reference/compound_stmts.rst:1570 msgid "statement" msgstr "statement(陳述式)" @@ -2090,23 +2098,23 @@ msgstr "" #: ../../reference/compound_stmts.rst:111 #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:207 -#: ../../reference/compound_stmts.rst:389 +#: ../../reference/compound_stmts.rst:390 msgid "else" msgstr "else" -#: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:587 +#: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:588 msgid "if" msgstr "if" #: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:111 #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:207 -#: ../../reference/compound_stmts.rst:328 -#: ../../reference/compound_stmts.rst:389 -#: ../../reference/compound_stmts.rst:407 -#: ../../reference/compound_stmts.rst:470 -#: ../../reference/compound_stmts.rst:587 -#: ../../reference/compound_stmts.rst:1500 +#: ../../reference/compound_stmts.rst:327 +#: ../../reference/compound_stmts.rst:390 +#: ../../reference/compound_stmts.rst:408 +#: ../../reference/compound_stmts.rst:471 +#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:1501 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2117,21 +2125,21 @@ msgstr "elif" #: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:111 #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:207 -#: ../../reference/compound_stmts.rst:470 -#: ../../reference/compound_stmts.rst:587 -#: ../../reference/compound_stmts.rst:1194 -#: ../../reference/compound_stmts.rst:1321 -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:471 +#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1381 msgid ": (colon)" msgstr ": (冒號)" #: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:111 #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:207 -#: ../../reference/compound_stmts.rst:470 -#: ../../reference/compound_stmts.rst:587 -#: ../../reference/compound_stmts.rst:1194 -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:471 +#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1381 msgid "compound statement" msgstr "compound statement(複合陳述式)" @@ -2146,15 +2154,15 @@ msgstr "loop(迴圈)" #: ../../reference/compound_stmts.rst:129 #: ../../reference/compound_stmts.rst:169 -#: ../../reference/compound_stmts.rst:389 -#: ../../reference/compound_stmts.rst:436 +#: ../../reference/compound_stmts.rst:390 +#: ../../reference/compound_stmts.rst:437 msgid "break" msgstr "break" #: ../../reference/compound_stmts.rst:129 #: ../../reference/compound_stmts.rst:169 -#: ../../reference/compound_stmts.rst:389 -#: ../../reference/compound_stmts.rst:436 +#: ../../reference/compound_stmts.rst:390 +#: ../../reference/compound_stmts.rst:437 msgid "continue" msgstr "continue" @@ -2175,9 +2183,9 @@ msgid "list" msgstr "list(串列)" #: ../../reference/compound_stmts.rst:144 -#: ../../reference/compound_stmts.rst:299 -#: ../../reference/compound_stmts.rst:1194 -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:298 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1381 msgid "object" msgstr "object(物件)" @@ -2202,244 +2210,244 @@ msgid "except" msgstr "except" #: ../../reference/compound_stmts.rst:207 -#: ../../reference/compound_stmts.rst:407 +#: ../../reference/compound_stmts.rst:408 msgid "finally" msgstr "finally" #: ../../reference/compound_stmts.rst:207 -#: ../../reference/compound_stmts.rst:266 -#: ../../reference/compound_stmts.rst:470 -#: ../../reference/compound_stmts.rst:587 +#: ../../reference/compound_stmts.rst:265 +#: ../../reference/compound_stmts.rst:471 +#: ../../reference/compound_stmts.rst:588 msgid "as" msgstr "as" -#: ../../reference/compound_stmts.rst:266 +#: ../../reference/compound_stmts.rst:265 msgid "except clause" msgstr "except clause(例外子句)" -#: ../../reference/compound_stmts.rst:299 +#: ../../reference/compound_stmts.rst:298 msgid "module" msgstr "module(模組)" -#: ../../reference/compound_stmts.rst:299 +#: ../../reference/compound_stmts.rst:298 msgid "sys" msgstr "sys" -#: ../../reference/compound_stmts.rst:299 +#: ../../reference/compound_stmts.rst:298 msgid "traceback" msgstr "traceback" -#: ../../reference/compound_stmts.rst:328 +#: ../../reference/compound_stmts.rst:327 msgid "except_star" msgstr "except_star" -#: ../../reference/compound_stmts.rst:389 -#: ../../reference/compound_stmts.rst:436 +#: ../../reference/compound_stmts.rst:390 +#: ../../reference/compound_stmts.rst:437 msgid "return" msgstr "return (回傳)" -#: ../../reference/compound_stmts.rst:470 +#: ../../reference/compound_stmts.rst:471 msgid "with" msgstr "with" -#: ../../reference/compound_stmts.rst:470 +#: ../../reference/compound_stmts.rst:471 msgid "with statement" msgstr "with statement(with 陳述式)" -#: ../../reference/compound_stmts.rst:470 -#: ../../reference/compound_stmts.rst:1194 -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:471 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1381 msgid ", (comma)" msgstr ", (逗號)" -#: ../../reference/compound_stmts.rst:587 +#: ../../reference/compound_stmts.rst:588 msgid "match" msgstr "match" -#: ../../reference/compound_stmts.rst:587 +#: ../../reference/compound_stmts.rst:588 msgid "case" msgstr "case" -#: ../../reference/compound_stmts.rst:587 +#: ../../reference/compound_stmts.rst:588 msgid "pattern matching" msgstr "pattern matching(模式匹配)" -#: ../../reference/compound_stmts.rst:587 +#: ../../reference/compound_stmts.rst:588 msgid "match statement" msgstr "match statement(匹配陳述式)" -#: ../../reference/compound_stmts.rst:691 +#: ../../reference/compound_stmts.rst:692 msgid "guard" msgstr "guard" -#: ../../reference/compound_stmts.rst:730 +#: ../../reference/compound_stmts.rst:731 msgid "irrefutable case block" msgstr "" -#: ../../reference/compound_stmts.rst:730 +#: ../../reference/compound_stmts.rst:731 msgid "case block" msgstr "" -#: ../../reference/compound_stmts.rst:754 +#: ../../reference/compound_stmts.rst:755 msgid "! patterns" msgstr "" -#: ../../reference/compound_stmts.rst:754 +#: ../../reference/compound_stmts.rst:755 msgid "AS pattern, OR pattern, capture pattern, wildcard pattern" msgstr "" -#: ../../reference/compound_stmts.rst:1185 -#: ../../reference/compound_stmts.rst:1271 +#: ../../reference/compound_stmts.rst:1186 +#: ../../reference/compound_stmts.rst:1272 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/compound_stmts.rst:1185 -#: ../../reference/compound_stmts.rst:1194 -#: ../../reference/compound_stmts.rst:1235 -#: ../../reference/compound_stmts.rst:1271 -#: ../../reference/compound_stmts.rst:1300 +#: ../../reference/compound_stmts.rst:1186 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1236 +#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1301 msgid "function definition" msgstr "function definition(函式定義)" -#: ../../reference/compound_stmts.rst:1194 +#: ../../reference/compound_stmts.rst:1195 msgid "def" msgstr "def" -#: ../../reference/compound_stmts.rst:1194 -#: ../../reference/compound_stmts.rst:1321 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1322 msgid "function" msgstr "function (函式)" -#: ../../reference/compound_stmts.rst:1194 -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1381 msgid "definition" msgstr "definition(定義)" -#: ../../reference/compound_stmts.rst:1194 -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1381 msgid "name" msgstr "name(名稱)" -#: ../../reference/compound_stmts.rst:1194 -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1381 msgid "binding" msgstr "binding(綁定)" -#: ../../reference/compound_stmts.rst:1194 +#: ../../reference/compound_stmts.rst:1195 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/compound_stmts.rst:1194 -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1381 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../reference/compound_stmts.rst:1194 +#: ../../reference/compound_stmts.rst:1195 msgid "parameter list" msgstr "parameter list(參數列表)" -#: ../../reference/compound_stmts.rst:1235 -#: ../../reference/compound_stmts.rst:1430 +#: ../../reference/compound_stmts.rst:1236 +#: ../../reference/compound_stmts.rst:1431 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/compound_stmts.rst:1271 +#: ../../reference/compound_stmts.rst:1272 msgid "default" msgstr "default(預設)" -#: ../../reference/compound_stmts.rst:1271 +#: ../../reference/compound_stmts.rst:1272 msgid "value" msgstr "value(值)" -#: ../../reference/compound_stmts.rst:1271 +#: ../../reference/compound_stmts.rst:1272 msgid "argument" msgstr "argument(引數)" -#: ../../reference/compound_stmts.rst:1271 +#: ../../reference/compound_stmts.rst:1272 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/compound_stmts.rst:1300 +#: ../../reference/compound_stmts.rst:1301 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/compound_stmts.rst:1300 +#: ../../reference/compound_stmts.rst:1301 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/compound_stmts.rst:1300 +#: ../../reference/compound_stmts.rst:1301 msgid "**" msgstr "**" -#: ../../reference/compound_stmts.rst:1321 +#: ../../reference/compound_stmts.rst:1322 msgid "annotations" msgstr "annotations(註釋)" -#: ../../reference/compound_stmts.rst:1321 +#: ../../reference/compound_stmts.rst:1322 msgid "->" msgstr "->" -#: ../../reference/compound_stmts.rst:1321 +#: ../../reference/compound_stmts.rst:1322 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../reference/compound_stmts.rst:1339 +#: ../../reference/compound_stmts.rst:1340 msgid "lambda" msgstr "lambda" -#: ../../reference/compound_stmts.rst:1339 +#: ../../reference/compound_stmts.rst:1340 msgid "expression" msgstr "expression(運算式)" -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:1381 msgid "class" msgstr "class(類別)" -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:1381 msgid "execution" msgstr "execution(執行)" -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:1381 msgid "frame" msgstr "frame" -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:1381 msgid "inheritance" msgstr "inheritance(繼承)" -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:1381 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../reference/compound_stmts.rst:1380 -#: ../../reference/compound_stmts.rst:1430 +#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1431 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/compound_stmts.rst:1380 +#: ../../reference/compound_stmts.rst:1381 msgid "expression list" msgstr "expression list(表達式列表)" -#: ../../reference/compound_stmts.rst:1490 +#: ../../reference/compound_stmts.rst:1491 msgid "async def" msgstr "async def" -#: ../../reference/compound_stmts.rst:1500 +#: ../../reference/compound_stmts.rst:1501 msgid "async" msgstr "async" -#: ../../reference/compound_stmts.rst:1500 +#: ../../reference/compound_stmts.rst:1501 msgid "await" msgstr "await" -#: ../../reference/compound_stmts.rst:1524 +#: ../../reference/compound_stmts.rst:1525 msgid "async for" msgstr "async for" -#: ../../reference/compound_stmts.rst:1569 +#: ../../reference/compound_stmts.rst:1570 msgid "async with" msgstr "async with" -#: ../../reference/compound_stmts.rst:1623 +#: ../../reference/compound_stmts.rst:1624 msgid "type parameters" msgstr "type parameter(型別參數)" diff --git a/reference/datamodel.po b/reference/datamodel.po index 73f257f726..0b7331a85f 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-01 00:03+0000\n" +"POT-Creation-Date: 2024-06-27 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1847,17 +1847,19 @@ msgstr "" #: ../../reference/datamodel.rst:1644 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " -"that still exist when the interpreter exits." +"that still exist when the interpreter exits. :class:`weakref.finalize` " +"provides a straightforward way to register a cleanup function to be called " +"when an object is garbage collected." msgstr "" -#: ../../reference/datamodel.rst:1649 +#: ../../reference/datamodel.rst:1651 msgid "" "``del x`` doesn't directly call ``x.__del__()`` --- the former decrements " "the reference count for ``x`` by one, and the latter is only called when " "``x``'s reference count reaches zero." msgstr "" -#: ../../reference/datamodel.rst:1654 +#: ../../reference/datamodel.rst:1656 msgid "" "It is possible for a reference cycle to prevent the reference count of an " "object from going to zero. In this case, the cycle will be later detected " @@ -1868,18 +1870,18 @@ msgid "" "caught in the traceback." msgstr "" -#: ../../reference/datamodel.rst:1664 +#: ../../reference/datamodel.rst:1666 msgid "Documentation for the :mod:`gc` module." msgstr "" -#: ../../reference/datamodel.rst:1668 +#: ../../reference/datamodel.rst:1670 msgid "" "Due to the precarious circumstances under which :meth:`__del__` methods are " "invoked, exceptions that occur during their execution are ignored, and a " "warning is printed to ``sys.stderr`` instead. In particular:" msgstr "" -#: ../../reference/datamodel.rst:1672 +#: ../../reference/datamodel.rst:1674 msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " @@ -1888,7 +1890,7 @@ msgid "" "`__del__`." msgstr "" -#: ../../reference/datamodel.rst:1678 +#: ../../reference/datamodel.rst:1680 msgid "" ":meth:`__del__` can be executed during interpreter shutdown. As a " "consequence, the global variables it needs to access (including other " @@ -1899,7 +1901,7 @@ msgid "" "still available at the time when the :meth:`__del__` method is called." msgstr "" -#: ../../reference/datamodel.rst:1693 +#: ../../reference/datamodel.rst:1695 msgid "" "Called by the :func:`repr` built-in function to compute the \"official\" " "string representation of an object. If at all possible, this should look " @@ -1911,13 +1913,13 @@ msgid "" "an \"informal\" string representation of instances of that class is required." msgstr "" -#: ../../reference/datamodel.rst:1702 +#: ../../reference/datamodel.rst:1704 msgid "" "This is typically used for debugging, so it is important that the " "representation is information-rich and unambiguous." msgstr "" -#: ../../reference/datamodel.rst:1713 +#: ../../reference/datamodel.rst:1715 msgid "" "Called by :func:`str(object) ` and the built-in functions :func:" "`format` and :func:`print` to compute the \"informal\" or nicely printable " @@ -1925,26 +1927,26 @@ msgid "" "` object." msgstr "" -#: ../../reference/datamodel.rst:1718 +#: ../../reference/datamodel.rst:1720 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:1722 +#: ../../reference/datamodel.rst:1724 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:1732 +#: ../../reference/datamodel.rst:1734 msgid "" "Called by :ref:`bytes ` to compute a byte-string representation " "of an object. This should return a :class:`bytes` object." msgstr "" -#: ../../reference/datamodel.rst:1743 +#: ../../reference/datamodel.rst:1745 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals ` and the :meth:`str.format` " @@ -1956,28 +1958,28 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:1753 +#: ../../reference/datamodel.rst:1755 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:1755 +#: ../../reference/datamodel.rst:1757 msgid "The return value must be a string object." msgstr "" -#: ../../reference/datamodel.rst:1757 +#: ../../reference/datamodel.rst:1759 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:1761 +#: ../../reference/datamodel.rst:1763 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:1777 +#: ../../reference/datamodel.rst:1779 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " "between operator symbols and method names is as follows: ``x.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:1869 +#: ../../reference/datamodel.rst:1871 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " @@ -2103,7 +2105,7 @@ msgid "" "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:1878 +#: ../../reference/datamodel.rst:1880 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are " "\"salted\" with an unpredictable random value. Although they remain " @@ -2111,7 +2113,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:1883 +#: ../../reference/datamodel.rst:1885 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " @@ -2119,22 +2121,22 @@ msgid "" "advisories/ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:1888 +#: ../../reference/datamodel.rst:1890 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:1892 +#: ../../reference/datamodel.rst:1894 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`。" -#: ../../reference/datamodel.rst:1894 +#: ../../reference/datamodel.rst:1896 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:1902 +#: ../../reference/datamodel.rst:1904 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " @@ -2143,18 +2145,18 @@ msgid "" "meth:`!__len__` nor :meth:`!__bool__`, all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:1913 +#: ../../reference/datamodel.rst:1915 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:1915 +#: ../../reference/datamodel.rst:1917 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:1923 +#: ../../reference/datamodel.rst:1925 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " @@ -2164,7 +2166,7 @@ msgid "" "attribute value or raise an :exc:`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:1930 +#: ../../reference/datamodel.rst:1932 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" @@ -2177,7 +2179,7 @@ msgid "" "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:1943 +#: ../../reference/datamodel.rst:1945 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2189,14 +2191,14 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:1954 +#: ../../reference/datamodel.rst:1956 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions `. See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:1959 +#: ../../reference/datamodel.rst:1961 msgid "" "Raises an :ref:`auditing event ` ``object.__getattr__`` with " "arguments ``obj``, ``name``." @@ -2204,27 +2206,27 @@ msgstr "" "引發一個附帶引數 ``obj``、``name`` 的\\ :ref:`稽核事件 ` ``object." "__getattr__``。" -#: ../../reference/datamodel.rst:1961 +#: ../../reference/datamodel.rst:1963 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:1968 +#: ../../reference/datamodel.rst:1970 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:1972 +#: ../../reference/datamodel.rst:1974 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " "call the base class method with the same name, for example, ``object." "__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:1976 +#: ../../reference/datamodel.rst:1978 msgid "" "Raises an :ref:`auditing event ` ``object.__setattr__`` with " "arguments ``obj``, ``name``, ``value``." @@ -2232,21 +2234,21 @@ msgstr "" "引發一個附帶引數 ``obj``、``name``、``value`` 的\\ :ref:`稽核事件 " "` ``object.__setattr__``。" -#: ../../reference/datamodel.rst:1978 +#: ../../reference/datamodel.rst:1980 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:1985 +#: ../../reference/datamodel.rst:1987 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:1988 +#: ../../reference/datamodel.rst:1990 msgid "" "Raises an :ref:`auditing event ` ``object.__delattr__`` with " "arguments ``obj``, ``name``." @@ -2254,23 +2256,23 @@ msgstr "" "引發一個附帶引數 ``obj``、``name`` 的\\ :ref:`稽核事件 ` ``object." "__delattr__``。" -#: ../../reference/datamodel.rst:1990 +#: ../../reference/datamodel.rst:1992 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:1997 +#: ../../reference/datamodel.rst:1999 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:2002 +#: ../../reference/datamodel.rst:2004 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:2009 +#: ../../reference/datamodel.rst:2011 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " @@ -2282,21 +2284,21 @@ msgid "" "with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:2018 +#: ../../reference/datamodel.rst:2020 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:2022 +#: ../../reference/datamodel.rst:2024 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:2040 +#: ../../reference/datamodel.rst:2042 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -2304,27 +2306,27 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:2045 +#: ../../reference/datamodel.rst:2047 msgid "``__class__`` module attribute is now writable." msgstr "" -#: ../../reference/datamodel.rst:2048 +#: ../../reference/datamodel.rst:2050 msgid "``__getattr__`` and ``__dir__`` module attributes." msgstr "" -#: ../../reference/datamodel.rst:2053 +#: ../../reference/datamodel.rst:2055 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:2054 +#: ../../reference/datamodel.rst:2056 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:2060 +#: ../../reference/datamodel.rst:2062 msgid "Implementing Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2062 +#: ../../reference/datamodel.rst:2064 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " @@ -2334,7 +2336,7 @@ msgid "" "the owner class' :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:2072 +#: ../../reference/datamodel.rst:2074 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2343,13 +2345,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:2078 +#: ../../reference/datamodel.rst:2080 msgid "" "This method should return the computed attribute value or raise an :exc:" "`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:2081 +#: ../../reference/datamodel.rst:2083 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2359,31 +2361,31 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:2090 +#: ../../reference/datamodel.rst:2092 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:2093 +#: ../../reference/datamodel.rst:2095 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:2099 +#: ../../reference/datamodel.rst:2101 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:2101 +#: ../../reference/datamodel.rst:2103 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" -#: ../../reference/datamodel.rst:2106 +#: ../../reference/datamodel.rst:2108 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2394,11 +2396,11 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:2117 +#: ../../reference/datamodel.rst:2119 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2119 +#: ../../reference/datamodel.rst:2121 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " @@ -2407,7 +2409,7 @@ msgid "" "is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:2125 +#: ../../reference/datamodel.rst:2127 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2415,7 +2417,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:2130 +#: ../../reference/datamodel.rst:2132 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2423,54 +2425,54 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:2135 +#: ../../reference/datamodel.rst:2137 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:2138 +#: ../../reference/datamodel.rst:2140 msgid "Direct Call" msgstr "" -#: ../../reference/datamodel.rst:2139 +#: ../../reference/datamodel.rst:2141 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:2142 +#: ../../reference/datamodel.rst:2144 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:2143 +#: ../../reference/datamodel.rst:2145 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:2146 +#: ../../reference/datamodel.rst:2148 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:2147 +#: ../../reference/datamodel.rst:2149 msgid "" "If binding to a class, ``A.x`` is transformed into the call: ``A." "__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:2150 +#: ../../reference/datamodel.rst:2152 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:2151 +#: ../../reference/datamodel.rst:2153 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " "for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." "__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." msgstr "" -#: ../../reference/datamodel.rst:2188 +#: ../../reference/datamodel.rst:2190 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " @@ -2488,7 +2490,7 @@ msgid "" "instances." msgstr "" -#: ../../reference/datamodel.rst:2203 +#: ../../reference/datamodel.rst:2205 msgid "" "Python methods (including those decorated with :func:`@staticmethod " "` and :func:`@classmethod `) are implemented as " @@ -2497,30 +2499,30 @@ msgid "" "from other instances of the same class." msgstr "" -#: ../../reference/datamodel.rst:2209 +#: ../../reference/datamodel.rst:2211 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:2216 +#: ../../reference/datamodel.rst:2218 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:2218 +#: ../../reference/datamodel.rst:2220 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:2222 +#: ../../reference/datamodel.rst:2224 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:2227 +#: ../../reference/datamodel.rst:2229 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " @@ -2528,18 +2530,18 @@ msgid "" "`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:2236 +#: ../../reference/datamodel.rst:2238 msgid "Notes on using *__slots__*:" msgstr "" -#: ../../reference/datamodel.rst:2238 +#: ../../reference/datamodel.rst:2240 msgid "" "When inheriting from a class without *__slots__*, the :attr:`~object." "__dict__` and *__weakref__* attribute of the instances will always be " "accessible." msgstr "" -#: ../../reference/datamodel.rst:2242 +#: ../../reference/datamodel.rst:2244 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -2548,7 +2550,7 @@ msgid "" "sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2249 +#: ../../reference/datamodel.rst:2251 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references ` to its " @@ -2556,7 +2558,7 @@ msgid "" "to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2255 +#: ../../reference/datamodel.rst:2257 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "` for each variable name. As a result, class attributes cannot " @@ -2564,7 +2566,7 @@ msgid "" "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:2261 +#: ../../reference/datamodel.rst:2263 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " @@ -2573,7 +2575,7 @@ msgid "" "names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:2267 +#: ../../reference/datamodel.rst:2269 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -2582,7 +2584,7 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:2272 +#: ../../reference/datamodel.rst:2274 msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " @@ -2590,11 +2592,11 @@ msgid "" "`tuple`." msgstr "" -#: ../../reference/datamodel.rst:2277 +#: ../../reference/datamodel.rst:2279 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2279 +#: ../../reference/datamodel.rst:2281 msgid "" "If a :class:`dictionary ` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " @@ -2602,13 +2604,13 @@ msgid "" "func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" -#: ../../reference/datamodel.rst:2284 +#: ../../reference/datamodel.rst:2286 msgid "" ":attr:`~instance.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2287 +#: ../../reference/datamodel.rst:2289 msgid "" ":ref:`Multiple inheritance ` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " @@ -2616,18 +2618,18 @@ msgid "" "raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2293 +#: ../../reference/datamodel.rst:2295 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:2301 +#: ../../reference/datamodel.rst:2303 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:2303 +#: ../../reference/datamodel.rst:2305 msgid "" "Whenever a class inherits from another class, :meth:`~object." "__init_subclass__` is called on the parent class. This way, it is possible " @@ -2637,14 +2639,14 @@ msgid "" "future subclasses of the class defining the method." msgstr "" -#: ../../reference/datamodel.rst:2312 +#: ../../reference/datamodel.rst:2314 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:2316 +#: ../../reference/datamodel.rst:2318 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " @@ -2652,13 +2654,13 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:2330 +#: ../../reference/datamodel.rst:2332 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:2335 +#: ../../reference/datamodel.rst:2337 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -2666,41 +2668,41 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:2343 +#: ../../reference/datamodel.rst:2345 msgid "" "When a class is created, :meth:`type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:2348 +#: ../../reference/datamodel.rst:2350 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:2354 +#: ../../reference/datamodel.rst:2356 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:2365 +#: ../../reference/datamodel.rst:2367 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`。" -#: ../../reference/datamodel.rst:2373 +#: ../../reference/datamodel.rst:2375 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2380 +#: ../../reference/datamodel.rst:2382 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:2384 +#: ../../reference/datamodel.rst:2386 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -2708,41 +2710,41 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:2398 +#: ../../reference/datamodel.rst:2400 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:2401 +#: ../../reference/datamodel.rst:2403 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:2403 +#: ../../reference/datamodel.rst:2405 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:2404 +#: ../../reference/datamodel.rst:2406 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:2405 +#: ../../reference/datamodel.rst:2407 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:2406 +#: ../../reference/datamodel.rst:2408 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:2407 +#: ../../reference/datamodel.rst:2409 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:2411 +#: ../../reference/datamodel.rst:2413 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2415 +#: ../../reference/datamodel.rst:2417 msgid "" "If a base that appears in a class definition is not an instance of :class:" "`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " @@ -2754,59 +2756,59 @@ msgid "" "is ignored." msgstr "" -#: ../../reference/datamodel.rst:2426 +#: ../../reference/datamodel.rst:2428 msgid ":func:`types.resolve_bases`" msgstr ":func:`types.resolve_bases`" -#: ../../reference/datamodel.rst:2427 +#: ../../reference/datamodel.rst:2429 msgid "Dynamically resolve bases that are not instances of :class:`type`." msgstr "" -#: ../../reference/datamodel.rst:2429 +#: ../../reference/datamodel.rst:2431 msgid ":func:`types.get_original_bases`" msgstr ":func:`types.get_original_bases`" -#: ../../reference/datamodel.rst:2430 +#: ../../reference/datamodel.rst:2432 msgid "" "Retrieve a class's \"original bases\" prior to modifications by :meth:" "`~object.__mro_entries__`." msgstr "" -#: ../../reference/datamodel.rst:2433 +#: ../../reference/datamodel.rst:2435 msgid ":pep:`560`" msgstr ":pep:`560`" -#: ../../reference/datamodel.rst:2434 +#: ../../reference/datamodel.rst:2436 msgid "Core support for typing module and generic types." msgstr "" -#: ../../reference/datamodel.rst:2438 +#: ../../reference/datamodel.rst:2440 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2442 +#: ../../reference/datamodel.rst:2444 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2444 +#: ../../reference/datamodel.rst:2446 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2445 +#: ../../reference/datamodel.rst:2447 msgid "" "if an explicit metaclass is given and it is *not* an instance of :func:" "`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2447 +#: ../../reference/datamodel.rst:2449 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2450 +#: ../../reference/datamodel.rst:2452 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -2815,11 +2817,11 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2460 +#: ../../reference/datamodel.rst:2462 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2465 +#: ../../reference/datamodel.rst:2467 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -2831,25 +2833,25 @@ msgid "" "copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2474 +#: ../../reference/datamodel.rst:2476 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2479 +#: ../../reference/datamodel.rst:2481 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2480 +#: ../../reference/datamodel.rst:2482 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2484 +#: ../../reference/datamodel.rst:2486 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2489 +#: ../../reference/datamodel.rst:2491 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -2858,7 +2860,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2495 +#: ../../reference/datamodel.rst:2497 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -2867,11 +2869,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2504 +#: ../../reference/datamodel.rst:2506 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2511 +#: ../../reference/datamodel.rst:2513 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -2879,7 +2881,7 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2516 +#: ../../reference/datamodel.rst:2518 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " @@ -2890,7 +2892,7 @@ msgid "" "is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2526 +#: ../../reference/datamodel.rst:2528 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -2899,39 +2901,39 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2532 +#: ../../reference/datamodel.rst:2534 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2536 +#: ../../reference/datamodel.rst:2538 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2538 +#: ../../reference/datamodel.rst:2540 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2540 +#: ../../reference/datamodel.rst:2542 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2543 +#: ../../reference/datamodel.rst:2545 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2547 +#: ../../reference/datamodel.rst:2549 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " @@ -2939,19 +2941,19 @@ msgid "" "becomes the :attr:`~object.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2554 +#: ../../reference/datamodel.rst:2556 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2555 +#: ../../reference/datamodel.rst:2557 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2559 +#: ../../reference/datamodel.rst:2561 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2561 +#: ../../reference/datamodel.rst:2563 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -2959,17 +2961,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2568 +#: ../../reference/datamodel.rst:2570 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2570 +#: ../../reference/datamodel.rst:2572 msgid "" "The following methods are used to override the default behavior of the :func:" "`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2573 +#: ../../reference/datamodel.rst:2575 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -2977,21 +2979,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2580 +#: ../../reference/datamodel.rst:2582 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2587 +#: ../../reference/datamodel.rst:2589 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2592 +#: ../../reference/datamodel.rst:2594 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -2999,11 +3001,11 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2599 +#: ../../reference/datamodel.rst:2601 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2600 +#: ../../reference/datamodel.rst:2602 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" "`issubclass` behavior through :meth:`~class.__instancecheck__` and :meth:" @@ -3012,11 +3014,11 @@ msgid "" "language." msgstr "" -#: ../../reference/datamodel.rst:2608 +#: ../../reference/datamodel.rst:2610 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2610 +#: ../../reference/datamodel.rst:2612 msgid "" "When using :term:`type annotations`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -3024,65 +3026,65 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2617 +#: ../../reference/datamodel.rst:2619 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/datamodel.rst:2618 +#: ../../reference/datamodel.rst:2620 msgid "Introducing Python's framework for type annotations" msgstr "" -#: ../../reference/datamodel.rst:2620 +#: ../../reference/datamodel.rst:2622 msgid ":ref:`Generic Alias Types`" msgstr ":ref:`泛型別名型別 `" -#: ../../reference/datamodel.rst:2621 +#: ../../reference/datamodel.rst:2623 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2623 +#: ../../reference/datamodel.rst:2625 msgid "" ":ref:`Generics`, :ref:`user-defined generics` and :" "class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2624 +#: ../../reference/datamodel.rst:2626 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2627 +#: ../../reference/datamodel.rst:2629 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2632 +#: ../../reference/datamodel.rst:2634 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2635 +#: ../../reference/datamodel.rst:2637 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " "method. As such, there is no need for it to be decorated with :func:" "`@classmethod` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:2641 +#: ../../reference/datamodel.rst:2643 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2643 +#: ../../reference/datamodel.rst:2645 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints` to these classes." msgstr "" -#: ../../reference/datamodel.rst:2647 +#: ../../reference/datamodel.rst:2649 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -3091,7 +3093,7 @@ msgid "" "own implementation of ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2653 +#: ../../reference/datamodel.rst:2655 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -3099,11 +3101,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:2663 +#: ../../reference/datamodel.rst:2665 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2665 +#: ../../reference/datamodel.rst:2667 msgid "" "Usually, the :ref:`subscription` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -3113,14 +3115,14 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:2672 +#: ../../reference/datamodel.rst:2674 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " "follows something like the following process to decide whether :meth:" "`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" -#: ../../reference/datamodel.rst:2700 +#: ../../reference/datamodel.rst:2702 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " @@ -3130,40 +3132,40 @@ msgid "" "__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:2719 +#: ../../reference/datamodel.rst:2721 msgid "" "However, if a class has a custom metaclass that defines :meth:`~object." "__getitem__`, subscribing the class may result in different behaviour. An " "example of this can be found in the :mod:`enum` module::" msgstr "" -#: ../../reference/datamodel.rst:2742 +#: ../../reference/datamodel.rst:2744 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:2743 +#: ../../reference/datamodel.rst:2745 msgid "" "Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" "`subscription` results in ``__class_getitem__()`` being " "called instead of :meth:`~object.__getitem__`" msgstr "" -#: ../../reference/datamodel.rst:2751 +#: ../../reference/datamodel.rst:2753 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:2758 +#: ../../reference/datamodel.rst:2760 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " "arg1, ...)``." msgstr "" -#: ../../reference/datamodel.rst:2765 +#: ../../reference/datamodel.rst:2767 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:2767 +#: ../../reference/datamodel.rst:2769 msgid "" "The following methods can be defined to implement container objects. " "Containers usually are :term:`sequences ` (such as :class:`lists " @@ -3199,7 +3201,7 @@ msgid "" "should iterate through the values." msgstr "" -#: ../../reference/datamodel.rst:2808 +#: ../../reference/datamodel.rst:2810 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -3207,7 +3209,7 @@ msgid "" "returns zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:2815 +#: ../../reference/datamodel.rst:2817 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " "length is larger than :data:`!sys.maxsize` some features (such as :func:" @@ -3216,7 +3218,7 @@ msgid "" "`~object.__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:2824 +#: ../../reference/datamodel.rst:2826 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -3226,20 +3228,20 @@ msgid "" "never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:2838 +#: ../../reference/datamodel.rst:2840 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:2842 +#: ../../reference/datamodel.rst:2844 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:2846 +#: ../../reference/datamodel.rst:2848 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:2851 +#: ../../reference/datamodel.rst:2853 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " "the accepted keys should be integers. Optionally, they may support :class:" @@ -3251,20 +3253,20 @@ msgid "" "`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:2863 +#: ../../reference/datamodel.rst:2865 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:2868 +#: ../../reference/datamodel.rst:2870 msgid "" "When :ref:`subscripting` a *class*, the special class method :" "meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " "See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:2876 +#: ../../reference/datamodel.rst:2878 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3273,7 +3275,7 @@ msgid "" "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2885 +#: ../../reference/datamodel.rst:2887 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3282,13 +3284,13 @@ msgid "" "values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2894 +#: ../../reference/datamodel.rst:2896 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:2900 +#: ../../reference/datamodel.rst:2902 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -3296,14 +3298,14 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:2908 +#: ../../reference/datamodel.rst:2910 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:2912 +#: ../../reference/datamodel.rst:2914 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " "built-in will fall back to using the sequence protocol (:meth:`__len__` and :" @@ -3312,7 +3314,7 @@ msgid "" "more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:2919 +#: ../../reference/datamodel.rst:2921 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -3320,14 +3322,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:2926 +#: ../../reference/datamodel.rst:2928 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:2930 +#: ../../reference/datamodel.rst:2932 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -3335,11 +3337,11 @@ msgid "" "reference `." msgstr "" -#: ../../reference/datamodel.rst:2939 +#: ../../reference/datamodel.rst:2941 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:2941 +#: ../../reference/datamodel.rst:2943 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3347,7 +3349,7 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:2967 +#: ../../reference/datamodel.rst:2969 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3361,13 +3363,13 @@ msgid "" "function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:2978 +#: ../../reference/datamodel.rst:2980 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3001 +#: ../../reference/datamodel.rst:3003 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3380,13 +3382,13 @@ msgid "" "`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3013 +#: ../../reference/datamodel.rst:3015 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:3018 +#: ../../reference/datamodel.rst:3020 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -3395,7 +3397,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:3039 +#: ../../reference/datamodel.rst:3041 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3413,19 +3415,19 @@ msgid "" "data model." msgstr "" -#: ../../reference/datamodel.rst:3062 +#: ../../reference/datamodel.rst:3064 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:3075 +#: ../../reference/datamodel.rst:3077 msgid "" "Called to implement the built-in functions :func:`complex`, :func:`int` and :" "func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:3082 +#: ../../reference/datamodel.rst:3084 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3434,14 +3436,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:3088 +#: ../../reference/datamodel.rst:3090 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:3100 +#: ../../reference/datamodel.rst:3102 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3450,21 +3452,21 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:3106 +#: ../../reference/datamodel.rst:3108 msgid "" "The built-in function :func:`int` falls back to :meth:`__trunc__` if " "neither :meth:`__int__` nor :meth:`__index__` is defined." msgstr "" -#: ../../reference/datamodel.rst:3109 +#: ../../reference/datamodel.rst:3111 msgid "The delegation of :func:`int` to :meth:`__trunc__` is deprecated." msgstr "" -#: ../../reference/datamodel.rst:3116 +#: ../../reference/datamodel.rst:3118 msgid "With Statement Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3118 +#: ../../reference/datamodel.rst:3120 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -3474,32 +3476,32 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:3129 +#: ../../reference/datamodel.rst:3131 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:3132 +#: ../../reference/datamodel.rst:3134 msgid "" "For more information on context managers, see :ref:`typecontextmanager`." msgstr "" -#: ../../reference/datamodel.rst:3137 +#: ../../reference/datamodel.rst:3139 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:3144 +#: ../../reference/datamodel.rst:3146 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:3148 +#: ../../reference/datamodel.rst:3150 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -3507,27 +3509,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:3152 +#: ../../reference/datamodel.rst:3154 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:3158 +#: ../../reference/datamodel.rst:3160 msgid ":pep:`343` - The \"with\" statement" msgstr "" -#: ../../reference/datamodel.rst:3159 +#: ../../reference/datamodel.rst:3161 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3166 +#: ../../reference/datamodel.rst:3168 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:3168 +#: ../../reference/datamodel.rst:3170 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -3535,7 +3537,7 @@ msgid "" "pattern, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:3175 +#: ../../reference/datamodel.rst:3177 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -3544,7 +3546,7 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:3181 +#: ../../reference/datamodel.rst:3183 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -3554,19 +3556,19 @@ msgid "" "exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:3191 +#: ../../reference/datamodel.rst:3193 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:3192 +#: ../../reference/datamodel.rst:3194 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:3198 +#: ../../reference/datamodel.rst:3200 msgid "Emulating buffer types" msgstr "" -#: ../../reference/datamodel.rst:3200 +#: ../../reference/datamodel.rst:3202 msgid "" "The :ref:`buffer protocol ` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " @@ -3574,13 +3576,13 @@ msgid "" "and third-party libraries may define additional buffer types." msgstr "" -#: ../../reference/datamodel.rst:3205 +#: ../../reference/datamodel.rst:3207 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" -#: ../../reference/datamodel.rst:3210 +#: ../../reference/datamodel.rst:3212 msgid "" "Called when a buffer is requested from *self* (for example, by the :class:" "`memoryview` constructor). The *flags* argument is an integer representing " @@ -3590,7 +3592,7 @@ msgid "" "`memoryview` object." msgstr "" -#: ../../reference/datamodel.rst:3219 +#: ../../reference/datamodel.rst:3221 msgid "" "Called when a buffer is no longer needed. The *buffer* argument is a :class:" "`memoryview` object that was previously returned by :meth:`~object." @@ -3599,28 +3601,28 @@ msgid "" "to perform any cleanup are not required to implement this method." msgstr "" -#: ../../reference/datamodel.rst:3230 +#: ../../reference/datamodel.rst:3232 msgid ":pep:`688` - Making the buffer protocol accessible in Python" msgstr "" -#: ../../reference/datamodel.rst:3231 +#: ../../reference/datamodel.rst:3233 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3233 +#: ../../reference/datamodel.rst:3235 msgid ":class:`collections.abc.Buffer`" msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3234 +#: ../../reference/datamodel.rst:3236 msgid "ABC for buffer types." msgstr "" -#: ../../reference/datamodel.rst:3239 +#: ../../reference/datamodel.rst:3241 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:3241 +#: ../../reference/datamodel.rst:3243 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -3628,7 +3630,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:3256 +#: ../../reference/datamodel.rst:3258 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -3637,21 +3639,21 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:3270 +#: ../../reference/datamodel.rst:3272 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:3279 +#: ../../reference/datamodel.rst:3281 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" "meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:3305 +#: ../../reference/datamodel.rst:3307 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -3660,36 +3662,36 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:3316 +#: ../../reference/datamodel.rst:3318 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:3320 +#: ../../reference/datamodel.rst:3322 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:3322 +#: ../../reference/datamodel.rst:3324 msgid "" "An :term:`awaitable` object generally implements an :meth:`~object." "__await__` method. :term:`Coroutine objects ` returned from :" "keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:3328 +#: ../../reference/datamodel.rst:3330 msgid "" "The :term:`generator iterator` objects returned from generators decorated " "with :func:`types.coroutine` are also awaitable, but they do not implement :" "meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:3334 +#: ../../reference/datamodel.rst:3336 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " "method to be compatible with the :keyword:`await` expression." msgstr "" -#: ../../reference/datamodel.rst:3340 +#: ../../reference/datamodel.rst:3342 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " @@ -3697,15 +3699,15 @@ msgid "" "g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" -#: ../../reference/datamodel.rst:3348 +#: ../../reference/datamodel.rst:3350 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:3354 +#: ../../reference/datamodel.rst:3356 msgid "Coroutine Objects" msgstr "" -#: ../../reference/datamodel.rst:3356 +#: ../../reference/datamodel.rst:3358 msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " @@ -3716,18 +3718,18 @@ msgid "" "should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:3364 +#: ../../reference/datamodel.rst:3366 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:3368 +#: ../../reference/datamodel.rst:3370 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:3374 +#: ../../reference/datamodel.rst:3376 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`~object." @@ -3738,7 +3740,7 @@ msgid "" "value, described above." msgstr "" -#: ../../reference/datamodel.rst:3385 +#: ../../reference/datamodel.rst:3387 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -3749,13 +3751,13 @@ msgid "" "not caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:3396 +#: ../../reference/datamodel.rst:3398 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/datamodel.rst:3401 +#: ../../reference/datamodel.rst:3403 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -3765,99 +3767,99 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:3409 +#: ../../reference/datamodel.rst:3411 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:3415 +#: ../../reference/datamodel.rst:3417 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:3417 +#: ../../reference/datamodel.rst:3419 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:3420 +#: ../../reference/datamodel.rst:3422 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:3424 +#: ../../reference/datamodel.rst:3426 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:3428 +#: ../../reference/datamodel.rst:3430 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:3431 +#: ../../reference/datamodel.rst:3433 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:3448 +#: ../../reference/datamodel.rst:3450 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator `." msgstr "" -#: ../../reference/datamodel.rst:3453 +#: ../../reference/datamodel.rst:3455 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " "asynchronous iterator object. Returning anything else will result in a :exc:" "`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:3461 +#: ../../reference/datamodel.rst:3463 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3463 +#: ../../reference/datamodel.rst:3465 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3466 +#: ../../reference/datamodel.rst:3468 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3470 +#: ../../reference/datamodel.rst:3472 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3475 +#: ../../reference/datamodel.rst:3477 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3478 +#: ../../reference/datamodel.rst:3480 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3491 +#: ../../reference/datamodel.rst:3493 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3492 +#: ../../reference/datamodel.rst:3494 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3496 +#: ../../reference/datamodel.rst:3498 msgid "" "The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." "__reversed__`, and :meth:`~object.__contains__` methods have special " @@ -3865,7 +3867,7 @@ msgid "" "by relying on the behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3502 +#: ../../reference/datamodel.rst:3504 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " @@ -3873,7 +3875,7 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3508 +#: ../../reference/datamodel.rst:3510 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method -- such as :meth:`~object.__add__` -- fails then the overall " @@ -3896,7 +3898,7 @@ msgstr "" #: ../../reference/datamodel.rst:1007 ../../reference/datamodel.rst:1034 #: ../../reference/datamodel.rst:1096 ../../reference/datamodel.rst:1200 #: ../../reference/datamodel.rst:1307 ../../reference/datamodel.rst:1407 -#: ../../reference/datamodel.rst:1819 ../../reference/datamodel.rst:2834 +#: ../../reference/datamodel.rst:1821 ../../reference/datamodel.rst:2836 msgid "object" msgstr "object(物件)" @@ -3908,12 +3910,12 @@ msgstr "data(資料)" #: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:423 #: ../../reference/datamodel.rst:462 ../../reference/datamodel.rst:802 #: ../../reference/datamodel.rst:1053 ../../reference/datamodel.rst:1490 -#: ../../reference/datamodel.rst:1730 ../../reference/datamodel.rst:1735 -#: ../../reference/datamodel.rst:1819 ../../reference/datamodel.rst:2375 -#: ../../reference/datamodel.rst:2804 ../../reference/datamodel.rst:2962 -#: ../../reference/datamodel.rst:2997 ../../reference/datamodel.rst:3011 -#: ../../reference/datamodel.rst:3060 ../../reference/datamodel.rst:3070 -#: ../../reference/datamodel.rst:3098 +#: ../../reference/datamodel.rst:1732 ../../reference/datamodel.rst:1737 +#: ../../reference/datamodel.rst:1821 ../../reference/datamodel.rst:2377 +#: ../../reference/datamodel.rst:2806 ../../reference/datamodel.rst:2964 +#: ../../reference/datamodel.rst:2999 ../../reference/datamodel.rst:3013 +#: ../../reference/datamodel.rst:3062 ../../reference/datamodel.rst:3072 +#: ../../reference/datamodel.rst:3100 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -3922,7 +3924,7 @@ msgid "id" msgstr "id" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:122 -#: ../../reference/datamodel.rst:2375 +#: ../../reference/datamodel.rst:2377 msgid "type" msgstr "type(型別)" @@ -4046,12 +4048,12 @@ msgstr "number(數字)" msgid "Java" msgstr "Java" -#: ../../reference/datamodel.rst:279 ../../reference/datamodel.rst:3070 +#: ../../reference/datamodel.rst:279 ../../reference/datamodel.rst:3072 msgid "complex" msgstr "complex(複數)" #: ../../reference/datamodel.rst:292 ../../reference/datamodel.rst:423 -#: ../../reference/datamodel.rst:462 ../../reference/datamodel.rst:2804 +#: ../../reference/datamodel.rst:462 ../../reference/datamodel.rst:2806 msgid "len" msgstr "len" @@ -4084,8 +4086,8 @@ msgstr "immutable sequence(不可變序列)" msgid "immutable" msgstr "immutable(不可變)" -#: ../../reference/datamodel.rst:335 ../../reference/datamodel.rst:1705 -#: ../../reference/datamodel.rst:1735 +#: ../../reference/datamodel.rst:335 ../../reference/datamodel.rst:1707 +#: ../../reference/datamodel.rst:1737 msgid "string" msgstr "string(字串)" @@ -4121,7 +4123,7 @@ msgstr "singleton(單例)" msgid "empty" msgstr "empty(空的)" -#: ../../reference/datamodel.rst:372 ../../reference/datamodel.rst:1730 +#: ../../reference/datamodel.rst:372 ../../reference/datamodel.rst:1732 msgid "bytes" msgstr "bytes(位元組)" @@ -4144,7 +4146,7 @@ msgstr "assignment(賦值)" #: ../../reference/datamodel.rst:384 ../../reference/datamodel.rst:859 #: ../../reference/datamodel.rst:1444 ../../reference/datamodel.rst:1626 -#: ../../reference/datamodel.rst:3125 +#: ../../reference/datamodel.rst:3127 msgid "statement" msgstr "statement(陳述式)" @@ -4181,7 +4183,7 @@ msgid "mapping" msgstr "mapping(對映)" #: ../../reference/datamodel.rst:479 ../../reference/datamodel.rst:938 -#: ../../reference/datamodel.rst:1819 +#: ../../reference/datamodel.rst:1821 msgid "dictionary" msgstr "dictionary(字典)" @@ -4204,7 +4206,7 @@ msgid "function" msgstr "function (函式)" #: ../../reference/datamodel.rst:515 ../../reference/datamodel.rst:938 -#: ../../reference/datamodel.rst:961 ../../reference/datamodel.rst:2756 +#: ../../reference/datamodel.rst:961 ../../reference/datamodel.rst:2758 msgid "call" msgstr "call(呼叫)" @@ -4312,7 +4314,7 @@ msgstr "generator(產生器)" msgid "iterator" msgstr "itorator(疊代器)" -#: ../../reference/datamodel.rst:764 ../../reference/datamodel.rst:3312 +#: ../../reference/datamodel.rst:764 ../../reference/datamodel.rst:3314 msgid "coroutine" msgstr "coroutine(協程)" @@ -4358,7 +4360,7 @@ msgstr "__dict__ (模組屬性)" #: ../../reference/datamodel.rst:938 ../../reference/datamodel.rst:956 #: ../../reference/datamodel.rst:1007 ../../reference/datamodel.rst:1609 -#: ../../reference/datamodel.rst:2486 +#: ../../reference/datamodel.rst:2488 msgid "class" msgstr "class(類別)" @@ -4368,7 +4370,7 @@ msgid "class instance" msgstr "class instance(類別實例)" #: ../../reference/datamodel.rst:938 ../../reference/datamodel.rst:1007 -#: ../../reference/datamodel.rst:2756 +#: ../../reference/datamodel.rst:2758 msgid "instance" msgstr "instance(實例)" @@ -4656,7 +4658,7 @@ msgstr "try" msgid "tb_next (traceback attribute)" msgstr "tb_next (traceback 屬性)" -#: ../../reference/datamodel.rst:1490 ../../reference/datamodel.rst:2834 +#: ../../reference/datamodel.rst:1490 ../../reference/datamodel.rst:2836 msgid "slice" msgstr "slice(切片)" @@ -4708,127 +4710,127 @@ msgstr "finalizer(終結函式)" msgid "del" msgstr "del" -#: ../../reference/datamodel.rst:1688 +#: ../../reference/datamodel.rst:1690 msgid "repr() (built-in function)" msgstr "repr() (內建函式)" -#: ../../reference/datamodel.rst:1688 +#: ../../reference/datamodel.rst:1690 msgid "__repr__() (object method)" msgstr "__repr__() (物件方法)" -#: ../../reference/datamodel.rst:1705 +#: ../../reference/datamodel.rst:1707 msgid "__str__() (object method)" msgstr "__str__() (物件方法)" -#: ../../reference/datamodel.rst:1705 +#: ../../reference/datamodel.rst:1707 msgid "format() (built-in function)" msgstr "format() (內建函式)" -#: ../../reference/datamodel.rst:1705 +#: ../../reference/datamodel.rst:1707 msgid "print() (built-in function)" msgstr "print() (內建函式)" -#: ../../reference/datamodel.rst:1735 +#: ../../reference/datamodel.rst:1737 msgid "__format__() (object method)" msgstr "__format__() (物件方法)" -#: ../../reference/datamodel.rst:1735 +#: ../../reference/datamodel.rst:1737 msgid "conversion" msgstr "conversion" -#: ../../reference/datamodel.rst:1735 +#: ../../reference/datamodel.rst:1737 msgid "print" msgstr "print" -#: ../../reference/datamodel.rst:1774 +#: ../../reference/datamodel.rst:1776 msgid "comparisons" msgstr "comparison(比較)" -#: ../../reference/datamodel.rst:1819 +#: ../../reference/datamodel.rst:1821 msgid "hash" msgstr "hash(雜湊)" -#: ../../reference/datamodel.rst:1900 +#: ../../reference/datamodel.rst:1902 msgid "__len__() (mapping object method)" msgstr "__len__() (對映物件方法)" -#: ../../reference/datamodel.rst:2004 +#: ../../reference/datamodel.rst:2006 msgid "__getattr__ (module attribute)" msgstr "__getattr__ (模組屬性)" -#: ../../reference/datamodel.rst:2004 +#: ../../reference/datamodel.rst:2006 msgid "__dir__ (module attribute)" msgstr "__dir__ (模組屬性)" -#: ../../reference/datamodel.rst:2004 +#: ../../reference/datamodel.rst:2006 msgid "__class__ (module attribute)" msgstr "__class__ (模組屬性)" -#: ../../reference/datamodel.rst:2375 +#: ../../reference/datamodel.rst:2377 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../reference/datamodel.rst:2375 +#: ../../reference/datamodel.rst:2377 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/datamodel.rst:2375 +#: ../../reference/datamodel.rst:2377 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/datamodel.rst:2439 +#: ../../reference/datamodel.rst:2441 msgid "metaclass hint" msgstr "metaclass hint(元類別提示)" -#: ../../reference/datamodel.rst:2462 +#: ../../reference/datamodel.rst:2464 msgid "__prepare__ (metaclass method)" msgstr "__prepare__ (元類別方法)" -#: ../../reference/datamodel.rst:2486 +#: ../../reference/datamodel.rst:2488 msgid "body" msgstr "body" -#: ../../reference/datamodel.rst:2506 +#: ../../reference/datamodel.rst:2508 msgid "__class__ (method cell)" msgstr "__class__ (方法 cell)" -#: ../../reference/datamodel.rst:2506 +#: ../../reference/datamodel.rst:2508 msgid "__classcell__ (class namespace entry)" msgstr "__classcell__ (類別命名空間項目)" -#: ../../reference/datamodel.rst:2804 +#: ../../reference/datamodel.rst:2806 msgid "__bool__() (object method)" msgstr "__bool__() (物件方法)" -#: ../../reference/datamodel.rst:2962 ../../reference/datamodel.rst:2997 +#: ../../reference/datamodel.rst:2964 ../../reference/datamodel.rst:2999 msgid "divmod" msgstr "divmod" -#: ../../reference/datamodel.rst:2962 ../../reference/datamodel.rst:2997 -#: ../../reference/datamodel.rst:3011 +#: ../../reference/datamodel.rst:2964 ../../reference/datamodel.rst:2999 +#: ../../reference/datamodel.rst:3013 msgid "pow" msgstr "pow" -#: ../../reference/datamodel.rst:3060 +#: ../../reference/datamodel.rst:3062 msgid "abs" msgstr "abs" -#: ../../reference/datamodel.rst:3070 +#: ../../reference/datamodel.rst:3072 msgid "int" msgstr "int" -#: ../../reference/datamodel.rst:3070 +#: ../../reference/datamodel.rst:3072 msgid "float" msgstr "float" -#: ../../reference/datamodel.rst:3098 +#: ../../reference/datamodel.rst:3100 msgid "round" msgstr "round" -#: ../../reference/datamodel.rst:3125 +#: ../../reference/datamodel.rst:3127 msgid "with" msgstr "with" -#: ../../reference/datamodel.rst:3125 +#: ../../reference/datamodel.rst:3127 msgid "context manager" msgstr "context manager(情境管理器)" diff --git a/reference/expressions.po b/reference/expressions.po index 7c9ea7aec3..7f6fb4a506 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-18 00:04+0000\n" +"POT-Creation-Date: 2024-07-14 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -102,31 +102,86 @@ msgid "" "`NameError` exception." msgstr "" -#: ../../reference/expressions.rst:86 +#: ../../reference/expressions.rst:87 +msgid "Private name mangling" +msgstr "" + +#: ../../reference/expressions.rst:89 +msgid "" +"When an identifier that textually occurs in a class definition begins with " +"two or more underscore characters and does not end in two or more " +"underscores, it is considered a :dfn:`private name` of that class." +msgstr "" + +#: ../../reference/expressions.rst:95 +msgid "The :ref:`class specifications `." +msgstr "" + +#: ../../reference/expressions.rst:97 +msgid "" +"More precisely, private names are transformed to a longer form before code " +"is generated for them. If the transformed name is longer than 255 " +"characters, implementation-defined truncation may happen." +msgstr "" + +#: ../../reference/expressions.rst:101 +msgid "" +"The transformation is independent of the syntactical context in which the " +"identifier is used but only the following private identifiers are mangled:" +msgstr "" + +#: ../../reference/expressions.rst:104 +msgid "" +"Any name used as the name of a variable that is assigned or read or any name " +"of an attribute being accessed." +msgstr "" + +#: ../../reference/expressions.rst:107 +msgid "" +"The ``__name__`` attribute of nested functions, classes, and type aliases is " +"however not mangled." +msgstr "" + +#: ../../reference/expressions.rst:110 +msgid "" +"The name of imported modules, e.g., ``__spam`` in ``import __spam``. If the " +"module is part of a package (i.e., its name contains a dot), the name is " +"*not* mangled, e.g., the ``__foo`` in ``import __foo.bar`` is not mangled." +msgstr "" + +#: ../../reference/expressions.rst:115 +msgid "" +"The name of an imported member, e.g., ``__f`` in ``from spam import __f``." +msgstr "" + +#: ../../reference/expressions.rst:117 +msgid "The transformation rule is defined as follows:" +msgstr "" + +#: ../../reference/expressions.rst:119 msgid "" -"**Private name mangling:** When an identifier that textually occurs in a " -"class definition begins with two or more underscore characters and does not " -"end in two or more underscores, it is considered a :dfn:`private name` of " -"that class. Private names are transformed to a longer form before code is " -"generated for them. The transformation inserts the class name, with leading " -"underscores removed and a single underscore inserted, in front of the name. " -"For example, the identifier ``__spam`` occurring in a class named ``Ham`` " -"will be transformed to ``_Ham__spam``. This transformation is independent " -"of the syntactical context in which the identifier is used. If the " -"transformed name is extremely long (longer than 255 characters), " -"implementation defined truncation may happen. If the class name consists " -"only of underscores, no transformation is done." +"The class name, with leading underscores removed and a single leading " +"underscore inserted, is inserted in front of the identifier, e.g., the " +"identifier ``__spam`` occurring in a class named ``Foo``, ``_Foo`` or " +"``__Foo`` is transformed to ``_Foo__spam``." msgstr "" -#: ../../reference/expressions.rst:102 +#: ../../reference/expressions.rst:124 +msgid "" +"If the class name consists only of underscores, the transformation is the " +"identity, e.g., the identifier ``__spam`` occurring in a class named ``_`` " +"or ``__`` is left as is." +msgstr "" + +#: ../../reference/expressions.rst:131 msgid "Literals" msgstr "" -#: ../../reference/expressions.rst:106 +#: ../../reference/expressions.rst:135 msgid "Python supports string and bytes literals and various numeric literals:" msgstr "" -#: ../../reference/expressions.rst:112 +#: ../../reference/expressions.rst:141 msgid "" "Evaluation of a literal yields an object of the given type (string, bytes, " "integer, floating point number, complex number) with the given value. The " @@ -134,7 +189,7 @@ msgid "" "(complex) literals. See section :ref:`literals` for details." msgstr "" -#: ../../reference/expressions.rst:121 +#: ../../reference/expressions.rst:150 msgid "" "All literals correspond to immutable data types, and hence the object's " "identity is less important than its value. Multiple evaluations of literals " @@ -143,30 +198,30 @@ msgid "" "the same value." msgstr "" -#: ../../reference/expressions.rst:131 +#: ../../reference/expressions.rst:160 msgid "Parenthesized forms" msgstr "" -#: ../../reference/expressions.rst:137 +#: ../../reference/expressions.rst:166 msgid "" "A parenthesized form is an optional expression list enclosed in parentheses:" msgstr "" -#: ../../reference/expressions.rst:142 +#: ../../reference/expressions.rst:171 msgid "" "A parenthesized expression list yields whatever that expression list yields: " "if the list contains at least one comma, it yields a tuple; otherwise, it " "yields the single expression that makes up the expression list." msgstr "" -#: ../../reference/expressions.rst:148 +#: ../../reference/expressions.rst:177 msgid "" "An empty pair of parentheses yields an empty tuple object. Since tuples are " "immutable, the same rules as for literals apply (i.e., two occurrences of " "the empty tuple may or may not yield the same object)." msgstr "" -#: ../../reference/expressions.rst:156 +#: ../../reference/expressions.rst:185 msgid "" "Note that tuples are not formed by the parentheses, but rather by use of the " "comma. The exception is the empty tuple, for which parentheses *are* " @@ -174,31 +229,31 @@ msgid "" "ambiguities and allow common typos to pass uncaught." msgstr "" -#: ../../reference/expressions.rst:165 +#: ../../reference/expressions.rst:194 msgid "Displays for lists, sets and dictionaries" msgstr "" -#: ../../reference/expressions.rst:169 +#: ../../reference/expressions.rst:198 msgid "" "For constructing a list, a set or a dictionary Python provides special " "syntax called \"displays\", each of them in two flavors:" msgstr "" -#: ../../reference/expressions.rst:172 +#: ../../reference/expressions.rst:201 msgid "either the container contents are listed explicitly, or" msgstr "" -#: ../../reference/expressions.rst:174 +#: ../../reference/expressions.rst:203 msgid "" "they are computed via a set of looping and filtering instructions, called a :" "dfn:`comprehension`." msgstr "" -#: ../../reference/expressions.rst:182 +#: ../../reference/expressions.rst:211 msgid "Common syntax elements for comprehensions are:" msgstr "" -#: ../../reference/expressions.rst:190 +#: ../../reference/expressions.rst:219 msgid "" "The comprehension consists of a single expression followed by at least one :" "keyword:`!for` clause and zero or more :keyword:`!for` or :keyword:`!if` " @@ -208,7 +263,7 @@ msgid "" "expression to produce an element each time the innermost block is reached." msgstr "" -#: ../../reference/expressions.rst:197 +#: ../../reference/expressions.rst:226 msgid "" "However, aside from the iterable expression in the leftmost :keyword:`!for` " "clause, the comprehension is executed in a separate implicitly nested scope. " @@ -216,7 +271,7 @@ msgid "" "the enclosing scope." msgstr "" -#: ../../reference/expressions.rst:201 +#: ../../reference/expressions.rst:230 msgid "" "The iterable expression in the leftmost :keyword:`!for` clause is evaluated " "directly in the enclosing scope and then passed as an argument to the " @@ -226,52 +281,58 @@ msgid "" "iterable. For example: ``[x*y for x in range(10) for y in range(x, x+10)]``." msgstr "" -#: ../../reference/expressions.rst:208 +#: ../../reference/expressions.rst:237 msgid "" "To ensure the comprehension always results in a container of the appropriate " "type, ``yield`` and ``yield from`` expressions are prohibited in the " "implicitly nested scope." msgstr "" -#: ../../reference/expressions.rst:215 +#: ../../reference/expressions.rst:244 msgid "" "Since Python 3.6, in an :keyword:`async def` function, an :keyword:`!async " "for` clause may be used to iterate over a :term:`asynchronous iterator`. A " "comprehension in an :keyword:`!async def` function may consist of either a :" "keyword:`!for` or :keyword:`!async for` clause following the leading " "expression, may contain additional :keyword:`!for` or :keyword:`!async for` " -"clauses, and may also use :keyword:`await` expressions. If a comprehension " -"contains either :keyword:`!async for` clauses or :keyword:`!await` " -"expressions or other asynchronous comprehensions it is called an :dfn:" -"`asynchronous comprehension`. An asynchronous comprehension may suspend the " -"execution of the coroutine function in which it appears. See also :pep:`530`." +"clauses, and may also use :keyword:`await` expressions." +msgstr "" + +#: ../../reference/expressions.rst:251 +msgid "" +"If a comprehension contains :keyword:`!async for` clauses, or if it " +"contains :keyword:`!await` expressions or other asynchronous comprehensions " +"anywhere except the iterable expression in the leftmost :keyword:`!for` " +"clause, it is called an :dfn:`asynchronous comprehension`. An asynchronous " +"comprehension may suspend the execution of the coroutine function in which " +"it appears. See also :pep:`530`." msgstr "" -#: ../../reference/expressions.rst:227 +#: ../../reference/expressions.rst:258 msgid "Asynchronous comprehensions were introduced." msgstr "" -#: ../../reference/expressions.rst:230 ../../reference/expressions.rst:408 +#: ../../reference/expressions.rst:261 ../../reference/expressions.rst:439 msgid "``yield`` and ``yield from`` prohibited in the implicitly nested scope." msgstr "" -#: ../../reference/expressions.rst:233 +#: ../../reference/expressions.rst:264 msgid "" "Asynchronous comprehensions are now allowed inside comprehensions in " "asynchronous functions. Outer comprehensions implicitly become asynchronous." msgstr "" -#: ../../reference/expressions.rst:242 +#: ../../reference/expressions.rst:273 msgid "List displays" msgstr "" -#: ../../reference/expressions.rst:252 +#: ../../reference/expressions.rst:283 msgid "" "A list display is a possibly empty series of expressions enclosed in square " "brackets:" msgstr "" -#: ../../reference/expressions.rst:258 +#: ../../reference/expressions.rst:289 msgid "" "A list display yields a new list object, the contents being specified by " "either a list of expressions or a comprehension. When a comma-separated " @@ -281,17 +342,17 @@ msgid "" "comprehension." msgstr "" -#: ../../reference/expressions.rst:268 +#: ../../reference/expressions.rst:299 msgid "Set displays" msgstr "" -#: ../../reference/expressions.rst:277 +#: ../../reference/expressions.rst:308 msgid "" "A set display is denoted by curly braces and distinguishable from dictionary " "displays by the lack of colons separating keys and values:" msgstr "" -#: ../../reference/expressions.rst:283 +#: ../../reference/expressions.rst:314 msgid "" "A set display yields a new mutable set object, the contents being specified " "by either a sequence of expressions or a comprehension. When a comma-" @@ -301,27 +362,27 @@ msgid "" "comprehension." msgstr "" -#: ../../reference/expressions.rst:289 +#: ../../reference/expressions.rst:320 msgid "" "An empty set cannot be constructed with ``{}``; this literal constructs an " "empty dictionary." msgstr "" -#: ../../reference/expressions.rst:296 +#: ../../reference/expressions.rst:327 msgid "Dictionary displays" msgstr "" -#: ../../reference/expressions.rst:307 +#: ../../reference/expressions.rst:338 msgid "" "A dictionary display is a possibly empty series of dict items (key/value " "pairs) enclosed in curly braces:" msgstr "" -#: ../../reference/expressions.rst:316 +#: ../../reference/expressions.rst:347 msgid "A dictionary display yields a new dictionary object." msgstr "" -#: ../../reference/expressions.rst:318 +#: ../../reference/expressions.rst:349 msgid "" "If a comma-separated sequence of dict items is given, they are evaluated " "from left to right to define the entries of the dictionary: each key object " @@ -331,7 +392,7 @@ msgid "" "given." msgstr "" -#: ../../reference/expressions.rst:328 +#: ../../reference/expressions.rst:359 msgid "" "A double asterisk ``**`` denotes :dfn:`dictionary unpacking`. Its operand " "must be a :term:`mapping`. Each mapping item is added to the new " @@ -339,11 +400,11 @@ msgid "" "and earlier dictionary unpackings." msgstr "" -#: ../../reference/expressions.rst:333 +#: ../../reference/expressions.rst:364 msgid "Unpacking into dictionary displays, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:336 +#: ../../reference/expressions.rst:367 msgid "" "A dict comprehension, in contrast to list and set comprehensions, needs two " "expressions separated with a colon followed by the usual \"for\" and \"if\" " @@ -351,7 +412,7 @@ msgid "" "are inserted in the new dictionary in the order they are produced." msgstr "" -#: ../../reference/expressions.rst:344 +#: ../../reference/expressions.rst:375 msgid "" "Restrictions on the types of the key values are listed earlier in section :" "ref:`types`. (To summarize, the key type should be :term:`hashable`, which " @@ -360,7 +421,7 @@ msgid "" "given key value prevails." msgstr "" -#: ../../reference/expressions.rst:350 +#: ../../reference/expressions.rst:381 msgid "" "Prior to Python 3.8, in dict comprehensions, the evaluation order of key and " "value was not well-defined. In CPython, the value was evaluated before the " @@ -368,22 +429,22 @@ msgid "" "by :pep:`572`." msgstr "" -#: ../../reference/expressions.rst:360 +#: ../../reference/expressions.rst:391 msgid "Generator expressions" msgstr "" -#: ../../reference/expressions.rst:367 +#: ../../reference/expressions.rst:398 msgid "A generator expression is a compact generator notation in parentheses:" msgstr "" -#: ../../reference/expressions.rst:372 +#: ../../reference/expressions.rst:403 msgid "" "A generator expression yields a new generator object. Its syntax is the " "same as for comprehensions, except that it is enclosed in parentheses " "instead of brackets or curly braces." msgstr "" -#: ../../reference/expressions.rst:376 +#: ../../reference/expressions.rst:407 msgid "" "Variables used in the generator expression are evaluated lazily when the :" "meth:`~generator.__next__` method is called for the generator object (in the " @@ -397,20 +458,20 @@ msgid "" "``(x*y for x in range(10) for y in range(x, x+10))``." msgstr "" -#: ../../reference/expressions.rst:387 +#: ../../reference/expressions.rst:418 msgid "" "The parentheses can be omitted on calls with only one argument. See " "section :ref:`calls` for details." msgstr "" -#: ../../reference/expressions.rst:390 +#: ../../reference/expressions.rst:421 msgid "" "To avoid interfering with the expected operation of the generator expression " "itself, ``yield`` and ``yield from`` expressions are prohibited in the " "implicitly defined generator." msgstr "" -#: ../../reference/expressions.rst:394 +#: ../../reference/expressions.rst:425 msgid "" "If a generator expression contains either :keyword:`!async for` clauses or :" "keyword:`await` expressions it is called an :dfn:`asynchronous generator " @@ -419,22 +480,22 @@ msgid "" "`async-iterators`)." msgstr "" -#: ../../reference/expressions.rst:400 +#: ../../reference/expressions.rst:431 msgid "Asynchronous generator expressions were introduced." msgstr "" -#: ../../reference/expressions.rst:403 +#: ../../reference/expressions.rst:434 msgid "" "Prior to Python 3.7, asynchronous generator expressions could only appear " "in :keyword:`async def` coroutines. Starting with 3.7, any function can use " "asynchronous generator expressions." msgstr "" -#: ../../reference/expressions.rst:415 +#: ../../reference/expressions.rst:446 msgid "Yield expressions" msgstr "" -#: ../../reference/expressions.rst:428 +#: ../../reference/expressions.rst:459 msgid "" "The yield expression is used when defining a :term:`generator` function or " "an :term:`asynchronous generator` function and thus can only be used in the " @@ -444,27 +505,27 @@ msgid "" "asynchronous generator function. For example::" msgstr "" -#: ../../reference/expressions.rst:441 +#: ../../reference/expressions.rst:472 msgid "" "Due to their side effects on the containing scope, ``yield`` expressions are " "not permitted as part of the implicitly defined scopes used to implement " "comprehensions and generator expressions." msgstr "" -#: ../../reference/expressions.rst:445 +#: ../../reference/expressions.rst:476 msgid "" "Yield expressions prohibited in the implicitly nested scopes used to " "implement comprehensions and generator expressions." msgstr "" -#: ../../reference/expressions.rst:449 +#: ../../reference/expressions.rst:480 msgid "" "Generator functions are described below, while asynchronous generator " "functions are described separately in section :ref:`asynchronous-generator-" "functions`." msgstr "" -#: ../../reference/expressions.rst:453 +#: ../../reference/expressions.rst:484 msgid "" "When a generator function is called, it returns an iterator known as a " "generator. That generator then controls the execution of the generator " @@ -485,7 +546,7 @@ msgid "" "be the value passed in to that method." msgstr "" -#: ../../reference/expressions.rst:473 +#: ../../reference/expressions.rst:504 msgid "" "All of this makes generator functions quite similar to coroutines; they " "yield multiple times, they have more than one entry point and their " @@ -494,7 +555,7 @@ msgid "" "the control is always transferred to the generator's caller." msgstr "" -#: ../../reference/expressions.rst:479 +#: ../../reference/expressions.rst:510 msgid "" "Yield expressions are allowed anywhere in a :keyword:`try` construct. If " "the generator is not resumed before it is finalized (by reaching a zero " @@ -503,7 +564,7 @@ msgid "" "`finally` clauses to execute." msgstr "" -#: ../../reference/expressions.rst:488 +#: ../../reference/expressions.rst:519 msgid "" "When ``yield from `` is used, the supplied expression must be an " "iterable. The values produced by iterating that iterable are passed directly " @@ -515,7 +576,7 @@ msgid "" "will just raise the passed in exception immediately." msgstr "" -#: ../../reference/expressions.rst:497 +#: ../../reference/expressions.rst:528 msgid "" "When the underlying iterator is complete, the :attr:`~StopIteration.value` " "attribute of the raised :exc:`StopIteration` instance becomes the value of " @@ -524,73 +585,73 @@ msgid "" "returning a value from the subgenerator)." msgstr "" -#: ../../reference/expressions.rst:503 +#: ../../reference/expressions.rst:534 msgid "Added ``yield from `` to delegate control flow to a subiterator." msgstr "" -#: ../../reference/expressions.rst:506 +#: ../../reference/expressions.rst:537 msgid "" "The parentheses may be omitted when the yield expression is the sole " "expression on the right hand side of an assignment statement." msgstr "" -#: ../../reference/expressions.rst:511 +#: ../../reference/expressions.rst:542 msgid ":pep:`255` - Simple Generators" msgstr "" -#: ../../reference/expressions.rst:512 +#: ../../reference/expressions.rst:543 msgid "" "The proposal for adding generators and the :keyword:`yield` statement to " "Python." msgstr "" -#: ../../reference/expressions.rst:514 +#: ../../reference/expressions.rst:545 msgid ":pep:`342` - Coroutines via Enhanced Generators" msgstr "" -#: ../../reference/expressions.rst:515 +#: ../../reference/expressions.rst:546 msgid "" "The proposal to enhance the API and syntax of generators, making them usable " "as simple coroutines." msgstr "" -#: ../../reference/expressions.rst:518 +#: ../../reference/expressions.rst:549 msgid ":pep:`380` - Syntax for Delegating to a Subgenerator" msgstr "" -#: ../../reference/expressions.rst:519 +#: ../../reference/expressions.rst:550 msgid "" "The proposal to introduce the :token:`~python-grammar:yield_from` syntax, " "making delegation to subgenerators easy." msgstr "" -#: ../../reference/expressions.rst:522 +#: ../../reference/expressions.rst:553 msgid ":pep:`525` - Asynchronous Generators" msgstr "" -#: ../../reference/expressions.rst:523 +#: ../../reference/expressions.rst:554 msgid "" "The proposal that expanded on :pep:`492` by adding generator capabilities to " "coroutine functions." msgstr "" -#: ../../reference/expressions.rst:530 +#: ../../reference/expressions.rst:561 msgid "Generator-iterator methods" msgstr "" -#: ../../reference/expressions.rst:532 +#: ../../reference/expressions.rst:563 msgid "" "This subsection describes the methods of a generator iterator. They can be " "used to control the execution of a generator function." msgstr "" -#: ../../reference/expressions.rst:535 +#: ../../reference/expressions.rst:566 msgid "" "Note that calling any of the generator methods below when the generator is " "already executing raises a :exc:`ValueError` exception." msgstr "" -#: ../../reference/expressions.rst:543 +#: ../../reference/expressions.rst:574 msgid "" "Starts the execution of a generator function or resumes it at the last " "executed yield expression. When a generator function is resumed with a :" @@ -602,13 +663,13 @@ msgid "" "`StopIteration` exception is raised." msgstr "" -#: ../../reference/expressions.rst:552 +#: ../../reference/expressions.rst:583 msgid "" "This method is normally called implicitly, e.g. by a :keyword:`for` loop, or " "by the built-in :func:`next` function." msgstr "" -#: ../../reference/expressions.rst:558 +#: ../../reference/expressions.rst:589 msgid "" "Resumes the execution and \"sends\" a value into the generator function. " "The *value* argument becomes the result of the current yield expression. " @@ -619,7 +680,7 @@ msgid "" "expression that could receive the value." msgstr "" -#: ../../reference/expressions.rst:570 +#: ../../reference/expressions.rst:601 msgid "" "Raises an exception at the point where the generator was paused, and returns " "the next value yielded by the generator function. If the generator exits " @@ -628,13 +689,13 @@ msgid "" "a different exception, then that exception propagates to the caller." msgstr "" -#: ../../reference/expressions.rst:576 +#: ../../reference/expressions.rst:607 msgid "" "In typical use, this is called with a single exception instance similar to " "the way the :keyword:`raise` keyword is used." msgstr "" -#: ../../reference/expressions.rst:579 +#: ../../reference/expressions.rst:610 msgid "" "For backwards compatibility, however, the second signature is supported, " "following a convention from older versions of Python. The *type* argument " @@ -645,13 +706,13 @@ msgid "" "*value* may be cleared." msgstr "" -#: ../../reference/expressions.rst:590 ../../reference/expressions.rst:764 +#: ../../reference/expressions.rst:621 ../../reference/expressions.rst:795 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/expressions.rst:598 +#: ../../reference/expressions.rst:629 msgid "" "Raises a :exc:`GeneratorExit` at the point where the generator function was " "paused. If the generator function then exits gracefully, is already closed, " @@ -662,34 +723,34 @@ msgid "" "has already exited due to an exception or normal exit." msgstr "" -#: ../../reference/expressions.rst:609 +#: ../../reference/expressions.rst:640 msgid "Examples" msgstr "模組" -#: ../../reference/expressions.rst:611 +#: ../../reference/expressions.rst:642 msgid "" "Here is a simple example that demonstrates the behavior of generators and " "generator functions::" msgstr "" -#: ../../reference/expressions.rst:638 +#: ../../reference/expressions.rst:669 msgid "" "For examples using ``yield from``, see :ref:`pep-380` in \"What's New in " "Python.\"" msgstr "" -#: ../../reference/expressions.rst:644 +#: ../../reference/expressions.rst:675 msgid "Asynchronous generator functions" msgstr "" -#: ../../reference/expressions.rst:646 +#: ../../reference/expressions.rst:677 msgid "" "The presence of a yield expression in a function or method defined using :" "keyword:`async def` further defines the function as an :term:`asynchronous " "generator` function." msgstr "" -#: ../../reference/expressions.rst:650 +#: ../../reference/expressions.rst:681 msgid "" "When an asynchronous generator function is called, it returns an " "asynchronous iterator known as an asynchronous generator object. That object " @@ -699,7 +760,7 @@ msgid "" "keyword:`for` statement." msgstr "" -#: ../../reference/expressions.rst:657 +#: ../../reference/expressions.rst:688 msgid "" "Calling one of the asynchronous generator's methods returns an :term:" "`awaitable` object, and the execution starts when this object is awaited on. " @@ -718,7 +779,7 @@ msgid "" "method." msgstr "" -#: ../../reference/expressions.rst:672 +#: ../../reference/expressions.rst:703 msgid "" "If an asynchronous generator happens to exit early by :keyword:`break`, the " "caller task being cancelled, or other exceptions, the generator's async " @@ -730,7 +791,7 @@ msgid "" "generator and ultimately detach it from the event loop." msgstr "" -#: ../../reference/expressions.rst:682 +#: ../../reference/expressions.rst:713 msgid "" "In an asynchronous generator function, yield expressions are allowed " "anywhere in a :keyword:`try` construct. However, if an asynchronous " @@ -744,7 +805,7 @@ msgid "" "finally` clauses to execute." msgstr "" -#: ../../reference/expressions.rst:693 +#: ../../reference/expressions.rst:724 msgid "" "To take care of finalization upon event loop termination, an event loop " "should define a *finalizer* function which takes an asynchronous generator-" @@ -757,23 +818,23 @@ msgid "" "asyncio/base_events.py`." msgstr "" -#: ../../reference/expressions.rst:702 +#: ../../reference/expressions.rst:733 msgid "" "The expression ``yield from `` is a syntax error when used in an " "asynchronous generator function." msgstr "" -#: ../../reference/expressions.rst:709 +#: ../../reference/expressions.rst:740 msgid "Asynchronous generator-iterator methods" msgstr "" -#: ../../reference/expressions.rst:711 +#: ../../reference/expressions.rst:742 msgid "" "This subsection describes the methods of an asynchronous generator iterator, " "which are used to control the execution of a generator function." msgstr "" -#: ../../reference/expressions.rst:719 +#: ../../reference/expressions.rst:750 msgid "" "Returns an awaitable which when run starts to execute the asynchronous " "generator or resumes it at the last executed yield expression. When an " @@ -788,12 +849,12 @@ msgid "" "has completed." msgstr "" -#: ../../reference/expressions.rst:731 +#: ../../reference/expressions.rst:762 msgid "" "This method is normally called implicitly by a :keyword:`async for` loop." msgstr "" -#: ../../reference/expressions.rst:736 +#: ../../reference/expressions.rst:767 msgid "" "Returns an awaitable which when run resumes the execution of the " "asynchronous generator. As with the :meth:`~generator.send()` method for a " @@ -808,7 +869,7 @@ msgid "" "receive the value." msgstr "" -#: ../../reference/expressions.rst:752 +#: ../../reference/expressions.rst:783 msgid "" "Returns an awaitable that raises an exception of type ``type`` at the point " "where the asynchronous generator was paused, and returns the next value " @@ -820,7 +881,7 @@ msgid "" "that exception propagates to the caller of the awaitable." msgstr "" -#: ../../reference/expressions.rst:772 +#: ../../reference/expressions.rst:803 msgid "" "Returns an awaitable that when run will throw a :exc:`GeneratorExit` into " "the asynchronous generator function at the point where it was paused. If the " @@ -836,25 +897,25 @@ msgid "" "will return an awaitable that does nothing." msgstr "" -#: ../../reference/expressions.rst:788 +#: ../../reference/expressions.rst:819 msgid "Primaries" msgstr "" -#: ../../reference/expressions.rst:792 +#: ../../reference/expressions.rst:823 msgid "" "Primaries represent the most tightly bound operations of the language. Their " "syntax is:" msgstr "" -#: ../../reference/expressions.rst:802 +#: ../../reference/expressions.rst:833 msgid "Attribute references" msgstr "" -#: ../../reference/expressions.rst:808 +#: ../../reference/expressions.rst:839 msgid "An attribute reference is a primary followed by a period and a name:" msgstr "" -#: ../../reference/expressions.rst:818 +#: ../../reference/expressions.rst:849 msgid "" "The primary must evaluate to an object of a type that supports attribute " "references, which most objects do. This object is then asked to produce the " @@ -863,7 +924,7 @@ msgid "" "reference may yield different objects." msgstr "" -#: ../../reference/expressions.rst:824 +#: ../../reference/expressions.rst:855 msgid "" "This production can be customized by overriding the :meth:`~object." "__getattribute__` method or the :meth:`~object.__getattr__` method. The :" @@ -871,17 +932,17 @@ msgid "" "or raises :exc:`AttributeError` if the attribute is not available." msgstr "" -#: ../../reference/expressions.rst:830 +#: ../../reference/expressions.rst:861 msgid "" "If an :exc:`AttributeError` is raised and the object has a :meth:`!" "__getattr__` method, that method is called as a fallback." msgstr "" -#: ../../reference/expressions.rst:836 +#: ../../reference/expressions.rst:867 msgid "Subscriptions" msgstr "" -#: ../../reference/expressions.rst:851 +#: ../../reference/expressions.rst:882 msgid "" "The subscription of an instance of a :ref:`container class ` " "will generally select an element from the container. The subscription of a :" @@ -889,13 +950,13 @@ msgid "" "`GenericAlias ` object." msgstr "" -#: ../../reference/expressions.rst:859 +#: ../../reference/expressions.rst:890 msgid "" "When an object is subscripted, the interpreter will evaluate the primary and " "the expression list." msgstr "" -#: ../../reference/expressions.rst:862 +#: ../../reference/expressions.rst:893 msgid "" "The primary must evaluate to an object that supports subscription. An object " "may support subscription through defining one or both of :meth:`~object." @@ -905,20 +966,20 @@ msgid "" "called instead of ``__getitem__``, see :ref:`classgetitem-versus-getitem`." msgstr "" -#: ../../reference/expressions.rst:869 +#: ../../reference/expressions.rst:900 msgid "" "If the expression list contains at least one comma, it will evaluate to a :" "class:`tuple` containing the items of the expression list. Otherwise, the " "expression list will evaluate to the value of the list's sole member." msgstr "" -#: ../../reference/expressions.rst:873 +#: ../../reference/expressions.rst:904 msgid "" "For built-in objects, there are two types of objects that support " "subscription via :meth:`~object.__getitem__`:" msgstr "" -#: ../../reference/expressions.rst:876 +#: ../../reference/expressions.rst:907 msgid "" "Mappings. If the primary is a :term:`mapping`, the expression list must " "evaluate to an object whose value is one of the keys of the mapping, and the " @@ -926,7 +987,7 @@ msgid "" "An example of a builtin mapping class is the :class:`dict` class." msgstr "" -#: ../../reference/expressions.rst:880 +#: ../../reference/expressions.rst:911 msgid "" "Sequences. If the primary is a :term:`sequence`, the expression list must " "evaluate to an :class:`int` or a :class:`slice` (as discussed in the " @@ -934,7 +995,7 @@ msgid "" "`str`, :class:`list` and :class:`tuple` classes." msgstr "" -#: ../../reference/expressions.rst:885 +#: ../../reference/expressions.rst:916 msgid "" "The formal syntax makes no special provision for negative indices in :term:" "`sequences `. However, built-in sequences all provide a :meth:" @@ -948,25 +1009,25 @@ msgid "" "explicitly add that support." msgstr "" -#: ../../reference/expressions.rst:899 +#: ../../reference/expressions.rst:930 msgid "" "A :class:`string ` is a special kind of sequence whose items are " "*characters*. A character is not a separate data type but a string of " "exactly one character." msgstr "" -#: ../../reference/expressions.rst:907 +#: ../../reference/expressions.rst:938 msgid "Slicings" msgstr "" -#: ../../reference/expressions.rst:921 +#: ../../reference/expressions.rst:952 msgid "" "A slicing selects a range of items in a sequence object (e.g., a string, " "tuple or list). Slicings may be used as expressions or as targets in " "assignment or :keyword:`del` statements. The syntax for a slicing:" msgstr "" -#: ../../reference/expressions.rst:934 +#: ../../reference/expressions.rst:965 msgid "" "There is ambiguity in the formal syntax here: anything that looks like an " "expression list also looks like a slice list, so any subscription can be " @@ -976,7 +1037,7 @@ msgid "" "the case if the slice list contains no proper slice)." msgstr "" -#: ../../reference/expressions.rst:946 +#: ../../reference/expressions.rst:977 msgid "" "The semantics for a slicing are as follows. The primary is indexed (using " "the same :meth:`~object.__getitem__` method as normal subscription) with a " @@ -991,23 +1052,23 @@ msgid "" "missing expressions." msgstr "" -#: ../../reference/expressions.rst:970 +#: ../../reference/expressions.rst:1001 msgid "Calls" msgstr "" -#: ../../reference/expressions.rst:972 +#: ../../reference/expressions.rst:1003 msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments `:" msgstr "" -#: ../../reference/expressions.rst:989 +#: ../../reference/expressions.rst:1020 msgid "" "An optional trailing comma may be present after the positional and keyword " "arguments but does not affect the semantics." msgstr "" -#: ../../reference/expressions.rst:995 +#: ../../reference/expressions.rst:1026 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -1017,7 +1078,7 @@ msgid "" "formal :term:`parameter` lists." msgstr "" -#: ../../reference/expressions.rst:1003 +#: ../../reference/expressions.rst:1034 msgid "" "If keyword arguments are present, they are first converted to positional " "arguments, as follows. First, a list of unfilled slots is created for the " @@ -1038,7 +1099,7 @@ msgid "" "filled slots is used as the argument list for the call." msgstr "" -#: ../../reference/expressions.rst:1023 +#: ../../reference/expressions.rst:1054 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " @@ -1047,7 +1108,7 @@ msgid "" "`PyArg_ParseTuple` to parse their arguments." msgstr "" -#: ../../reference/expressions.rst:1029 +#: ../../reference/expressions.rst:1060 msgid "" "If there are more positional arguments than there are formal parameter " "slots, a :exc:`TypeError` exception is raised, unless a formal parameter " @@ -1056,7 +1117,7 @@ msgid "" "empty tuple if there were no excess positional arguments)." msgstr "" -#: ../../reference/expressions.rst:1035 +#: ../../reference/expressions.rst:1066 msgid "" "If any keyword argument does not correspond to a formal parameter name, a :" "exc:`TypeError` exception is raised, unless a formal parameter using the " @@ -1066,7 +1127,7 @@ msgid "" "(new) empty dictionary if there were no excess keyword arguments." msgstr "" -#: ../../reference/expressions.rst:1046 +#: ../../reference/expressions.rst:1077 msgid "" "If the syntax ``*expression`` appears in the function call, ``expression`` " "must evaluate to an :term:`iterable`. Elements from these iterables are " @@ -1076,20 +1137,20 @@ msgid "" "*y1*, ..., *yM*, *x3*, *x4*." msgstr "" -#: ../../reference/expressions.rst:1053 +#: ../../reference/expressions.rst:1084 msgid "" "A consequence of this is that although the ``*expression`` syntax may appear " "*after* explicit keyword arguments, it is processed *before* the keyword " "arguments (and any ``**expression`` arguments -- see below). So::" msgstr "" -#: ../../reference/expressions.rst:1069 +#: ../../reference/expressions.rst:1100 msgid "" "It is unusual for both keyword arguments and the ``*expression`` syntax to " "be used in the same call, so in practice this confusion does not often arise." msgstr "" -#: ../../reference/expressions.rst:1075 +#: ../../reference/expressions.rst:1106 msgid "" "If the syntax ``**expression`` appears in the function call, ``expression`` " "must evaluate to a :term:`mapping`, the contents of which are treated as " @@ -1098,7 +1159,7 @@ msgid "" "a :exc:`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1081 +#: ../../reference/expressions.rst:1112 msgid "" "When ``**expression`` is used, each key in this mapping must be a string. " "Each value from the mapping is assigned to the first formal parameter " @@ -1110,35 +1171,35 @@ msgid "" "is raised." msgstr "" -#: ../../reference/expressions.rst:1091 +#: ../../reference/expressions.rst:1122 msgid "" "Formal parameters using the syntax ``*identifier`` or ``**identifier`` " "cannot be used as positional argument slots or as keyword argument names." msgstr "" -#: ../../reference/expressions.rst:1094 +#: ../../reference/expressions.rst:1125 msgid "" "Function calls accept any number of ``*`` and ``**`` unpackings, positional " "arguments may follow iterable unpackings (``*``), and keyword arguments may " "follow dictionary unpackings (``**``). Originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1100 +#: ../../reference/expressions.rst:1131 msgid "" "A call always returns some value, possibly ``None``, unless it raises an " "exception. How this value is computed depends on the type of the callable " "object." msgstr "" -#: ../../reference/expressions.rst:1104 +#: ../../reference/expressions.rst:1135 msgid "If it is---" msgstr "" -#: ../../reference/expressions.rst:1106 +#: ../../reference/expressions.rst:1137 msgid "a user-defined function:" msgstr "" -#: ../../reference/expressions.rst:1113 +#: ../../reference/expressions.rst:1144 msgid "" "The code block for the function is executed, passing it the argument list. " "The first thing the code block will do is bind the formal parameters to the " @@ -1147,73 +1208,73 @@ msgid "" "value of the function call." msgstr "" -#: ../../reference/expressions.rst:1119 +#: ../../reference/expressions.rst:1150 msgid "a built-in function or method:" msgstr "" -#: ../../reference/expressions.rst:1130 +#: ../../reference/expressions.rst:1161 msgid "" "The result is up to the interpreter; see :ref:`built-in-funcs` for the " "descriptions of built-in functions and methods." msgstr "" -#: ../../reference/expressions.rst:1133 +#: ../../reference/expressions.rst:1164 msgid "a class object:" msgstr "" -#: ../../reference/expressions.rst:1138 +#: ../../reference/expressions.rst:1169 msgid "A new instance of that class is returned." msgstr "" -#: ../../reference/expressions.rst:1140 +#: ../../reference/expressions.rst:1171 msgid "a class instance method:" msgstr "" -#: ../../reference/expressions.rst:1146 +#: ../../reference/expressions.rst:1177 msgid "" "The corresponding user-defined function is called, with an argument list " "that is one longer than the argument list of the call: the instance becomes " "the first argument." msgstr "" -#: ../../reference/expressions.rst:1150 +#: ../../reference/expressions.rst:1181 msgid "a class instance:" msgstr "" -#: ../../reference/expressions.rst:1155 +#: ../../reference/expressions.rst:1186 msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" -#: ../../reference/expressions.rst:1163 ../../reference/expressions.rst:1946 +#: ../../reference/expressions.rst:1194 ../../reference/expressions.rst:1987 msgid "Await expression" msgstr "" -#: ../../reference/expressions.rst:1165 +#: ../../reference/expressions.rst:1196 msgid "" "Suspend the execution of :term:`coroutine` on an :term:`awaitable` object. " "Can only be used inside a :term:`coroutine function`." msgstr "" -#: ../../reference/expressions.rst:1177 +#: ../../reference/expressions.rst:1208 msgid "The power operator" msgstr "" -#: ../../reference/expressions.rst:1183 +#: ../../reference/expressions.rst:1214 msgid "" "The power operator binds more tightly than unary operators on its left; it " "binds less tightly than unary operators on its right. The syntax is:" msgstr "" -#: ../../reference/expressions.rst:1189 +#: ../../reference/expressions.rst:1220 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -#: ../../reference/expressions.rst:1193 +#: ../../reference/expressions.rst:1224 msgid "" "The power operator has the same semantics as the built-in :func:`pow` " "function, when called with two arguments: it yields its left argument raised " @@ -1221,7 +1282,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: ../../reference/expressions.rst:1198 +#: ../../reference/expressions.rst:1229 msgid "" "For int operands, the result has the same type as the operands unless the " "second argument is negative; in that case, all arguments are converted to " @@ -1229,41 +1290,41 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: ../../reference/expressions.rst:1203 +#: ../../reference/expressions.rst:1234 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " "Raising a negative number to a fractional power results in a :class:" "`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" msgstr "" -#: ../../reference/expressions.rst:1207 +#: ../../reference/expressions.rst:1238 msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " -"method." +"and :meth:`~object.__rpow__` methods." msgstr "" -#: ../../reference/expressions.rst:1212 +#: ../../reference/expressions.rst:1244 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1218 +#: ../../reference/expressions.rst:1250 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: ../../reference/expressions.rst:1229 +#: ../../reference/expressions.rst:1261 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" -#: ../../reference/expressions.rst:1237 +#: ../../reference/expressions.rst:1269 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" -#: ../../reference/expressions.rst:1244 +#: ../../reference/expressions.rst:1276 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " @@ -1271,17 +1332,17 @@ msgid "" "meth:`~object.__invert__` special method." msgstr "" -#: ../../reference/expressions.rst:1253 +#: ../../reference/expressions.rst:1285 msgid "" "In all three cases, if the argument does not have the proper type, a :exc:" "`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1260 +#: ../../reference/expressions.rst:1292 msgid "Binary arithmetic operations" msgstr "" -#: ../../reference/expressions.rst:1264 +#: ../../reference/expressions.rst:1296 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1289,7 +1350,7 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: ../../reference/expressions.rst:1279 +#: ../../reference/expressions.rst:1311 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " @@ -1299,19 +1360,25 @@ msgid "" "an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1285 +#: ../../reference/expressions.rst:1317 msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1292 +#: ../../reference/expressions.rst:1324 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: ../../reference/expressions.rst:1303 +#: ../../reference/expressions.rst:1327 +msgid "" +"This operation can be customized using the special :meth:`~object." +"__matmul__` and :meth:`~object.__rmatmul__` methods." +msgstr "" + +#: ../../reference/expressions.rst:1338 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1321,13 +1388,15 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: ../../reference/expressions.rst:1310 +#: ../../reference/expressions.rst:1345 msgid "" -"This operation can be customized using the special :meth:`~object." -"__truediv__` and :meth:`~object.__floordiv__` methods." +"The division operation can be customized using the special :meth:`~object." +"__truediv__` and :meth:`~object.__rtruediv__` methods. The floor division " +"operation can be customized using the special :meth:`~object.__floordiv__` " +"and :meth:`~object.__rfloordiv__` methods." msgstr "" -#: ../../reference/expressions.rst:1317 +#: ../../reference/expressions.rst:1354 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -1339,7 +1408,7 @@ msgid "" "absolute value of the second operand [#]_." msgstr "" -#: ../../reference/expressions.rst:1326 +#: ../../reference/expressions.rst:1363 msgid "" "The floor division and modulo operators are connected by the following " "identity: ``x == (x//y)*y + (x%y)``. Floor division and modulo are also " @@ -1347,7 +1416,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: ../../reference/expressions.rst:1331 +#: ../../reference/expressions.rst:1368 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1356,20 +1425,20 @@ msgid "" "formatting`." msgstr "" -#: ../../reference/expressions.rst:1336 +#: ../../reference/expressions.rst:1373 msgid "" "The *modulo* operation can be customized using the special :meth:`~object." -"__mod__` method." +"__mod__` and :meth:`~object.__rmod__` methods." msgstr "" -#: ../../reference/expressions.rst:1338 +#: ../../reference/expressions.rst:1376 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " "floating point number using the :func:`abs` function if appropriate." msgstr "" -#: ../../reference/expressions.rst:1347 +#: ../../reference/expressions.rst:1385 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " @@ -1377,85 +1446,87 @@ msgid "" "then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1352 +#: ../../reference/expressions.rst:1390 msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" -#: ../../reference/expressions.rst:1360 +#: ../../reference/expressions.rst:1398 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common type." msgstr "" -#: ../../reference/expressions.rst:1363 +#: ../../reference/expressions.rst:1401 msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " -"method." +"and :meth:`~object.__rsub__` methods." msgstr "" -#: ../../reference/expressions.rst:1369 +#: ../../reference/expressions.rst:1408 msgid "Shifting operations" msgstr "" -#: ../../reference/expressions.rst:1376 +#: ../../reference/expressions.rst:1415 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: ../../reference/expressions.rst:1381 +#: ../../reference/expressions.rst:1420 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -#: ../../reference/expressions.rst:1384 +#: ../../reference/expressions.rst:1423 msgid "" -"This operation can be customized using the special :meth:`~object." -"__lshift__` and :meth:`~object.__rshift__` methods." +"The left shift operation can be customized using the special :meth:`~object." +"__lshift__` and :meth:`~object.__rlshift__` methods. The right shift " +"operation can be customized using the special :meth:`~object.__rshift__` " +"and :meth:`~object.__rrshift__` methods." msgstr "" -#: ../../reference/expressions.rst:1389 +#: ../../reference/expressions.rst:1430 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -#: ../../reference/expressions.rst:1396 +#: ../../reference/expressions.rst:1437 msgid "Binary bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1400 +#: ../../reference/expressions.rst:1441 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: ../../reference/expressions.rst:1411 +#: ../../reference/expressions.rst:1452 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " "integers or one of them must be a custom object overriding :meth:`~object." "__and__` or :meth:`~object.__rand__` special methods." msgstr "" -#: ../../reference/expressions.rst:1420 +#: ../../reference/expressions.rst:1461 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " "which must be integers or one of them must be a custom object overriding :" "meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." msgstr "" -#: ../../reference/expressions.rst:1429 +#: ../../reference/expressions.rst:1470 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " "must be integers or one of them must be a custom object overriding :meth:" "`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" -#: ../../reference/expressions.rst:1437 +#: ../../reference/expressions.rst:1478 msgid "Comparisons" msgstr "" -#: ../../reference/expressions.rst:1449 +#: ../../reference/expressions.rst:1490 msgid "" "Unlike C, all comparison operations in Python have the same priority, which " "is lower than that of any arithmetic, shifting or bitwise operation. Also " @@ -1463,14 +1534,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: ../../reference/expressions.rst:1459 +#: ../../reference/expressions.rst:1500 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -#: ../../reference/expressions.rst:1465 +#: ../../reference/expressions.rst:1506 msgid "" "Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent " "to ``x < y and y <= z``, except that ``y`` is evaluated only once (but in " @@ -1478,7 +1549,7 @@ msgid "" "false)." msgstr "" -#: ../../reference/expressions.rst:1469 +#: ../../reference/expressions.rst:1510 msgid "" "Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, " "*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN " @@ -1486,24 +1557,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: ../../reference/expressions.rst:1474 +#: ../../reference/expressions.rst:1515 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -#: ../../reference/expressions.rst:1481 +#: ../../reference/expressions.rst:1522 msgid "Value comparisons" msgstr "" -#: ../../reference/expressions.rst:1483 +#: ../../reference/expressions.rst:1524 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: ../../reference/expressions.rst:1486 +#: ../../reference/expressions.rst:1527 msgid "" "Chapter :ref:`objects` states that objects have a value (in addition to type " "and identity). The value of an object is a rather abstract notion in " @@ -1515,7 +1586,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: ../../reference/expressions.rst:1495 +#: ../../reference/expressions.rst:1536 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1523,7 +1594,7 @@ msgid "" "methods` like :meth:`~object.__lt__`, described in :ref:`customization`." msgstr "" -#: ../../reference/expressions.rst:1501 +#: ../../reference/expressions.rst:1542 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1533,14 +1604,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: ../../reference/expressions.rst:1508 +#: ../../reference/expressions.rst:1549 msgid "" "A default order comparison (``<``, ``>``, ``<=``, and ``>=``) is not " "provided; an attempt raises :exc:`TypeError`. A motivation for this default " "behavior is the lack of a similar invariant as for equality." msgstr "" -#: ../../reference/expressions.rst:1512 +#: ../../reference/expressions.rst:1553 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1549,13 +1620,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: ../../reference/expressions.rst:1518 +#: ../../reference/expressions.rst:1559 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: ../../reference/expressions.rst:1521 +#: ../../reference/expressions.rst:1562 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1565,7 +1636,7 @@ msgid "" "of precision." msgstr "" -#: ../../reference/expressions.rst:1528 +#: ../../reference/expressions.rst:1569 msgid "" "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are " "special. Any ordered comparison of a number to a not-a-number value is " @@ -1575,32 +1646,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: ../../reference/expressions.rst:1535 +#: ../../reference/expressions.rst:1576 msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -#: ../../reference/expressions.rst:1539 +#: ../../reference/expressions.rst:1580 msgid "" "Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be " "compared within and across their types. They compare lexicographically " "using the numeric values of their elements." msgstr "" -#: ../../reference/expressions.rst:1543 +#: ../../reference/expressions.rst:1584 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " "numerical Unicode code points (the result of the built-in function :func:" "`ord`) of their characters. [#]_" msgstr "" -#: ../../reference/expressions.rst:1547 +#: ../../reference/expressions.rst:1588 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: ../../reference/expressions.rst:1549 +#: ../../reference/expressions.rst:1590 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1609,7 +1680,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1555 +#: ../../reference/expressions.rst:1596 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1617,19 +1688,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: ../../reference/expressions.rst:1560 +#: ../../reference/expressions.rst:1601 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: ../../reference/expressions.rst:1562 +#: ../../reference/expressions.rst:1603 msgid "" "For two collections to compare equal, they must be of the same type, have " "the same length, and each pair of corresponding elements must compare equal " "(for example, ``[1,2] == (1,2)`` is false because the type is not the same)." msgstr "" -#: ../../reference/expressions.rst:1567 +#: ../../reference/expressions.rst:1608 msgid "" "Collections that support order comparison are ordered the same as their " "first unequal elements (for example, ``[1,2,x] <= [1,2,y]`` has the same " @@ -1638,25 +1709,25 @@ msgid "" "true)." msgstr "" -#: ../../reference/expressions.rst:1573 +#: ../../reference/expressions.rst:1614 msgid "" "Mappings (instances of :class:`dict`) compare equal if and only if they have " "equal ``(key, value)`` pairs. Equality comparison of the keys and values " "enforces reflexivity." msgstr "" -#: ../../reference/expressions.rst:1577 +#: ../../reference/expressions.rst:1618 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1579 +#: ../../reference/expressions.rst:1620 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: ../../reference/expressions.rst:1582 +#: ../../reference/expressions.rst:1623 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " @@ -1667,110 +1738,110 @@ msgid "" "sets as inputs)." msgstr "" -#: ../../reference/expressions.rst:1590 +#: ../../reference/expressions.rst:1631 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: ../../reference/expressions.rst:1592 +#: ../../reference/expressions.rst:1633 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: ../../reference/expressions.rst:1595 +#: ../../reference/expressions.rst:1636 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: ../../reference/expressions.rst:1598 +#: ../../reference/expressions.rst:1639 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: ../../reference/expressions.rst:1601 +#: ../../reference/expressions.rst:1642 msgid "``x is y`` implies ``x == y``" msgstr "" -#: ../../reference/expressions.rst:1603 +#: ../../reference/expressions.rst:1644 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1606 +#: ../../reference/expressions.rst:1647 msgid "``x == y`` and ``y == x``" msgstr "``x == y`` 和 ``y == x``" -#: ../../reference/expressions.rst:1608 +#: ../../reference/expressions.rst:1649 msgid "``x != y`` and ``y != x``" msgstr "``x != y`` 和 ``y != x``" -#: ../../reference/expressions.rst:1610 +#: ../../reference/expressions.rst:1651 msgid "``x < y`` and ``y > x``" msgstr "``x < y`` 和 ``y > x``" -#: ../../reference/expressions.rst:1612 +#: ../../reference/expressions.rst:1653 msgid "``x <= y`` and ``y >= x``" msgstr "``x <= y`` 和 ``y >= x``" -#: ../../reference/expressions.rst:1614 +#: ../../reference/expressions.rst:1655 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: ../../reference/expressions.rst:1617 +#: ../../reference/expressions.rst:1658 msgid "``x > y and y > z`` implies ``x > z``" msgstr "``x > y and y > z`` 暗示了 ``x > z``" -#: ../../reference/expressions.rst:1619 +#: ../../reference/expressions.rst:1660 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "``x < y and y <= z`` 暗示了 ``x < z``" -#: ../../reference/expressions.rst:1621 +#: ../../reference/expressions.rst:1662 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1624 +#: ../../reference/expressions.rst:1665 msgid "``x == y`` and ``not x != y``" msgstr "``x == y`` 和 ``not x != y``" -#: ../../reference/expressions.rst:1626 +#: ../../reference/expressions.rst:1667 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1628 +#: ../../reference/expressions.rst:1669 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1630 +#: ../../reference/expressions.rst:1671 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " "sequences, but not to sets or mappings). See also the :func:`~functools." "total_ordering` decorator." msgstr "" -#: ../../reference/expressions.rst:1634 +#: ../../reference/expressions.rst:1675 msgid "" "The :func:`hash` result should be consistent with equality. Objects that are " "equal should either have the same hash value, or be marked as unhashable." msgstr "" -#: ../../reference/expressions.rst:1638 +#: ../../reference/expressions.rst:1679 msgid "" "Python does not enforce these consistency rules. In fact, the not-a-number " "values are an example for not following these rules." msgstr "" -#: ../../reference/expressions.rst:1647 +#: ../../reference/expressions.rst:1688 msgid "Membership test operations" msgstr "" -#: ../../reference/expressions.rst:1649 +#: ../../reference/expressions.rst:1690 msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " @@ -1781,7 +1852,7 @@ msgid "" "expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." msgstr "" -#: ../../reference/expressions.rst:1657 +#: ../../reference/expressions.rst:1698 msgid "" "For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is " "a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty " @@ -1789,14 +1860,14 @@ msgid "" "``\"\" in \"abc\"`` will return ``True``." msgstr "" -#: ../../reference/expressions.rst:1662 +#: ../../reference/expressions.rst:1703 msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1666 +#: ../../reference/expressions.rst:1707 msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -1805,7 +1876,7 @@ msgid "" "it is as if :keyword:`in` raised that exception." msgstr "" -#: ../../reference/expressions.rst:1672 +#: ../../reference/expressions.rst:1713 msgid "" "Lastly, the old-style iteration protocol is tried: if a class defines :meth:" "`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" @@ -1814,17 +1885,17 @@ msgid "" "exception is raised, it is as if :keyword:`in` raised that exception)." msgstr "" -#: ../../reference/expressions.rst:1684 +#: ../../reference/expressions.rst:1725 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: ../../reference/expressions.rst:1697 +#: ../../reference/expressions.rst:1738 msgid "Identity comparisons" msgstr "" -#: ../../reference/expressions.rst:1699 +#: ../../reference/expressions.rst:1740 msgid "" "The operators :keyword:`is` and :keyword:`is not` test for an object's " "identity: ``x is y`` is true if and only if *x* and *y* are the same " @@ -1832,11 +1903,11 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: ../../reference/expressions.rst:1711 +#: ../../reference/expressions.rst:1752 msgid "Boolean operations" msgstr "" -#: ../../reference/expressions.rst:1722 +#: ../../reference/expressions.rst:1763 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " @@ -1847,25 +1918,25 @@ msgid "" "__bool__` method." msgstr "" -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:1772 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1736 +#: ../../reference/expressions.rst:1777 msgid "" "The expression ``x and y`` first evaluates *x*; if *x* is false, its value " "is returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1741 +#: ../../reference/expressions.rst:1782 msgid "" "The expression ``x or y`` first evaluates *x*; if *x* is true, its value is " "returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1744 +#: ../../reference/expressions.rst:1785 msgid "" "Note that neither :keyword:`and` nor :keyword:`or` restrict the value and " "type they return to ``False`` and ``True``, but rather return the last " @@ -1876,11 +1947,11 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1760 +#: ../../reference/expressions.rst:1801 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1765 +#: ../../reference/expressions.rst:1806 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " "\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" @@ -1888,15 +1959,15 @@ msgid "" "`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1770 +#: ../../reference/expressions.rst:1811 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1777 +#: ../../reference/expressions.rst:1818 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1784 +#: ../../reference/expressions.rst:1825 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -1906,36 +1977,36 @@ msgid "" "and ``while`` statements." msgstr "" -#: ../../reference/expressions.rst:1792 +#: ../../reference/expressions.rst:1833 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1799 +#: ../../reference/expressions.rst:1840 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1811 +#: ../../reference/expressions.rst:1852 msgid "" "Conditional expressions (sometimes called a \"ternary operator\") have the " "lowest priority of all Python operations." msgstr "" -#: ../../reference/expressions.rst:1814 +#: ../../reference/expressions.rst:1855 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: ../../reference/expressions.rst:1818 +#: ../../reference/expressions.rst:1859 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1825 +#: ../../reference/expressions.rst:1866 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1836 +#: ../../reference/expressions.rst:1877 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -1943,25 +2014,25 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1845 +#: ../../reference/expressions.rst:1886 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: ../../reference/expressions.rst:1853 +#: ../../reference/expressions.rst:1894 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:1867 +#: ../../reference/expressions.rst:1908 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: ../../reference/expressions.rst:1876 +#: ../../reference/expressions.rst:1917 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -1969,12 +2040,12 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:1881 +#: ../../reference/expressions.rst:1922 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1886 +#: ../../reference/expressions.rst:1927 msgid "" "A trailing comma is required only to create a one-item tuple, such as ``1," "``; it is optional in all other cases. A single expression without a " @@ -1983,28 +2054,28 @@ msgid "" "``()``.)" msgstr "" -#: ../../reference/expressions.rst:1897 +#: ../../reference/expressions.rst:1938 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:1901 +#: ../../reference/expressions.rst:1942 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: ../../reference/expressions.rst:1904 +#: ../../reference/expressions.rst:1945 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:1918 +#: ../../reference/expressions.rst:1959 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:1923 +#: ../../reference/expressions.rst:1964 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -2014,176 +2085,176 @@ msgid "" "group from right to left)." msgstr "" -#: ../../reference/expressions.rst:1929 +#: ../../reference/expressions.rst:1970 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: ../../reference/expressions.rst:1935 +#: ../../reference/expressions.rst:1976 msgid "Operator" msgstr "" -#: ../../reference/expressions.rst:1935 +#: ../../reference/expressions.rst:1976 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:1937 +#: ../../reference/expressions.rst:1978 msgid "``(expressions...)``," msgstr "``(expressions...)``," -#: ../../reference/expressions.rst:1939 +#: ../../reference/expressions.rst:1980 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" -#: ../../reference/expressions.rst:1937 +#: ../../reference/expressions.rst:1978 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:1943 +#: ../../reference/expressions.rst:1984 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" -#: ../../reference/expressions.rst:1943 +#: ../../reference/expressions.rst:1984 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:1946 +#: ../../reference/expressions.rst:1987 msgid ":keyword:`await x `" msgstr ":keyword:`await x `" -#: ../../reference/expressions.rst:1948 +#: ../../reference/expressions.rst:1989 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:1948 +#: ../../reference/expressions.rst:1989 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:1950 +#: ../../reference/expressions.rst:1991 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:1950 +#: ../../reference/expressions.rst:1991 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:1952 +#: ../../reference/expressions.rst:1993 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:1952 +#: ../../reference/expressions.rst:1993 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:1956 +#: ../../reference/expressions.rst:1997 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:1956 +#: ../../reference/expressions.rst:1997 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:1958 +#: ../../reference/expressions.rst:1999 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:1958 +#: ../../reference/expressions.rst:1999 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:1960 +#: ../../reference/expressions.rst:2001 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:1960 +#: ../../reference/expressions.rst:2001 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:1962 +#: ../../reference/expressions.rst:2003 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:1962 +#: ../../reference/expressions.rst:2003 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:1964 +#: ../../reference/expressions.rst:2005 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:1964 +#: ../../reference/expressions.rst:2005 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:1966 +#: ../../reference/expressions.rst:2007 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:1966 +#: ../../reference/expressions.rst:2007 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:1970 +#: ../../reference/expressions.rst:2011 msgid ":keyword:`not x `" msgstr ":keyword:`not x `" -#: ../../reference/expressions.rst:1970 +#: ../../reference/expressions.rst:2011 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:1972 +#: ../../reference/expressions.rst:2013 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:1972 +#: ../../reference/expressions.rst:2013 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:1974 +#: ../../reference/expressions.rst:2015 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:1974 +#: ../../reference/expressions.rst:2015 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:1976 +#: ../../reference/expressions.rst:2017 msgid ":keyword:`if ` -- :keyword:`!else`" msgstr ":keyword:`if ` -- :keyword:`!else`" -#: ../../reference/expressions.rst:1976 +#: ../../reference/expressions.rst:2017 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:1978 +#: ../../reference/expressions.rst:2019 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:1978 +#: ../../reference/expressions.rst:2019 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:1980 +#: ../../reference/expressions.rst:2021 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:1980 +#: ../../reference/expressions.rst:2021 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:1985 +#: ../../reference/expressions.rst:2026 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:1986 +#: ../../reference/expressions.rst:2027 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2195,7 +2266,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:1995 +#: ../../reference/expressions.rst:2036 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2203,7 +2274,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:2000 +#: ../../reference/expressions.rst:2041 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2217,7 +2288,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:2011 +#: ../../reference/expressions.rst:2052 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2225,13 +2296,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:2016 +#: ../../reference/expressions.rst:2057 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: ../../reference/expressions.rst:2019 +#: ../../reference/expressions.rst:2060 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2239,22 +2310,22 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:2024 +#: ../../reference/expressions.rst:2065 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: ../../reference/expressions.rst:2027 +#: ../../reference/expressions.rst:2068 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." msgstr "" -#: ../../reference/expressions.rst:8 ../../reference/expressions.rst:362 -#: ../../reference/expressions.rst:417 ../../reference/expressions.rst:1713 -#: ../../reference/expressions.rst:1801 ../../reference/expressions.rst:1827 -#: ../../reference/expressions.rst:1855 +#: ../../reference/expressions.rst:8 ../../reference/expressions.rst:393 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1754 +#: ../../reference/expressions.rst:1842 ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:1896 msgid "expression" msgstr "" @@ -2262,8 +2333,8 @@ msgstr "" msgid "BNF" msgstr "BNF" -#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1214 -#: ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1246 +#: ../../reference/expressions.rst:1294 msgid "arithmetic" msgstr "" @@ -2283,11 +2354,11 @@ msgstr "name(名稱)" msgid "identifier" msgstr "" -#: ../../reference/expressions.rst:74 ../../reference/expressions.rst:538 -#: ../../reference/expressions.rst:593 ../../reference/expressions.rst:715 -#: ../../reference/expressions.rst:767 ../../reference/expressions.rst:813 -#: ../../reference/expressions.rst:1251 ../../reference/expressions.rst:1297 -#: ../../reference/expressions.rst:1387 +#: ../../reference/expressions.rst:74 ../../reference/expressions.rst:569 +#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:746 +#: ../../reference/expressions.rst:798 ../../reference/expressions.rst:844 +#: ../../reference/expressions.rst:1283 ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1428 msgid "exception" msgstr "" @@ -2307,708 +2378,708 @@ msgstr "" msgid "names" msgstr "" -#: ../../reference/expressions.rst:104 +#: ../../reference/expressions.rst:133 msgid "literal" msgstr "" -#: ../../reference/expressions.rst:117 ../../reference/expressions.rst:341 +#: ../../reference/expressions.rst:146 ../../reference/expressions.rst:372 msgid "immutable" msgstr "" -#: ../../reference/expressions.rst:117 +#: ../../reference/expressions.rst:146 msgid "data" msgstr "data(資料)" -#: ../../reference/expressions.rst:117 +#: ../../reference/expressions.rst:146 msgid "type" msgstr "type(型別)" -#: ../../reference/expressions.rst:117 ../../reference/expressions.rst:244 -#: ../../reference/expressions.rst:270 ../../reference/expressions.rst:298 -#: ../../reference/expressions.rst:341 ../../reference/expressions.rst:362 -#: ../../reference/expressions.rst:526 ../../reference/expressions.rst:705 -#: ../../reference/expressions.rst:813 ../../reference/expressions.rst:842 -#: ../../reference/expressions.rst:915 ../../reference/expressions.rst:959 -#: ../../reference/expressions.rst:1107 ../../reference/expressions.rst:1120 -#: ../../reference/expressions.rst:1134 ../../reference/expressions.rst:1141 -#: ../../reference/expressions.rst:1678 ../../reference/expressions.rst:1865 +#: ../../reference/expressions.rst:146 ../../reference/expressions.rst:275 +#: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 +#: ../../reference/expressions.rst:372 ../../reference/expressions.rst:393 +#: ../../reference/expressions.rst:557 ../../reference/expressions.rst:736 +#: ../../reference/expressions.rst:844 ../../reference/expressions.rst:873 +#: ../../reference/expressions.rst:946 ../../reference/expressions.rst:990 +#: ../../reference/expressions.rst:1138 ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:1165 ../../reference/expressions.rst:1172 +#: ../../reference/expressions.rst:1719 ../../reference/expressions.rst:1906 msgid "object" msgstr "object(物件)" -#: ../../reference/expressions.rst:133 +#: ../../reference/expressions.rst:162 msgid "parenthesized form" msgstr "" -#: ../../reference/expressions.rst:133 ../../reference/expressions.rst:362 -#: ../../reference/expressions.rst:959 +#: ../../reference/expressions.rst:162 ../../reference/expressions.rst:393 +#: ../../reference/expressions.rst:990 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../reference/expressions.rst:133 +#: ../../reference/expressions.rst:162 msgid "tuple display" msgstr "" -#: ../../reference/expressions.rst:146 ../../reference/expressions.rst:244 +#: ../../reference/expressions.rst:175 ../../reference/expressions.rst:275 msgid "empty" msgstr "" -#: ../../reference/expressions.rst:146 ../../reference/expressions.rst:842 -#: ../../reference/expressions.rst:915 ../../reference/expressions.rst:1865 +#: ../../reference/expressions.rst:175 ../../reference/expressions.rst:873 +#: ../../reference/expressions.rst:946 ../../reference/expressions.rst:1906 msgid "tuple" msgstr "" -#: ../../reference/expressions.rst:152 ../../reference/expressions.rst:1884 +#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1925 msgid "comma" msgstr "" -#: ../../reference/expressions.rst:152 ../../reference/expressions.rst:244 -#: ../../reference/expressions.rst:270 ../../reference/expressions.rst:298 -#: ../../reference/expressions.rst:909 ../../reference/expressions.rst:959 -#: ../../reference/expressions.rst:1855 +#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:275 +#: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 +#: ../../reference/expressions.rst:940 ../../reference/expressions.rst:990 +#: ../../reference/expressions.rst:1896 msgid ", (comma)" msgstr ", (逗號)" -#: ../../reference/expressions.rst:167 ../../reference/expressions.rst:244 -#: ../../reference/expressions.rst:270 ../../reference/expressions.rst:298 +#: ../../reference/expressions.rst:196 ../../reference/expressions.rst:275 +#: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 msgid "comprehensions" msgstr "" -#: ../../reference/expressions.rst:177 +#: ../../reference/expressions.rst:206 msgid "for" msgstr "for" -#: ../../reference/expressions.rst:177 ../../reference/expressions.rst:212 +#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:241 msgid "in comprehensions" msgstr "於 comprehensions(綜合運算)" -#: ../../reference/expressions.rst:177 ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1842 msgid "if" msgstr "if" -#: ../../reference/expressions.rst:177 +#: ../../reference/expressions.rst:206 msgid "async for" msgstr "async for" -#: ../../reference/expressions.rst:212 ../../reference/expressions.rst:1159 +#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1190 msgid "await" msgstr "await" -#: ../../reference/expressions.rst:244 ../../reference/expressions.rst:813 -#: ../../reference/expressions.rst:842 ../../reference/expressions.rst:915 -#: ../../reference/expressions.rst:1855 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:844 +#: ../../reference/expressions.rst:873 ../../reference/expressions.rst:946 +#: ../../reference/expressions.rst:1896 msgid "list" msgstr "list(串列)" -#: ../../reference/expressions.rst:244 ../../reference/expressions.rst:270 -#: ../../reference/expressions.rst:298 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:301 +#: ../../reference/expressions.rst:329 msgid "display" msgstr "" -#: ../../reference/expressions.rst:244 ../../reference/expressions.rst:838 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:869 msgid "[] (square brackets)" msgstr "[] (方括號)" -#: ../../reference/expressions.rst:244 +#: ../../reference/expressions.rst:275 msgid "list expression" msgstr "list expression(串列運算式)" -#: ../../reference/expressions.rst:244 ../../reference/expressions.rst:270 -#: ../../reference/expressions.rst:1855 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:301 +#: ../../reference/expressions.rst:1896 msgid "expression list" msgstr "expression list(運算式串列)" -#: ../../reference/expressions.rst:270 +#: ../../reference/expressions.rst:301 msgid "set" msgstr "set(集合)" -#: ../../reference/expressions.rst:270 ../../reference/expressions.rst:298 +#: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../reference/expressions.rst:270 +#: ../../reference/expressions.rst:301 msgid "set expression" msgstr "set expression(集合運算式)" -#: ../../reference/expressions.rst:298 ../../reference/expressions.rst:324 -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:355 +#: ../../reference/expressions.rst:873 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../reference/expressions.rst:298 +#: ../../reference/expressions.rst:329 msgid "key" msgstr "key(鍵)" -#: ../../reference/expressions.rst:298 +#: ../../reference/expressions.rst:329 msgid "value" msgstr "value(值)" -#: ../../reference/expressions.rst:298 +#: ../../reference/expressions.rst:329 msgid "key/value pair" msgstr "key/value pair(鍵/值對)" -#: ../../reference/expressions.rst:298 +#: ../../reference/expressions.rst:329 msgid "dictionary expression" msgstr "dictionary expression(字典運算式)" -#: ../../reference/expressions.rst:298 ../../reference/expressions.rst:909 -#: ../../reference/expressions.rst:1827 +#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:940 +#: ../../reference/expressions.rst:1868 msgid ": (colon)" msgstr ": (冒號)" -#: ../../reference/expressions.rst:298 +#: ../../reference/expressions.rst:329 msgid "in dictionary expressions" msgstr "於字典運算式" -#: ../../reference/expressions.rst:298 ../../reference/expressions.rst:324 +#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:355 msgid "in dictionary displays" msgstr "於字典顯示" -#: ../../reference/expressions.rst:324 ../../reference/expressions.rst:1042 -#: ../../reference/expressions.rst:1872 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1073 +#: ../../reference/expressions.rst:1913 msgid "unpacking" msgstr "unpacking(解包)" -#: ../../reference/expressions.rst:324 ../../reference/expressions.rst:1072 -#: ../../reference/expressions.rst:1179 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1103 +#: ../../reference/expressions.rst:1210 msgid "**" msgstr "**" -#: ../../reference/expressions.rst:341 +#: ../../reference/expressions.rst:372 msgid "hashable" msgstr "hashable(可雜湊)" -#: ../../reference/expressions.rst:362 ../../reference/expressions.rst:417 -#: ../../reference/expressions.rst:526 +#: ../../reference/expressions.rst:393 ../../reference/expressions.rst:448 +#: ../../reference/expressions.rst:557 msgid "generator" msgstr "generator(產生器)" -#: ../../reference/expressions.rst:362 +#: ../../reference/expressions.rst:393 msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../reference/expressions.rst:417 ../../reference/expressions.rst:1159 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1190 msgid "keyword" msgstr "keyword(關鍵字)" -#: ../../reference/expressions.rst:417 ../../reference/expressions.rst:606 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:637 msgid "yield" msgstr "yield" -#: ../../reference/expressions.rst:417 ../../reference/expressions.rst:485 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:516 msgid "from" msgstr "from" -#: ../../reference/expressions.rst:417 ../../reference/expressions.rst:1107 -#: ../../reference/expressions.rst:1120 ../../reference/expressions.rst:1827 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1138 +#: ../../reference/expressions.rst:1151 ../../reference/expressions.rst:1868 msgid "function" msgstr "function (函式)" -#: ../../reference/expressions.rst:471 +#: ../../reference/expressions.rst:502 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../reference/expressions.rst:485 +#: ../../reference/expressions.rst:516 msgid "yield from expression" msgstr "yield from expression(yield from 運算式)" -#: ../../reference/expressions.rst:538 +#: ../../reference/expressions.rst:569 msgid "StopIteration" msgstr "StopIteration" -#: ../../reference/expressions.rst:593 ../../reference/expressions.rst:767 +#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:798 msgid "GeneratorExit" msgstr "GeneratorExit" -#: ../../reference/expressions.rst:606 +#: ../../reference/expressions.rst:637 msgid "examples" msgstr "範例" -#: ../../reference/expressions.rst:705 +#: ../../reference/expressions.rst:736 msgid "asynchronous-generator" msgstr "asynchronous-generator(非同步產生器)" -#: ../../reference/expressions.rst:715 +#: ../../reference/expressions.rst:746 msgid "StopAsyncIteration" msgstr "StopAsyncIteration" -#: ../../reference/expressions.rst:790 +#: ../../reference/expressions.rst:821 msgid "primary" msgstr "primary(主要)" -#: ../../reference/expressions.rst:804 +#: ../../reference/expressions.rst:835 msgid "attribute" msgstr "attribute(屬性)" -#: ../../reference/expressions.rst:804 +#: ../../reference/expressions.rst:835 msgid "reference" msgstr "reference(參照)" -#: ../../reference/expressions.rst:804 +#: ../../reference/expressions.rst:835 msgid ". (dot)" msgstr ". (點)" -#: ../../reference/expressions.rst:804 +#: ../../reference/expressions.rst:835 msgid "attribute reference" msgstr "attribute reference(屬性參照)" -#: ../../reference/expressions.rst:813 +#: ../../reference/expressions.rst:844 msgid "AttributeError" msgstr "AttributeError" -#: ../../reference/expressions.rst:813 +#: ../../reference/expressions.rst:844 msgid "module" msgstr "module(模組)" -#: ../../reference/expressions.rst:838 +#: ../../reference/expressions.rst:869 msgid "subscription" msgstr "subscription(下標)" -#: ../../reference/expressions.rst:842 ../../reference/expressions.rst:915 -#: ../../reference/expressions.rst:1678 +#: ../../reference/expressions.rst:873 ../../reference/expressions.rst:946 +#: ../../reference/expressions.rst:1719 msgid "sequence" msgstr "sequence(序列)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:873 msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/expressions.rst:842 ../../reference/expressions.rst:895 -#: ../../reference/expressions.rst:915 +#: ../../reference/expressions.rst:873 ../../reference/expressions.rst:926 +#: ../../reference/expressions.rst:946 msgid "string" msgstr "string(字串)" -#: ../../reference/expressions.rst:842 ../../reference/expressions.rst:895 +#: ../../reference/expressions.rst:873 ../../reference/expressions.rst:926 msgid "item" msgstr "item(項目)" -#: ../../reference/expressions.rst:895 +#: ../../reference/expressions.rst:926 msgid "character" msgstr "character(字元)" -#: ../../reference/expressions.rst:909 +#: ../../reference/expressions.rst:940 msgid "slicing" msgstr "slicing(切片)" -#: ../../reference/expressions.rst:909 +#: ../../reference/expressions.rst:940 msgid "slice" msgstr "slice(切片)" -#: ../../reference/expressions.rst:941 +#: ../../reference/expressions.rst:972 msgid "start (slice object attribute)" msgstr "start(切片物件屬性)" -#: ../../reference/expressions.rst:941 +#: ../../reference/expressions.rst:972 msgid "stop (slice object attribute)" msgstr "stop(切片物件屬性)" -#: ../../reference/expressions.rst:941 +#: ../../reference/expressions.rst:972 msgid "step (slice object attribute)" msgstr "step(切片物件屬性)" -#: ../../reference/expressions.rst:959 +#: ../../reference/expressions.rst:990 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../reference/expressions.rst:959 ../../reference/expressions.rst:1107 -#: ../../reference/expressions.rst:1120 ../../reference/expressions.rst:1134 -#: ../../reference/expressions.rst:1141 ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:990 ../../reference/expressions.rst:1138 +#: ../../reference/expressions.rst:1151 ../../reference/expressions.rst:1165 +#: ../../reference/expressions.rst:1172 ../../reference/expressions.rst:1182 msgid "call" msgstr "call(呼叫)" -#: ../../reference/expressions.rst:959 +#: ../../reference/expressions.rst:990 msgid "argument" msgstr "argument(引數)" -#: ../../reference/expressions.rst:959 ../../reference/expressions.rst:992 +#: ../../reference/expressions.rst:990 ../../reference/expressions.rst:1023 msgid "call semantics" msgstr "call semantics(呼叫語意)" -#: ../../reference/expressions.rst:959 +#: ../../reference/expressions.rst:990 msgid "argument list" msgstr "argument list(引數列表)" -#: ../../reference/expressions.rst:959 +#: ../../reference/expressions.rst:990 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/expressions.rst:959 ../../reference/expressions.rst:1042 -#: ../../reference/expressions.rst:1072 +#: ../../reference/expressions.rst:990 ../../reference/expressions.rst:1073 +#: ../../reference/expressions.rst:1103 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../reference/expressions.rst:992 +#: ../../reference/expressions.rst:1023 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/expressions.rst:1042 ../../reference/expressions.rst:1275 -#: ../../reference/expressions.rst:1872 +#: ../../reference/expressions.rst:1073 ../../reference/expressions.rst:1307 +#: ../../reference/expressions.rst:1913 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/expressions.rst:1107 +#: ../../reference/expressions.rst:1138 msgid "user-defined" msgstr "user-defined(使用者定義)" -#: ../../reference/expressions.rst:1107 +#: ../../reference/expressions.rst:1138 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/expressions.rst:1120 +#: ../../reference/expressions.rst:1151 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../reference/expressions.rst:1120 +#: ../../reference/expressions.rst:1151 msgid "method" msgstr "method(方法)" -#: ../../reference/expressions.rst:1120 +#: ../../reference/expressions.rst:1151 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/expressions.rst:1134 +#: ../../reference/expressions.rst:1165 msgid "class" msgstr "class(類別)" -#: ../../reference/expressions.rst:1134 +#: ../../reference/expressions.rst:1165 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/expressions.rst:1141 +#: ../../reference/expressions.rst:1172 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/expressions.rst:1141 ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:1172 ../../reference/expressions.rst:1182 msgid "instance" msgstr "instance(實例)" -#: ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:1182 msgid "__call__() (object method)" msgstr "__call__() (物件方法)" -#: ../../reference/expressions.rst:1179 +#: ../../reference/expressions.rst:1210 msgid "power" msgstr "power(次方)" -#: ../../reference/expressions.rst:1179 ../../reference/expressions.rst:1214 -#: ../../reference/expressions.rst:1262 ../../reference/expressions.rst:1371 -#: ../../reference/expressions.rst:1398 ../../reference/expressions.rst:1713 +#: ../../reference/expressions.rst:1210 ../../reference/expressions.rst:1246 +#: ../../reference/expressions.rst:1294 ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1439 ../../reference/expressions.rst:1754 msgid "operation" msgstr "operation(操作)" -#: ../../reference/expressions.rst:1179 ../../reference/expressions.rst:1223 -#: ../../reference/expressions.rst:1232 ../../reference/expressions.rst:1240 -#: ../../reference/expressions.rst:1275 ../../reference/expressions.rst:1288 -#: ../../reference/expressions.rst:1297 ../../reference/expressions.rst:1313 -#: ../../reference/expressions.rst:1342 ../../reference/expressions.rst:1355 -#: ../../reference/expressions.rst:1371 ../../reference/expressions.rst:1407 -#: ../../reference/expressions.rst:1415 ../../reference/expressions.rst:1424 -#: ../../reference/expressions.rst:1439 ../../reference/expressions.rst:1678 -#: ../../reference/expressions.rst:1687 ../../reference/expressions.rst:1729 -#: ../../reference/expressions.rst:1734 ../../reference/expressions.rst:1739 -#: ../../reference/expressions.rst:1801 ../../reference/expressions.rst:1920 +#: ../../reference/expressions.rst:1210 ../../reference/expressions.rst:1255 +#: ../../reference/expressions.rst:1264 ../../reference/expressions.rst:1272 +#: ../../reference/expressions.rst:1307 ../../reference/expressions.rst:1320 +#: ../../reference/expressions.rst:1332 ../../reference/expressions.rst:1350 +#: ../../reference/expressions.rst:1380 ../../reference/expressions.rst:1393 +#: ../../reference/expressions.rst:1410 ../../reference/expressions.rst:1448 +#: ../../reference/expressions.rst:1456 ../../reference/expressions.rst:1465 +#: ../../reference/expressions.rst:1480 ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:1728 ../../reference/expressions.rst:1770 +#: ../../reference/expressions.rst:1775 ../../reference/expressions.rst:1780 +#: ../../reference/expressions.rst:1842 ../../reference/expressions.rst:1961 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/expressions.rst:1214 +#: ../../reference/expressions.rst:1246 msgid "unary" msgstr "unary(一元)" -#: ../../reference/expressions.rst:1214 ../../reference/expressions.rst:1398 -#: ../../reference/expressions.rst:1407 ../../reference/expressions.rst:1415 -#: ../../reference/expressions.rst:1424 +#: ../../reference/expressions.rst:1246 ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1448 ../../reference/expressions.rst:1456 +#: ../../reference/expressions.rst:1465 msgid "bitwise" msgstr "bitwise(位元)" -#: ../../reference/expressions.rst:1223 +#: ../../reference/expressions.rst:1255 msgid "negation" msgstr "negation(否定)" -#: ../../reference/expressions.rst:1223 +#: ../../reference/expressions.rst:1255 msgid "minus" msgstr "minus(減)" -#: ../../reference/expressions.rst:1223 ../../reference/expressions.rst:1355 +#: ../../reference/expressions.rst:1255 ../../reference/expressions.rst:1393 msgid "- (minus)" msgstr "- (減號)" -#: ../../reference/expressions.rst:1223 ../../reference/expressions.rst:1232 +#: ../../reference/expressions.rst:1255 ../../reference/expressions.rst:1264 msgid "unary operator" msgstr "unary operator(一元運算子)" -#: ../../reference/expressions.rst:1232 +#: ../../reference/expressions.rst:1264 msgid "plus" msgstr "plus(加)" -#: ../../reference/expressions.rst:1232 ../../reference/expressions.rst:1342 +#: ../../reference/expressions.rst:1264 ../../reference/expressions.rst:1380 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../reference/expressions.rst:1240 +#: ../../reference/expressions.rst:1272 msgid "inversion" msgstr "inversion(反轉)" -#: ../../reference/expressions.rst:1240 +#: ../../reference/expressions.rst:1272 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../reference/expressions.rst:1251 +#: ../../reference/expressions.rst:1283 msgid "TypeError" msgstr "TypeError" -#: ../../reference/expressions.rst:1262 ../../reference/expressions.rst:1398 +#: ../../reference/expressions.rst:1294 ../../reference/expressions.rst:1439 msgid "binary" msgstr "binary(二進位)" -#: ../../reference/expressions.rst:1275 +#: ../../reference/expressions.rst:1307 msgid "multiplication" msgstr "multiplication(乘)" -#: ../../reference/expressions.rst:1288 +#: ../../reference/expressions.rst:1320 msgid "matrix multiplication" msgstr "matrix multiplication(矩陣乘法)" -#: ../../reference/expressions.rst:1288 +#: ../../reference/expressions.rst:1320 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/expressions.rst:1297 +#: ../../reference/expressions.rst:1332 msgid "ZeroDivisionError" msgstr "ZeroDivisionError" -#: ../../reference/expressions.rst:1297 +#: ../../reference/expressions.rst:1332 msgid "division" msgstr "division(除)" -#: ../../reference/expressions.rst:1297 +#: ../../reference/expressions.rst:1332 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/expressions.rst:1297 +#: ../../reference/expressions.rst:1332 msgid "//" msgstr "//" -#: ../../reference/expressions.rst:1313 +#: ../../reference/expressions.rst:1350 msgid "modulo" msgstr "modulo(餘數)" -#: ../../reference/expressions.rst:1313 +#: ../../reference/expressions.rst:1350 msgid "% (percent)" msgstr "% (百分號)" -#: ../../reference/expressions.rst:1342 +#: ../../reference/expressions.rst:1380 msgid "addition" msgstr "addition(加)" -#: ../../reference/expressions.rst:1342 ../../reference/expressions.rst:1355 +#: ../../reference/expressions.rst:1380 ../../reference/expressions.rst:1393 msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../reference/expressions.rst:1355 +#: ../../reference/expressions.rst:1393 msgid "subtraction" msgstr "subtraction(減)" -#: ../../reference/expressions.rst:1371 +#: ../../reference/expressions.rst:1410 msgid "shifting" msgstr "shifting(移動)" -#: ../../reference/expressions.rst:1371 +#: ../../reference/expressions.rst:1410 msgid "<<" msgstr "<<" -#: ../../reference/expressions.rst:1371 +#: ../../reference/expressions.rst:1410 msgid ">>" msgstr ">>" -#: ../../reference/expressions.rst:1387 +#: ../../reference/expressions.rst:1428 msgid "ValueError" msgstr "ValueError" -#: ../../reference/expressions.rst:1407 ../../reference/expressions.rst:1734 +#: ../../reference/expressions.rst:1448 ../../reference/expressions.rst:1775 msgid "and" msgstr "and" -#: ../../reference/expressions.rst:1407 +#: ../../reference/expressions.rst:1448 msgid "& (ampersand)" msgstr "& (和號)" -#: ../../reference/expressions.rst:1415 +#: ../../reference/expressions.rst:1456 msgid "xor" msgstr "xor" -#: ../../reference/expressions.rst:1415 +#: ../../reference/expressions.rst:1456 msgid "exclusive" msgstr "exclusive(排外)" -#: ../../reference/expressions.rst:1415 ../../reference/expressions.rst:1424 -#: ../../reference/expressions.rst:1739 +#: ../../reference/expressions.rst:1456 ../../reference/expressions.rst:1465 +#: ../../reference/expressions.rst:1780 msgid "or" msgstr "or" -#: ../../reference/expressions.rst:1415 +#: ../../reference/expressions.rst:1456 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../reference/expressions.rst:1424 +#: ../../reference/expressions.rst:1465 msgid "inclusive" msgstr "inclusive(包含)" -#: ../../reference/expressions.rst:1424 +#: ../../reference/expressions.rst:1465 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1480 msgid "comparison" msgstr "comparison(比較)" -#: ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1480 msgid "C" msgstr "C" -#: ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1480 msgid "language" msgstr "language(語言)" -#: ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1480 msgid "< (less)" msgstr "< (小於)" -#: ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1480 msgid "> (greater)" msgstr "> (大於)" -#: ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1480 msgid "<=" msgstr "<=" -#: ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1480 msgid ">=" msgstr ">=" -#: ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1480 msgid "==" msgstr "==" -#: ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1480 msgid "!=" msgstr "!=" -#: ../../reference/expressions.rst:1463 +#: ../../reference/expressions.rst:1504 msgid "chaining" msgstr "chaining(鏈接)" -#: ../../reference/expressions.rst:1463 +#: ../../reference/expressions.rst:1504 msgid "comparisons" msgstr "comparisons(比較)" -#: ../../reference/expressions.rst:1678 +#: ../../reference/expressions.rst:1719 msgid "in" msgstr "in" -#: ../../reference/expressions.rst:1678 +#: ../../reference/expressions.rst:1719 msgid "not in" msgstr "not in" -#: ../../reference/expressions.rst:1678 +#: ../../reference/expressions.rst:1719 msgid "membership" msgstr "membership(成員)" -#: ../../reference/expressions.rst:1678 ../../reference/expressions.rst:1687 +#: ../../reference/expressions.rst:1719 ../../reference/expressions.rst:1728 msgid "test" msgstr "test(測試)" -#: ../../reference/expressions.rst:1687 +#: ../../reference/expressions.rst:1728 msgid "is" msgstr "is" -#: ../../reference/expressions.rst:1687 +#: ../../reference/expressions.rst:1728 msgid "is not" msgstr "is not" -#: ../../reference/expressions.rst:1687 +#: ../../reference/expressions.rst:1728 msgid "identity" msgstr "identity" -#: ../../reference/expressions.rst:1713 +#: ../../reference/expressions.rst:1754 msgid "Conditional" msgstr "Conditional(條件式)" -#: ../../reference/expressions.rst:1713 +#: ../../reference/expressions.rst:1754 msgid "Boolean" msgstr "Boolean(布林)" -#: ../../reference/expressions.rst:1729 +#: ../../reference/expressions.rst:1770 msgid "not" msgstr "not" -#: ../../reference/expressions.rst:1753 +#: ../../reference/expressions.rst:1794 msgid ":= (colon equals)" msgstr ":= (冒號等於)" -#: ../../reference/expressions.rst:1753 +#: ../../reference/expressions.rst:1794 msgid "assignment expression" msgstr "assignment expression(賦值運算式)" -#: ../../reference/expressions.rst:1753 +#: ../../reference/expressions.rst:1794 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../reference/expressions.rst:1753 +#: ../../reference/expressions.rst:1794 msgid "named expression" msgstr "named expression(附名運算式)" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1842 msgid "conditional" msgstr "conditional(條件式)" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1842 msgid "ternary" msgstr "ternary(三元)" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1842 msgid "conditional expression" msgstr "conditional expression(條件運算式)" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1842 msgid "else" msgstr "else" -#: ../../reference/expressions.rst:1827 +#: ../../reference/expressions.rst:1868 msgid "lambda" msgstr "lambda" -#: ../../reference/expressions.rst:1827 +#: ../../reference/expressions.rst:1868 msgid "form" msgstr "form" -#: ../../reference/expressions.rst:1827 +#: ../../reference/expressions.rst:1868 msgid "anonymous" msgstr "anonymous(匿名)" -#: ../../reference/expressions.rst:1827 +#: ../../reference/expressions.rst:1868 msgid "lambda expression" msgstr "lambda expression(lambda 運算式)" -#: ../../reference/expressions.rst:1872 +#: ../../reference/expressions.rst:1913 msgid "iterable" msgstr "iterable(可疊代)" -#: ../../reference/expressions.rst:1872 +#: ../../reference/expressions.rst:1913 msgid "in expression lists" msgstr "於 expression list(運算式串列)" -#: ../../reference/expressions.rst:1884 +#: ../../reference/expressions.rst:1925 msgid "trailing" msgstr "trailing" -#: ../../reference/expressions.rst:1899 +#: ../../reference/expressions.rst:1940 msgid "evaluation" msgstr "evaluation" -#: ../../reference/expressions.rst:1899 +#: ../../reference/expressions.rst:1940 msgid "order" msgstr "order(順序)" -#: ../../reference/expressions.rst:1920 +#: ../../reference/expressions.rst:1961 msgid "precedence" msgstr "precedence(優先順序)" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index a9ec01b51a..a5b35e53ed 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-18 00:04+0000\n" +"POT-Creation-Date: 2024-07-05 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -283,7 +283,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:296 msgid "" -"An augmented assignment expression like ``x += 1`` can be rewritten as ``x = " +"An augmented assignment statement like ``x += 1`` can be rewritten as ``x = " "x + 1`` to achieve a similar, but not exactly equal effect. In the augmented " "version, ``x`` is only evaluated once. Also, when possible, the actual " "operation is performed *in-place*, meaning that rather than creating a new " @@ -333,27 +333,29 @@ msgstr "" #: ../../reference/simple_stmts.rst:336 msgid "" -"For simple names as assignment targets, if in class or module scope, the " -"annotations are evaluated and stored in a special class or module attribute :" -"attr:`__annotations__` that is a dictionary mapping from variable names " -"(mangled if private) to evaluated annotations. This attribute is writable " -"and is automatically created at the start of class or module body execution, " -"if annotations are found statically." +"The assignment target is considered \"simple\" if it consists of a single " +"name that is not enclosed in parentheses. For simple assignment targets, if " +"in class or module scope, the annotations are evaluated and stored in a " +"special class or module attribute :attr:`__annotations__` that is a " +"dictionary mapping from variable names (mangled if private) to evaluated " +"annotations. This attribute is writable and is automatically created at the " +"start of class or module body execution, if annotations are found statically." msgstr "" -#: ../../reference/simple_stmts.rst:344 +#: ../../reference/simple_stmts.rst:346 msgid "" -"For expressions as assignment targets, the annotations are evaluated if in " -"class or module scope, but not stored." +"If the assignment target is not simple (an attribute, subscript node, or " +"parenthesized name), the annotation is evaluated if in class or module " +"scope, but not stored." msgstr "" -#: ../../reference/simple_stmts.rst:347 +#: ../../reference/simple_stmts.rst:350 msgid "" "If a name is annotated in a function scope, then this name is local for that " "scope. Annotations are never evaluated and stored in function scopes." msgstr "" -#: ../../reference/simple_stmts.rst:350 +#: ../../reference/simple_stmts.rst:353 msgid "" "If the right hand side is present, an annotated assignment performs the " "actual assignment before evaluating annotations (where applicable). If the " @@ -362,55 +364,55 @@ msgid "" "__setitem__` or :meth:`~object.__setattr__` call." msgstr "" -#: ../../reference/simple_stmts.rst:358 +#: ../../reference/simple_stmts.rst:361 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: ../../reference/simple_stmts.rst:359 +#: ../../reference/simple_stmts.rst:362 msgid "" "The proposal that added syntax for annotating the types of variables " "(including class variables and instance variables), instead of expressing " "them through comments." msgstr "" -#: ../../reference/simple_stmts.rst:363 +#: ../../reference/simple_stmts.rst:366 msgid ":pep:`484` - Type hints" msgstr "" -#: ../../reference/simple_stmts.rst:364 +#: ../../reference/simple_stmts.rst:367 msgid "" "The proposal that added the :mod:`typing` module to provide a standard " "syntax for type annotations that can be used in static analysis tools and " "IDEs." msgstr "" -#: ../../reference/simple_stmts.rst:368 +#: ../../reference/simple_stmts.rst:371 msgid "" "Now annotated assignments allow the same expressions in the right hand side " "as regular assignments. Previously, some expressions (like un-parenthesized " "tuple expressions) caused a syntax error." msgstr "" -#: ../../reference/simple_stmts.rst:377 +#: ../../reference/simple_stmts.rst:380 msgid "The :keyword:`!assert` statement" msgstr "" -#: ../../reference/simple_stmts.rst:384 +#: ../../reference/simple_stmts.rst:387 msgid "" "Assert statements are a convenient way to insert debugging assertions into a " "program:" msgstr "" -#: ../../reference/simple_stmts.rst:390 +#: ../../reference/simple_stmts.rst:393 msgid "The simple form, ``assert expression``, is equivalent to ::" msgstr "" -#: ../../reference/simple_stmts.rst:395 +#: ../../reference/simple_stmts.rst:398 msgid "" "The extended form, ``assert expression1, expression2``, is equivalent to ::" msgstr "" -#: ../../reference/simple_stmts.rst:404 +#: ../../reference/simple_stmts.rst:407 msgid "" "These equivalences assume that :const:`__debug__` and :exc:`AssertionError` " "refer to the built-in variables with those names. In the current " @@ -422,40 +424,40 @@ msgid "" "in the error message; it will be displayed as part of the stack trace." msgstr "" -#: ../../reference/simple_stmts.rst:413 +#: ../../reference/simple_stmts.rst:416 msgid "" "Assignments to :const:`__debug__` are illegal. The value for the built-in " "variable is determined when the interpreter starts." msgstr "" -#: ../../reference/simple_stmts.rst:420 +#: ../../reference/simple_stmts.rst:423 msgid "The :keyword:`!pass` statement" msgstr "" -#: ../../reference/simple_stmts.rst:430 +#: ../../reference/simple_stmts.rst:433 msgid "" ":keyword:`pass` is a null operation --- when it is executed, nothing " "happens. It is useful as a placeholder when a statement is required " "syntactically, but no code needs to be executed, for example::" msgstr "" -#: ../../reference/simple_stmts.rst:442 +#: ../../reference/simple_stmts.rst:445 msgid "The :keyword:`!del` statement" msgstr "" -#: ../../reference/simple_stmts.rst:452 +#: ../../reference/simple_stmts.rst:455 msgid "" "Deletion is recursively defined very similar to the way assignment is " "defined. Rather than spelling it out in full details, here are some hints." msgstr "" -#: ../../reference/simple_stmts.rst:455 +#: ../../reference/simple_stmts.rst:458 msgid "" "Deletion of a target list recursively deletes each target, from left to " "right." msgstr "" -#: ../../reference/simple_stmts.rst:461 +#: ../../reference/simple_stmts.rst:464 msgid "" "Deletion of a name removes the binding of that name from the local or global " "namespace, depending on whether the name occurs in a :keyword:`global` " @@ -463,7 +465,7 @@ msgid "" "`NameError` exception will be raised." msgstr "" -#: ../../reference/simple_stmts.rst:468 +#: ../../reference/simple_stmts.rst:471 msgid "" "Deletion of attribute references, subscriptions and slicings is passed to " "the primary object involved; deletion of a slicing is in general equivalent " @@ -471,42 +473,42 @@ msgid "" "determined by the sliced object)." msgstr "" -#: ../../reference/simple_stmts.rst:473 +#: ../../reference/simple_stmts.rst:476 msgid "" "Previously it was illegal to delete a name from the local namespace if it " "occurs as a free variable in a nested block." msgstr "" -#: ../../reference/simple_stmts.rst:481 +#: ../../reference/simple_stmts.rst:484 msgid "The :keyword:`!return` statement" msgstr "" -#: ../../reference/simple_stmts.rst:491 +#: ../../reference/simple_stmts.rst:494 msgid "" ":keyword:`return` may only occur syntactically nested in a function " "definition, not within a nested class definition." msgstr "" -#: ../../reference/simple_stmts.rst:494 +#: ../../reference/simple_stmts.rst:497 msgid "" "If an expression list is present, it is evaluated, else ``None`` is " "substituted." msgstr "" -#: ../../reference/simple_stmts.rst:496 +#: ../../reference/simple_stmts.rst:499 msgid "" ":keyword:`return` leaves the current function call with the expression list " "(or ``None``) as return value." msgstr "" -#: ../../reference/simple_stmts.rst:501 +#: ../../reference/simple_stmts.rst:504 msgid "" "When :keyword:`return` passes control out of a :keyword:`try` statement with " "a :keyword:`finally` clause, that :keyword:`!finally` clause is executed " "before really leaving the function." msgstr "" -#: ../../reference/simple_stmts.rst:505 +#: ../../reference/simple_stmts.rst:508 msgid "" "In a generator function, the :keyword:`return` statement indicates that the " "generator is done and will cause :exc:`StopIteration` to be raised. The " @@ -514,7 +516,7 @@ msgid "" "`StopIteration` and becomes the :attr:`StopIteration.value` attribute." msgstr "" -#: ../../reference/simple_stmts.rst:510 +#: ../../reference/simple_stmts.rst:513 msgid "" "In an asynchronous generator function, an empty :keyword:`return` statement " "indicates that the asynchronous generator is done and will cause :exc:" @@ -522,11 +524,11 @@ msgid "" "is a syntax error in an asynchronous generator function." msgstr "" -#: ../../reference/simple_stmts.rst:518 +#: ../../reference/simple_stmts.rst:521 msgid "The :keyword:`!yield` statement" msgstr "" -#: ../../reference/simple_stmts.rst:530 +#: ../../reference/simple_stmts.rst:533 msgid "" "A :keyword:`yield` statement is semantically equivalent to a :ref:`yield " "expression `. The yield statement can be used to omit the " @@ -534,11 +536,11 @@ msgid "" "expression statement. For example, the yield statements ::" msgstr "" -#: ../../reference/simple_stmts.rst:538 +#: ../../reference/simple_stmts.rst:541 msgid "are equivalent to the yield expression statements ::" msgstr "" -#: ../../reference/simple_stmts.rst:543 +#: ../../reference/simple_stmts.rst:546 msgid "" "Yield expressions and statements are only used when defining a :term:" "`generator` function, and are only used in the body of the generator " @@ -546,17 +548,17 @@ msgid "" "definition to create a generator function instead of a normal function." msgstr "" -#: ../../reference/simple_stmts.rst:548 +#: ../../reference/simple_stmts.rst:551 msgid "" "For full details of :keyword:`yield` semantics, refer to the :ref:" "`yieldexpr` section." msgstr "" -#: ../../reference/simple_stmts.rst:554 +#: ../../reference/simple_stmts.rst:557 msgid "The :keyword:`!raise` statement" msgstr "" -#: ../../reference/simple_stmts.rst:565 +#: ../../reference/simple_stmts.rst:568 msgid "" "If no expressions are present, :keyword:`raise` re-raises the exception that " "is currently being handled, which is also known as the *active exception*. " @@ -564,7 +566,7 @@ msgid "" "exception is raised indicating that this is an error." msgstr "" -#: ../../reference/simple_stmts.rst:570 +#: ../../reference/simple_stmts.rst:573 msgid "" "Otherwise, :keyword:`raise` evaluates the first expression as the exception " "object. It must be either a subclass or an instance of :class:" @@ -572,13 +574,13 @@ msgid "" "when needed by instantiating the class with no arguments." msgstr "" -#: ../../reference/simple_stmts.rst:575 +#: ../../reference/simple_stmts.rst:578 msgid "" "The :dfn:`type` of the exception is the exception instance's class, the :dfn:" "`value` is the instance itself." msgstr "" -#: ../../reference/simple_stmts.rst:580 +#: ../../reference/simple_stmts.rst:583 msgid "" "A traceback object is normally created automatically when an exception is " "raised and attached to it as the :attr:`~BaseException.__traceback__` " @@ -588,7 +590,7 @@ msgid "" "argument), like so::" msgstr "" -#: ../../reference/simple_stmts.rst:592 +#: ../../reference/simple_stmts.rst:595 msgid "" "The ``from`` clause is used for exception chaining: if given, the second " "*expression* must be another exception class or instance. If the second " @@ -600,7 +602,7 @@ msgid "" "exception is not handled, both exceptions will be printed:" msgstr "" -#: ../../reference/simple_stmts.rst:621 +#: ../../reference/simple_stmts.rst:624 msgid "" "A similar mechanism works implicitly if a new exception is raised when an " "exception is already being handled. An exception may be handled when an :" @@ -609,30 +611,30 @@ msgid "" "exception's :attr:`~BaseException.__context__` attribute:" msgstr "" -#: ../../reference/simple_stmts.rst:647 +#: ../../reference/simple_stmts.rst:650 msgid "" "Exception chaining can be explicitly suppressed by specifying :const:`None` " "in the ``from`` clause:" msgstr "" -#: ../../reference/simple_stmts.rst:661 +#: ../../reference/simple_stmts.rst:664 msgid "" "Additional information on exceptions can be found in section :ref:" "`exceptions`, and information about handling exceptions is in section :ref:" "`try`." msgstr "" -#: ../../reference/simple_stmts.rst:664 +#: ../../reference/simple_stmts.rst:667 msgid ":const:`None` is now permitted as ``Y`` in ``raise X from Y``." msgstr "" -#: ../../reference/simple_stmts.rst:667 +#: ../../reference/simple_stmts.rst:670 msgid "" "Added the :attr:`~BaseException.__suppress_context__` attribute to suppress " "automatic display of the exception context." msgstr "" -#: ../../reference/simple_stmts.rst:670 +#: ../../reference/simple_stmts.rst:673 msgid "" "If the traceback of the active exception is modified in an :keyword:`except` " "clause, a subsequent ``raise`` statement re-raises the exception with the " @@ -640,41 +642,41 @@ msgid "" "traceback it had when it was caught." msgstr "" -#: ../../reference/simple_stmts.rst:679 +#: ../../reference/simple_stmts.rst:682 msgid "The :keyword:`!break` statement" msgstr "" -#: ../../reference/simple_stmts.rst:690 +#: ../../reference/simple_stmts.rst:693 msgid "" ":keyword:`break` may only occur syntactically nested in a :keyword:`for` or :" "keyword:`while` loop, but not nested in a function or class definition " "within that loop." msgstr "" -#: ../../reference/simple_stmts.rst:697 +#: ../../reference/simple_stmts.rst:700 msgid "" "It terminates the nearest enclosing loop, skipping the optional :keyword:`!" "else` clause if the loop has one." msgstr "" -#: ../../reference/simple_stmts.rst:700 +#: ../../reference/simple_stmts.rst:703 msgid "" "If a :keyword:`for` loop is terminated by :keyword:`break`, the loop control " "target keeps its current value." msgstr "" -#: ../../reference/simple_stmts.rst:705 +#: ../../reference/simple_stmts.rst:708 msgid "" "When :keyword:`break` passes control out of a :keyword:`try` statement with " "a :keyword:`finally` clause, that :keyword:`!finally` clause is executed " "before really leaving the loop." msgstr "" -#: ../../reference/simple_stmts.rst:713 +#: ../../reference/simple_stmts.rst:716 msgid "The :keyword:`!continue` statement" msgstr "" -#: ../../reference/simple_stmts.rst:725 +#: ../../reference/simple_stmts.rst:728 msgid "" ":keyword:`continue` may only occur syntactically nested in a :keyword:`for` " "or :keyword:`while` loop, but not nested in a function or class definition " @@ -682,41 +684,41 @@ msgid "" "loop." msgstr "" -#: ../../reference/simple_stmts.rst:729 +#: ../../reference/simple_stmts.rst:732 msgid "" "When :keyword:`continue` passes control out of a :keyword:`try` statement " "with a :keyword:`finally` clause, that :keyword:`!finally` clause is " "executed before really starting the next loop cycle." msgstr "" -#: ../../reference/simple_stmts.rst:738 +#: ../../reference/simple_stmts.rst:741 msgid "The :keyword:`!import` statement" msgstr "" -#: ../../reference/simple_stmts.rst:759 +#: ../../reference/simple_stmts.rst:762 msgid "" "The basic import statement (no :keyword:`from` clause) is executed in two " "steps:" msgstr "" -#: ../../reference/simple_stmts.rst:762 +#: ../../reference/simple_stmts.rst:765 msgid "find a module, loading and initializing it if necessary" msgstr "" -#: ../../reference/simple_stmts.rst:763 +#: ../../reference/simple_stmts.rst:766 msgid "" "define a name or names in the local namespace for the scope where the :" "keyword:`import` statement occurs." msgstr "" -#: ../../reference/simple_stmts.rst:766 +#: ../../reference/simple_stmts.rst:769 msgid "" "When the statement contains multiple clauses (separated by commas) the two " "steps are carried out separately for each clause, just as though the clauses " "had been separated out into individual import statements." msgstr "" -#: ../../reference/simple_stmts.rst:771 +#: ../../reference/simple_stmts.rst:774 msgid "" "The details of the first step, finding and loading modules, are described in " "greater detail in the section on the :ref:`import system `, " @@ -727,26 +729,26 @@ msgid "" "module, which includes execution of the module's code." msgstr "" -#: ../../reference/simple_stmts.rst:779 +#: ../../reference/simple_stmts.rst:782 msgid "" "If the requested module is retrieved successfully, it will be made available " "in the local namespace in one of three ways:" msgstr "" -#: ../../reference/simple_stmts.rst:784 +#: ../../reference/simple_stmts.rst:787 msgid "" "If the module name is followed by :keyword:`!as`, then the name following :" "keyword:`!as` is bound directly to the imported module." msgstr "" -#: ../../reference/simple_stmts.rst:786 +#: ../../reference/simple_stmts.rst:789 msgid "" "If no other name is specified, and the module being imported is a top level " "module, the module's name is bound in the local namespace as a reference to " "the imported module" msgstr "" -#: ../../reference/simple_stmts.rst:789 +#: ../../reference/simple_stmts.rst:792 msgid "" "If the module being imported is *not* a top level module, then the name of " "the top level package that contains the module is bound in the local " @@ -754,53 +756,53 @@ msgid "" "be accessed using its full qualified name rather than directly" msgstr "" -#: ../../reference/simple_stmts.rst:799 +#: ../../reference/simple_stmts.rst:802 msgid "The :keyword:`from` form uses a slightly more complex process:" msgstr "" -#: ../../reference/simple_stmts.rst:801 +#: ../../reference/simple_stmts.rst:804 msgid "" "find the module specified in the :keyword:`from` clause, loading and " "initializing it if necessary;" msgstr "" -#: ../../reference/simple_stmts.rst:803 +#: ../../reference/simple_stmts.rst:806 msgid "for each of the identifiers specified in the :keyword:`import` clauses:" msgstr "" -#: ../../reference/simple_stmts.rst:805 +#: ../../reference/simple_stmts.rst:808 msgid "check if the imported module has an attribute by that name" msgstr "" -#: ../../reference/simple_stmts.rst:806 +#: ../../reference/simple_stmts.rst:809 msgid "" "if not, attempt to import a submodule with that name and then check the " "imported module again for that attribute" msgstr "" -#: ../../reference/simple_stmts.rst:808 +#: ../../reference/simple_stmts.rst:811 msgid "if the attribute is not found, :exc:`ImportError` is raised." msgstr "" -#: ../../reference/simple_stmts.rst:809 +#: ../../reference/simple_stmts.rst:812 msgid "" "otherwise, a reference to that value is stored in the local namespace, using " "the name in the :keyword:`!as` clause if it is present, otherwise using the " "attribute name" msgstr "" -#: ../../reference/simple_stmts.rst:813 +#: ../../reference/simple_stmts.rst:816 msgid "Examples::" msgstr "範例: ::" -#: ../../reference/simple_stmts.rst:823 +#: ../../reference/simple_stmts.rst:826 msgid "" "If the list of identifiers is replaced by a star (``'*'``), all public names " "defined in the module are bound in the local namespace for the scope where " "the :keyword:`import` statement occurs." msgstr "" -#: ../../reference/simple_stmts.rst:829 +#: ../../reference/simple_stmts.rst:832 msgid "" "The *public names* defined by a module are determined by checking the " "module's namespace for a variable named ``__all__``; if defined, it must be " @@ -813,14 +815,14 @@ msgid "" "API (such as library modules which were imported and used within the module)." msgstr "" -#: ../../reference/simple_stmts.rst:839 +#: ../../reference/simple_stmts.rst:842 msgid "" "The wild card form of import --- ``from module import *`` --- is only " "allowed at the module level. Attempting to use it in class or function " "definitions will raise a :exc:`SyntaxError`." msgstr "" -#: ../../reference/simple_stmts.rst:846 +#: ../../reference/simple_stmts.rst:849 msgid "" "When specifying what module to import you do not have to specify the " "absolute name of the module. When a module or package is contained within " @@ -837,13 +839,13 @@ msgid "" "the :ref:`relativeimports` section." msgstr "" -#: ../../reference/simple_stmts.rst:860 +#: ../../reference/simple_stmts.rst:863 msgid "" ":func:`importlib.import_module` is provided to support applications that " "determine dynamically the modules to be loaded." msgstr "" -#: ../../reference/simple_stmts.rst:863 +#: ../../reference/simple_stmts.rst:866 msgid "" "Raises an :ref:`auditing event ` ``import`` with arguments " "``module``, ``filename``, ``sys.path``, ``sys.meta_path``, ``sys." @@ -852,18 +854,18 @@ msgstr "" "引發一個附帶引數 ``module``、``filename``、``sys.path``、``sys.meta_path``、" "``sys.path_hooks`` 的\\ :ref:`稽核事件 ` ``import``。" -#: ../../reference/simple_stmts.rst:868 +#: ../../reference/simple_stmts.rst:871 msgid "Future statements" msgstr "" -#: ../../reference/simple_stmts.rst:874 +#: ../../reference/simple_stmts.rst:877 msgid "" "A :dfn:`future statement` is a directive to the compiler that a particular " "module should be compiled using syntax or semantics that will be available " "in a specified future release of Python where the feature becomes standard." msgstr "" -#: ../../reference/simple_stmts.rst:878 +#: ../../reference/simple_stmts.rst:881 msgid "" "The future statement is intended to ease migration to future versions of " "Python that introduce incompatible changes to the language. It allows use " @@ -871,35 +873,35 @@ msgid "" "feature becomes standard." msgstr "" -#: ../../reference/simple_stmts.rst:890 +#: ../../reference/simple_stmts.rst:893 msgid "" "A future statement must appear near the top of the module. The only lines " "that can appear before a future statement are:" msgstr "" -#: ../../reference/simple_stmts.rst:893 +#: ../../reference/simple_stmts.rst:896 msgid "the module docstring (if any)," msgstr "" -#: ../../reference/simple_stmts.rst:894 +#: ../../reference/simple_stmts.rst:897 msgid "comments," msgstr "" -#: ../../reference/simple_stmts.rst:895 +#: ../../reference/simple_stmts.rst:898 msgid "blank lines, and" msgstr "" -#: ../../reference/simple_stmts.rst:896 +#: ../../reference/simple_stmts.rst:899 msgid "other future statements." msgstr "" -#: ../../reference/simple_stmts.rst:898 +#: ../../reference/simple_stmts.rst:901 msgid "" "The only feature that requires using the future statement is ``annotations`` " "(see :pep:`563`)." msgstr "" -#: ../../reference/simple_stmts.rst:901 +#: ../../reference/simple_stmts.rst:904 msgid "" "All historical features enabled by the future statement are still recognized " "by Python 3. The list includes ``absolute_import``, ``division``, " @@ -909,7 +911,7 @@ msgid "" "compatibility." msgstr "" -#: ../../reference/simple_stmts.rst:908 +#: ../../reference/simple_stmts.rst:911 msgid "" "A future statement is recognized and treated specially at compile time: " "Changes to the semantics of core constructs are often implemented by " @@ -919,37 +921,37 @@ msgid "" "cannot be pushed off until runtime." msgstr "" -#: ../../reference/simple_stmts.rst:915 +#: ../../reference/simple_stmts.rst:918 msgid "" "For any given release, the compiler knows which feature names have been " "defined, and raises a compile-time error if a future statement contains a " "feature not known to it." msgstr "" -#: ../../reference/simple_stmts.rst:919 +#: ../../reference/simple_stmts.rst:922 msgid "" "The direct runtime semantics are the same as for any import statement: there " "is a standard module :mod:`__future__`, described later, and it will be " "imported in the usual way at the time the future statement is executed." msgstr "" -#: ../../reference/simple_stmts.rst:923 +#: ../../reference/simple_stmts.rst:926 msgid "" "The interesting runtime semantics depend on the specific feature enabled by " "the future statement." msgstr "" -#: ../../reference/simple_stmts.rst:926 +#: ../../reference/simple_stmts.rst:929 msgid "Note that there is nothing special about the statement::" msgstr "" -#: ../../reference/simple_stmts.rst:930 +#: ../../reference/simple_stmts.rst:933 msgid "" "That is not a future statement; it's an ordinary import statement with no " "special semantics or syntax restrictions." msgstr "" -#: ../../reference/simple_stmts.rst:933 +#: ../../reference/simple_stmts.rst:936 msgid "" "Code compiled by calls to the built-in functions :func:`exec` and :func:" "`compile` that occur in a module :mod:`!M` containing a future statement " @@ -958,7 +960,7 @@ msgid "" "--- see the documentation of that function for details." msgstr "" -#: ../../reference/simple_stmts.rst:939 +#: ../../reference/simple_stmts.rst:942 msgid "" "A future statement typed at an interactive interpreter prompt will take " "effect for the rest of the interpreter session. If an interpreter is " @@ -967,19 +969,19 @@ msgid "" "interactive session started after the script is executed." msgstr "" -#: ../../reference/simple_stmts.rst:947 +#: ../../reference/simple_stmts.rst:950 msgid ":pep:`236` - Back to the __future__" msgstr "" -#: ../../reference/simple_stmts.rst:948 +#: ../../reference/simple_stmts.rst:951 msgid "The original proposal for the __future__ mechanism." msgstr "" -#: ../../reference/simple_stmts.rst:954 +#: ../../reference/simple_stmts.rst:957 msgid "The :keyword:`!global` statement" msgstr "" -#: ../../reference/simple_stmts.rst:964 +#: ../../reference/simple_stmts.rst:967 msgid "" "The :keyword:`global` statement is a declaration which holds for the entire " "current code block. It means that the listed identifiers are to be " @@ -988,13 +990,13 @@ msgid "" "globals without being declared global." msgstr "" -#: ../../reference/simple_stmts.rst:970 +#: ../../reference/simple_stmts.rst:973 msgid "" "Names listed in a :keyword:`global` statement must not be used in the same " "code block textually preceding that :keyword:`!global` statement." msgstr "" -#: ../../reference/simple_stmts.rst:973 +#: ../../reference/simple_stmts.rst:976 msgid "" "Names listed in a :keyword:`global` statement must not be defined as formal " "parameters, or as targets in :keyword:`with` statements or :keyword:`except` " @@ -1002,14 +1004,14 @@ msgid "" "function definition, :keyword:`import` statement, or variable annotation." msgstr "" -#: ../../reference/simple_stmts.rst:980 +#: ../../reference/simple_stmts.rst:983 msgid "" "The current implementation does not enforce some of these restrictions, but " "programs should not abuse this freedom, as future implementations may " "enforce them or silently change the meaning of the program." msgstr "" -#: ../../reference/simple_stmts.rst:989 +#: ../../reference/simple_stmts.rst:992 msgid "" "**Programmer's note:** :keyword:`global` is a directive to the parser. It " "applies only to code parsed at the same time as the :keyword:`!global` " @@ -1021,11 +1023,11 @@ msgid "" "func:`compile` functions." msgstr "" -#: ../../reference/simple_stmts.rst:1001 +#: ../../reference/simple_stmts.rst:1004 msgid "The :keyword:`!nonlocal` statement" msgstr "" -#: ../../reference/simple_stmts.rst:1009 +#: ../../reference/simple_stmts.rst:1012 msgid "" "When the definition of a function or class is nested (enclosed) within the " "definitions of other functions, its nonlocal scopes are the local scopes of " @@ -1037,53 +1039,53 @@ msgid "" "`SyntaxError` is raised." msgstr "" -#: ../../reference/simple_stmts.rst:1018 +#: ../../reference/simple_stmts.rst:1021 msgid "" "The nonlocal statement applies to the entire scope of a function or class " "body. A :exc:`SyntaxError` is raised if a variable is used or assigned to " "prior to its nonlocal declaration in the scope." msgstr "" -#: ../../reference/simple_stmts.rst:1024 +#: ../../reference/simple_stmts.rst:1027 msgid ":pep:`3104` - Access to Names in Outer Scopes" msgstr "" -#: ../../reference/simple_stmts.rst:1025 +#: ../../reference/simple_stmts.rst:1028 msgid "The specification for the :keyword:`nonlocal` statement." msgstr "" -#: ../../reference/simple_stmts.rst:1027 +#: ../../reference/simple_stmts.rst:1030 msgid "" "**Programmer's note:** :keyword:`nonlocal` is a directive to the parser and " "applies only to code parsed along with it. See the note for the :keyword:" "`global` statement." msgstr "" -#: ../../reference/simple_stmts.rst:1035 +#: ../../reference/simple_stmts.rst:1038 msgid "The :keyword:`!type` statement" msgstr "" -#: ../../reference/simple_stmts.rst:1042 +#: ../../reference/simple_stmts.rst:1045 msgid "" "The :keyword:`!type` statement declares a type alias, which is an instance " "of :class:`typing.TypeAliasType`." msgstr "" -#: ../../reference/simple_stmts.rst:1045 +#: ../../reference/simple_stmts.rst:1048 msgid "For example, the following statement creates a type alias::" msgstr "" -#: ../../reference/simple_stmts.rst:1049 +#: ../../reference/simple_stmts.rst:1052 msgid "This code is roughly equivalent to::" msgstr "" -#: ../../reference/simple_stmts.rst:1055 +#: ../../reference/simple_stmts.rst:1058 msgid "" "``annotation-def`` indicates an :ref:`annotation scope `, " "which behaves mostly like a function, but with several small differences." msgstr "" -#: ../../reference/simple_stmts.rst:1058 +#: ../../reference/simple_stmts.rst:1061 msgid "" "The value of the type alias is evaluated in the annotation scope. It is not " "evaluated when the type alias is created, but only when the value is " @@ -1092,21 +1094,21 @@ msgid "" "not yet defined." msgstr "" -#: ../../reference/simple_stmts.rst:1064 +#: ../../reference/simple_stmts.rst:1067 msgid "" "Type aliases may be made generic by adding a :ref:`type parameter list ` after the name. See :ref:`generic-type-aliases` for more." msgstr "" -#: ../../reference/simple_stmts.rst:1067 +#: ../../reference/simple_stmts.rst:1070 msgid ":keyword:`!type` is a :ref:`soft keyword `." msgstr "" -#: ../../reference/simple_stmts.rst:1073 +#: ../../reference/simple_stmts.rst:1076 msgid ":pep:`695` - Type Parameter Syntax" msgstr "" -#: ../../reference/simple_stmts.rst:1074 +#: ../../reference/simple_stmts.rst:1077 msgid "" "Introduced the :keyword:`!type` statement and syntax for generic classes and " "functions." @@ -1118,14 +1120,14 @@ msgstr "" #: ../../reference/simple_stmts.rst:8 ../../reference/simple_stmts.rst:39 #: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:263 -#: ../../reference/simple_stmts.rst:322 ../../reference/simple_stmts.rst:379 -#: ../../reference/simple_stmts.rst:422 ../../reference/simple_stmts.rst:444 -#: ../../reference/simple_stmts.rst:457 ../../reference/simple_stmts.rst:483 -#: ../../reference/simple_stmts.rst:520 ../../reference/simple_stmts.rst:556 -#: ../../reference/simple_stmts.rst:681 ../../reference/simple_stmts.rst:715 -#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:870 -#: ../../reference/simple_stmts.rst:956 ../../reference/simple_stmts.rst:1003 -#: ../../reference/simple_stmts.rst:1037 +#: ../../reference/simple_stmts.rst:322 ../../reference/simple_stmts.rst:382 +#: ../../reference/simple_stmts.rst:425 ../../reference/simple_stmts.rst:447 +#: ../../reference/simple_stmts.rst:460 ../../reference/simple_stmts.rst:486 +#: ../../reference/simple_stmts.rst:523 ../../reference/simple_stmts.rst:559 +#: ../../reference/simple_stmts.rst:684 ../../reference/simple_stmts.rst:718 +#: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:873 +#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:1006 +#: ../../reference/simple_stmts.rst:1040 msgid "statement" msgstr "statement(陳述式)" @@ -1135,11 +1137,11 @@ msgstr "" #: ../../reference/simple_stmts.rst:39 ../../reference/simple_stmts.rst:42 #: ../../reference/simple_stmts.rst:105 ../../reference/simple_stmts.rst:116 -#: ../../reference/simple_stmts.rst:196 ../../reference/simple_stmts.rst:444 +#: ../../reference/simple_stmts.rst:196 ../../reference/simple_stmts.rst:447 msgid "list" msgstr "list(串列)" -#: ../../reference/simple_stmts.rst:56 ../../reference/simple_stmts.rst:984 +#: ../../reference/simple_stmts.rst:56 ../../reference/simple_stmts.rst:987 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -1149,7 +1151,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:56 ../../reference/simple_stmts.rst:75 #: ../../reference/simple_stmts.rst:187 ../../reference/simple_stmts.rst:196 -#: ../../reference/simple_stmts.rst:207 ../../reference/simple_stmts.rst:578 +#: ../../reference/simple_stmts.rst:207 ../../reference/simple_stmts.rst:581 msgid "object" msgstr "object(物件)" @@ -1204,14 +1206,14 @@ msgstr "assignment statement(賦值陳述式)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:740 -#: ../../reference/simple_stmts.rst:795 ../../reference/simple_stmts.rst:956 +#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:743 +#: ../../reference/simple_stmts.rst:798 ../../reference/simple_stmts.rst:959 msgid "binding" msgstr "binding(繫結)" -#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:457 -#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:795 -#: ../../reference/simple_stmts.rst:956 +#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:460 +#: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:798 +#: ../../reference/simple_stmts.rst:959 msgid "name" msgstr "name(名稱)" @@ -1224,18 +1226,18 @@ msgid "mutable" msgstr "mutable(可變的)" #: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:159 -#: ../../reference/simple_stmts.rst:466 +#: ../../reference/simple_stmts.rst:469 msgid "attribute" msgstr "attribute(屬性)" #: ../../reference/simple_stmts.rst:105 ../../reference/simple_stmts.rst:116 -#: ../../reference/simple_stmts.rst:444 ../../reference/simple_stmts.rst:694 +#: ../../reference/simple_stmts.rst:447 ../../reference/simple_stmts.rst:697 msgid "target" msgstr "target" -#: ../../reference/simple_stmts.rst:116 ../../reference/simple_stmts.rst:379 -#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:956 -#: ../../reference/simple_stmts.rst:1003 +#: ../../reference/simple_stmts.rst:116 ../../reference/simple_stmts.rst:382 +#: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:959 +#: ../../reference/simple_stmts.rst:1006 msgid ", (comma)" msgstr ", (逗號)" @@ -1243,7 +1245,7 @@ msgstr ", (逗號)" msgid "in target list" msgstr "於目標列表中" -#: ../../reference/simple_stmts.rst:116 ../../reference/simple_stmts.rst:821 +#: ../../reference/simple_stmts.rst:116 ../../reference/simple_stmts.rst:824 msgid "* (asterisk)" msgstr "* (星號)" @@ -1359,232 +1361,232 @@ msgstr ": (冒號)" msgid "annotated variable" msgstr "annotated variable(註釋變數)" -#: ../../reference/simple_stmts.rst:379 +#: ../../reference/simple_stmts.rst:382 msgid "assert" msgstr "assert" -#: ../../reference/simple_stmts.rst:379 +#: ../../reference/simple_stmts.rst:382 msgid "debugging" msgstr "debugging(除錯)" -#: ../../reference/simple_stmts.rst:379 +#: ../../reference/simple_stmts.rst:382 msgid "assertions" msgstr "assertions(斷言)" -#: ../../reference/simple_stmts.rst:379 +#: ../../reference/simple_stmts.rst:382 msgid "expression list" msgstr "expression list(運算式列表)" -#: ../../reference/simple_stmts.rst:400 +#: ../../reference/simple_stmts.rst:403 msgid "__debug__" msgstr "__debug__" -#: ../../reference/simple_stmts.rst:400 ../../reference/simple_stmts.rst:520 -#: ../../reference/simple_stmts.rst:556 ../../reference/simple_stmts.rst:588 -#: ../../reference/simple_stmts.rst:740 +#: ../../reference/simple_stmts.rst:403 ../../reference/simple_stmts.rst:523 +#: ../../reference/simple_stmts.rst:559 ../../reference/simple_stmts.rst:591 +#: ../../reference/simple_stmts.rst:743 msgid "exception" msgstr "exception(例外)" -#: ../../reference/simple_stmts.rst:400 +#: ../../reference/simple_stmts.rst:403 msgid "AssertionError" msgstr "AssertionError" -#: ../../reference/simple_stmts.rst:422 +#: ../../reference/simple_stmts.rst:425 msgid "pass" msgstr "pass" -#: ../../reference/simple_stmts.rst:422 +#: ../../reference/simple_stmts.rst:425 msgid "null" msgstr "null" -#: ../../reference/simple_stmts.rst:422 +#: ../../reference/simple_stmts.rst:425 msgid "operation" msgstr "operation(操作)" -#: ../../reference/simple_stmts.rst:444 +#: ../../reference/simple_stmts.rst:447 msgid "del" msgstr "del" -#: ../../reference/simple_stmts.rst:444 ../../reference/simple_stmts.rst:466 +#: ../../reference/simple_stmts.rst:447 ../../reference/simple_stmts.rst:469 msgid "deletion" msgstr "deletion(刪除)" -#: ../../reference/simple_stmts.rst:457 ../../reference/simple_stmts.rst:956 +#: ../../reference/simple_stmts.rst:460 ../../reference/simple_stmts.rst:959 msgid "global" msgstr "global" -#: ../../reference/simple_stmts.rst:457 +#: ../../reference/simple_stmts.rst:460 msgid "unbinding" msgstr "unbinding(解除繫結)" -#: ../../reference/simple_stmts.rst:483 +#: ../../reference/simple_stmts.rst:486 msgid "return" msgstr "return (回傳)" -#: ../../reference/simple_stmts.rst:483 ../../reference/simple_stmts.rst:520 +#: ../../reference/simple_stmts.rst:486 ../../reference/simple_stmts.rst:523 msgid "function" msgstr "function (函式)" -#: ../../reference/simple_stmts.rst:483 +#: ../../reference/simple_stmts.rst:486 msgid "definition" msgstr "definition(定義)" -#: ../../reference/simple_stmts.rst:483 +#: ../../reference/simple_stmts.rst:486 msgid "class" msgstr "class(類別)" -#: ../../reference/simple_stmts.rst:499 ../../reference/simple_stmts.rst:694 -#: ../../reference/simple_stmts.rst:703 ../../reference/simple_stmts.rst:715 -#: ../../reference/simple_stmts.rst:740 +#: ../../reference/simple_stmts.rst:502 ../../reference/simple_stmts.rst:697 +#: ../../reference/simple_stmts.rst:706 ../../reference/simple_stmts.rst:718 +#: ../../reference/simple_stmts.rst:743 msgid "keyword" msgstr "keyword(關鍵字)" -#: ../../reference/simple_stmts.rst:499 ../../reference/simple_stmts.rst:703 -#: ../../reference/simple_stmts.rst:715 +#: ../../reference/simple_stmts.rst:502 ../../reference/simple_stmts.rst:706 +#: ../../reference/simple_stmts.rst:718 msgid "finally" msgstr "finally" -#: ../../reference/simple_stmts.rst:520 +#: ../../reference/simple_stmts.rst:523 msgid "yield" msgstr "yield" -#: ../../reference/simple_stmts.rst:520 +#: ../../reference/simple_stmts.rst:523 msgid "generator" msgstr "generator(產生器)" -#: ../../reference/simple_stmts.rst:520 +#: ../../reference/simple_stmts.rst:523 msgid "iterator" msgstr "iterator(疊代器)" -#: ../../reference/simple_stmts.rst:520 +#: ../../reference/simple_stmts.rst:523 msgid "StopIteration" msgstr "StopIteration" -#: ../../reference/simple_stmts.rst:556 +#: ../../reference/simple_stmts.rst:559 msgid "raise" msgstr "raise" -#: ../../reference/simple_stmts.rst:556 +#: ../../reference/simple_stmts.rst:559 msgid "raising" msgstr "raiseing" -#: ../../reference/simple_stmts.rst:556 +#: ../../reference/simple_stmts.rst:559 msgid "__traceback__ (exception attribute)" msgstr "__traceback__(例外屬性)" -#: ../../reference/simple_stmts.rst:578 +#: ../../reference/simple_stmts.rst:581 msgid "traceback" msgstr "traceback" -#: ../../reference/simple_stmts.rst:588 +#: ../../reference/simple_stmts.rst:591 msgid "chaining" msgstr "chaining(鏈結)" -#: ../../reference/simple_stmts.rst:588 +#: ../../reference/simple_stmts.rst:591 msgid "__cause__ (exception attribute)" msgstr "__cause__(例外屬性)" -#: ../../reference/simple_stmts.rst:588 +#: ../../reference/simple_stmts.rst:591 msgid "__context__ (exception attribute)" msgstr "__context__(例外屬性)" -#: ../../reference/simple_stmts.rst:681 +#: ../../reference/simple_stmts.rst:684 msgid "break" msgstr "break" -#: ../../reference/simple_stmts.rst:681 ../../reference/simple_stmts.rst:715 +#: ../../reference/simple_stmts.rst:684 ../../reference/simple_stmts.rst:718 msgid "for" msgstr "for" -#: ../../reference/simple_stmts.rst:681 ../../reference/simple_stmts.rst:715 +#: ../../reference/simple_stmts.rst:684 ../../reference/simple_stmts.rst:718 msgid "while" msgstr "while" -#: ../../reference/simple_stmts.rst:681 ../../reference/simple_stmts.rst:715 +#: ../../reference/simple_stmts.rst:684 ../../reference/simple_stmts.rst:718 msgid "loop" msgstr "loop(迴圈)" -#: ../../reference/simple_stmts.rst:694 +#: ../../reference/simple_stmts.rst:697 msgid "else" msgstr "else" -#: ../../reference/simple_stmts.rst:694 +#: ../../reference/simple_stmts.rst:697 msgid "loop control" msgstr "loop control(迴圈控制)" -#: ../../reference/simple_stmts.rst:715 +#: ../../reference/simple_stmts.rst:718 msgid "continue" msgstr "continue" -#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:843 +#: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:846 msgid "import" msgstr "import(引入)" -#: ../../reference/simple_stmts.rst:740 +#: ../../reference/simple_stmts.rst:743 msgid "module" msgstr "module(模組)" -#: ../../reference/simple_stmts.rst:740 +#: ../../reference/simple_stmts.rst:743 msgid "importing" msgstr "importing(引入)" -#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:795 +#: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:798 msgid "from" msgstr "from" -#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:782 +#: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:785 msgid "as" msgstr "as" -#: ../../reference/simple_stmts.rst:740 +#: ../../reference/simple_stmts.rst:743 msgid "ImportError" msgstr "ImportError" -#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:782 -#: ../../reference/simple_stmts.rst:795 ../../reference/simple_stmts.rst:821 +#: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:785 +#: ../../reference/simple_stmts.rst:798 ../../reference/simple_stmts.rst:824 msgid "import statement" msgstr "import statement(引入陳述式)" -#: ../../reference/simple_stmts.rst:827 +#: ../../reference/simple_stmts.rst:830 msgid "__all__ (optional module attribute)" msgstr "__all__(可選模組屬性)" -#: ../../reference/simple_stmts.rst:843 +#: ../../reference/simple_stmts.rst:846 msgid "relative" msgstr "relative(相對)" -#: ../../reference/simple_stmts.rst:870 +#: ../../reference/simple_stmts.rst:873 msgid "future" msgstr "future" -#: ../../reference/simple_stmts.rst:870 +#: ../../reference/simple_stmts.rst:873 msgid "__future__" msgstr "__future__" -#: ../../reference/simple_stmts.rst:870 +#: ../../reference/simple_stmts.rst:873 msgid "future statement" msgstr "future statement(future 陳述式)" -#: ../../reference/simple_stmts.rst:956 ../../reference/simple_stmts.rst:1003 +#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:1006 msgid "identifier list" msgstr "identifier list(識別符號清單)" -#: ../../reference/simple_stmts.rst:984 +#: ../../reference/simple_stmts.rst:987 msgid "exec" msgstr "exec" -#: ../../reference/simple_stmts.rst:984 +#: ../../reference/simple_stmts.rst:987 msgid "eval" msgstr "eval" -#: ../../reference/simple_stmts.rst:984 +#: ../../reference/simple_stmts.rst:987 msgid "compile" msgstr "compile(編譯)" -#: ../../reference/simple_stmts.rst:1003 +#: ../../reference/simple_stmts.rst:1006 msgid "nonlocal" msgstr "nonlocal" -#: ../../reference/simple_stmts.rst:1037 +#: ../../reference/simple_stmts.rst:1040 msgid "type" msgstr "" diff --git a/tutorial/classes.po b/tutorial/classes.po index 55c2370949..5451a98cec 100644 --- a/tutorial/classes.po +++ b/tutorial/classes.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-02 00:03+0000\n" +"POT-Creation-Date: 2024-07-14 00:03+0000\n" "PO-Revision-Date: 2022-12-26 23:12+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -994,7 +994,14 @@ msgstr "" "``classname`` 就是去掉前導下底線的當前 class 名稱。只要這個修飾是在 class 的" "定義之中發生,它就會在不考慮該物件名稱的語法位置的情況下完成。" -#: ../../tutorial/classes.rst:691 +#: ../../tutorial/classes.rst:693 +msgid "" +"The :ref:`private name mangling specifications ` for " +"details and special cases." +msgstr "" +"參閱\\ :ref:`私有名稱修飾規格 `\\ 的詳情與特殊情況。" + +#: ../../tutorial/classes.rst:696 msgid "" "Name mangling is helpful for letting subclasses override methods without " "breaking intraclass method calls. For example::" @@ -1002,7 +1009,7 @@ msgstr "" "名稱修飾對於讓 subclass 覆寫 method 而不用破壞 class 內部的 method 呼叫,是有" "幫助的。舉例來說: ::" -#: ../../tutorial/classes.rst:713 +#: ../../tutorial/classes.rst:718 msgid "" "The above example would work even if ``MappingSubclass`` were to introduce a " "``__update`` identifier since it is replaced with ``_Mapping__update`` in " @@ -1013,7 +1020,7 @@ msgstr "" "作,因為在 ``Mapping`` class 中,它會被替換為 ``_Mapping__update``,而在 " "``MappingSubclass`` class 中,它會被替換為 ``_MappingSubclass__update``。" -#: ../../tutorial/classes.rst:718 +#: ../../tutorial/classes.rst:723 msgid "" "Note that the mangling rules are designed mostly to avoid accidents; it " "still is possible to access or modify a variable that is considered " @@ -1023,7 +1030,7 @@ msgstr "" "請注意,修飾規則是被設計來避免意外;它仍可能存取或修改一個被視為私有的變數。" "這在特殊情況下甚至可能很有用,例如在除錯器 (debugger)。" -#: ../../tutorial/classes.rst:722 +#: ../../tutorial/classes.rst:727 msgid "" "Notice that code passed to ``exec()`` or ``eval()`` does not consider the " "classname of the invoking class to be the current class; this is similar to " @@ -1037,11 +1044,11 @@ msgstr "" "組編譯後 (byte-compiled) 的程式碼。同樣的限制適用於 ``getattr()``," "``setattr()`` 和 ``delattr()``,以及直接參照 ``__dict__`` 時。" -#: ../../tutorial/classes.rst:733 +#: ../../tutorial/classes.rst:738 msgid "Odds and Ends" msgstr "補充說明" -#: ../../tutorial/classes.rst:735 +#: ../../tutorial/classes.rst:740 msgid "" "Sometimes it is useful to have a data type similar to the Pascal \"record\" " "or C \"struct\", bundling together a few named data items. The idiomatic " @@ -1051,7 +1058,7 @@ msgstr "" "名稱的資料項目捆綁在一起,有時候這會很有用。符合語言習慣的做法是使用 :mod:" "`dataclasses`: ::" -#: ../../tutorial/classes.rst:755 +#: ../../tutorial/classes.rst:760 msgid "" "A piece of Python code that expects a particular abstract data type can " "often be passed a class that emulates the methods of that data type " @@ -1066,7 +1073,7 @@ msgstr "" "meth:`~io.TextIOBase.readline` method 的 class 作為替代方式,從字串緩衝區取得" "資料,並將其作為引數來傳遞。" -#: ../../tutorial/classes.rst:767 +#: ../../tutorial/classes.rst:772 msgid "" ":ref:`Instance method objects ` have attributes, too: :" "attr:`m.__self__ ` is the instance object with the method :" @@ -1078,11 +1085,11 @@ msgstr "" "__func__ ` 則是該 method 所對應的\\ :ref:`函式物件 `。" -#: ../../tutorial/classes.rst:777 +#: ../../tutorial/classes.rst:782 msgid "Iterators" msgstr "疊代器 (Iterator)" -#: ../../tutorial/classes.rst:779 +#: ../../tutorial/classes.rst:784 msgid "" "By now you have probably noticed that most container objects can be looped " "over using a :keyword:`for` statement::" @@ -1090,7 +1097,7 @@ msgstr "" "到目前為止,你可能已經注意到大多數的容器 (container) 物件都可以使用 :keyword:" "`for` 陳述式來進行迴圈: ::" -#: ../../tutorial/classes.rst:793 +#: ../../tutorial/classes.rst:798 msgid "" "This style of access is clear, concise, and convenient. The use of " "iterators pervades and unifies Python. Behind the scenes, the :keyword:" @@ -1110,7 +1117,7 @@ msgstr "" "func:`next` 來呼叫 :meth:`~iterator.__next__` method;這個例子展示了它的運作" "方式: ::" -#: ../../tutorial/classes.rst:818 +#: ../../tutorial/classes.rst:823 msgid "" "Having seen the mechanics behind the iterator protocol, it is easy to add " "iterator behavior to your classes. Define an :meth:`~container.__iter__` " @@ -1123,11 +1130,11 @@ msgstr "" "__next__` method 的物件。如果 class 已定義了 :meth:`!__next__`,則 :meth:`!" "__iter__` 可以只回傳 ``self``: ::" -#: ../../tutorial/classes.rst:855 +#: ../../tutorial/classes.rst:860 msgid "Generators" msgstr "產生器 (Generator)" -#: ../../tutorial/classes.rst:857 +#: ../../tutorial/classes.rst:862 msgid "" ":term:`Generators ` are a simple and powerful tool for creating " "iterators. They are written like regular functions but use the :keyword:" @@ -1141,7 +1148,7 @@ msgstr "" "次在產生器上呼叫 :func:`next` 時,它會從上次離開的位置恢復執行(它會記得所有" "資料值以及上一個被執行的陳述式)。以下範例顯示,建立產生器可以相當地容易: ::" -#: ../../tutorial/classes.rst:878 +#: ../../tutorial/classes.rst:883 msgid "" "Anything that can be done with generators can also be done with class-based " "iterators as described in the previous section. What makes generators so " @@ -1152,7 +1159,7 @@ msgstr "" "描述。而讓產生器的程式碼更為精簡的原因是,:meth:`~iterator.__iter__` 和 :" "meth:`~generator.__next__` method 會自動被建立。" -#: ../../tutorial/classes.rst:883 +#: ../../tutorial/classes.rst:888 msgid "" "Another key feature is that the local variables and execution state are " "automatically saved between calls. This made the function easier to write " @@ -1163,7 +1170,7 @@ msgstr "" "函式比使用 ``self.index`` 和 ``self.data`` 這種實例變數的方式更容易編寫且更為" "清晰。" -#: ../../tutorial/classes.rst:888 +#: ../../tutorial/classes.rst:893 msgid "" "In addition to automatic method creation and saving program state, when " "generators terminate, they automatically raise :exc:`StopIteration`. In " @@ -1173,11 +1180,11 @@ msgstr "" "除了會自動建立 method 和儲存程式狀態,當產生器終止時,它們還會自動引發 :exc:" "`StopIteration`。這些特性結合在一起,使建立疊代器能與編寫常規函式一樣容易。" -#: ../../tutorial/classes.rst:897 +#: ../../tutorial/classes.rst:902 msgid "Generator Expressions" msgstr "產生器運算式" -#: ../../tutorial/classes.rst:899 +#: ../../tutorial/classes.rst:904 msgid "" "Some simple generators can be coded succinctly as expressions using a syntax " "similar to list comprehensions but with parentheses instead of square " @@ -1192,15 +1199,15 @@ msgstr "" "產生器定義相比,程式碼較精簡但功能較少,也比等效的 list comprehension 更為節" "省記憶體。" -#: ../../tutorial/classes.rst:906 +#: ../../tutorial/classes.rst:911 msgid "Examples::" msgstr "例如: ::" -#: ../../tutorial/classes.rst:927 +#: ../../tutorial/classes.rst:932 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/classes.rst:928 +#: ../../tutorial/classes.rst:933 msgid "" "Except for one thing. Module objects have a secret read-only attribute " "called :attr:`~object.__dict__` which returns the dictionary used to " diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index 829836e8ee..77eb9b1d8e 100644 --- a/tutorial/stdlib2.po +++ b/tutorial/stdlib2.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-23 00:17+0000\n" +"POT-Creation-Date: 2024-06-13 00:03+0000\n" "PO-Revision-Date: 2021-06-19 14:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -294,25 +294,25 @@ msgstr "" #: ../../tutorial/stdlib2.rst:296 msgid "" -"The :mod:`array` module provides an :class:`~array.array()` object that is " +"The :mod:`array` module provides an :class:`~array.array` object that is " "like a list that stores only homogeneous data and stores it more compactly. " "The following example shows an array of numbers stored as two byte unsigned " "binary numbers (typecode ``\"H\"``) rather than the usual 16 bytes per entry " "for regular lists of Python int objects::" msgstr "" -":mod:`array` 模組提供了一個 :class:`~array.array()` 物件,它像是 list,但只能" -"儲存同類的資料且能緊密地儲存。下面的範例展示一個數值陣列 (array),以兩個位元" -"組的無符號二進數 (unsigned binary numbers) 為儲存單位(類型碼為 ``\"H\"``)," -"而在 Python 整數物件的正規 list 中,每個項目通常使用 16 個位元組: ::" +":mod:`array` 模組提供了一個 :class:`~array.array` 物件,它像是 list,但只能儲" +"存同類的資料且能緊密地儲存。下面的範例展示一個數值陣列 (array),以兩個位元組" +"的無符號二進數 (unsigned binary numbers) 為儲存單位(類型碼為 ``\"H\"``),而" +"在 Python 整數物件的正規 list 中,每個項目通常使用 16 個位元組: ::" #: ../../tutorial/stdlib2.rst:309 msgid "" -"The :mod:`collections` module provides a :class:`~collections.deque()` " -"object that is like a list with faster appends and pops from the left side " -"but slower lookups in the middle. These objects are well suited for " -"implementing queues and breadth first tree searches::" +"The :mod:`collections` module provides a :class:`~collections.deque` object " +"that is like a list with faster appends and pops from the left side but " +"slower lookups in the middle. These objects are well suited for implementing " +"queues and breadth first tree searches::" msgstr "" -":mod:`collections` 模組提供了一個 :class:`~collections.deque()` 物件,它像是 " +":mod:`collections` 模組提供了一個 :class:`~collections.deque` 物件,它像是 " "list,但從左側加入 (append) 和彈出 (pop) 的速度較快,而在中間查找的速度則較" "慢。這種物件適用於實作佇列 (queue) 和廣度優先搜尋法 (breadth first tree " "search): ::" diff --git a/using/cmdline.po b/using/cmdline.po index 1a3a41009d..461dc7b961 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-18 00:04+0000\n" +"POT-Creation-Date: 2024-06-30 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -508,8 +508,8 @@ msgstr "" msgid "See also :envvar:`PYTHONNOUSERSITE`." msgstr "另請參閱 :envvar:`PYTHONNOUSERSITE`。" -#: ../../using/cmdline.rst:394 ../../using/cmdline.rst:810 -#: ../../using/cmdline.rst:822 +#: ../../using/cmdline.rst:394 ../../using/cmdline.rst:811 +#: ../../using/cmdline.rst:823 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" @@ -559,44 +559,44 @@ msgid "" "messages to :data:`sys.stderr`." msgstr "" -#: ../../using/cmdline.rst:436 ../../using/cmdline.rst:838 +#: ../../using/cmdline.rst:436 ../../using/cmdline.rst:839 msgid "" "The simplest settings apply a particular action unconditionally to all " "warnings emitted by a process (even those that are otherwise ignored by " "default)::" msgstr "" -#: ../../using/cmdline.rst:447 +#: ../../using/cmdline.rst:448 msgid "" "The action names can be abbreviated as desired and the interpreter will " "resolve them to the appropriate action name. For example, ``-Wi`` is the " "same as ``-Wignore``." msgstr "" -#: ../../using/cmdline.rst:451 +#: ../../using/cmdline.rst:452 msgid "The full form of argument is::" msgstr "" -#: ../../using/cmdline.rst:455 +#: ../../using/cmdline.rst:456 msgid "" "Empty fields match all values; trailing empty fields may be omitted. For " "example ``-W ignore::DeprecationWarning`` ignores all DeprecationWarning " "warnings." msgstr "" -#: ../../using/cmdline.rst:459 +#: ../../using/cmdline.rst:460 msgid "" "The *action* field is as explained above but only applies to warnings that " "match the remaining fields." msgstr "" -#: ../../using/cmdline.rst:462 +#: ../../using/cmdline.rst:463 msgid "" "The *message* field must match the whole warning message; this match is case-" "insensitive." msgstr "" -#: ../../using/cmdline.rst:465 +#: ../../using/cmdline.rst:466 msgid "" "The *category* field matches the warning category (ex: " "``DeprecationWarning``). This must be a class name; the match test whether " @@ -604,19 +604,19 @@ msgid "" "warning category." msgstr "" -#: ../../using/cmdline.rst:470 +#: ../../using/cmdline.rst:471 msgid "" "The *module* field matches the (fully qualified) module name; this match is " "case-sensitive." msgstr "" -#: ../../using/cmdline.rst:473 +#: ../../using/cmdline.rst:474 msgid "" "The *lineno* field matches the line number, where zero matches all line " "numbers and is thus equivalent to an omitted line number." msgstr "" -#: ../../using/cmdline.rst:476 +#: ../../using/cmdline.rst:477 msgid "" "Multiple :option:`-W` options can be given; when a warning matches more than " "one option, the action for the last matching option is performed. Invalid :" @@ -624,7 +624,7 @@ msgid "" "invalid options when the first warning is issued)." msgstr "" -#: ../../using/cmdline.rst:481 +#: ../../using/cmdline.rst:482 msgid "" "Warnings can also be controlled using the :envvar:`PYTHONWARNINGS` " "environment variable and from within a Python program using the :mod:" @@ -632,31 +632,31 @@ msgid "" "can be used to use a regular expression on the warning message." msgstr "" -#: ../../using/cmdline.rst:486 ../../using/cmdline.rst:849 +#: ../../using/cmdline.rst:487 ../../using/cmdline.rst:851 msgid "" "See :ref:`warning-filter` and :ref:`describing-warning-filters` for more " "details." msgstr "" -#: ../../using/cmdline.rst:492 +#: ../../using/cmdline.rst:493 msgid "" "Skip the first line of the source, allowing use of non-Unix forms of ``#!" "cmd``. This is intended for a DOS specific hack only." msgstr "" -#: ../../using/cmdline.rst:498 +#: ../../using/cmdline.rst:499 msgid "" "Reserved for various implementation-specific options. CPython currently " "defines the following possible values:" msgstr "" -#: ../../using/cmdline.rst:501 +#: ../../using/cmdline.rst:502 msgid "" "``-X faulthandler`` to enable :mod:`faulthandler`. See also :envvar:" "`PYTHONFAULTHANDLER`." msgstr "" -#: ../../using/cmdline.rst:506 +#: ../../using/cmdline.rst:507 msgid "" "``-X showrefcount`` to output the total reference count and number of used " "memory blocks when the program finishes or after each statement in the " @@ -664,7 +664,7 @@ msgid "" "build>`." msgstr "" -#: ../../using/cmdline.rst:513 +#: ../../using/cmdline.rst:514 msgid "" "``-X tracemalloc`` to start tracing Python memory allocations using the :mod:" "`tracemalloc` module. By default, only the most recent frame is stored in a " @@ -673,14 +673,14 @@ msgid "" "envvar:`PYTHONTRACEMALLOC` for more information." msgstr "" -#: ../../using/cmdline.rst:522 +#: ../../using/cmdline.rst:523 msgid "" "``-X int_max_str_digits`` configures the :ref:`integer string conversion " "length limitation `. See also :envvar:" "`PYTHONINTMAXSTRDIGITS`." msgstr "" -#: ../../using/cmdline.rst:528 +#: ../../using/cmdline.rst:529 msgid "" "``-X importtime`` to show how long each import takes. It shows module name, " "cumulative time (including nested imports) and self time (excluding nested " @@ -689,35 +689,35 @@ msgid "" "asyncio'``. See also :envvar:`PYTHONPROFILEIMPORTTIME`." msgstr "" -#: ../../using/cmdline.rst:536 +#: ../../using/cmdline.rst:537 msgid "" "``-X dev``: enable :ref:`Python Development Mode `, introducing " "additional runtime checks that are too expensive to be enabled by default. " "See also :envvar:`PYTHONDEVMODE`." msgstr "" -#: ../../using/cmdline.rst:542 +#: ../../using/cmdline.rst:543 msgid "" "``-X utf8`` enables the :ref:`Python UTF-8 Mode `. ``-X utf8=0`` " "explicitly disables :ref:`Python UTF-8 Mode ` (even when it would " "otherwise activate automatically). See also :envvar:`PYTHONUTF8`." msgstr "" -#: ../../using/cmdline.rst:549 +#: ../../using/cmdline.rst:550 msgid "" "``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel tree " "rooted at the given directory instead of to the code tree. See also :envvar:" "`PYTHONPYCACHEPREFIX`." msgstr "" -#: ../../using/cmdline.rst:555 +#: ../../using/cmdline.rst:556 msgid "" "``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the " "locale-specific default encoding is used for opening files. See also :envvar:" "`PYTHONWARNDEFAULTENCODING`." msgstr "" -#: ../../using/cmdline.rst:561 +#: ../../using/cmdline.rst:562 msgid "" "``-X no_debug_ranges`` disables the inclusion of the tables mapping extra " "location information (end line, start column offset and end column offset) " @@ -727,7 +727,7 @@ msgid "" "envvar:`PYTHONNODEBUGRANGES`." msgstr "" -#: ../../using/cmdline.rst:570 +#: ../../using/cmdline.rst:571 msgid "" "``-X frozen_modules`` determines whether or not frozen modules are ignored " "by the import machinery. A value of \"on\" means they get imported and " @@ -738,7 +738,7 @@ msgid "" "are always used, even if this flag is set to \"off\"." msgstr "" -#: ../../using/cmdline.rst:580 +#: ../../using/cmdline.rst:581 msgid "" "``-X perf`` enables support for the Linux ``perf`` profiler. When this " "option is provided, the ``perf`` profiler will be able to report Python " @@ -747,33 +747,33 @@ msgid "" "also :envvar:`PYTHONPERFSUPPORT` and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:588 +#: ../../using/cmdline.rst:589 msgid "" "It also allows passing arbitrary values and retrieving them through the :" "data:`sys._xoptions` dictionary." msgstr "" -#: ../../using/cmdline.rst:593 +#: ../../using/cmdline.rst:594 msgid "Removed the ``-X showalloccount`` option." msgstr "移除 ``-X showalloccount`` 選項。" -#: ../../using/cmdline.rst:596 +#: ../../using/cmdline.rst:597 msgid "Removed the ``-X oldparser`` option." msgstr "移除 ``-X oldparser`` 選項。" -#: ../../using/cmdline.rst:601 +#: ../../using/cmdline.rst:602 msgid "Options you shouldn't use" msgstr "你不該使用的選項" -#: ../../using/cmdline.rst:605 +#: ../../using/cmdline.rst:606 msgid "Reserved for use by Jython_." msgstr "" -#: ../../using/cmdline.rst:613 +#: ../../using/cmdline.rst:614 msgid "Environment variables" msgstr "環境變數" -#: ../../using/cmdline.rst:615 +#: ../../using/cmdline.rst:616 msgid "" "These environment variables influence Python's behavior, they are processed " "before the command-line switches other than -E or -I. It is customary that " @@ -781,7 +781,7 @@ msgid "" "conflict." msgstr "" -#: ../../using/cmdline.rst:622 +#: ../../using/cmdline.rst:623 msgid "" "Change the location of the standard Python libraries. By default, the " "libraries are searched in :file:`{prefix}/lib/python{version}` and :file:" @@ -790,14 +790,14 @@ msgid "" "file:`/usr/local`." msgstr "" -#: ../../using/cmdline.rst:628 +#: ../../using/cmdline.rst:629 msgid "" "When :envvar:`PYTHONHOME` is set to a single directory, its value replaces " "both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different " "values for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`." msgstr "" -#: ../../using/cmdline.rst:635 +#: ../../using/cmdline.rst:636 msgid "" "Augment the default search path for module files. The format is the same as " "the shell's :envvar:`PATH`: one or more directory pathnames separated by :" @@ -805,21 +805,21 @@ msgid "" "existent directories are silently ignored." msgstr "" -#: ../../using/cmdline.rst:640 +#: ../../using/cmdline.rst:641 msgid "" "In addition to normal directories, individual :envvar:`PYTHONPATH` entries " "may refer to zipfiles containing pure Python modules (in either source or " "compiled form). Extension modules cannot be imported from zipfiles." msgstr "" -#: ../../using/cmdline.rst:644 +#: ../../using/cmdline.rst:645 msgid "" "The default search path is installation dependent, but generally begins " "with :file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). " "It is *always* appended to :envvar:`PYTHONPATH`." msgstr "" -#: ../../using/cmdline.rst:648 +#: ../../using/cmdline.rst:649 msgid "" "An additional directory will be inserted in the search path in front of :" "envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" @@ -827,19 +827,19 @@ msgid "" "the variable :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:656 +#: ../../using/cmdline.rst:657 msgid "" "If this is set to a non-empty string, don't prepend a potentially unsafe " "path to :data:`sys.path`: see the :option:`-P` option for details." msgstr "" -#: ../../using/cmdline.rst:664 +#: ../../using/cmdline.rst:665 msgid "" "If this is set to a non-empty string, it overrides the :data:`sys." "platlibdir` value." msgstr "" -#: ../../using/cmdline.rst:672 +#: ../../using/cmdline.rst:673 msgid "" "If this is the name of a readable file, the Python commands in that file are " "executed before the first prompt is displayed in interactive mode. The file " @@ -850,7 +850,7 @@ msgid "" "file." msgstr "" -#: ../../using/cmdline.rst:679 +#: ../../using/cmdline.rst:680 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_startup`` with " "argument ``filename``." @@ -858,7 +858,7 @@ msgstr "" "引發一個附帶引數 ``filename`` 的\\ :ref:`稽核事件 ` ``cpython." "run_startup``。" -#: ../../using/cmdline.rst:681 +#: ../../using/cmdline.rst:682 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_startup`` with the " "filename as the argument when called on startup." @@ -866,14 +866,14 @@ msgstr "" "引發一個附帶呼叫啟動時的檔案名稱為引數的\\ :ref:`稽核事件 ` " "``cpython.run_startup``。" -#: ../../using/cmdline.rst:687 +#: ../../using/cmdline.rst:688 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-O` option. If set to an integer, it is equivalent to specifying :" "option:`-O` multiple times." msgstr "" -#: ../../using/cmdline.rst:694 +#: ../../using/cmdline.rst:695 msgid "" "If this is set, it names a callable using dotted-path notation. The module " "containing the callable will be imported and then the callable will be run " @@ -884,58 +884,58 @@ msgid "" "breakpointhook` to do nothing but return immediately." msgstr "" -#: ../../using/cmdline.rst:706 +#: ../../using/cmdline.rst:707 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-d` option. If set to an integer, it is equivalent to specifying :" "option:`-d` multiple times." msgstr "" -#: ../../using/cmdline.rst:710 +#: ../../using/cmdline.rst:711 msgid "" "This environment variable requires a :ref:`debug build of Python `, otherwise it's ignored." msgstr "" -#: ../../using/cmdline.rst:716 +#: ../../using/cmdline.rst:717 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-i` option." msgstr "" -#: ../../using/cmdline.rst:719 +#: ../../using/cmdline.rst:720 msgid "" "This variable can also be modified by Python code using :data:`os.environ` " "to force inspect mode on program termination." msgstr "" -#: ../../using/cmdline.rst:725 +#: ../../using/cmdline.rst:726 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-u` option." msgstr "" -#: ../../using/cmdline.rst:731 +#: ../../using/cmdline.rst:732 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-v` option. If set to an integer, it is equivalent to specifying :" "option:`-v` multiple times." msgstr "" -#: ../../using/cmdline.rst:738 +#: ../../using/cmdline.rst:739 msgid "" "If this is set, Python ignores case in :keyword:`import` statements. This " "only works on Windows and macOS." msgstr "" -#: ../../using/cmdline.rst:744 +#: ../../using/cmdline.rst:745 msgid "" "If this is set to a non-empty string, Python won't try to write ``.pyc`` " "files on the import of source modules. This is equivalent to specifying " "the :option:`-B` option." msgstr "" -#: ../../using/cmdline.rst:751 +#: ../../using/cmdline.rst:752 msgid "" "If this is set, Python will write ``.pyc`` files in a mirror directory tree " "at this path, instead of in ``__pycache__`` directories within the source " @@ -943,40 +943,40 @@ msgid "" "``pycache_prefix=PATH`` option." msgstr "" -#: ../../using/cmdline.rst:761 +#: ../../using/cmdline.rst:762 msgid "" "If this variable is not set or set to ``random``, a random value is used to " "seed the hashes of str and bytes objects." msgstr "" -#: ../../using/cmdline.rst:764 +#: ../../using/cmdline.rst:765 msgid "" "If :envvar:`PYTHONHASHSEED` is set to an integer value, it is used as a " "fixed seed for generating the hash() of the types covered by the hash " "randomization." msgstr "" -#: ../../using/cmdline.rst:768 +#: ../../using/cmdline.rst:769 msgid "" "Its purpose is to allow repeatable hashing, such as for selftests for the " "interpreter itself, or to allow a cluster of python processes to share hash " "values." msgstr "" -#: ../../using/cmdline.rst:772 +#: ../../using/cmdline.rst:773 msgid "" "The integer must be a decimal number in the range [0,4294967295]. " "Specifying the value 0 will disable hash randomization." msgstr "" -#: ../../using/cmdline.rst:779 +#: ../../using/cmdline.rst:780 msgid "" "If this variable is set to an integer, it is used to configure the " "interpreter's global :ref:`integer string conversion length limitation " "`." msgstr "" -#: ../../using/cmdline.rst:787 +#: ../../using/cmdline.rst:788 msgid "" "If this is set before running the interpreter, it overrides the encoding " "used for stdin/stdout/stderr, in the syntax ``encodingname:errorhandler``. " @@ -984,17 +984,17 @@ msgid "" "have the same meaning as in :func:`str.encode`." msgstr "" -#: ../../using/cmdline.rst:792 +#: ../../using/cmdline.rst:793 msgid "" "For stderr, the ``:errorhandler`` part is ignored; the handler will always " "be ``'backslashreplace'``." msgstr "" -#: ../../using/cmdline.rst:795 +#: ../../using/cmdline.rst:796 msgid "The ``encodingname`` part is now optional." msgstr "" -#: ../../using/cmdline.rst:798 +#: ../../using/cmdline.rst:799 msgid "" "On Windows, the encoding specified by this variable is ignored for " "interactive console buffers unless :envvar:`PYTHONLEGACYWINDOWSSTDIO` is " @@ -1002,13 +1002,13 @@ msgid "" "not affected." msgstr "" -#: ../../using/cmdline.rst:805 +#: ../../using/cmdline.rst:806 msgid "" "If this is set, Python won't add the :data:`user site-packages directory " "` to :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:815 +#: ../../using/cmdline.rst:816 msgid "" "Defines the :data:`user base directory `, which is used to " "compute the path of the :data:`user site-packages directory ` of the :mod:`asyncio` module." msgstr "" -#: ../../using/cmdline.rst:897 +#: ../../using/cmdline.rst:899 msgid "Set the Python memory allocators and/or install debug hooks." msgstr "" -#: ../../using/cmdline.rst:899 +#: ../../using/cmdline.rst:901 msgid "Set the family of memory allocators used by Python:" msgstr "" -#: ../../using/cmdline.rst:901 +#: ../../using/cmdline.rst:903 msgid "" "``default``: use the :ref:`default memory allocators `." msgstr "" -#: ../../using/cmdline.rst:903 +#: ../../using/cmdline.rst:905 msgid "" "``malloc``: use the :c:func:`malloc` function of the C library for all " "domains (:c:macro:`PYMEM_DOMAIN_RAW`, :c:macro:`PYMEM_DOMAIN_MEM`, :c:macro:" "`PYMEM_DOMAIN_OBJ`)." msgstr "" -#: ../../using/cmdline.rst:906 +#: ../../using/cmdline.rst:908 msgid "" "``pymalloc``: use the :ref:`pymalloc allocator ` for :c:macro:" "`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" "func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." msgstr "" -#: ../../using/cmdline.rst:910 +#: ../../using/cmdline.rst:912 msgid "Install :ref:`debug hooks `:" msgstr "" -#: ../../using/cmdline.rst:912 +#: ../../using/cmdline.rst:914 msgid "" "``debug``: install debug hooks on top of the :ref:`default memory allocators " "`." msgstr "" -#: ../../using/cmdline.rst:914 +#: ../../using/cmdline.rst:916 msgid "``malloc_debug``: same as ``malloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:915 +#: ../../using/cmdline.rst:917 msgid "``pymalloc_debug``: same as ``pymalloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:919 +#: ../../using/cmdline.rst:921 msgid "Added the ``\"default\"`` allocator." msgstr "" -#: ../../using/cmdline.rst:925 +#: ../../using/cmdline.rst:927 msgid "" "If set to a non-empty string, Python will print statistics of the :ref:" "`pymalloc memory allocator ` every time a new pymalloc object " "arena is created, and on shutdown." msgstr "" -#: ../../using/cmdline.rst:929 +#: ../../using/cmdline.rst:931 msgid "" "This variable is ignored if the :envvar:`PYTHONMALLOC` environment variable " "is used to force the :c:func:`malloc` allocator of the C library, or if " "Python is configured without ``pymalloc`` support." msgstr "" -#: ../../using/cmdline.rst:933 +#: ../../using/cmdline.rst:935 msgid "" "This variable can now also be used on Python compiled in release mode. It " "now has no effect if set to an empty string." msgstr "" -#: ../../using/cmdline.rst:940 +#: ../../using/cmdline.rst:942 msgid "" "If set to a non-empty string, the default :term:`filesystem encoding and " "error handler` mode will revert to their pre-3.6 values of 'mbcs' and " @@ -1139,41 +1139,41 @@ msgid "" "'surrogatepass' are used." msgstr "" -#: ../../using/cmdline.rst:945 +#: ../../using/cmdline.rst:947 msgid "" "This may also be enabled at runtime with :func:`sys." "_enablelegacywindowsfsencoding()`." msgstr "" -#: ../../using/cmdline.rst:948 ../../using/cmdline.rst:962 +#: ../../using/cmdline.rst:950 ../../using/cmdline.rst:964 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../using/cmdline.rst:950 +#: ../../using/cmdline.rst:952 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../using/cmdline.rst:955 +#: ../../using/cmdline.rst:957 msgid "" "If set to a non-empty string, does not use the new console reader and " "writer. This means that Unicode characters will be encoded according to the " "active console code page, rather than using utf-8." msgstr "" -#: ../../using/cmdline.rst:959 +#: ../../using/cmdline.rst:961 msgid "" "This variable is ignored if the standard streams are redirected (to files or " "pipes) rather than referring to console buffers." msgstr "" -#: ../../using/cmdline.rst:969 +#: ../../using/cmdline.rst:971 msgid "" "If set to the value ``0``, causes the main Python command line application " "to skip coercing the legacy ASCII-based C and POSIX locales to a more " "capable UTF-8 based alternative." msgstr "" -#: ../../using/cmdline.rst:973 +#: ../../using/cmdline.rst:975 msgid "" "If this variable is *not* set (or is set to a value other than ``0``), the " "``LC_ALL`` locale override environment variable is also not set, and the " @@ -1184,19 +1184,19 @@ msgid "" "runtime:" msgstr "" -#: ../../using/cmdline.rst:981 +#: ../../using/cmdline.rst:983 msgid "``C.UTF-8``" msgstr "``C.UTF-8``" -#: ../../using/cmdline.rst:982 +#: ../../using/cmdline.rst:984 msgid "``C.utf8``" msgstr "``C.utf8``" -#: ../../using/cmdline.rst:983 +#: ../../using/cmdline.rst:985 msgid "``UTF-8``" msgstr "``UTF-8``" -#: ../../using/cmdline.rst:985 +#: ../../using/cmdline.rst:987 msgid "" "If setting one of these locale categories succeeds, then the ``LC_CTYPE`` " "environment variable will also be set accordingly in the current process " @@ -1209,7 +1209,7 @@ msgid "" "(such as Python's own :func:`locale.getdefaultlocale`)." msgstr "" -#: ../../using/cmdline.rst:995 +#: ../../using/cmdline.rst:997 msgid "" "Configuring one of these locales (either explicitly or via the above " "implicit locale coercion) automatically enables the ``surrogateescape`` :ref:" @@ -1219,7 +1219,7 @@ msgid "" "envvar:`PYTHONIOENCODING` as usual." msgstr "" -#: ../../using/cmdline.rst:1002 +#: ../../using/cmdline.rst:1004 msgid "" "For debugging purposes, setting ``PYTHONCOERCECLOCALE=warn`` will cause " "Python to emit warning messages on ``stderr`` if either the locale coercion " @@ -1227,7 +1227,7 @@ msgid "" "active when the Python runtime is initialized." msgstr "" -#: ../../using/cmdline.rst:1007 +#: ../../using/cmdline.rst:1009 msgid "" "Also note that even when locale coercion is disabled, or when it fails to " "find a suitable target locale, :envvar:`PYTHONUTF8` will still activate by " @@ -1236,15 +1236,15 @@ msgid "" "system interfaces." msgstr "" -#: ../../using/cmdline.rst:1013 +#: ../../using/cmdline.rst:1015 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" -#: ../../using/cmdline.rst:1015 +#: ../../using/cmdline.rst:1017 msgid "See :pep:`538` for more details." msgstr "更多細節請見 :pep:`538`。" -#: ../../using/cmdline.rst:1021 +#: ../../using/cmdline.rst:1023 msgid "" "If this environment variable is set to a non-empty string, enable :ref:" "`Python Development Mode `, introducing additional runtime checks " @@ -1252,31 +1252,31 @@ msgid "" "setting the :option:`-X` ``dev`` option." msgstr "" -#: ../../using/cmdline.rst:1030 +#: ../../using/cmdline.rst:1032 msgid "If set to ``1``, enable the :ref:`Python UTF-8 Mode `." msgstr "如果設為 ``1``,則啟用 :ref:`Python UTF-8 Mode `。" -#: ../../using/cmdline.rst:1032 +#: ../../using/cmdline.rst:1034 msgid "If set to ``0``, disable the :ref:`Python UTF-8 Mode `." msgstr "如果設為 ``0``,則停用 :ref:`Python UTF-8 Mode `。" -#: ../../using/cmdline.rst:1034 +#: ../../using/cmdline.rst:1036 msgid "" "Setting any other non-empty string causes an error during interpreter " "initialisation." msgstr "" -#: ../../using/cmdline.rst:1041 +#: ../../using/cmdline.rst:1043 msgid "" "If this environment variable is set to a non-empty string, issue a :class:" "`EncodingWarning` when the locale-specific default encoding is used." msgstr "" -#: ../../using/cmdline.rst:1044 +#: ../../using/cmdline.rst:1046 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節請見 :ref:`io-encoding-warning`。" -#: ../../using/cmdline.rst:1050 +#: ../../using/cmdline.rst:1052 msgid "" "If this variable is set, it disables the inclusion of the tables mapping " "extra location information (end line, start column offset and end column " @@ -1285,38 +1285,38 @@ msgid "" "visual location indicators when the interpreter displays tracebacks." msgstr "" -#: ../../using/cmdline.rst:1060 +#: ../../using/cmdline.rst:1062 msgid "" "If this variable is set to a nonzero value, it enables support for the Linux " "``perf`` profiler so Python calls can be detected by it." msgstr "" -#: ../../using/cmdline.rst:1063 +#: ../../using/cmdline.rst:1065 msgid "If set to ``0``, disable Linux ``perf`` profiler support." msgstr "" -#: ../../using/cmdline.rst:1065 +#: ../../using/cmdline.rst:1067 msgid "" "See also the :option:`-X perf <-X>` command-line option and :ref:" "`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:1072 +#: ../../using/cmdline.rst:1074 msgid "Debug-mode variables" msgstr "除錯模式變數" -#: ../../using/cmdline.rst:1076 +#: ../../using/cmdline.rst:1078 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter." msgstr "" -#: ../../using/cmdline.rst:1079 ../../using/cmdline.rst:1086 +#: ../../using/cmdline.rst:1081 ../../using/cmdline.rst:1088 msgid "" "Need Python configured with the :option:`--with-trace-refs` build option." msgstr "" -#: ../../using/cmdline.rst:1083 +#: ../../using/cmdline.rst:1085 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter into a file called *FILENAME*." diff --git a/whatsnew/2.5.po b/whatsnew/2.5.po index 820ca1a7de..4c80246ead 100644 --- a/whatsnew/2.5.po +++ b/whatsnew/2.5.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-18 00:04+0000\n" +"POT-Creation-Date: 2024-06-13 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2027,15 +2027,15 @@ msgid "" ":mod:`ctypes` also provides a wrapper for Python's C API as the ``ctypes." "pythonapi`` object. This object does *not* release the global interpreter " "lock before calling a function, because the lock must be held when calling " -"into the interpreter's code. There's a :class:`py_object()` type " +"into the interpreter's code. There's a :class:`~ctypes.py_object` type " "constructor that will create a :c:expr:`PyObject *` pointer. A simple " "usage::" msgstr "" #: ../../whatsnew/2.5.rst:1737 msgid "" -"Don't forget to use :class:`py_object()`; if it's omitted you end up with a " -"segmentation fault." +"Don't forget to use :func:`~ctypes.py_object`; if it's omitted you end up " +"with a segmentation fault." msgstr "" #: ../../whatsnew/2.5.rst:1740 diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index 23ac3e9dd8..62774f916b 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-16 00:03+0000\n" +"POT-Creation-Date: 2024-06-18 00:03+0000\n" "PO-Revision-Date: 2023-05-28 18:21+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -147,7 +147,7 @@ msgid "" "pep670>`" msgstr ":pep:`670`::ref:`轉換為靜態行內函式的巨集 `" -#: ../../whatsnew/3.11.rst:108 ../../whatsnew/3.11.rst:2196 +#: ../../whatsnew/3.11.rst:108 ../../whatsnew/3.11.rst:2211 msgid "New Features" msgstr "新增特性" @@ -1100,10 +1100,26 @@ msgid "(Contributed by Yurii Karabas in :issue:`46014`.)" msgstr "(由 Yurii Karabas 於 :issue:`46014` 中所貢獻。)" #: ../../whatsnew/3.11.rst:774 +msgid "gzip" +msgstr "" + +#: ../../whatsnew/3.11.rst:776 +msgid "" +"The :func:`gzip.compress` function is now faster when used with the " +"**mtime=0** argument as it delegates the compression entirely to a single :" +"func:`zlib.compress` operation. There is one side effect of this change: The " +"gzip file header contains an \"OS\" byte in its header. That was " +"traditionally always set to a value of 255 representing \"unknown\" by the :" +"mod:`gzip` module. Now, when using :func:`~gzip.compress` with **mtime=0**, " +"it may be set to a different value by the underlying zlib C library Python " +"was linked against. (See :gh:`112346` for details on the side effect.)" +msgstr "" + +#: ../../whatsnew/3.11.rst:789 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.11.rst:776 +#: ../../whatsnew/3.11.rst:791 msgid "" ":func:`hashlib.blake2b` and :func:`hashlib.blake2s` now prefer `libb2`_ over " "Python's vendored copy. (Contributed by Christian Heimes in :issue:`47095`.)" @@ -1112,7 +1128,7 @@ msgstr "" "於 Python 自發行版的複製。(由 Christian Heimes 於 :issue:`47095` 中所貢" "獻。)" -#: ../../whatsnew/3.11.rst:780 +#: ../../whatsnew/3.11.rst:795 msgid "" "The internal ``_sha3`` module with SHA3 and SHAKE algorithms now uses " "*tiny_sha3* instead of the *Keccak Code Package* to reduce code and binary " @@ -1125,7 +1141,7 @@ msgstr "" "來自 OpenSSL 的 SHA3 和 SHAKE 最佳化實作。此更改僅影響沒有 OpenSSL 支援的安" "裝。(由 Christian Heimes 在 :issue:`47098` 中貢獻。)" -#: ../../whatsnew/3.11.rst:787 +#: ../../whatsnew/3.11.rst:802 msgid "" "Add :func:`hashlib.file_digest`, a helper function for efficient hashing of " "files or file-like objects. (Contributed by Christian Heimes in :gh:`89313`.)" @@ -1133,11 +1149,11 @@ msgstr "" "新增 :func:`hashlib.file_digest`,是個能夠為檔案或類檔案物件做高效率雜湊的幫" "助函式。(由 Christian Heimes 於 :gh:`89313` 中貢獻。)" -#: ../../whatsnew/3.11.rst:795 +#: ../../whatsnew/3.11.rst:810 msgid "IDLE and idlelib" msgstr "IDLE 與 idlelib" -#: ../../whatsnew/3.11.rst:797 +#: ../../whatsnew/3.11.rst:812 msgid "" "Apply syntax highlighting to ``.pyi`` files. (Contributed by Alex Waygood " "and Terry Jan Reedy in :issue:`45447`.)" @@ -1145,7 +1161,7 @@ msgstr "" "在 ``.pyi`` 檔案施用語法突顯 (syntax highlight)。(由 Alex Waygood 與 Terry " "Jan Reedy 於 :issue:`45447` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:800 +#: ../../whatsnew/3.11.rst:815 msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" @@ -1153,11 +1169,11 @@ msgstr "" "當帶有輸入與輸出地儲存 Shell 時,也會包含提示字元。(由 Terry Jan Reedy 於 :" "gh:`95191` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:807 +#: ../../whatsnew/3.11.rst:822 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.11.rst:809 +#: ../../whatsnew/3.11.rst:824 msgid "" "Add :func:`~inspect.getmembers_static` to return all members without " "triggering dynamic lookup via the descriptor protocol. (Contributed by " @@ -1167,7 +1183,7 @@ msgstr "" "(descriptor protocol) 觸發動態查找。(由 Weipeng Hong 在 :issue:`30533` 中貢" "獻。)" -#: ../../whatsnew/3.11.rst:813 +#: ../../whatsnew/3.11.rst:828 msgid "" "Add :func:`~inspect.ismethodwrapper` for checking if the type of an object " "is a :class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik in :" @@ -1176,7 +1192,7 @@ msgstr "" "新增 :func:`inspect.ismethodwrapper`,用來檢查一個物件的型別是否為 :class:" "`~types.MethodWrapperType`。(由 Hakan Çelik 於 :issue:`29418` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:817 +#: ../../whatsnew/3.11.rst:832 msgid "" "Change the frame-related functions in the :mod:`inspect` module to return " "new :class:`~inspect.FrameInfo` and :class:`~inspect.Traceback` class " @@ -1189,35 +1205,35 @@ msgstr "" "`named tuple` 的介面),包括擴充的 :pep:`657` 位置資訊(結束行號、欄和結束" "欄)。受影響的功能是:" -#: ../../whatsnew/3.11.rst:823 +#: ../../whatsnew/3.11.rst:838 msgid ":func:`inspect.getframeinfo`" msgstr ":func:`inspect.getframeinfo`" -#: ../../whatsnew/3.11.rst:824 +#: ../../whatsnew/3.11.rst:839 msgid ":func:`inspect.getouterframes`" msgstr ":func:`inspect.getouterframes`" -#: ../../whatsnew/3.11.rst:825 +#: ../../whatsnew/3.11.rst:840 msgid ":func:`inspect.getinnerframes`," msgstr ":func:`inspect.getinnerframes`," -#: ../../whatsnew/3.11.rst:826 +#: ../../whatsnew/3.11.rst:841 msgid ":func:`inspect.stack`" msgstr ":func:`inspect.stack`" -#: ../../whatsnew/3.11.rst:827 +#: ../../whatsnew/3.11.rst:842 msgid ":func:`inspect.trace`" msgstr ":func:`inspect.trace`" -#: ../../whatsnew/3.11.rst:829 +#: ../../whatsnew/3.11.rst:844 msgid "(Contributed by Pablo Galindo in :gh:`88116`.)" msgstr "(由 Pablo Galindo 於 :gh:`88116` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:835 +#: ../../whatsnew/3.11.rst:850 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.11.rst:837 +#: ../../whatsnew/3.11.rst:852 msgid "" "Add :func:`locale.getencoding` to get the current locale encoding. It is " "similar to ``locale.getpreferredencoding(False)`` but ignores the :ref:" @@ -1227,11 +1243,11 @@ msgstr "" "``locale.getpreferredencoding(False)`` 類似但不考慮 :ref:`Python UTF-8 模式 " "`。" -#: ../../whatsnew/3.11.rst:845 +#: ../../whatsnew/3.11.rst:860 msgid "logging" msgstr "logging" -#: ../../whatsnew/3.11.rst:847 +#: ../../whatsnew/3.11.rst:862 msgid "" "Added :func:`~logging.getLevelNamesMapping` to return a mapping from logging " "level names (e.g. ``'CRITICAL'``) to the values of their corresponding :ref:" @@ -1242,7 +1258,7 @@ msgstr "" "``'CRITICAL'``)指到對應的 :ref:`levels` 數值(例如,預設為 ``50``)的映射。" "(由 Andrei Kulakovin 於 :gh:`88024` 中貢獻。)" -#: ../../whatsnew/3.11.rst:852 +#: ../../whatsnew/3.11.rst:867 msgid "" "Added a :meth:`~logging.handlers.SysLogHandler.createSocket` method to :" "class:`~logging.handlers.SysLogHandler`, to match :meth:`SocketHandler." @@ -1256,11 +1272,11 @@ msgstr "" "用的 socket,它會在處理程式初始化期間和發出一個事件時自動呼叫。(由 Kirill " "Pinchuk 在 :gh:`88457` 中貢獻。)" -#: ../../whatsnew/3.11.rst:864 +#: ../../whatsnew/3.11.rst:879 msgid "math" msgstr "math" -#: ../../whatsnew/3.11.rst:866 +#: ../../whatsnew/3.11.rst:881 msgid "" "Add :func:`math.exp2`: return 2 raised to the power of x. (Contributed by " "Gideon Mitchell in :issue:`45917`.)" @@ -1268,7 +1284,7 @@ msgstr "" "新增 :func:`math.exp2`:回傳 2 的 x 次方。(由 Gideon Mitchell 於 :issue:" "`45917` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:869 +#: ../../whatsnew/3.11.rst:884 msgid "" "Add :func:`math.cbrt`: return the cube root of x. (Contributed by Ajith " "Ramachandran in :issue:`44357`.)" @@ -1276,7 +1292,7 @@ msgstr "" "新增 :func:`math.cbrt`:回傳 x 的立方根。(由 Ajith Ramachandran 於 :issue:" "`44357` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:872 +#: ../../whatsnew/3.11.rst:887 msgid "" "The behaviour of two :func:`math.pow` corner cases was changed, for " "consistency with the IEEE 754 specification. The operations ``math.pow(0.0, -" @@ -1289,7 +1305,7 @@ msgstr "" "現在回傳 ``inf``,之前它們會引發 :exc:`ValueError`。(由 Mark Dickinson 在 :" "issue:`44339` 中貢獻。)" -#: ../../whatsnew/3.11.rst:878 +#: ../../whatsnew/3.11.rst:893 msgid "" "The :data:`math.nan` value is now always available. (Contributed by Victor " "Stinner in :issue:`46917`.)" @@ -1297,11 +1313,11 @@ msgstr "" ":data:`math.nan` 現為隨時可用。(由 Victor Stinner 於 :issue:`46917` 中所貢" "獻。)" -#: ../../whatsnew/3.11.rst:885 +#: ../../whatsnew/3.11.rst:900 msgid "operator" msgstr "operator" -#: ../../whatsnew/3.11.rst:887 +#: ../../whatsnew/3.11.rst:902 msgid "" "A new function ``operator.call`` has been added, such that ``operator." "call(obj, *args, **kwargs) == obj(*args, **kwargs)``. (Contributed by Antony " @@ -1310,11 +1326,11 @@ msgstr "" "新增 ``operator.call`` 函式,使得 ``operator.call(obj, *args, **kwargs) == " "obj(*args, **kwargs)``。(由 Antony Lee 於 :issue:`44019` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:895 +#: ../../whatsnew/3.11.rst:910 msgid "os" msgstr "os" -#: ../../whatsnew/3.11.rst:897 +#: ../../whatsnew/3.11.rst:912 msgid "" "On Windows, :func:`os.urandom` now uses ``BCryptGenRandom()``, instead of " "``CryptGenRandom()`` which is deprecated. (Contributed by Donghee Na in :" @@ -1323,11 +1339,11 @@ msgstr "" "在 Windows 上,:func:`os.urandom` 現在使用 ``BCryptGenRandom()`` 以取代被棄用" "的 ``CryptGenRandom()``。(由 Donghee Na 於 :issue:`44611` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:905 +#: ../../whatsnew/3.11.rst:920 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.11.rst:907 +#: ../../whatsnew/3.11.rst:922 msgid "" ":meth:`~pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` return only " "directories if *pattern* ends with a pathname components separator: :data:" @@ -1338,11 +1354,11 @@ msgstr "" "結尾,:meth:`~pathlib.Path.glob` 和 :meth:`~pathlib.Path.rglob` 只回傳目錄。" "(由 Eisuke Kawasima 於 :issue:`22276` 與 :issue:`33392` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:916 +#: ../../whatsnew/3.11.rst:931 msgid "re" msgstr "re" -#: ../../whatsnew/3.11.rst:918 +#: ../../whatsnew/3.11.rst:933 msgid "" "Atomic grouping (``(?>...)``) and possessive quantifiers (``*+``, ``++``, ``?" "+``, ``{m,n}+``) are now supported in regular expressions. (Contributed by " @@ -1353,11 +1369,11 @@ msgstr "" "``{m,n}+``) 的。(由 Jeffrey C. Jacobs 和 Serhiy Storchaka 在 :issue:" "`433030` 中貢獻。)" -#: ../../whatsnew/3.11.rst:926 +#: ../../whatsnew/3.11.rst:941 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.11.rst:928 +#: ../../whatsnew/3.11.rst:943 msgid "" "Add optional parameter *dir_fd* in :func:`shutil.rmtree`. (Contributed by " "Serhiy Storchaka in :issue:`46245`.)" @@ -1365,11 +1381,11 @@ msgstr "" "新增 :func:`shutil.rmtree` 的可選參數 *dir_fd*。(由 Serhiy Storchaka 於 :" "issue:`46245` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:935 +#: ../../whatsnew/3.11.rst:950 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.11.rst:937 +#: ../../whatsnew/3.11.rst:952 msgid "" "Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner in :issue:" "`30512`.)" @@ -1377,7 +1393,7 @@ msgstr "" "新增 NetBSD 對於 CAN Socket 的支援。(由 Thomas Klausner 於 :issue:`30512` 中" "所貢獻。)" -#: ../../whatsnew/3.11.rst:940 +#: ../../whatsnew/3.11.rst:955 msgid "" ":meth:`~socket.create_connection` has an option to raise, in case of failure " "to connect, an :exc:`ExceptionGroup` containing all errors instead of only " @@ -1387,11 +1403,11 @@ msgstr "" "錯誤的 :exc:`ExceptionGroup`,而非只引發最後一個錯誤。(由 Irit Katriel 於 :" "issue:`29980` 中貢獻。)" -#: ../../whatsnew/3.11.rst:949 +#: ../../whatsnew/3.11.rst:964 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.11.rst:951 +#: ../../whatsnew/3.11.rst:966 msgid "" "You can now disable the authorizer by passing :const:`None` to :meth:" "`~sqlite3.Connection.set_authorizer`. (Contributed by Erlend E. Aasland in :" @@ -1401,7 +1417,7 @@ msgstr "" "set_authorizer` 來停用 authorizer。(由 Erlend E. Aasland 於 :issue:`44491` " "中貢獻。)" -#: ../../whatsnew/3.11.rst:955 +#: ../../whatsnew/3.11.rst:970 msgid "" "Collation name :meth:`~sqlite3.Connection.create_collation` can now contain " "any Unicode character. Collation names with invalid characters now raise :" @@ -1413,7 +1429,7 @@ msgstr "" "`UnicodeEncodeError` 而不是 :exc:`sqlite3.ProgrammingError`。(由 Erlend E. " "Aasland 在 :issue:`44688` 中貢獻。)" -#: ../../whatsnew/3.11.rst:960 +#: ../../whatsnew/3.11.rst:975 msgid "" ":mod:`sqlite3` exceptions now include the SQLite extended error code as :" "attr:`~sqlite3.Error.sqlite_errorcode` and the SQLite error name as :attr:" @@ -1425,7 +1441,7 @@ msgstr "" "sqlite_errorname`)。(由 Aviv Palivoda、Daniel Shahaf 和 Erlend E. Aasland " "在 :issue:`16379` 和 :issue:`24139` 中貢獻。)" -#: ../../whatsnew/3.11.rst:966 +#: ../../whatsnew/3.11.rst:981 msgid "" "Add :meth:`~sqlite3.Connection.setlimit` and :meth:`~sqlite3.Connection." "getlimit` to :class:`sqlite3.Connection` for setting and getting SQLite " @@ -1436,7 +1452,7 @@ msgstr "" "getlimit` 新增到 :class:`sqlite3.Connection` 以根據連線來設定和取得 SQLite 限" "制。(由 Erlend E. Aasland 在 :issue:`45243` 中貢獻。)" -#: ../../whatsnew/3.11.rst:971 +#: ../../whatsnew/3.11.rst:986 msgid "" ":mod:`sqlite3` now sets :attr:`sqlite3.threadsafety` based on the default " "threading mode the underlying SQLite library has been compiled with. " @@ -1446,7 +1462,7 @@ msgstr "" "定 :attr:`sqlite3.threadsafety`。(由 Erlend E. Aasland 在 :issue:`45613` 中" "貢獻。)" -#: ../../whatsnew/3.11.rst:975 +#: ../../whatsnew/3.11.rst:990 msgid "" ":mod:`sqlite3` C callbacks now use unraisable exceptions if callback " "tracebacks are enabled. Users can now register an :func:`unraisable hook " @@ -1458,7 +1474,7 @@ msgstr "" "(unraisable hook handler) ` 來改善他們的除錯體驗。(由 " "Erlend E. Aasland 在 :issue:`45828` 中貢獻。)" -#: ../../whatsnew/3.11.rst:981 +#: ../../whatsnew/3.11.rst:996 msgid "" "Fetch across rollback no longer raises :exc:`~sqlite3.InterfaceError`. " "Instead we leave it to the SQLite library to handle these cases. " @@ -1468,7 +1484,7 @@ msgstr "" "們將其留給 SQLite 函式庫來處理這些情況。(由 Erlend E. Aasland 在 :issue:" "`44092` 中貢獻。)" -#: ../../whatsnew/3.11.rst:985 +#: ../../whatsnew/3.11.rst:1000 msgid "" "Add :meth:`~sqlite3.Connection.serialize` and :meth:`~sqlite3.Connection." "deserialize` to :class:`sqlite3.Connection` for serializing and " @@ -1479,7 +1495,7 @@ msgstr "" "deserialize` 新增到 :class:`sqlite3.Connection` 以用於序列化和反序列化資料" "庫。(由 Erlend E. Aasland 在 :issue:`41930` 中貢獻。)" -#: ../../whatsnew/3.11.rst:990 +#: ../../whatsnew/3.11.rst:1005 msgid "" "Add :meth:`~sqlite3.Connection.create_window_function` to :class:`sqlite3." "Connection` for creating aggregate window functions. (Contributed by Erlend " @@ -1489,7 +1505,7 @@ msgstr "" "create_window_function` 已建立聚合視窗函式 (aggregate window function)。(由 " "Erlend E. Aasland 於 :issue:`34916` 中貢獻。)" -#: ../../whatsnew/3.11.rst:994 +#: ../../whatsnew/3.11.rst:1009 msgid "" "Add :meth:`~sqlite3.Connection.blobopen` to :class:`sqlite3.Connection`. :" "class:`sqlite3.Blob` allows incremental I/O operations on blobs. " @@ -1500,11 +1516,11 @@ msgstr "" "operations)。(由 Aviv Palivoda 和 Erlend E. Aasland 在 :issue:`24905` 中貢" "獻。)" -#: ../../whatsnew/3.11.rst:1002 +#: ../../whatsnew/3.11.rst:1017 msgid "string" msgstr "string" -#: ../../whatsnew/3.11.rst:1004 +#: ../../whatsnew/3.11.rst:1019 msgid "" "Add :meth:`~string.Template.get_identifiers` and :meth:`~string.Template." "is_valid` to :class:`string.Template`, which respectively return all valid " @@ -1516,11 +1532,11 @@ msgstr "" "(placeholder) 與是否有任何不合格的預留位置存在。(由 Ben Kehoe 於 :gh:" "`90465` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1014 +#: ../../whatsnew/3.11.rst:1029 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.11.rst:1016 +#: ../../whatsnew/3.11.rst:1031 msgid "" ":func:`sys.exc_info` now derives the ``type`` and ``traceback`` fields from " "the ``value`` (the exception instance), so when an exception is modified " @@ -1532,7 +1548,7 @@ msgstr "" "``traceback`` 欄位,因此當例外在處理過程中被修改時,變更會反映在 :func:`!" "exc_info` 後續呼叫的結果中。(由 Irit Katriel 在 :issue:`45711` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1022 +#: ../../whatsnew/3.11.rst:1037 msgid "" "Add :func:`sys.exception` which returns the active exception instance " "(equivalent to ``sys.exc_info()[1]``). (Contributed by Irit Katriel in :" @@ -1542,7 +1558,7 @@ msgstr "" "exception`\\ (等價於 ``sys.exc_info()[1]``\\ )。(由 Irit Katriel 於 :" "issue:`46328` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:1026 +#: ../../whatsnew/3.11.rst:1041 msgid "" "Add the :data:`sys.flags.safe_path ` flag. (Contributed by Victor " "Stinner in :gh:`57684`.)" @@ -1550,11 +1566,11 @@ msgstr "" "新增 :data:`sys.flags.safe_path ` 旗標。(由 Victor Stinner 於 :" "gh:`57684` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:1033 +#: ../../whatsnew/3.11.rst:1048 msgid "sysconfig" msgstr "sysconfig" -#: ../../whatsnew/3.11.rst:1035 +#: ../../whatsnew/3.11.rst:1050 msgid "" "Three new :ref:`installation schemes ` (*posix_venv*, " "*nt_venv* and *venv*) were added and are used when Python creates new " @@ -1575,11 +1591,11 @@ msgstr "" "的第三方程式碼應該使用新的 *venv* 安裝方案來確定路徑,就像 :mod:`venv` 一樣。" "(由 Miro Hrončok 在 :issue:`45413` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1052 +#: ../../whatsnew/3.11.rst:1067 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.11.rst:1054 +#: ../../whatsnew/3.11.rst:1069 msgid "" ":class:`~tempfile.SpooledTemporaryFile` objects now fully implement the " "methods of :class:`io.BufferedIOBase` or :class:`io.TextIOBase` (depending " @@ -1592,11 +1608,11 @@ msgstr "" "能夠正確地使用需要類檔案物件的 API,例如壓縮模組。(由 Carey Metcalfe 在 :gh:" "`70363` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1065 +#: ../../whatsnew/3.11.rst:1080 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.11.rst:1067 +#: ../../whatsnew/3.11.rst:1082 msgid "" "On Unix, if the ``sem_clockwait()`` function is available in the C library " "(glibc 2.30 and newer), the :meth:`threading.Lock.acquire` method now uses " @@ -1611,11 +1627,11 @@ msgstr "" "const:`time.CLOCK_REALTIME`),以免受系統時鐘變化的影響。 由 Victor Stinner " "在 :issue:`41710` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1078 +#: ../../whatsnew/3.11.rst:1093 msgid "time" msgstr "time" -#: ../../whatsnew/3.11.rst:1080 +#: ../../whatsnew/3.11.rst:1095 msgid "" "On Unix, :func:`time.sleep` now uses the ``clock_nanosleep()`` or " "``nanosleep()`` function, if available, which has a resolution of 1 " @@ -1628,7 +1644,7 @@ msgstr "" "`-9` 秒),而不是使用解析度為 1 微秒(10\\ :sup:`-6` 秒)的 ``select()``。" "(由 Benjamin Szőke 和 Victor Stinner 在 :issue:`21302` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1086 +#: ../../whatsnew/3.11.rst:1101 msgid "" "On Windows 8.1 and newer, :func:`time.sleep` now uses a waitable timer based " "on `high-resolution timers `. " @@ -1803,7 +1819,7 @@ msgstr "" "`typing.get_type_hints` 現支援了為字串求值 (evaluate)。(由 Niklas " "Rosenstein 在 :gh:`85542` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1177 +#: ../../whatsnew/3.11.rst:1192 msgid "" ":func:`typing.get_type_hints` no longer adds :data:`~typing.Optional` to " "parameters with ``None`` as a default. (Contributed by Nikita Sobolev in :gh:" @@ -1812,7 +1828,7 @@ msgstr "" ":func:`typing.get_type_hints` 不再將 :data:`~typing.Optional` 新增到預設為 " "``None`` 的參數中。(由 Nikita Sobolev 在 :gh:`90353` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1181 +#: ../../whatsnew/3.11.rst:1196 msgid "" ":func:`typing.get_type_hints` now supports evaluating bare stringified :data:" "`~typing.ClassVar` annotations. (Contributed by Gregory Beauregard in :gh:" @@ -1822,7 +1838,7 @@ msgstr "" "的 :data:`~typing.ClassVar` 標註來求值。(由 Gregory Beauregard 在 :gh:" "`90711` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1185 +#: ../../whatsnew/3.11.rst:1200 msgid "" ":func:`typing.no_type_check` no longer modifies external classes and " "functions. It also now correctly marks classmethods as not to be type " @@ -1831,11 +1847,11 @@ msgstr "" ":func:`typing.no_type_check` 不再修改外部類別和函式。它現在也正確地將類別方法" "標記為不需進行型別檢查。(由 Nikita Sobolev 在 :gh:`90729` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1193 +#: ../../whatsnew/3.11.rst:1208 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.11.rst:1195 +#: ../../whatsnew/3.11.rst:1210 msgid "" "The Unicode database has been updated to version 14.0.0. (Contributed by " "Benjamin Peterson in :issue:`45190`)." @@ -1843,11 +1859,11 @@ msgstr "" "Unicode 資料庫被更新為 14.0.0 版本。(Benjamin Peterson 於 :issue:`45190` 中" "所貢獻。)" -#: ../../whatsnew/3.11.rst:1202 +#: ../../whatsnew/3.11.rst:1217 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.11.rst:1204 +#: ../../whatsnew/3.11.rst:1219 msgid "" "Added methods :meth:`~unittest.TestCase.enterContext` and :meth:`~unittest." "TestCase.enterClassContext` of class :class:`~unittest.TestCase`, method :" @@ -1861,11 +1877,11 @@ msgstr "" "IsolatedAsyncioTestCase.enterAsyncContext` 方法、:func:`unittest." "enterModuleContext` 函式。(由 Serhiy Storchaka 於 :issue:`45046` 貢獻。)" -#: ../../whatsnew/3.11.rst:1216 +#: ../../whatsnew/3.11.rst:1231 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.11.rst:1218 +#: ../../whatsnew/3.11.rst:1233 msgid "" "When new Python virtual environments are created, the *venv* :ref:`sysconfig " "installation scheme ` is used to determine the paths " @@ -1882,11 +1898,11 @@ msgstr "" "下更改預設的 sysconfig 安裝方案。建立新虛擬環境的第三方程式碼也應該這樣做。" "(由 Miro Hrončok 在 :issue:`45413` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1232 +#: ../../whatsnew/3.11.rst:1247 msgid "warnings" msgstr "warnings" -#: ../../whatsnew/3.11.rst:1234 +#: ../../whatsnew/3.11.rst:1249 msgid "" ":func:`warnings.catch_warnings` now accepts arguments for :func:`warnings." "simplefilter`, providing a more concise way to locally ignore warnings or " @@ -1897,11 +1913,11 @@ msgstr "" "數,提供了一種更簡潔的方法來在本地端忽略警告或將它們轉換為錯誤。(由 Zac " "Hatfield-Dodds 在 :issue:`47074` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1242 +#: ../../whatsnew/3.11.rst:1257 msgid "zipfile" msgstr "zipfile" -#: ../../whatsnew/3.11.rst:1244 +#: ../../whatsnew/3.11.rst:1259 msgid "" "Added support for specifying member name encoding for reading metadata in a :" "class:`~zipfile.ZipFile`'s directory and file headers. (Contributed by " @@ -1911,7 +1927,7 @@ msgstr "" "標頭中讀取元資料 (metadata)。(由 Stephen J. Turnbull 和 Serhiy Storchaka " "在 :issue:`28080` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1248 +#: ../../whatsnew/3.11.rst:1263 msgid "" "Added :meth:`ZipFile.mkdir() ` for creating new " "directories inside ZIP archives. (Contributed by Sam Ezeh in :gh:`49083`.)" @@ -1919,7 +1935,7 @@ msgstr "" "新增 :meth:`ZipFile.mkdir() ` 以在 ZIP 歸檔中建立新的" "目錄。(由 Sam Ezeh 於 :gh:`49083` 貢獻。)" -#: ../../whatsnew/3.11.rst:1252 +#: ../../whatsnew/3.11.rst:1267 msgid "" "Added :attr:`~zipfile.Path.stem`, :attr:`~zipfile.Path.suffix` and :attr:" "`~zipfile.Path.suffixes` to :class:`zipfile.Path`. (Contributed by Miguel " @@ -1929,11 +1945,11 @@ msgstr "" "Path.suffix` 和 :attr:`~zipfile.Path.suffixes`。(由 Miguel Brito 於 :gh:" "`88261` 貢獻。)" -#: ../../whatsnew/3.11.rst:1260 +#: ../../whatsnew/3.11.rst:1275 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.11.rst:1262 +#: ../../whatsnew/3.11.rst:1277 msgid "" "This section covers specific optimizations independent of the :ref:" "`whatsnew311-faster-cpython` project, which is covered in its own section." @@ -1941,7 +1957,7 @@ msgstr "" "這個部分會涵蓋到特定的最佳化,但獨立於擁有自己一個說明的\\ :ref:`whatsnew311-" "faster-cpython` 計畫。" -#: ../../whatsnew/3.11.rst:1265 +#: ../../whatsnew/3.11.rst:1280 msgid "" "The compiler now optimizes simple :ref:`printf-style % formatting ` on string literals containing only the format codes " @@ -1953,7 +1969,7 @@ msgstr "" "` 最佳化並使其與相應的 :term:`f-string` 運算式一樣快。" "(由 Serhiy Storchaka 在 :issue:`28307` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1271 +#: ../../whatsnew/3.11.rst:1286 msgid "" "Integer division (``//``) is better tuned for optimization by compilers. It " "is now around 20% faster on x86-64 when dividing an :class:`int` by a value " @@ -1964,7 +1980,7 @@ msgstr "" "``2**30`` 的值時,在 x86-64 上快了大約 20%。(由 Gregory P. Smith 和 Tim " "Peters 在 :gh:`90564` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1276 +#: ../../whatsnew/3.11.rst:1291 msgid "" ":func:`sum` is now nearly 30% faster for integers smaller than ``2**30``. " "(Contributed by Stefan Behnel in :gh:`68264`.)" @@ -1972,7 +1988,7 @@ msgstr "" "針對小於 ``2**30`` 的整數,:func:`sum` 現在快了將近 30%。(由 Stefan Behnel " "於 :gh:`68264` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:1279 +#: ../../whatsnew/3.11.rst:1294 msgid "" "Resizing lists is streamlined for the common case, speeding up :meth:`list." "append` by ≈15% and simple :term:`list comprehension`\\s by up to 20-30% " @@ -1982,7 +1998,7 @@ msgstr "" "為簡單的 :term:`list comprehension` 加快了高達 20-30%(由 Dennis Sweeney 在 :" "gh:`91165` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1284 +#: ../../whatsnew/3.11.rst:1299 msgid "" "Dictionaries don't store hash values when all keys are Unicode objects, " "decreasing :class:`dict` size. For example, ``sys.getsizeof(dict." @@ -1994,7 +2010,7 @@ msgstr "" "元組減少到 272 位元組(減少 23%)。(由 Inada Naoki 在 :issue:`46845` 中貢" "獻。)" -#: ../../whatsnew/3.11.rst:1290 +#: ../../whatsnew/3.11.rst:1305 msgid "" "Using :class:`asyncio.DatagramProtocol` is now orders of magnitude faster " "when transferring large files over UDP, with speeds over 100 times higher " @@ -2004,7 +2020,7 @@ msgstr "" "了幾個數量級,傳輸 ≈60 MiB 檔案的速度提高了 100 多倍。(由 msoxzw 在 :gh:" "`91487` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1295 +#: ../../whatsnew/3.11.rst:1310 msgid "" ":mod:`math` functions :func:`~math.comb` and :func:`~math.perm` are now ≈10 " "times faster for large arguments (with a larger speedup for larger *k*). " @@ -2014,7 +2030,7 @@ msgstr "" "了 ≈10 倍(對於更大的 *k* 有更大的加速)。(由 Serhiy Storchaka 在 :issue:" "`37295` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1299 +#: ../../whatsnew/3.11.rst:1314 msgid "" "The :mod:`statistics` functions :func:`~statistics.mean`, :func:`~statistics." "variance` and :func:`~statistics.stdev` now consume iterators in one pass " @@ -2027,7 +2043,7 @@ msgstr "" "們轉換為 :class:`list`,這讓速度提升為兩倍並可以節省大量記憶體空間。(由 " "Raymond Hettinger 在 :gh:`90415` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1305 +#: ../../whatsnew/3.11.rst:1320 msgid "" ":func:`unicodedata.normalize` now normalizes pure-ASCII strings in constant " "time. (Contributed by Donghee Na in :issue:`44987`.)" @@ -2035,11 +2051,11 @@ msgstr "" ":func:`unicodedata.normalize` 現在在常數時間內規範化 (normalize) 純 ASCII 字" "串。(由 Donghee Na 在 :issue:`44987` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1313 +#: ../../whatsnew/3.11.rst:1328 msgid "Faster CPython" msgstr "更快的 CPython" -#: ../../whatsnew/3.11.rst:1315 +#: ../../whatsnew/3.11.rst:1330 msgid "" "CPython 3.11 is an average of `25% faster `_ than CPython 3.10 as measured with the " @@ -2052,7 +2068,7 @@ msgstr "" "Python 3.10 `快了 25% `_。根據程式工作量可能有所不同,整體加速程度可達 10-60%。" -#: ../../whatsnew/3.11.rst:1322 +#: ../../whatsnew/3.11.rst:1337 msgid "" "This project focuses on two major areas in Python: :ref:`whatsnew311-faster-" "startup` and :ref:`whatsnew311-faster-runtime`. Optimizations not covered by " @@ -2062,15 +2078,15 @@ msgstr "" "`whatsnew311-faster-runtime`。不在此專案內的最佳化被獨立列出在 :ref:" "`whatsnew311-optimizations`。" -#: ../../whatsnew/3.11.rst:1331 +#: ../../whatsnew/3.11.rst:1346 msgid "Faster Startup" msgstr "更快的啟動" -#: ../../whatsnew/3.11.rst:1336 +#: ../../whatsnew/3.11.rst:1351 msgid "Frozen imports / Static code objects" msgstr "凍結引入 (Frozen imports) / 靜態程式碼物件 (Static code objects)" -#: ../../whatsnew/3.11.rst:1338 +#: ../../whatsnew/3.11.rst:1353 msgid "" "Python caches :term:`bytecode` in the :ref:`__pycache__ ` " "directory to speed up module loading." @@ -2078,11 +2094,11 @@ msgstr "" "Python 將\\ :term:`位元組碼 `\\ 於 :ref:`__pycache__` " "目錄中存為快取來加速模組的載入。" -#: ../../whatsnew/3.11.rst:1341 +#: ../../whatsnew/3.11.rst:1356 msgid "Previously in 3.10, Python module execution looked like this:" msgstr "在先前的 3.10 中,執行 Python 模組會像是這樣:" -#: ../../whatsnew/3.11.rst:1347 +#: ../../whatsnew/3.11.rst:1362 msgid "" "In Python 3.11, the core modules essential for Python startup are " "\"frozen\". This means that their :ref:`codeobjects` (and bytecode) are " @@ -2093,7 +2109,7 @@ msgstr "" "ref:`程式碼物件 `\\ (和位元組碼)是由直譯器靜態分配的。這將模組" "執行過程中的步驟減少為:" -#: ../../whatsnew/3.11.rst:1356 +#: ../../whatsnew/3.11.rst:1371 msgid "" "Interpreter startup is now 10-15% faster in Python 3.11. This has a big " "impact for short-running programs using Python." @@ -2101,21 +2117,21 @@ msgstr "" "在 Python 3.11 中直譯器啟動速度快了 10-15%。這對於使用 Python 所撰寫的短暫程" "式有著巨大影響。" -#: ../../whatsnew/3.11.rst:1359 +#: ../../whatsnew/3.11.rst:1374 msgid "" "(Contributed by Eric Snow, Guido van Rossum and Kumar Aditya in many issues.)" msgstr "" "(由 Eric Snow、Guido van Rossum 與 Kumar Aditya 於多個 issue 中貢獻。)" -#: ../../whatsnew/3.11.rst:1365 +#: ../../whatsnew/3.11.rst:1380 msgid "Faster Runtime" msgstr "更快的運行程式" -#: ../../whatsnew/3.11.rst:1370 +#: ../../whatsnew/3.11.rst:1385 msgid "Cheaper, lazy Python frames" msgstr "所需資源更少 (cheaper) 且惰性的 (lazy)) Python 幀 (frame)" -#: ../../whatsnew/3.11.rst:1372 +#: ../../whatsnew/3.11.rst:1387 msgid "" "Python frames, holding execution information, are created whenever Python " "calls a Python function. The following are new frame optimizations:" @@ -2123,16 +2139,16 @@ msgstr "" "每當 Python 呼叫 Python 函式時,就會建立保存執行資訊的 Python 幀。以下是針對" "幀而做的新最佳化:" -#: ../../whatsnew/3.11.rst:1376 +#: ../../whatsnew/3.11.rst:1391 msgid "Streamlined the frame creation process." msgstr "使幀的建立過程更有效率。" -#: ../../whatsnew/3.11.rst:1377 +#: ../../whatsnew/3.11.rst:1392 msgid "" "Avoided memory allocation by generously re-using frame space on the C stack." msgstr "在 C 堆疊 (stack) 中盡量重複利用幀的空間來避免記憶體分配。" -#: ../../whatsnew/3.11.rst:1378 +#: ../../whatsnew/3.11.rst:1393 msgid "" "Streamlined the internal frame struct to contain only essential information. " "Frames previously held extra debugging and memory management information." @@ -2140,7 +2156,7 @@ msgstr "" "讓內部幀結構只包含必要資訊,使其更加精簡。在過去,幀必須帶有額外的偵錯與記憶" "體管理的資訊。" -#: ../../whatsnew/3.11.rst:1381 +#: ../../whatsnew/3.11.rst:1396 msgid "" "Old-style :ref:`frame objects ` are now created only when " "requested by debuggers or by Python introspection functions such as :func:" @@ -2154,15 +2170,15 @@ msgstr "" "對於大多數使用者程式碼,根本不會建立任何幀物件。結果幾乎所有 Python 函式呼叫" "都顯著加速。我們以 pyperformance 測得了 3-7% 的加速。" -#: ../../whatsnew/3.11.rst:1388 +#: ../../whatsnew/3.11.rst:1403 msgid "(Contributed by Mark Shannon in :issue:`44590`.)" msgstr "(由 Mark Shannon 於 :issue:`44590` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:1395 +#: ../../whatsnew/3.11.rst:1410 msgid "Inlined Python function calls" msgstr "行內 Python 函式呼叫" -#: ../../whatsnew/3.11.rst:1397 +#: ../../whatsnew/3.11.rst:1412 msgid "" "During a Python function call, Python will call an evaluating C function to " "interpret that function's code. This effectively limits pure Python " @@ -2171,7 +2187,7 @@ msgstr "" "在 Python 函式呼叫期間,Python 將呼叫一個正在求值的 C 函式來直譯該函式的程式" "碼,這有效地將純 Python 遞迴限制在對 C 堆疊的安全範圍內。" -#: ../../whatsnew/3.11.rst:1401 +#: ../../whatsnew/3.11.rst:1416 msgid "" "In 3.11, when CPython detects Python code calling another Python function, " "it sets up a new frame, and \"jumps\" to the new code inside the new frame. " @@ -2181,7 +2197,7 @@ msgstr "" "一個新框架 (frame),並「跳轉」到新框架內的新程式碼,這避免了呼叫整個 C 直譯函" "式。" -#: ../../whatsnew/3.11.rst:1405 +#: ../../whatsnew/3.11.rst:1420 msgid "" "Most Python function calls now consume no C stack space, speeding them up. " "In simple recursive functions like fibonacci or factorial, we observed a " @@ -2194,15 +2210,15 @@ msgstr "" "以遞迴得更深(如果使用者有增加\\ :func:`遞迴限制 `\\ )。我們在 pyperformance 測得 1-3% 的改進。" -#: ../../whatsnew/3.11.rst:1412 +#: ../../whatsnew/3.11.rst:1427 msgid "(Contributed by Pablo Galindo and Mark Shannon in :issue:`45256`.)" msgstr "(由 Pablo Galindo 與 Mark Shannon 於 :issue:`45256` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:1418 +#: ../../whatsnew/3.11.rst:1433 msgid "PEP 659: Specializing Adaptive Interpreter" msgstr "PEP 659:特化的適應性直譯器" -#: ../../whatsnew/3.11.rst:1420 +#: ../../whatsnew/3.11.rst:1435 msgid "" ":pep:`659` is one of the key parts of the Faster CPython project. The " "general idea is that while Python is a dynamic language, most code has " @@ -2213,7 +2229,7 @@ msgstr "" "種動態語言,但大多數程式碼都有物件和型別很少去更改的區域。這個概念被稱為\\ *" "型別穩定 (type stability)*。" -#: ../../whatsnew/3.11.rst:1424 +#: ../../whatsnew/3.11.rst:1439 msgid "" "At runtime, Python will try to look for common patterns and type stability " "in the executing code. Python will then replace the current operation with a " @@ -2229,7 +2245,7 @@ msgstr "" "稱為\\ *行內快取 (inline caching)*\\ 的概念,其中 Python 將繁重操作的結果直接" "快取在\\ :term:`位元組碼 `\\ 中。" -#: ../../whatsnew/3.11.rst:1432 +#: ../../whatsnew/3.11.rst:1447 msgid "" "The specializer will also combine certain common instruction pairs into one " "superinstruction, reducing the overhead during execution." @@ -2237,7 +2253,7 @@ msgstr "" "特化程式 (specializer) 還將某些常用指示 (common instruction) 組合成一個超級指" "示 (superinstruction),這減少了執行期間的開銷。" -#: ../../whatsnew/3.11.rst:1435 +#: ../../whatsnew/3.11.rst:1450 msgid "" "Python will only specialize when it sees code that is \"hot\" (executed " "multiple times). This prevents Python from wasting time on run-once code. " @@ -2251,7 +2267,7 @@ msgstr "" "特化 (de-specialize)。特化會定期被嘗試執行,而嘗試的成本也不會太高,這讓特化" "得以適應新的環境。" -#: ../../whatsnew/3.11.rst:1442 +#: ../../whatsnew/3.11.rst:1457 msgid "" "(PEP written by Mark Shannon, with ideas inspired by Stefan Brunthaler. See :" "pep:`659` for more information. Implementation by Mark Shannon and Brandt " @@ -2261,43 +2277,43 @@ msgstr "" "`659`。由 Mark Shannon 和 Brandt Bucher 實作,Irit Katriel 和 Dennis Sweeney " "亦提供了額外的幫助。)" -#: ../../whatsnew/3.11.rst:1450 +#: ../../whatsnew/3.11.rst:1465 msgid "Operation" msgstr "操作" -#: ../../whatsnew/3.11.rst:1450 +#: ../../whatsnew/3.11.rst:1465 msgid "Form" msgstr "形式" -#: ../../whatsnew/3.11.rst:1450 +#: ../../whatsnew/3.11.rst:1465 msgid "Specialization" msgstr "特化" -#: ../../whatsnew/3.11.rst:1450 +#: ../../whatsnew/3.11.rst:1465 msgid "Operation speedup (up to)" msgstr "操作加速程度(上限)" -#: ../../whatsnew/3.11.rst:1450 +#: ../../whatsnew/3.11.rst:1465 msgid "Contributor(s)" msgstr "貢獻者" -#: ../../whatsnew/3.11.rst:1453 +#: ../../whatsnew/3.11.rst:1468 msgid "Binary operations" msgstr "二元操作" -#: ../../whatsnew/3.11.rst:1453 +#: ../../whatsnew/3.11.rst:1468 msgid "``x + x``" msgstr "``x + x``" -#: ../../whatsnew/3.11.rst:1455 +#: ../../whatsnew/3.11.rst:1470 msgid "``x - x``" msgstr "``x - x``" -#: ../../whatsnew/3.11.rst:1457 +#: ../../whatsnew/3.11.rst:1472 msgid "``x * x``" msgstr "``x * x``" -#: ../../whatsnew/3.11.rst:1453 +#: ../../whatsnew/3.11.rst:1468 msgid "" "Binary add, multiply and subtract for common types such as :class:`int`, :" "class:`float` and :class:`str` take custom fast paths for their underlying " @@ -2306,23 +2322,23 @@ msgstr "" "常見型別如 :class:`int`、:class:`float` 與 :class:`str` 的二元加法、乘法與減" "法,為底層型別採取了特製的快速路徑。" -#: ../../whatsnew/3.11.rst:1453 +#: ../../whatsnew/3.11.rst:1468 msgid "10%" msgstr "10%" -#: ../../whatsnew/3.11.rst:1453 +#: ../../whatsnew/3.11.rst:1468 msgid "Mark Shannon, Donghee Na, Brandt Bucher, Dennis Sweeney" msgstr "Mark Shannon, Donghee Na, Brandt Bucher, Dennis Sweeney" -#: ../../whatsnew/3.11.rst:1459 +#: ../../whatsnew/3.11.rst:1474 msgid "Subscript" msgstr "下標" -#: ../../whatsnew/3.11.rst:1459 +#: ../../whatsnew/3.11.rst:1474 msgid "``a[i]``" msgstr "``a[i]``" -#: ../../whatsnew/3.11.rst:1459 +#: ../../whatsnew/3.11.rst:1474 msgid "" "Subscripting container types such as :class:`list`, :class:`tuple` and :" "class:`dict` directly index the underlying data structures." @@ -2330,7 +2346,7 @@ msgstr "" "下標容器型別如 :class:`list`、:class:`tuple` 和 :class:`dict` 直接索引底層的" "資料結構。" -#: ../../whatsnew/3.11.rst:1463 +#: ../../whatsnew/3.11.rst:1478 msgid "" "Subscripting custom :meth:`~object.__getitem__` is also inlined similar to :" "ref:`inline-calls`." @@ -2338,43 +2354,43 @@ msgstr "" "下標自定義 :meth:`~object.__getitem__` 也是行內的,類似於 :ref:`inline-" "calls`。" -#: ../../whatsnew/3.11.rst:1459 ../../whatsnew/3.11.rst:1466 +#: ../../whatsnew/3.11.rst:1474 ../../whatsnew/3.11.rst:1481 msgid "10-25%" msgstr "10-25%" -#: ../../whatsnew/3.11.rst:1459 +#: ../../whatsnew/3.11.rst:1474 msgid "Irit Katriel, Mark Shannon" msgstr "Irit Katriel, Mark Shannon" -#: ../../whatsnew/3.11.rst:1466 +#: ../../whatsnew/3.11.rst:1481 msgid "Store subscript" msgstr "儲存下標" -#: ../../whatsnew/3.11.rst:1466 +#: ../../whatsnew/3.11.rst:1481 msgid "``a[i] = z``" msgstr "``a[i] = z``" -#: ../../whatsnew/3.11.rst:1466 +#: ../../whatsnew/3.11.rst:1481 msgid "Similar to subscripting specialization above." msgstr "類似於上面的下標特化。" -#: ../../whatsnew/3.11.rst:1466 +#: ../../whatsnew/3.11.rst:1481 msgid "Dennis Sweeney" msgstr "Dennis Sweeney" -#: ../../whatsnew/3.11.rst:1469 +#: ../../whatsnew/3.11.rst:1484 msgid "Calls" msgstr "呼叫" -#: ../../whatsnew/3.11.rst:1469 +#: ../../whatsnew/3.11.rst:1484 msgid "``f(arg)``" msgstr "``f(arg)``" -#: ../../whatsnew/3.11.rst:1471 +#: ../../whatsnew/3.11.rst:1486 msgid "``C(arg)``" msgstr "``C(arg)``" -#: ../../whatsnew/3.11.rst:1469 +#: ../../whatsnew/3.11.rst:1484 msgid "" "Calls to common builtin (C) functions and types such as :func:`len` and :" "class:`str` directly call their underlying C version. This avoids going " @@ -2383,27 +2399,27 @@ msgstr "" "常見內建 (C) 函式和型別的呼叫,例如 :func:`len` 和 :class:`str`,會直接呼叫它" "們的 C 版本底層,這避免了通過內部呼叫的慣例。" -#: ../../whatsnew/3.11.rst:1469 +#: ../../whatsnew/3.11.rst:1484 msgid "20%" msgstr "20%" -#: ../../whatsnew/3.11.rst:1469 +#: ../../whatsnew/3.11.rst:1484 msgid "Mark Shannon, Ken Jin" msgstr "Mark Shannon, Ken Jin" -#: ../../whatsnew/3.11.rst:1474 +#: ../../whatsnew/3.11.rst:1489 msgid "Load global variable" msgstr "載入全域變數" -#: ../../whatsnew/3.11.rst:1474 +#: ../../whatsnew/3.11.rst:1489 msgid "``print``" msgstr "``print``" -#: ../../whatsnew/3.11.rst:1476 +#: ../../whatsnew/3.11.rst:1491 msgid "``len``" msgstr "``len``" -#: ../../whatsnew/3.11.rst:1474 +#: ../../whatsnew/3.11.rst:1489 msgid "" "The object's index in the globals/builtins namespace is cached. Loading " "globals and builtins require zero namespace lookups." @@ -2411,24 +2427,24 @@ msgstr "" "全域/內建之命名空間內的物件索引被快取起來。載入全域與內建變數不需要任何命名空" "間的查找。" -#: ../../whatsnew/3.11.rst:1474 +#: ../../whatsnew/3.11.rst:1489 msgid "[#load-global]_" msgstr "[#load-global]_" -#: ../../whatsnew/3.11.rst:1474 ../../whatsnew/3.11.rst:1478 -#: ../../whatsnew/3.11.rst:1487 +#: ../../whatsnew/3.11.rst:1489 ../../whatsnew/3.11.rst:1493 +#: ../../whatsnew/3.11.rst:1502 msgid "Mark Shannon" msgstr "Mark Shannon" -#: ../../whatsnew/3.11.rst:1478 +#: ../../whatsnew/3.11.rst:1493 msgid "Load attribute" msgstr "載入屬性" -#: ../../whatsnew/3.11.rst:1478 +#: ../../whatsnew/3.11.rst:1493 msgid "``o.attr``" msgstr "``o.attr``" -#: ../../whatsnew/3.11.rst:1478 +#: ../../whatsnew/3.11.rst:1493 msgid "" "Similar to loading global variables. The attribute's index inside the class/" "object's namespace is cached. In most cases, attribute loading will require " @@ -2437,19 +2453,19 @@ msgstr "" "和載入全域變數類似,類別/物件之命名空間內的屬性索引被快取起來。在大部分情況" "中,載入屬性不需要任何命名空間的查找。" -#: ../../whatsnew/3.11.rst:1478 +#: ../../whatsnew/3.11.rst:1493 msgid "[#load-attr]_" msgstr "[#load-attr]_" -#: ../../whatsnew/3.11.rst:1483 +#: ../../whatsnew/3.11.rst:1498 msgid "Load methods for call" msgstr "載入要呼叫的方法" -#: ../../whatsnew/3.11.rst:1483 +#: ../../whatsnew/3.11.rst:1498 msgid "``o.meth()``" msgstr "``o.meth()``" -#: ../../whatsnew/3.11.rst:1483 +#: ../../whatsnew/3.11.rst:1498 msgid "" "The actual address of the method is cached. Method loading now has no " "namespace lookups -- even for classes with long inheritance chains." @@ -2457,54 +2473,54 @@ msgstr "" "方法的真實記憶體地址被快取 (cache) 起來,方法的載入現在不需要命名空間的查找 " "-- 即便有很長繼承鏈結的類別也是。" -#: ../../whatsnew/3.11.rst:1483 +#: ../../whatsnew/3.11.rst:1498 msgid "10-20%" msgstr "10-20%" -#: ../../whatsnew/3.11.rst:1483 +#: ../../whatsnew/3.11.rst:1498 msgid "Ken Jin, Mark Shannon" msgstr "Ken Jin, Mark Shannon" -#: ../../whatsnew/3.11.rst:1487 +#: ../../whatsnew/3.11.rst:1502 msgid "Store attribute" msgstr "儲存屬性" -#: ../../whatsnew/3.11.rst:1487 +#: ../../whatsnew/3.11.rst:1502 msgid "``o.attr = z``" msgstr "``o.attr = z``" -#: ../../whatsnew/3.11.rst:1487 +#: ../../whatsnew/3.11.rst:1502 msgid "Similar to load attribute optimization." msgstr "和載入屬性的最佳化相似。" -#: ../../whatsnew/3.11.rst:1487 +#: ../../whatsnew/3.11.rst:1502 msgid "2% in pyperformance" msgstr "2% 於 pyperformance 中" -#: ../../whatsnew/3.11.rst:1490 +#: ../../whatsnew/3.11.rst:1505 msgid "Unpack Sequence" msgstr "拆解 (unpack) 序列" -#: ../../whatsnew/3.11.rst:1490 +#: ../../whatsnew/3.11.rst:1505 msgid "``*seq``" msgstr "``*seq``" -#: ../../whatsnew/3.11.rst:1490 +#: ../../whatsnew/3.11.rst:1505 msgid "" "Specialized for common containers such as :class:`list` and :class:`tuple`. " "Avoids internal calling convention." msgstr "" "為像是 :class:`list` 和 :class:`tuple` 的常見容器所特化,避免了內部呼叫慣例。" -#: ../../whatsnew/3.11.rst:1490 +#: ../../whatsnew/3.11.rst:1505 msgid "8%" msgstr "8%" -#: ../../whatsnew/3.11.rst:1490 +#: ../../whatsnew/3.11.rst:1505 msgid "Brandt Bucher" msgstr "Brandt Bucher" -#: ../../whatsnew/3.11.rst:1495 +#: ../../whatsnew/3.11.rst:1510 msgid "" "A similar optimization already existed since Python 3.8. 3.11 specializes " "for more forms and reduces some overhead." @@ -2512,7 +2528,7 @@ msgstr "" "類似的最佳化自從 Python 3.8 就存在。3.11 特別處理了更多形式並減少效能開銷 " "(overhead)。" -#: ../../whatsnew/3.11.rst:1498 +#: ../../whatsnew/3.11.rst:1513 msgid "" "A similar optimization already existed since Python 3.10. 3.11 specializes " "for more forms. Furthermore, all attribute loads should be sped up by :issue:" @@ -2521,11 +2537,11 @@ msgstr "" "類似的最佳化自從 Python 3.10 就存在。3.11 特別處理了更多形式。此外,所有屬性" "載入也被 :issue:`45947` 所加速。" -#: ../../whatsnew/3.11.rst:1506 +#: ../../whatsnew/3.11.rst:1521 msgid "Misc" msgstr "雜項" -#: ../../whatsnew/3.11.rst:1508 +#: ../../whatsnew/3.11.rst:1523 msgid "" "Objects now require less memory due to lazily created object namespaces. " "Their namespace dictionaries now also share keys more freely. (Contributed " @@ -2535,7 +2551,7 @@ msgstr "" "字典現在也更自由地共享鍵。(由 Mark Shannon 於 :issue:`45340` 和 :issue:" "`40116` 貢獻。 )" -#: ../../whatsnew/3.11.rst:1512 +#: ../../whatsnew/3.11.rst:1527 msgid "" "\"Zero-cost\" exceptions are implemented, eliminating the cost of :keyword:" "`try` statements when no exception is raised. (Contributed by Mark Shannon " @@ -2544,7 +2560,7 @@ msgstr "" "實作了「無代價 (Zero-cost)」的例外,消除了在沒有例外被引發時的 :keyword:" "`try` 陳述式開銷。(由 Mark Shannon 於 :issue:`40222` 貢獻。)" -#: ../../whatsnew/3.11.rst:1516 +#: ../../whatsnew/3.11.rst:1531 msgid "" "A more concise representation of exceptions in the interpreter reduced the " "time required for catching an exception by about 10%. (Contributed by Irit " @@ -2553,7 +2569,7 @@ msgstr "" "在直譯器內使用更簡潔的例外表示法將捕獲一個例外所需的時間減少了大約 10%。 由 " "Irit Katriel 在 :issue:`45711` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1520 +#: ../../whatsnew/3.11.rst:1535 msgid "" ":mod:`re`'s regular expression matching engine has been partially " "refactored, and now uses computed gotos (or \"threaded code\") on supported " @@ -2568,15 +2584,15 @@ msgstr "" "benchmarks.html#regex-dna>`_\\ 的表現上比起 Python 3.10 快了 10%。(由 " "Brandt Bucher 於 :gh:`91404` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1531 +#: ../../whatsnew/3.11.rst:1546 msgid "FAQ" msgstr "FAQ" -#: ../../whatsnew/3.11.rst:1536 +#: ../../whatsnew/3.11.rst:1551 msgid "How should I write my code to utilize these speedups?" msgstr "我該如何在程式碼中獲取這些加速?" -#: ../../whatsnew/3.11.rst:1538 +#: ../../whatsnew/3.11.rst:1553 msgid "" "Write Pythonic code that follows common best practices; you don't have to " "change your code. The Faster CPython project optimizes for common code " @@ -2585,11 +2601,11 @@ msgstr "" "撰寫符合 Python 風格 (Pythonic) 且依循常見最佳實踐的程式碼就好,你不需要改變" "你的程式碼。CPython 加速計畫中,我們為所觀察到的常見程式編寫模式來做最佳化。" -#: ../../whatsnew/3.11.rst:1546 +#: ../../whatsnew/3.11.rst:1561 msgid "Will CPython 3.11 use more memory?" msgstr "Python 3.11 會不會使用更多記憶體?" -#: ../../whatsnew/3.11.rst:1548 +#: ../../whatsnew/3.11.rst:1563 msgid "" "Maybe not; we don't expect memory use to exceed 20% higher than 3.10. This " "is offset by memory optimizations for frame objects and object dictionaries " @@ -2598,11 +2614,11 @@ msgstr "" "也許不會。我們預期不會有超出 3.10 20% 的記憶體使用量。這數字會和上述禎物件與" "物件字典的記憶體最佳化而有所偏差。" -#: ../../whatsnew/3.11.rst:1556 +#: ../../whatsnew/3.11.rst:1571 msgid "I don't see any speedups in my workload. Why?" msgstr "我在我的程式當中沒感覺到任何加速,為什麼?" -#: ../../whatsnew/3.11.rst:1558 +#: ../../whatsnew/3.11.rst:1573 msgid "" "Certain code won't have noticeable benefits. If your code spends most of its " "time on I/O operations, or already does most of its computation in a C " @@ -2613,7 +2629,7 @@ msgstr "" "將大部分計算用像是 numpy 的 C 擴充函式庫處理,那就不會有明顯的加速。這個計畫" "是對純 Python 的工作負荷最有幫助。" -#: ../../whatsnew/3.11.rst:1563 +#: ../../whatsnew/3.11.rst:1578 msgid "" "Furthermore, the pyperformance figures are a geometric mean. Even within the " "pyperformance benchmarks, certain benchmarks have slowed down slightly, " @@ -2622,19 +2638,19 @@ msgstr "" "此外,pyperformance 數值為一個幾何平均數 (geometric mean)。即便在 " "pyperformance 基準量測中,某些測試稍微慢了一些,但其他加快了將近兩倍!" -#: ../../whatsnew/3.11.rst:1571 +#: ../../whatsnew/3.11.rst:1586 msgid "Is there a JIT compiler?" msgstr "有用到 JIT 編譯器嗎?" -#: ../../whatsnew/3.11.rst:1573 +#: ../../whatsnew/3.11.rst:1588 msgid "No. We're still exploring other optimizations." msgstr "沒有,我們還在探索其他最佳化方式。" -#: ../../whatsnew/3.11.rst:1579 +#: ../../whatsnew/3.11.rst:1594 msgid "About" msgstr "關於" -#: ../../whatsnew/3.11.rst:1581 +#: ../../whatsnew/3.11.rst:1596 msgid "" "Faster CPython explores optimizations for :term:`CPython`. The main team is " "funded by Microsoft to work on this full-time. Pablo Galindo Salgado is also " @@ -2645,11 +2661,11 @@ msgstr "" "(microsoft) 所資助以全職發展該計畫,Pablo Galindo Salgado 亦由彭博有限合夥企" "業 (Bloomberg LP) 資助來兼職開發,更有許許多多來自社群的自發性貢獻者。" -#: ../../whatsnew/3.11.rst:1590 +#: ../../whatsnew/3.11.rst:1605 msgid "CPython bytecode changes" msgstr "CPython 位元組碼 (bytecode) 變更" -#: ../../whatsnew/3.11.rst:1592 +#: ../../whatsnew/3.11.rst:1607 msgid "" "The bytecode now contains inline cache entries, which take the form of the " "newly-added :opcode:`CACHE` instructions. Many opcodes expect to be followed " @@ -2663,11 +2679,11 @@ msgstr "" "(populated) 快取看起來像任意指示,因此在讀取或修改包含加速資料的原始且適應 " "(adaptive) 位元組碼時應格外小心。" -#: ../../whatsnew/3.11.rst:1604 +#: ../../whatsnew/3.11.rst:1619 msgid "New opcodes" msgstr "新增 opcode" -#: ../../whatsnew/3.11.rst:1606 +#: ../../whatsnew/3.11.rst:1621 msgid "" ":opcode:`!ASYNC_GEN_WRAP`, :opcode:`RETURN_GENERATOR` and :opcode:`SEND`, " "used in generators and co-routines." @@ -2675,7 +2691,7 @@ msgstr "" ":opcode:`!ASYNC_GEN_WRAP`、:opcode:`RETURN_GENERATOR` 和 :opcode:`SEND` 被用" "於產生器與協程。" -#: ../../whatsnew/3.11.rst:1609 +#: ../../whatsnew/3.11.rst:1624 msgid "" ":opcode:`COPY_FREE_VARS`, which avoids needing special caller-side code for " "closures." @@ -2683,17 +2699,17 @@ msgstr "" ":opcode:`COPY_FREE_VARS`,避免了為閉包 (closure) 而生的特殊呼叫方 (caller-" "side) 程式碼的需求。" -#: ../../whatsnew/3.11.rst:1612 +#: ../../whatsnew/3.11.rst:1627 msgid "" ":opcode:`JUMP_BACKWARD_NO_INTERRUPT`, for use in certain loops where " "handling interrupts is undesirable." msgstr ":opcode:`JUMP_BACKWARD_NO_INTERRUPT`,用於某些不需要處理中斷的循環。" -#: ../../whatsnew/3.11.rst:1615 +#: ../../whatsnew/3.11.rst:1630 msgid ":opcode:`MAKE_CELL`, to create :ref:`cell-objects`." msgstr ":opcode:`MAKE_CELL` 被用於建立 :ref:`cell-objects`。" -#: ../../whatsnew/3.11.rst:1617 +#: ../../whatsnew/3.11.rst:1632 msgid "" ":opcode:`CHECK_EG_MATCH` and :opcode:`!PREP_RERAISE_STAR`, to handle the :" "ref:`new exception groups and except* ` added in :pep:" @@ -2702,29 +2718,29 @@ msgstr "" ":opcode:`CHECK_EG_MATCH` 和 :opcode:`!PREP_RERAISE_STAR`,處理 :pep:`654` 所" "加入的\\ :ref:`新增例外群組和 except* `。" -#: ../../whatsnew/3.11.rst:1621 +#: ../../whatsnew/3.11.rst:1636 msgid ":opcode:`PUSH_EXC_INFO`, for use in exception handlers." msgstr ":opcode:`PUSH_EXC_INFO` 被用於例外處理函式。" -#: ../../whatsnew/3.11.rst:1623 +#: ../../whatsnew/3.11.rst:1638 msgid "" ":opcode:`RESUME`, a no-op, for internal tracing, debugging and optimization " "checks." msgstr ":opcode:`RESUME`,為無操作 (no-po),用於內部追查、除錯和最佳化檢查。" -#: ../../whatsnew/3.11.rst:1630 +#: ../../whatsnew/3.11.rst:1645 msgid "Replaced opcodes" msgstr "被取代的操作碼 (opcode)" -#: ../../whatsnew/3.11.rst:1633 +#: ../../whatsnew/3.11.rst:1648 msgid "Replaced Opcode(s)" msgstr "被取代的操作碼" -#: ../../whatsnew/3.11.rst:1633 +#: ../../whatsnew/3.11.rst:1648 msgid "New Opcode(s)" msgstr "新的操作碼" -#: ../../whatsnew/3.11.rst:1633 +#: ../../whatsnew/3.11.rst:1648 msgid "Notes" msgstr "註記" @@ -2736,11 +2752,11 @@ msgstr ":opcode:`!BINARY_*`" msgid ":opcode:`!INPLACE_*`" msgstr ":opcode:`!INPLACE_*`" -#: ../../whatsnew/3.11.rst:1635 +#: ../../whatsnew/3.11.rst:1650 msgid ":opcode:`BINARY_OP`" msgstr ":opcode:`BINARY_OP`" -#: ../../whatsnew/3.11.rst:1635 +#: ../../whatsnew/3.11.rst:1650 msgid "Replaced all numeric binary/in-place opcodes with a single opcode" msgstr "以單一一個操作碼來取代所有數值的、二進位/原位 (in-place) 操作碼" @@ -2772,7 +2788,7 @@ msgstr ":opcode:`!PRECALL`" msgid ":opcode:`PUSH_NULL`" msgstr ":opcode:`PUSH_NULL`" -#: ../../whatsnew/3.11.rst:1638 +#: ../../whatsnew/3.11.rst:1653 msgid "" "Decouples argument shifting for methods from handling of keyword arguments; " "allows better specialization of calls" @@ -2812,7 +2828,7 @@ msgstr ":opcode:`COPY`" msgid ":opcode:`SWAP`" msgstr ":opcode:`SWAP`" -#: ../../whatsnew/3.11.rst:1643 +#: ../../whatsnew/3.11.rst:1658 msgid "Stack manipulation instructions" msgstr "堆疊操作指示" @@ -2824,7 +2840,7 @@ msgstr ":opcode:`!JUMP_IF_NOT_EXC_MATCH`" msgid ":opcode:`CHECK_EXC_MATCH`" msgstr ":opcode:`CHECK_EXC_MATCH`" -#: ../../whatsnew/3.11.rst:1650 +#: ../../whatsnew/3.11.rst:1665 msgid "Now performs check but doesn't jump" msgstr "現在執行檢查但不跳位 (jump)" @@ -2852,7 +2868,7 @@ msgstr ":opcode:`!POP_JUMP_BACKWARD_IF_*`" msgid ":opcode:`!POP_JUMP_FORWARD_IF_*`" msgstr ":opcode:`!POP_JUMP_FORWARD_IF_*`" -#: ../../whatsnew/3.11.rst:1652 +#: ../../whatsnew/3.11.rst:1667 msgid "" "See [#bytecode-jump]_; ``TRUE``, ``FALSE``, ``NONE`` and ``NOT_NONE`` " "variants for each direction" @@ -2868,15 +2884,15 @@ msgstr ":opcode:`!SETUP_WITH`" msgid ":opcode:`!SETUP_ASYNC_WITH`" msgstr ":opcode:`!SETUP_ASYNC_WITH`" -#: ../../whatsnew/3.11.rst:1658 +#: ../../whatsnew/3.11.rst:1673 msgid ":opcode:`BEFORE_WITH`" msgstr ":opcode:`BEFORE_WITH`" -#: ../../whatsnew/3.11.rst:1658 +#: ../../whatsnew/3.11.rst:1673 msgid ":keyword:`with` block setup" msgstr ":keyword:`with` 區塊設置" -#: ../../whatsnew/3.11.rst:1662 +#: ../../whatsnew/3.11.rst:1677 msgid "" "All jump opcodes are now relative, including the existing :opcode:`!" "JUMP_IF_TRUE_OR_POP` and :opcode:`!JUMP_IF_FALSE_OR_POP`. The argument is " @@ -2886,11 +2902,11 @@ msgstr "" "JUMP_IF_TRUE_OR_POP` 和 :opcode:`!JUMP_IF_FALSE_OR_POP`。該引數現在是當前指" "示 (instruction) 的偏移量而不是絕對位置。" -#: ../../whatsnew/3.11.rst:1673 +#: ../../whatsnew/3.11.rst:1688 msgid "Changed/removed opcodes" msgstr "有更動/被移除的 opcode" -#: ../../whatsnew/3.11.rst:1675 +#: ../../whatsnew/3.11.rst:1690 msgid "" "Changed :opcode:`MATCH_CLASS` and :opcode:`MATCH_KEYS` to no longer push an " "additional boolean value to indicate success/failure. Instead, ``None`` is " @@ -2900,7 +2916,7 @@ msgstr "" "值來表示成功/失敗。取而代之的是會在失敗時推送 ``None``,而非一個包含提取值的" "元組。" -#: ../../whatsnew/3.11.rst:1680 +#: ../../whatsnew/3.11.rst:1695 msgid "" "Changed opcodes that work with exceptions to reflect them now being " "represented as one item on the stack instead of three (see :gh:`89874`)." @@ -2908,7 +2924,7 @@ msgstr "" "更改了運作於例外的操作碼以反映它們現在在堆疊中的表示為一項而不是三項(請參" "閱 :gh:`89874`)。" -#: ../../whatsnew/3.11.rst:1684 +#: ../../whatsnew/3.11.rst:1699 msgid "" "Removed :opcode:`!COPY_DICT_WITHOUT_KEYS`, :opcode:`!GEN_START`, :opcode:`!" "POP_BLOCK`, :opcode:`!SETUP_FINALLY` and :opcode:`!YIELD_FROM`." @@ -2916,26 +2932,26 @@ msgstr "" "刪除 :opcode:`!COPY_DICT_WITHOUT_KEYS`、:opcode:`!GEN_START`、:opcode:`!" "POP_BLOCK`、:opcode:`!SETUP_FINALLY` 和 :opcode:`!YIELD_FROM`。" -#: ../../whatsnew/3.11.rst:1692 ../../whatsnew/3.11.rst:2565 +#: ../../whatsnew/3.11.rst:1707 ../../whatsnew/3.11.rst:2580 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.11.rst:1694 +#: ../../whatsnew/3.11.rst:1709 msgid "" "This section lists Python APIs that have been deprecated in Python 3.11." msgstr "這個部分列出了在 Python 3.11 中棄用的 Python API。" -#: ../../whatsnew/3.11.rst:1696 +#: ../../whatsnew/3.11.rst:1711 msgid "" "Deprecated C APIs are :ref:`listed separately `." msgstr "被棄用的 C API 被\\ :ref:`獨立列出 `。" -#: ../../whatsnew/3.11.rst:1703 +#: ../../whatsnew/3.11.rst:1718 msgid "Language/Builtins" msgstr "語言/內建" -#: ../../whatsnew/3.11.rst:1705 +#: ../../whatsnew/3.11.rst:1720 msgid "" "Chaining :class:`classmethod` descriptors (introduced in :issue:`19072`) is " "now deprecated. It can no longer be used to wrap other descriptors such as :" @@ -2950,7 +2966,7 @@ msgstr "" "慮使用 Python 3.10 中添加的 :attr:`!__wrapped__` 屬性。(由 Raymond " "Hettinger 在 :gh:`89519` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1713 +#: ../../whatsnew/3.11.rst:1728 msgid "" "Octal escapes in string and bytes literals with values larger than ``0o377`` " "(255 in decimal) now produce a :exc:`DeprecationWarning`. In a future Python " @@ -2962,7 +2978,7 @@ msgstr "" "Python 版本中,他們將引發一個 :exc:`SyntaxWarning` 並最終引發一個 :exc:" "`SyntaxError`。(由 Serhiy Storchaka 在 :gh:`81548` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1719 +#: ../../whatsnew/3.11.rst:1734 msgid "" "The delegation of :func:`int` to :meth:`~object.__trunc__` is now " "deprecated. Calling ``int(a)`` when ``type(a)`` implements :meth:`!" @@ -2975,93 +2991,93 @@ msgstr "" "meth:`~object.__index__`,呼叫 ``int(a)`` 現在會引發一個 :exc:" "`DeprecationWarning`。(由 Zackery Spytz 在 :issue:`44977` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1729 +#: ../../whatsnew/3.11.rst:1744 msgid "Modules" msgstr "模組" -#: ../../whatsnew/3.11.rst:1733 +#: ../../whatsnew/3.11.rst:1748 msgid "" ":pep:`594` led to the deprecations of the following modules slated for " "removal in Python 3.13:" msgstr ":pep:`594` 引領下列模組的棄用,並排訂於 Python 3.13 移除:" -#: ../../whatsnew/3.11.rst:1737 +#: ../../whatsnew/3.11.rst:1752 msgid ":mod:`aifc`" msgstr ":mod:`aifc`" -#: ../../whatsnew/3.11.rst:1737 +#: ../../whatsnew/3.11.rst:1752 msgid ":mod:`chunk`" msgstr ":mod:`chunk`" -#: ../../whatsnew/3.11.rst:1737 +#: ../../whatsnew/3.11.rst:1752 msgid ":mod:`msilib`" msgstr ":mod:`msilib`" -#: ../../whatsnew/3.11.rst:1737 +#: ../../whatsnew/3.11.rst:1752 msgid ":mod:`pipes`" msgstr ":mod:`pipes`" -#: ../../whatsnew/3.11.rst:1737 +#: ../../whatsnew/3.11.rst:1752 msgid ":mod:`telnetlib`" msgstr ":mod:`telnetlib`" -#: ../../whatsnew/3.11.rst:1739 +#: ../../whatsnew/3.11.rst:1754 msgid ":mod:`audioop`" msgstr ":mod:`audioop`" -#: ../../whatsnew/3.11.rst:1739 +#: ../../whatsnew/3.11.rst:1754 msgid ":mod:`crypt`" msgstr ":mod:`crypt`" -#: ../../whatsnew/3.11.rst:1739 +#: ../../whatsnew/3.11.rst:1754 msgid ":mod:`nis`" msgstr ":mod:`nis`" -#: ../../whatsnew/3.11.rst:1739 +#: ../../whatsnew/3.11.rst:1754 msgid ":mod:`sndhdr`" msgstr ":mod:`sndhdr`" -#: ../../whatsnew/3.11.rst:1739 +#: ../../whatsnew/3.11.rst:1754 msgid ":mod:`uu`" msgstr ":mod:`uu`" -#: ../../whatsnew/3.11.rst:1741 +#: ../../whatsnew/3.11.rst:1756 msgid ":mod:`cgi`" msgstr ":mod:`cgi`" -#: ../../whatsnew/3.11.rst:1741 +#: ../../whatsnew/3.11.rst:1756 msgid ":mod:`imghdr`" msgstr ":mod:`imghdr`" -#: ../../whatsnew/3.11.rst:1741 +#: ../../whatsnew/3.11.rst:1756 msgid ":mod:`nntplib`" msgstr ":mod:`nntplib`" -#: ../../whatsnew/3.11.rst:1741 +#: ../../whatsnew/3.11.rst:1756 msgid ":mod:`spwd`" msgstr ":mod:`spwd`" -#: ../../whatsnew/3.11.rst:1741 +#: ../../whatsnew/3.11.rst:1756 msgid ":mod:`xdrlib`" msgstr ":mod:`xdrlib`" -#: ../../whatsnew/3.11.rst:1743 +#: ../../whatsnew/3.11.rst:1758 msgid ":mod:`cgitb`" msgstr ":mod:`cgitb`" -#: ../../whatsnew/3.11.rst:1743 +#: ../../whatsnew/3.11.rst:1758 msgid ":mod:`mailcap`" msgstr ":mod:`mailcap`" -#: ../../whatsnew/3.11.rst:1743 +#: ../../whatsnew/3.11.rst:1758 msgid ":mod:`ossaudiodev`" msgstr ":mod:`ossaudiodev`" -#: ../../whatsnew/3.11.rst:1743 +#: ../../whatsnew/3.11.rst:1758 msgid ":mod:`sunau`" msgstr ":mod:`sunau`" -#: ../../whatsnew/3.11.rst:1746 +#: ../../whatsnew/3.11.rst:1761 msgid "" "(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in :gh:" "`68966`.)" @@ -3069,7 +3085,7 @@ msgstr "" "(由 Brett Cannon 和 Victor Stinner 分別於 :issue:`47061` 與 :gh:`68966` 中所" "貢獻。)" -#: ../../whatsnew/3.11.rst:1749 +#: ../../whatsnew/3.11.rst:1764 msgid "" "The :mod:`!asynchat`, :mod:`!asyncore` and :mod:`!smtpd` modules have been " "deprecated since at least Python 3.6. Their documentation and deprecation " @@ -3080,7 +3096,7 @@ msgstr "" "被棄用,它們的文件與棄用警告現在已被更新為會提示它們即將於 Python 3.12 中移" "除。(由 Hugo van Kemenade 於 :issue:`47022` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1754 +#: ../../whatsnew/3.11.rst:1769 msgid "" "The :mod:`lib2to3` package and :ref:`2to3 <2to3-reference>` tool are now " "deprecated and may not be able to parse Python 3.10 or newer. See :pep:" @@ -3091,7 +3107,7 @@ msgstr "" "析 Python 3.10 或更新版本。有關詳細資訊請參閱 :pep:`617`,它引入了新的 PEG 剖" "析器。(由 Victor Stinner 在 :issue:`40360` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1759 +#: ../../whatsnew/3.11.rst:1774 msgid "" "Undocumented modules :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!" "sre_parse` are now deprecated. (Contributed by Serhiy Storchaka in :issue:" @@ -3101,11 +3117,11 @@ msgstr "" "sre_parse` 模組現在已被棄用。(由 Serhiy Storchaka 在 :issue:`47152` 中貢" "獻。)" -#: ../../whatsnew/3.11.rst:1767 +#: ../../whatsnew/3.11.rst:1782 msgid "Standard Library" msgstr "標準函式庫" -#: ../../whatsnew/3.11.rst:1769 +#: ../../whatsnew/3.11.rst:1784 msgid "" "The following have been deprecated in :mod:`configparser` since Python 3.2. " "Their deprecation warnings have now been updated to note they will be " @@ -3114,23 +3130,23 @@ msgstr "" "以下 :mod:`configparser` 相關項目已在 Python 3.2 中棄用,它們的棄用警告現在會" "提示它們即將於 Python 3.12 中移除:" -#: ../../whatsnew/3.11.rst:1773 +#: ../../whatsnew/3.11.rst:1788 msgid "the :class:`!configparser.SafeConfigParser` class" msgstr ":class:`!configparser.SafeConfigParser` 類別" -#: ../../whatsnew/3.11.rst:1774 +#: ../../whatsnew/3.11.rst:1789 msgid "the :attr:`!configparser.ParsingError.filename` property" msgstr ":attr:`!configparser.ParsingError.filename` 屬性" -#: ../../whatsnew/3.11.rst:1775 +#: ../../whatsnew/3.11.rst:1790 msgid "the :meth:`!configparser.RawConfigParser.readfp` method" msgstr ":meth:`!configparser.RawConfigParser.readfp` 方法" -#: ../../whatsnew/3.11.rst:1777 +#: ../../whatsnew/3.11.rst:1792 msgid "(Contributed by Hugo van Kemenade in :issue:`45173`.)" msgstr "(由 Hugo van Kemenade 於 :issue:`45173` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:1779 +#: ../../whatsnew/3.11.rst:1794 msgid "" ":class:`!configparser.LegacyInterpolation` has been deprecated in the " "docstring since Python 3.2, and is not listed in the :mod:`configparser` " @@ -3145,7 +3161,7 @@ msgstr "" "BasicInterpolation` 或 :class:`configparser.ExtendedInterpolation`。(由 " "Hugo van Kemenade 在 :issue:`46607` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1786 +#: ../../whatsnew/3.11.rst:1801 msgid "" "The older set of :mod:`importlib.resources` functions were deprecated in " "favor of the replacements added in Python 3.9 and will be removed in a " @@ -3156,35 +3172,35 @@ msgstr "" "用、並將在未來的 Python 版本中刪除,取而代之的是在 Python 3.9 中添加的替代方" "案:" -#: ../../whatsnew/3.11.rst:1791 +#: ../../whatsnew/3.11.rst:1806 msgid ":func:`importlib.resources.contents`" msgstr ":func:`importlib.resources.contents`" -#: ../../whatsnew/3.11.rst:1792 +#: ../../whatsnew/3.11.rst:1807 msgid ":func:`importlib.resources.is_resource`" msgstr ":func:`importlib.resources.is_resource`" -#: ../../whatsnew/3.11.rst:1793 +#: ../../whatsnew/3.11.rst:1808 msgid ":func:`importlib.resources.open_binary`" msgstr ":func:`importlib.resources.open_binary`" -#: ../../whatsnew/3.11.rst:1794 +#: ../../whatsnew/3.11.rst:1809 msgid ":func:`importlib.resources.open_text`" msgstr ":func:`importlib.resources.open_text`" -#: ../../whatsnew/3.11.rst:1795 +#: ../../whatsnew/3.11.rst:1810 msgid ":func:`importlib.resources.read_binary`" msgstr ":func:`importlib.resources.read_binary`" -#: ../../whatsnew/3.11.rst:1796 +#: ../../whatsnew/3.11.rst:1811 msgid ":func:`importlib.resources.read_text`" msgstr ":func:`importlib.resources.read_text`" -#: ../../whatsnew/3.11.rst:1797 +#: ../../whatsnew/3.11.rst:1812 msgid ":func:`importlib.resources.path`" msgstr ":func:`importlib.resources.path`" -#: ../../whatsnew/3.11.rst:1799 +#: ../../whatsnew/3.11.rst:1814 msgid "" "The :func:`locale.getdefaultlocale` function is deprecated and will be " "removed in Python 3.15. Use :func:`locale.setlocale`, :func:`locale." @@ -3196,7 +3212,7 @@ msgstr "" "` 和 :func:`locale.getlocale`。(Victor Stinner " "於 :gh:`90817` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:1805 +#: ../../whatsnew/3.11.rst:1820 msgid "" "The :func:`locale.resetlocale` function is deprecated and will be removed in " "Python 3.13. Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. " @@ -3206,7 +3222,7 @@ msgstr "" "``locale.setlocale(locale.LC_ALL, \"\")``。(由 Victor Stinner 於 :gh:" "`90817` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:1809 +#: ../../whatsnew/3.11.rst:1824 msgid "" "Stricter rules will now be applied for numerical group references and group " "names in :ref:`regular expressions `. Only sequences of ASCII " @@ -3222,7 +3238,7 @@ msgstr "" "字母、數字和底線。目前,會針對違反這些規則的語法發出棄用警告。(由 Serhiy " "Storchaka 在 :gh:`91760` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1817 +#: ../../whatsnew/3.11.rst:1832 msgid "" "In the :mod:`re` module, the :func:`!re.template` function and the " "corresponding :const:`!re.TEMPLATE` and :const:`!re.T` flags are deprecated, " @@ -3235,7 +3251,7 @@ msgstr "" "們將在 Python 3.13 中被刪除。(由 Serhiy Storchaka 和 Miro Hrončok 在 :gh:" "`92728` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1823 +#: ../../whatsnew/3.11.rst:1838 msgid "" ":func:`turtle.settiltangle` has been deprecated since Python 3.1; it now " "emits a deprecation warning and will be removed in Python 3.13. Use :func:" @@ -3248,7 +3264,7 @@ msgstr "" "誤地標記為已棄用,其文件字串現在已更正)。(由 Hugo van Kemenade 在 :issue:" "`45837` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1829 +#: ../../whatsnew/3.11.rst:1844 msgid "" ":class:`typing.Text`, which exists solely to provide compatibility support " "between Python 2 and Python 3 code, is now deprecated. Its removal is " @@ -3259,7 +3275,7 @@ msgstr "" "用。目前未計劃刪除它,但鼓勵用戶盡可能使用 :class:`str` 代替。(由 Alex " "Waygood 在 :gh:`92332` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1835 +#: ../../whatsnew/3.11.rst:1850 msgid "" "The keyword argument syntax for constructing :data:`typing.TypedDict` types " "is now deprecated. Support will be removed in Python 3.13. (Contributed by " @@ -3268,7 +3284,7 @@ msgstr "" "用於建構 :data:`typing.TypedDict` 型別的關鍵字引數語法現已棄用。將在 Python " "3.13 中停止支援。(由 Jingchen Ye 在 :gh:`90224` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1839 +#: ../../whatsnew/3.11.rst:1854 msgid "" ":class:`!webbrowser.MacOSX` is deprecated and will be removed in Python " "3.13. It is untested, undocumented, and not used by :mod:`webbrowser` " @@ -3278,7 +3294,7 @@ msgstr "" "過、沒紀錄於文件、也沒有被 :mod:`webbrowser` 本身使用。(由 Donghee Na 於 :" "issue:`42255`。)" -#: ../../whatsnew/3.11.rst:1843 +#: ../../whatsnew/3.11.rst:1858 msgid "" "The behavior of returning a value from a :class:`~unittest.TestCase` and :" "class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the " @@ -3288,7 +3304,7 @@ msgstr "" "IsolatedAsyncioTestCase` 測試方法(預設的 ``None`` 值除外)給定值的行為現已棄" "用。" -#: ../../whatsnew/3.11.rst:1847 +#: ../../whatsnew/3.11.rst:1862 msgid "" "Deprecated the following not-formally-documented :mod:`unittest` functions, " "scheduled for removal in Python 3.13:" @@ -3296,39 +3312,39 @@ msgstr "" "棄用以下並沒有正式紀錄於文件中的 :mod:`unittest` 函式,並預計於 Python 3.13 " "中移除:" -#: ../../whatsnew/3.11.rst:1850 +#: ../../whatsnew/3.11.rst:1865 msgid ":func:`!unittest.findTestCases`" msgstr ":func:`!unittest.findTestCases`" -#: ../../whatsnew/3.11.rst:1851 +#: ../../whatsnew/3.11.rst:1866 msgid ":func:`!unittest.makeSuite`" msgstr ":func:`!unittest.makeSuite`" -#: ../../whatsnew/3.11.rst:1852 +#: ../../whatsnew/3.11.rst:1867 msgid ":func:`!unittest.getTestCaseNames`" msgstr ":func:`!unittest.getTestCaseNames`" -#: ../../whatsnew/3.11.rst:1854 +#: ../../whatsnew/3.11.rst:1869 msgid "Use :class:`~unittest.TestLoader` methods instead:" msgstr "改用 :class:`~unittest.TestLoader` 方法:" -#: ../../whatsnew/3.11.rst:1856 +#: ../../whatsnew/3.11.rst:1871 msgid ":meth:`unittest.TestLoader.loadTestsFromModule`" msgstr ":meth:`unittest.TestLoader.loadTestsFromModule`" -#: ../../whatsnew/3.11.rst:1857 +#: ../../whatsnew/3.11.rst:1872 msgid ":meth:`unittest.TestLoader.loadTestsFromTestCase`" msgstr ":meth:`unittest.TestLoader.loadTestsFromTestCase`" -#: ../../whatsnew/3.11.rst:1858 +#: ../../whatsnew/3.11.rst:1873 msgid ":meth:`unittest.TestLoader.getTestCaseNames`" msgstr ":meth:`unittest.TestLoader.getTestCaseNames`" -#: ../../whatsnew/3.11.rst:1860 +#: ../../whatsnew/3.11.rst:1875 msgid "(Contributed by Erlend E. Aasland in :issue:`5846`.)" msgstr "(由 Erlend E. Aasland 於 :issue:`5846` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:1862 +#: ../../whatsnew/3.11.rst:1877 msgid "" ":meth:`!unittest.TestProgram.usageExit` is marked deprecated, to be removed " "in 3.13. (Contributed by Carlos Damázio in :gh:`67048`.)" @@ -3336,17 +3352,17 @@ msgstr "" ":meth:`!unittest.TestProgram.usageExit` 被標記為已棄用,即將在 3.13 中移除" "(由 Carlos Damázio 在 :gh:`67048` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1871 ../../whatsnew/3.11.rst:2593 +#: ../../whatsnew/3.11.rst:1886 ../../whatsnew/3.11.rst:2608 msgid "Pending Removal in Python 3.12" msgstr "Python 3.12 中待決議的移除項目" -#: ../../whatsnew/3.11.rst:1873 +#: ../../whatsnew/3.11.rst:1888 msgid "" "The following Python APIs have been deprecated in earlier Python releases, " "and will be removed in Python 3.12." msgstr "下列 API 已在先前的 Python 發布版本中棄用,並將於 Python 3.12 中移除。" -#: ../../whatsnew/3.11.rst:1876 +#: ../../whatsnew/3.11.rst:1891 msgid "" "C APIs pending removal are :ref:`listed separately `." @@ -3354,270 +3370,270 @@ msgstr "" "待定的 C API 移除項目為\\ :ref:`獨立列出的 `。" -#: ../../whatsnew/3.11.rst:1879 +#: ../../whatsnew/3.11.rst:1894 msgid "The :mod:`!asynchat` module" msgstr ":mod:`!asynchat` 模組" -#: ../../whatsnew/3.11.rst:1880 +#: ../../whatsnew/3.11.rst:1895 msgid "The :mod:`!asyncore` module" msgstr ":mod:`!asyncore` 模組" -#: ../../whatsnew/3.11.rst:1881 +#: ../../whatsnew/3.11.rst:1896 msgid "The :ref:`entire distutils package `" msgstr ":ref:`整個 distutils 套件 `" -#: ../../whatsnew/3.11.rst:1882 +#: ../../whatsnew/3.11.rst:1897 msgid "The :mod:`!imp` module" msgstr ":mod:`!imp` 模組" -#: ../../whatsnew/3.11.rst:1883 +#: ../../whatsnew/3.11.rst:1898 msgid "The :class:`typing.io ` namespace" msgstr ":class:`typing.io ` 命名空間" -#: ../../whatsnew/3.11.rst:1884 +#: ../../whatsnew/3.11.rst:1899 msgid "The :class:`typing.re ` namespace" msgstr ":class:`typing.re ` 命名空間" -#: ../../whatsnew/3.11.rst:1885 +#: ../../whatsnew/3.11.rst:1900 msgid ":func:`!cgi.log`" msgstr ":func:`!cgi.log`" -#: ../../whatsnew/3.11.rst:1886 +#: ../../whatsnew/3.11.rst:1901 msgid ":func:`!importlib.find_loader`" msgstr ":func:`!importlib.find_loader`" -#: ../../whatsnew/3.11.rst:1887 +#: ../../whatsnew/3.11.rst:1902 msgid ":meth:`!importlib.abc.Loader.module_repr`" msgstr ":meth:`!importlib.abc.Loader.module_repr`" -#: ../../whatsnew/3.11.rst:1888 +#: ../../whatsnew/3.11.rst:1903 msgid ":meth:`!importlib.abc.MetaPathFinder.find_module`" msgstr ":meth:`!importlib.abc.MetaPathFinder.find_module`" -#: ../../whatsnew/3.11.rst:1889 +#: ../../whatsnew/3.11.rst:1904 msgid ":meth:`!importlib.abc.PathEntryFinder.find_loader`" msgstr ":meth:`!importlib.abc.PathEntryFinder.find_loader`" -#: ../../whatsnew/3.11.rst:1890 +#: ../../whatsnew/3.11.rst:1905 msgid ":meth:`!importlib.abc.PathEntryFinder.find_module`" msgstr ":meth:`!importlib.abc.PathEntryFinder.find_module`" -#: ../../whatsnew/3.11.rst:1891 +#: ../../whatsnew/3.11.rst:1906 msgid ":meth:`!importlib.machinery.BuiltinImporter.find_module`" msgstr ":meth:`!importlib.machinery.BuiltinImporter.find_module`" -#: ../../whatsnew/3.11.rst:1892 +#: ../../whatsnew/3.11.rst:1907 msgid ":meth:`!importlib.machinery.BuiltinLoader.module_repr`" msgstr ":meth:`!importlib.machinery.BuiltinLoader.module_repr`" -#: ../../whatsnew/3.11.rst:1893 +#: ../../whatsnew/3.11.rst:1908 msgid ":meth:`!importlib.machinery.FileFinder.find_loader`" msgstr ":meth:`!importlib.machinery.FileFinder.find_loader`" -#: ../../whatsnew/3.11.rst:1894 +#: ../../whatsnew/3.11.rst:1909 msgid ":meth:`!importlib.machinery.FileFinder.find_module`" msgstr ":meth:`!importlib.machinery.FileFinder.find_module`" -#: ../../whatsnew/3.11.rst:1895 +#: ../../whatsnew/3.11.rst:1910 msgid ":meth:`!importlib.machinery.FrozenImporter.find_module`" msgstr ":meth:`!importlib.machinery.FrozenImporter.find_module`" -#: ../../whatsnew/3.11.rst:1896 +#: ../../whatsnew/3.11.rst:1911 msgid ":meth:`!importlib.machinery.FrozenLoader.module_repr`" msgstr ":meth:`!importlib.machinery.FrozenLoader.module_repr`" -#: ../../whatsnew/3.11.rst:1897 +#: ../../whatsnew/3.11.rst:1912 msgid ":meth:`!importlib.machinery.PathFinder.find_module`" msgstr ":meth:`!importlib.machinery.PathFinder.find_module`" -#: ../../whatsnew/3.11.rst:1898 +#: ../../whatsnew/3.11.rst:1913 msgid ":meth:`!importlib.machinery.WindowsRegistryFinder.find_module`" msgstr ":meth:`!importlib.machinery.WindowsRegistryFinder.find_module`" -#: ../../whatsnew/3.11.rst:1899 +#: ../../whatsnew/3.11.rst:1914 msgid ":func:`!importlib.util.module_for_loader`" msgstr ":func:`!importlib.util.module_for_loader`" -#: ../../whatsnew/3.11.rst:1900 +#: ../../whatsnew/3.11.rst:1915 msgid ":func:`!importlib.util.set_loader_wrapper`" msgstr ":func:`!importlib.util.set_loader_wrapper`" -#: ../../whatsnew/3.11.rst:1901 +#: ../../whatsnew/3.11.rst:1916 msgid ":func:`!importlib.util.set_package_wrapper`" msgstr ":func:`!importlib.util.set_package_wrapper`" -#: ../../whatsnew/3.11.rst:1902 +#: ../../whatsnew/3.11.rst:1917 msgid ":class:`!pkgutil.ImpImporter`" msgstr ":class:`!pkgutil.ImpImporter`" -#: ../../whatsnew/3.11.rst:1903 +#: ../../whatsnew/3.11.rst:1918 msgid ":class:`!pkgutil.ImpLoader`" msgstr ":class:`!pkgutil.ImpLoader`" -#: ../../whatsnew/3.11.rst:1904 +#: ../../whatsnew/3.11.rst:1919 msgid ":meth:`!pathlib.Path.link_to`" msgstr ":meth:`!pathlib.Path.link_to`" -#: ../../whatsnew/3.11.rst:1905 +#: ../../whatsnew/3.11.rst:1920 msgid ":func:`!sqlite3.enable_shared_cache`" msgstr ":func:`!sqlite3.enable_shared_cache`" -#: ../../whatsnew/3.11.rst:1906 +#: ../../whatsnew/3.11.rst:1921 msgid ":func:`!sqlite3.OptimizedUnicode`" msgstr ":func:`!sqlite3.OptimizedUnicode`" -#: ../../whatsnew/3.11.rst:1907 +#: ../../whatsnew/3.11.rst:1922 msgid ":envvar:`!PYTHONTHREADDEBUG` environment variable" msgstr ":envvar:`!PYTHONTHREADDEBUG` 環境變數" -#: ../../whatsnew/3.11.rst:1908 +#: ../../whatsnew/3.11.rst:1923 msgid "The following deprecated aliases in :mod:`unittest`:" msgstr ":mod:`unittest` 中被棄用的別名:" -#: ../../whatsnew/3.11.rst:1911 +#: ../../whatsnew/3.11.rst:1926 msgid "Deprecated alias" msgstr "已棄用的別名" -#: ../../whatsnew/3.11.rst:1911 +#: ../../whatsnew/3.11.rst:1926 msgid "Method Name" msgstr "方法名稱" -#: ../../whatsnew/3.11.rst:1911 +#: ../../whatsnew/3.11.rst:1926 msgid "Deprecated in" msgstr "棄用於" -#: ../../whatsnew/3.11.rst:1913 +#: ../../whatsnew/3.11.rst:1928 msgid "``failUnless``" msgstr "``failUnless``" -#: ../../whatsnew/3.11.rst:1913 ../../whatsnew/3.11.rst:1920 +#: ../../whatsnew/3.11.rst:1928 ../../whatsnew/3.11.rst:1935 msgid ":meth:`.assertTrue`" msgstr ":meth:`.assertTrue`" -#: ../../whatsnew/3.11.rst:1913 ../../whatsnew/3.11.rst:1914 -#: ../../whatsnew/3.11.rst:1915 ../../whatsnew/3.11.rst:1916 -#: ../../whatsnew/3.11.rst:1917 ../../whatsnew/3.11.rst:1918 -#: ../../whatsnew/3.11.rst:1919 +#: ../../whatsnew/3.11.rst:1928 ../../whatsnew/3.11.rst:1929 +#: ../../whatsnew/3.11.rst:1930 ../../whatsnew/3.11.rst:1931 +#: ../../whatsnew/3.11.rst:1932 ../../whatsnew/3.11.rst:1933 +#: ../../whatsnew/3.11.rst:1934 msgid "3.1" msgstr "3.1" -#: ../../whatsnew/3.11.rst:1914 +#: ../../whatsnew/3.11.rst:1929 msgid "``failIf``" msgstr "``failIf``" -#: ../../whatsnew/3.11.rst:1914 +#: ../../whatsnew/3.11.rst:1929 msgid ":meth:`.assertFalse`" msgstr ":meth:`.assertFalse`" -#: ../../whatsnew/3.11.rst:1915 +#: ../../whatsnew/3.11.rst:1930 msgid "``failUnlessEqual``" msgstr "``failUnlessEqual``" -#: ../../whatsnew/3.11.rst:1915 ../../whatsnew/3.11.rst:1921 +#: ../../whatsnew/3.11.rst:1930 ../../whatsnew/3.11.rst:1936 msgid ":meth:`.assertEqual`" msgstr ":meth:`.assertEqual`" -#: ../../whatsnew/3.11.rst:1916 +#: ../../whatsnew/3.11.rst:1931 msgid "``failIfEqual``" msgstr "``failIfEqual``" -#: ../../whatsnew/3.11.rst:1916 ../../whatsnew/3.11.rst:1922 +#: ../../whatsnew/3.11.rst:1931 ../../whatsnew/3.11.rst:1937 msgid ":meth:`.assertNotEqual`" msgstr ":meth:`.assertNotEqual`" -#: ../../whatsnew/3.11.rst:1917 +#: ../../whatsnew/3.11.rst:1932 msgid "``failUnlessAlmostEqual``" msgstr "``failUnlessAlmostEqual``" -#: ../../whatsnew/3.11.rst:1917 ../../whatsnew/3.11.rst:1923 +#: ../../whatsnew/3.11.rst:1932 ../../whatsnew/3.11.rst:1938 msgid ":meth:`.assertAlmostEqual`" msgstr ":meth:`.assertAlmostEqual`" -#: ../../whatsnew/3.11.rst:1918 +#: ../../whatsnew/3.11.rst:1933 msgid "``failIfAlmostEqual``" msgstr "``failIfAlmostEqual``" -#: ../../whatsnew/3.11.rst:1918 ../../whatsnew/3.11.rst:1924 +#: ../../whatsnew/3.11.rst:1933 ../../whatsnew/3.11.rst:1939 msgid ":meth:`.assertNotAlmostEqual`" msgstr ":meth:`.assertNotAlmostEqual`" -#: ../../whatsnew/3.11.rst:1919 +#: ../../whatsnew/3.11.rst:1934 msgid "``failUnlessRaises``" msgstr "``failUnlessRaises``" -#: ../../whatsnew/3.11.rst:1919 +#: ../../whatsnew/3.11.rst:1934 msgid ":meth:`.assertRaises`" msgstr ":meth:`.assertRaises`" -#: ../../whatsnew/3.11.rst:1920 +#: ../../whatsnew/3.11.rst:1935 msgid "``assert_``" msgstr "``assert_``" -#: ../../whatsnew/3.11.rst:1920 ../../whatsnew/3.11.rst:1921 -#: ../../whatsnew/3.11.rst:1922 ../../whatsnew/3.11.rst:1923 -#: ../../whatsnew/3.11.rst:1924 ../../whatsnew/3.11.rst:1925 -#: ../../whatsnew/3.11.rst:1926 +#: ../../whatsnew/3.11.rst:1935 ../../whatsnew/3.11.rst:1936 +#: ../../whatsnew/3.11.rst:1937 ../../whatsnew/3.11.rst:1938 +#: ../../whatsnew/3.11.rst:1939 ../../whatsnew/3.11.rst:1940 +#: ../../whatsnew/3.11.rst:1941 msgid "3.2" msgstr "3.2" -#: ../../whatsnew/3.11.rst:1921 +#: ../../whatsnew/3.11.rst:1936 msgid "``assertEquals``" msgstr "``assertEquals``" -#: ../../whatsnew/3.11.rst:1922 +#: ../../whatsnew/3.11.rst:1937 msgid "``assertNotEquals``" msgstr "``assertNotEquals``" -#: ../../whatsnew/3.11.rst:1923 +#: ../../whatsnew/3.11.rst:1938 msgid "``assertAlmostEquals``" msgstr "``assertAlmostEquals``" -#: ../../whatsnew/3.11.rst:1924 +#: ../../whatsnew/3.11.rst:1939 msgid "``assertNotAlmostEquals``" msgstr "``assertNotAlmostEquals``" -#: ../../whatsnew/3.11.rst:1925 +#: ../../whatsnew/3.11.rst:1940 msgid "``assertRegexpMatches``" msgstr "``assertRegexpMatches``" -#: ../../whatsnew/3.11.rst:1925 +#: ../../whatsnew/3.11.rst:1940 msgid ":meth:`.assertRegex`" msgstr ":meth:`.assertRegex`" -#: ../../whatsnew/3.11.rst:1926 +#: ../../whatsnew/3.11.rst:1941 msgid "``assertRaisesRegexp``" msgstr "``assertRaisesRegexp``" -#: ../../whatsnew/3.11.rst:1926 +#: ../../whatsnew/3.11.rst:1941 msgid ":meth:`.assertRaisesRegex`" msgstr ":meth:`.assertRaisesRegex`" -#: ../../whatsnew/3.11.rst:1927 +#: ../../whatsnew/3.11.rst:1942 msgid "``assertNotRegexpMatches``" msgstr "``assertNotRegexpMatches``" -#: ../../whatsnew/3.11.rst:1927 +#: ../../whatsnew/3.11.rst:1942 msgid ":meth:`.assertNotRegex`" msgstr ":meth:`.assertNotRegex`" -#: ../../whatsnew/3.11.rst:1927 +#: ../../whatsnew/3.11.rst:1942 msgid "3.5" msgstr "3.5" -#: ../../whatsnew/3.11.rst:1934 ../../whatsnew/3.11.rst:2619 +#: ../../whatsnew/3.11.rst:1949 ../../whatsnew/3.11.rst:2634 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.11.rst:1936 +#: ../../whatsnew/3.11.rst:1951 msgid "This section lists Python APIs that have been removed in Python 3.11." msgstr "此部分列出 Python 3.11 中移除的 Python API。" -#: ../../whatsnew/3.11.rst:1938 +#: ../../whatsnew/3.11.rst:1953 msgid "" "Removed C APIs are :ref:`listed separately `." msgstr "被移除的 C API 被\\ :ref:`獨立列出 `。" -#: ../../whatsnew/3.11.rst:1940 +#: ../../whatsnew/3.11.rst:1955 msgid "" "Removed the :func:`!@asyncio.coroutine` :term:`decorator` enabling legacy " "generator-based coroutines to be compatible with :keyword:`async` / :keyword:" @@ -3630,7 +3646,7 @@ msgstr "" "相容。該函式自 Python 3.8 起已被棄用,計劃於 Python 3.10 刪除。請改用 :" "keyword:`async def`。(由 Illia Volochii 在 :issue:`43216` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1947 +#: ../../whatsnew/3.11.rst:1962 msgid "" "Removed :class:`!asyncio.coroutines.CoroWrapper` used for wrapping legacy " "generator-based coroutine objects in the debug mode. (Contributed by Illia " @@ -3639,7 +3655,7 @@ msgstr "" "移除除錯模式中用於包裝遺留基於產生器之協程物件的 :class:`!asyncio.coroutines." "CoroWrapper`。(由 Illia Volochii 於 :issue:`43216` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1951 +#: ../../whatsnew/3.11.rst:1966 msgid "" "Due to significant security concerns, the *reuse_address* parameter of :meth:" "`asyncio.loop.create_datagram_endpoint`, disabled in Python 3.9, is now " @@ -3652,7 +3668,7 @@ msgstr "" "socket 選項 ``SO_REUSEADDR`` 的行為所致。(由 Hugo van Kemenade 於 :issue:" "`45129` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1957 +#: ../../whatsnew/3.11.rst:1972 msgid "" "Removed the :mod:`!binhex` module, deprecated in Python 3.9. Also removed " "the related, similarly-deprecated :mod:`binascii` functions:" @@ -3660,31 +3676,31 @@ msgstr "" "移除 Python 3.9 中棄用的 :mod:`!binhex` 模組,與其相關且相似的 :mod:" "`binascii` 函式也一併被移除:" -#: ../../whatsnew/3.11.rst:1960 +#: ../../whatsnew/3.11.rst:1975 msgid ":func:`!binascii.a2b_hqx`" msgstr ":func:`!binascii.a2b_hqx`" -#: ../../whatsnew/3.11.rst:1961 +#: ../../whatsnew/3.11.rst:1976 msgid ":func:`!binascii.b2a_hqx`" msgstr ":func:`!binascii.b2a_hqx`" -#: ../../whatsnew/3.11.rst:1962 +#: ../../whatsnew/3.11.rst:1977 msgid ":func:`!binascii.rlecode_hqx`" msgstr ":func:`!binascii.rlecode_hqx`" -#: ../../whatsnew/3.11.rst:1963 +#: ../../whatsnew/3.11.rst:1978 msgid ":func:`!binascii.rldecode_hqx`" msgstr ":func:`!binascii.rldecode_hqx`" -#: ../../whatsnew/3.11.rst:1965 +#: ../../whatsnew/3.11.rst:1980 msgid "The :func:`binascii.crc_hqx` function remains available." msgstr ":func:`binascii.crc_hqx` 維持可用。" -#: ../../whatsnew/3.11.rst:1967 +#: ../../whatsnew/3.11.rst:1982 msgid "(Contributed by Victor Stinner in :issue:`45085`.)" msgstr "(由 Victor Stinner 於 :issue:`45085` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:1969 +#: ../../whatsnew/3.11.rst:1984 msgid "" "Removed the :mod:`!distutils` ``bdist_msi`` command deprecated in Python " "3.9. Use ``bdist_wheel`` (wheel packages) instead. (Contributed by Hugo van " @@ -3694,7 +3710,7 @@ msgstr "" "``bdist_wheel``\\ (wheel 套件)。(由 Hugo van Kemenade 於 :issue:`45124` 中" "貢獻。)" -#: ../../whatsnew/3.11.rst:1973 +#: ../../whatsnew/3.11.rst:1988 msgid "" "Removed the :meth:`~object.__getitem__` methods of :class:`xml.dom.pulldom." "DOMEventStream`, :class:`wsgiref.util.FileWrapper` and :class:`fileinput." @@ -3706,7 +3722,7 @@ msgstr "" "`~object.__getitem__` 方法移除。(由 Hugo van Kemenade 在 :issue:`45132` 中貢" "獻。)" -#: ../../whatsnew/3.11.rst:1978 +#: ../../whatsnew/3.11.rst:1993 msgid "" "Removed the deprecated :mod:`gettext` functions :func:`!lgettext`, :func:`!" "ldgettext`, :func:`!lngettext` and :func:`!ldngettext`. Also removed the :" @@ -3723,11 +3739,11 @@ msgstr "" "和 :func:`!install` 的 *codeset* 參數,因為它們僅被用於 :func:`!l*gettext` 函" "式。(由 Donghee Na 和 Serhiy Storchaka 在 :issue:`44235` 中貢獻。)" -#: ../../whatsnew/3.11.rst:1988 +#: ../../whatsnew/3.11.rst:2003 msgid "Removed from the :mod:`inspect` module:" msgstr "於 :mod:`inspect` 模組中移除:" -#: ../../whatsnew/3.11.rst:1990 +#: ../../whatsnew/3.11.rst:2005 msgid "" "The :func:`!getargspec` function, deprecated since Python 3.0; use :func:" "`inspect.signature` or :func:`inspect.getfullargspec` instead." @@ -3735,7 +3751,7 @@ msgstr "" "Python 3.0 中棄用的 :func:`!getargspec`;改用 :func:`inspect.signature` 或 :" "func:`inspect.getfullargspec`。" -#: ../../whatsnew/3.11.rst:1993 +#: ../../whatsnew/3.11.rst:2008 msgid "" "The :func:`!formatargspec` function, deprecated since Python 3.5; use the :" "func:`inspect.signature` function or the :class:`inspect.Signature` object " @@ -3744,7 +3760,7 @@ msgstr "" "Python 3.5 中棄用的 :func:`!formatargspec` 函式;請直接用 :func:`inspect." "signature` 函式或 :class:`inspect.Signature` 物件。" -#: ../../whatsnew/3.11.rst:1997 +#: ../../whatsnew/3.11.rst:2012 msgid "" "The undocumented :meth:`!Signature.from_builtin` and :meth:`!Signature." "from_function` methods, deprecated since Python 3.5; use the :meth:" @@ -3754,11 +3770,11 @@ msgstr "" "meth:`!Signature.from_function` 方法;改用 :meth:`Signature.from_callable() " "` 方法。" -#: ../../whatsnew/3.11.rst:2002 +#: ../../whatsnew/3.11.rst:2017 msgid "(Contributed by Hugo van Kemenade in :issue:`45320`.)" msgstr "(由 Hugo van Kemenade 於 :issue:`45320` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2004 +#: ../../whatsnew/3.11.rst:2019 msgid "" "Removed the :meth:`~object.__class_getitem__` method from :class:`pathlib." "PurePath`, because it was not used and added by mistake in previous " @@ -3768,7 +3784,7 @@ msgstr "" "因為它是前一版本中誤加且沒被使用。(由 Nikita Sobolev 於 :issue:`46483` 中所" "貢獻。)" -#: ../../whatsnew/3.11.rst:2009 +#: ../../whatsnew/3.11.rst:2024 msgid "" "Removed the :class:`!MailmanProxy` class in the :mod:`!smtpd` module, as it " "is unusable without the external :mod:`!mailman` package. (Contributed by " @@ -3777,7 +3793,7 @@ msgstr "" "移除 :mod:`!smtpd` 模組中的 :class:`!MailmanProxy` 類別,因為它無法獨立於外部" "套件 :mod:`!mailman` 使用。(由 Donghee Na 於 :issue:`35800` 貢獻。)" -#: ../../whatsnew/3.11.rst:2013 +#: ../../whatsnew/3.11.rst:2028 msgid "" "Removed the deprecated :meth:`!split` method of :class:`!_tkinter." "TkappType`. (Contributed by Erlend E. Aasland in :issue:`38371`.)" @@ -3785,7 +3801,7 @@ msgstr "" "移除 :class:`!_tkinter.TkappType` 已被棄用的 :meth:`!split` 方法。(由 " "Erlend E. Aasland 於 :issue:`38371` 貢獻。)" -#: ../../whatsnew/3.11.rst:2016 +#: ../../whatsnew/3.11.rst:2031 msgid "" "Removed namespace package support from :mod:`unittest` discovery. It was " "introduced in Python 3.4 but has been broken since Python 3.7. (Contributed " @@ -3794,7 +3810,7 @@ msgstr "" "從 :mod:`unittest` 中刪除了命名空間套件支援。它在 Python 3.4 中引入,但自 " "Python 3.7 以來已無法運作。(由 Inada Naoki 在 :issue:`23882` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2020 +#: ../../whatsnew/3.11.rst:2035 msgid "" "Removed the undocumented private :meth:`!float.__set_format__()` method, " "previously known as :meth:`!float.__setformat__()` in Python 3.7. Its " @@ -3807,7 +3823,7 @@ msgstr "" "到:「你大概不會想要使用這個函式,它只為了讓 Python 測試系列套件 (suite) 使用" "而存在。」(由 Victor Stinner 於 :issue:`46852` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2026 +#: ../../whatsnew/3.11.rst:2041 msgid "" "The :option:`!--experimental-isolated-subinterpreters` configure flag (and " "corresponding :c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` macro) have " @@ -3816,7 +3832,7 @@ msgstr "" "移除 :option:`!--experimental-isolated-subinterpreters` 配置旗標(與對應的 :" "c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` 巨集)。" -#: ../../whatsnew/3.11.rst:2030 +#: ../../whatsnew/3.11.rst:2045 msgid "" ":pypi:`Pynche` --- The Pythonically Natural Color and Hue Editor --- has " "been moved out of ``Tools/scripts`` and is `being developed independently " @@ -3826,11 +3842,11 @@ msgstr "" "scripts``,`獨立開發 `_\\ 於 " "Python 原始碼之外。" -#: ../../whatsnew/3.11.rst:2040 ../../whatsnew/3.11.rst:2262 +#: ../../whatsnew/3.11.rst:2055 ../../whatsnew/3.11.rst:2277 msgid "Porting to Python 3.11" msgstr "移植至 Python 3.11" -#: ../../whatsnew/3.11.rst:2042 +#: ../../whatsnew/3.11.rst:2057 msgid "" "This section lists previously described changes and other bugfixes in the " "Python API that may require changes to your Python code." @@ -3838,13 +3854,13 @@ msgstr "" "本部分列出了之前描述的 Python API 中可能需要你去更改 Python 程式碼的變更和其" "他錯誤修復。" -#: ../../whatsnew/3.11.rst:2045 +#: ../../whatsnew/3.11.rst:2060 msgid "" "Porting notes for the C API are :ref:`listed separately `." msgstr "C API 的移植被\\ :ref:`獨立列出 `。" -#: ../../whatsnew/3.11.rst:2048 +#: ../../whatsnew/3.11.rst:2063 msgid "" ":func:`open`, :func:`io.open`, :func:`codecs.open` and :class:`fileinput." "FileInput` no longer accept ``'U'`` (\"universal newline\") in the file " @@ -3861,7 +3877,7 @@ msgstr "" "ref:`newline 參數 `\\ 控制了通用換行符的作用方式。" "(由 Victor Stinner 在 :issue:`37330` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2057 +#: ../../whatsnew/3.11.rst:2072 msgid "" ":class:`ast.AST` node positions are now validated when provided to :func:" "`compile` and other related functions. If invalid positions are detected, a :" @@ -3872,7 +3888,7 @@ msgstr "" "證。如果檢測到無效位置,則會引發 :exc:`ValueError`。(由 Pablo Galindo 在 :" "gh:`93351` 中貢獻)" -#: ../../whatsnew/3.11.rst:2061 +#: ../../whatsnew/3.11.rst:2076 msgid "" "Prohibited passing non-:class:`concurrent.futures.ThreadPoolExecutor` " "executors to :meth:`asyncio.loop.set_default_executor` following a " @@ -3882,7 +3898,7 @@ msgstr "" "ThreadPoolExecutor` 執行器傳遞給 :meth:`asyncio.loop.set_default_executor`。" "(由 Illia Volochii 在 :issue:`43234` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2066 +#: ../../whatsnew/3.11.rst:2081 msgid "" ":mod:`calendar`: The :class:`calendar.LocaleTextCalendar` and :class:" "`calendar.LocaleHTMLCalendar` classes now use :func:`locale.getlocale`, " @@ -3894,7 +3910,7 @@ msgstr "" "getlocale` 而非 :func:`locale.getdefaultlocale`。(由 Victor Stinner 在 :" "issue:`46659` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2072 +#: ../../whatsnew/3.11.rst:2087 msgid "" "The :mod:`pdb` module now reads the :file:`.pdbrc` configuration file with " "the ``'UTF-8'`` encoding. (Contributed by Srinivas Reddy Thatiparthy (శ్రీనివాస్ " @@ -3903,7 +3919,7 @@ msgstr "" ":mod:`pdb` 模組現在會讀取 ``'UTF-8'`` 編碼的 :file:`.pdbrc` 配置檔案。" "(Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 於 :issue:`41137` 貢獻。)" -#: ../../whatsnew/3.11.rst:2076 +#: ../../whatsnew/3.11.rst:2091 msgid "" "The *population* parameter of :func:`random.sample` must be a sequence, and " "automatic conversion of :class:`set`\\s to :class:`list`\\s is no longer " @@ -3915,7 +3931,7 @@ msgstr "" "`set` 到 :class:`list` 的自動轉換。此外,如果抽樣大小大於總體大小,則會引發 :" "exc:`ValueError`。(由 Raymond Hettinger 在 :issue:`40465` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2082 +#: ../../whatsnew/3.11.rst:2097 msgid "" "The *random* optional parameter of :func:`random.shuffle` was removed. It " "was previously an arbitrary random function to use for the shuffle; now, :" @@ -3925,7 +3941,7 @@ msgstr "" "(shuffle) 的任意隨機函式;現在都會使用 :func:`random.random`\\ (這是它以前的" "預設值)。" -#: ../../whatsnew/3.11.rst:2086 +#: ../../whatsnew/3.11.rst:2101 msgid "" "In :mod:`re` :ref:`re-syntax`, global inline flags (e.g. ``(?i)``) can now " "only be used at the start of regular expressions. Using them elsewhere has " @@ -3936,7 +3952,7 @@ msgstr "" "運算式的開頭使用。自 Python 3.6 以來,在其他地方使用它們已被棄用。(由 " "Serhiy Storchaka 在 :issue:`47066` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2091 +#: ../../whatsnew/3.11.rst:2106 msgid "" "In the :mod:`re` module, several long-standing bugs where fixed that, in " "rare cases, could cause capture groups to get the wrong result. Therefore, " @@ -3947,11 +3963,11 @@ msgstr "" "致捕獲群組 (capture group) 得到錯誤的結果。因此,這可能會在這些情況下更改捕獲" "的輸出。(Ma Lin 在 :issue:`35859` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2100 +#: ../../whatsnew/3.11.rst:2115 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.11.rst:2102 +#: ../../whatsnew/3.11.rst:2117 msgid "" "CPython now has :pep:`11` :pep:`Tier 3 support <11#tier-3>` for cross " "compiling to the `WebAssembly `_ platforms " @@ -3975,11 +3991,11 @@ msgstr "" "Christian Heimes 和 Ethan Smith 在 :gh:`84461` 貢獻,WASI 由 Christian " "Heimes 在 :gh:`90473` 貢獻;平台在 :gh:`95085` 中推廣)" -#: ../../whatsnew/3.11.rst:2116 +#: ../../whatsnew/3.11.rst:2131 msgid "Building CPython now requires:" msgstr "建置 CPython 現在必須要有:" -#: ../../whatsnew/3.11.rst:2118 +#: ../../whatsnew/3.11.rst:2133 msgid "" "A `C11 `_ compiler and standard library. " "`Optional C11 features `_ 並非必要。(由 Victor Stinner " "於 :issue:`46656`、:issue:`45440` 和 :issue:`46640` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2125 +#: ../../whatsnew/3.11.rst:2140 msgid "" "Support for `IEEE 754 `_ floating " "point numbers. (Contributed by Victor Stinner in :issue:`46917`.)" @@ -4000,7 +4016,7 @@ msgstr "" "對 `IEEE 754 `_ 浮點數的支援(由 " "Victor Stinner 於 :issue:`46917` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2129 +#: ../../whatsnew/3.11.rst:2144 msgid "" "The :c:macro:`!Py_NO_NAN` macro has been removed. Since CPython now requires " "IEEE 754 floats, NaN values are always available. (Contributed by Victor " @@ -4009,7 +4025,7 @@ msgstr "" ":c:macro:`!Py_NO_NAN` 巨集已被移除。因為 CPython 現在需要 IEEE 754 浮點數," "NaN 數值皆為可得的。(由 Victor Stinner 在 :issue:`46656` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2133 +#: ../../whatsnew/3.11.rst:2148 msgid "" "The :mod:`tkinter` package now requires `Tcl/Tk `_ " "version 8.5.12 or newer. (Contributed by Serhiy Storchaka in :issue:`46996`.)" @@ -4017,7 +4033,7 @@ msgstr "" ":mod:`tkinter` 套件現在必須要有 `Tcl/Tk `_ 8.5.12 或更新" "的版本。(由 Serhiy Storchaka 於 :issue:`46996` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2137 +#: ../../whatsnew/3.11.rst:2152 msgid "" "Build dependencies, compiler flags, and linker flags for most stdlib " "extension modules are now detected by :program:`configure`. libffi, libnsl, " @@ -4036,14 +4052,14 @@ msgstr "" "和函式庫的開發設定。(由 Christian Heimes 和 Erlend Egeberg Aasland 在 :" "issue:`45847`、:issue:`45747` 和 :issue:`45763` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2147 +#: ../../whatsnew/3.11.rst:2162 msgid "" "libpython is no longer linked against libcrypt. (Contributed by Mike Gilbert " "in :issue:`45433`.)" msgstr "" "libpython 不再鏈接到 libcrypt。(由 Mike Gilbert 在 :issue:`45433` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2150 +#: ../../whatsnew/3.11.rst:2165 msgid "" "CPython can now be built with the `ThinLTO `_ option via passing ``thin`` to :option:`--with-lto`, i.e. " @@ -4055,7 +4071,7 @@ msgstr "" "html>`_ 選項建置。(由 Donghee Na 與 Brett Holman 於 :issue:`44340` 中所貢" "獻。)" -#: ../../whatsnew/3.11.rst:2155 +#: ../../whatsnew/3.11.rst:2170 msgid "" "Freelists for object structs can now be disabled. A new :program:`configure` " "option :option:`--without-freelists` can be used to disable all freelists " @@ -4063,7 +4079,7 @@ msgid "" "`45522`.)" msgstr "" -#: ../../whatsnew/3.11.rst:2160 +#: ../../whatsnew/3.11.rst:2175 msgid "" "``Modules/Setup`` and ``Modules/makesetup`` have been improved and tied up. " "Extension modules can now be built through ``makesetup``. All except some " @@ -4076,7 +4092,7 @@ msgstr "" "的二進制文件或函式庫中。(由 Brett Cannon 和 Christian Heimes 在 :issue:" "`45548`、:issue:`45570`、:issue:`45571` 和 :issue:`43974` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2167 +#: ../../whatsnew/3.11.rst:2182 msgid "" "Use the environment variables :envvar:`!TCLTK_CFLAGS` and :envvar:`!" "TCLTK_LIBS` to manually specify the location of Tcl/Tk headers and " @@ -4087,7 +4103,7 @@ msgstr "" "Tk 標頭檔和函式庫的位置。:program:`configure` 選項 :option:`!—with-tcltk-" "includes` 和 :option:`!—with-tcltk-libs` 已被刪除。" -#: ../../whatsnew/3.11.rst:2173 +#: ../../whatsnew/3.11.rst:2188 msgid "" "On RHEL 7 and CentOS 7 the development packages do not provide ``tcl.pc`` " "and ``tk.pc``; use ``TCLTK_LIBS=\"-ltk8.5 -ltkstub8.5 -ltcl8.5\"``. The " @@ -4099,7 +4115,7 @@ msgstr "" "pc`` 檔案與如何使用 RHEL 7 和 CentOS 7 的 Tcl/Tk 與 OpenSSL 建置 Python 的指" "示。" -#: ../../whatsnew/3.11.rst:2178 +#: ../../whatsnew/3.11.rst:2193 msgid "" "CPython will now use 30-bit digits by default for the Python :class:`int` " "implementation. Previously, the default was to use 30-bit digits on " @@ -4117,11 +4133,11 @@ msgstr "" "此選項可能會在將來的某個時候被刪除。(由 Mark Dickinson 在 :issue:`45569` 中" "貢獻。)" -#: ../../whatsnew/3.11.rst:2191 +#: ../../whatsnew/3.11.rst:2206 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.11.rst:2198 +#: ../../whatsnew/3.11.rst:2213 msgid "" "Add a new :c:func:`PyType_GetName` function to get type's short name. " "(Contributed by Hai Shi in :issue:`42035`.)" @@ -4129,7 +4145,7 @@ msgstr "" "新增 :c:func:`PyType_GetName` 函式來取得型別的短名。(由 Hai Shi 於 :issue:" "`42035` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2201 +#: ../../whatsnew/3.11.rst:2216 msgid "" "Add a new :c:func:`PyType_GetQualName` function to get type's qualified " "name. (Contributed by Hai Shi in :issue:`42035`.)" @@ -4137,7 +4153,7 @@ msgstr "" "新增 :c:func:`PyType_GetQualName` 函式來取得型別的合格名稱 (qualified name)。" "(由 Hai Shi 於 :issue:`42035` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2204 +#: ../../whatsnew/3.11.rst:2219 msgid "" "Add new :c:func:`PyThreadState_EnterTracing` and :c:func:" "`PyThreadState_LeaveTracing` functions to the limited C API to suspend and " @@ -4148,7 +4164,7 @@ msgstr "" "c:func:`PyThreadState_LeaveTracing` 函式來中止和繼續追蹤 (tracing) 和性能分" "析 (profiling)。(由 Victor Stinner 於 :issue:`43760` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2209 +#: ../../whatsnew/3.11.rst:2224 msgid "" "Added the :c:data:`Py_Version` constant which bears the same value as :c:" "macro:`PY_VERSION_HEX`. (Contributed by Gabriele N. Tornetta in :issue:" @@ -4157,61 +4173,61 @@ msgstr "" "添加了 :c:data:`Py_Version` 常數,其值與 :c:macro:`PY_VERSION_HEX` 相同。" "(由 Gabriele N. Tornetta 在 :issue:`43931` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2213 +#: ../../whatsnew/3.11.rst:2228 msgid "" ":c:type:`Py_buffer` and APIs are now part of the limited API and the stable " "ABI:" msgstr ":c:type:`Py_buffer` 與 API 目前是受限 API 與穩定 ABI 中的一部分:" -#: ../../whatsnew/3.11.rst:2216 +#: ../../whatsnew/3.11.rst:2231 msgid ":c:func:`PyObject_CheckBuffer`" msgstr ":c:func:`PyObject_CheckBuffer`" -#: ../../whatsnew/3.11.rst:2217 +#: ../../whatsnew/3.11.rst:2232 msgid ":c:func:`PyObject_GetBuffer`" msgstr ":c:func:`PyObject_GetBuffer`" -#: ../../whatsnew/3.11.rst:2218 +#: ../../whatsnew/3.11.rst:2233 msgid ":c:func:`PyBuffer_GetPointer`" msgstr ":c:func:`PyBuffer_GetPointer`" -#: ../../whatsnew/3.11.rst:2219 +#: ../../whatsnew/3.11.rst:2234 msgid ":c:func:`PyBuffer_SizeFromFormat`" msgstr ":c:func:`PyBuffer_SizeFromFormat`" -#: ../../whatsnew/3.11.rst:2220 +#: ../../whatsnew/3.11.rst:2235 msgid ":c:func:`PyBuffer_ToContiguous`" msgstr ":c:func:`PyBuffer_ToContiguous`" -#: ../../whatsnew/3.11.rst:2221 +#: ../../whatsnew/3.11.rst:2236 msgid ":c:func:`PyBuffer_FromContiguous`" msgstr ":c:func:`PyBuffer_FromContiguous`" -#: ../../whatsnew/3.11.rst:2222 +#: ../../whatsnew/3.11.rst:2237 msgid ":c:func:`PyObject_CopyData`" msgstr ":c:func:`PyObject_CopyData`" -#: ../../whatsnew/3.11.rst:2223 +#: ../../whatsnew/3.11.rst:2238 msgid ":c:func:`PyBuffer_IsContiguous`" msgstr ":c:func:`PyBuffer_IsContiguous`" -#: ../../whatsnew/3.11.rst:2224 +#: ../../whatsnew/3.11.rst:2239 msgid ":c:func:`PyBuffer_FillContiguousStrides`" msgstr ":c:func:`PyBuffer_FillContiguousStrides`" -#: ../../whatsnew/3.11.rst:2225 +#: ../../whatsnew/3.11.rst:2240 msgid ":c:func:`PyBuffer_FillInfo`" msgstr ":c:func:`PyBuffer_FillInfo`" -#: ../../whatsnew/3.11.rst:2226 +#: ../../whatsnew/3.11.rst:2241 msgid ":c:func:`PyBuffer_Release`" msgstr ":c:func:`PyBuffer_Release`" -#: ../../whatsnew/3.11.rst:2227 +#: ../../whatsnew/3.11.rst:2242 msgid ":c:func:`PyMemoryView_FromBuffer`" msgstr ":c:func:`PyMemoryView_FromBuffer`" -#: ../../whatsnew/3.11.rst:2228 +#: ../../whatsnew/3.11.rst:2243 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` type slots" @@ -4219,11 +4235,11 @@ msgstr "" ":c:member:`~PyBufferProcs.bf_getbuffer` 與 :c:member:`~PyBufferProcs." "bf_releasebuffer` 型別插槽 (type slot)" -#: ../../whatsnew/3.11.rst:2231 +#: ../../whatsnew/3.11.rst:2246 msgid "(Contributed by Christian Heimes in :issue:`45459`.)" msgstr "(由 Christian Heimes 於 :issue:`45459` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2233 +#: ../../whatsnew/3.11.rst:2248 msgid "" "Added the :c:func:`PyType_GetModuleByDef` function, used to get the module " "in which a method was defined, in cases where this information is not " @@ -4234,7 +4250,7 @@ msgstr "" "以免這項資訊無法直接被取得(透過 :c:type:`PyCMethod`)。(由 Petr Viktorin " "於 :issue:`46613` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2238 +#: ../../whatsnew/3.11.rst:2253 msgid "" "Add new functions to pack and unpack C double (serialize and deserialize): :" "c:func:`PyFloat_Pack2`, :c:func:`PyFloat_Pack4`, :c:func:`PyFloat_Pack8`, :c:" @@ -4246,7 +4262,7 @@ msgstr "" "`PyFloat_Unpack2` , :c:func:`PyFloat_Unpack4` 和 :c:func:`PyFloat_Unpack8`。" "(由 Victor Stinner 在 :issue:`46906` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2244 +#: ../../whatsnew/3.11.rst:2259 msgid "" "Add new functions to get frame object attributes: :c:func:" "`PyFrame_GetBuiltins`, :c:func:`PyFrame_GetGenerator`, :c:func:" @@ -4256,7 +4272,7 @@ msgstr "" "`PyFrame_GetGenerator`、:c:func:`PyFrame_GetGlobals`、:c:func:" "`PyFrame_GetLasti`。" -#: ../../whatsnew/3.11.rst:2248 +#: ../../whatsnew/3.11.rst:2263 msgid "" "Added two new functions to get and set the active exception instance: :c:" "func:`PyErr_GetHandledException` and :c:func:`PyErr_SetHandledException`. " @@ -4270,7 +4286,7 @@ msgstr "" "例外的遺留三元組表示法一起作用。(由 Irit Katriel 在 :issue:`46343` 中貢" "獻。)" -#: ../../whatsnew/3.11.rst:2255 +#: ../../whatsnew/3.11.rst:2270 msgid "" "Added the :c:member:`PyConfig.safe_path` member. (Contributed by Victor " "Stinner in :gh:`57684`.)" @@ -4278,7 +4294,7 @@ msgstr "" "新增 :c:member:`PyConfig.safe_path` 成員。(由 Victor Stinner 於 :gh:`57684` " "中所貢獻。)" -#: ../../whatsnew/3.11.rst:2266 +#: ../../whatsnew/3.11.rst:2281 msgid "" "Some macros have been converted to static inline functions to avoid `macro " "pitfalls `_. The " @@ -4296,7 +4312,7 @@ msgstr "" "要將引數轉換為他們期望的型別。有關更多詳細資訊,請參閱 :pep:`670`。(由 " "Victor Stinner 和 Erlend E. Aasland 在 :gh:`89653` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2277 +#: ../../whatsnew/3.11.rst:2292 msgid "" ":c:func:`PyErr_SetExcInfo()` no longer uses the ``type`` and ``traceback`` " "arguments, the interpreter now derives those values from the exception " @@ -4307,7 +4323,7 @@ msgstr "" "現在從例外實例(``value`` 引數)中獲得這些值。該函式仍會偷用這三個引數的參" "照。(由 Irit Katriel 在 :issue:`45711` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2283 +#: ../../whatsnew/3.11.rst:2298 msgid "" ":c:func:`PyErr_GetExcInfo()` now derives the ``type`` and ``traceback`` " "fields of the result from the exception instance (the ``value`` field). " @@ -4317,7 +4333,7 @@ msgstr "" "``type`` 和 ``traceback`` 欄位。(由 Irit Katriel 在 :issue:`45711` 中貢" "獻。)" -#: ../../whatsnew/3.11.rst:2287 +#: ../../whatsnew/3.11.rst:2302 msgid "" ":c:struct:`_frozen` has a new ``is_package`` field to indicate whether or " "not the frozen module is a package. Previously, a negative value in the " @@ -4328,7 +4344,7 @@ msgstr "" "件。以前 ``size`` 欄位中的負值是指標,現在只有非負值可用於 ``size``。(由 " "Kumar Aditya 在 :issue:`46608` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2293 +#: ../../whatsnew/3.11.rst:2308 msgid "" ":c:func:`_PyFrameEvalFunction` now takes ``_PyInterpreterFrame*`` as its " "second parameter, instead of ``PyFrameObject*``. See :pep:`523` for more " @@ -4338,7 +4354,7 @@ msgstr "" "數,而不是 ``PyFrameObject*``。有關如何使用此函式指標型別的更多詳細資訊,請參" "閱 :pep:`523`。" -#: ../../whatsnew/3.11.rst:2297 +#: ../../whatsnew/3.11.rst:2312 msgid "" ":c:func:`!PyCode_New` and :c:func:`!PyCode_NewWithPosOnlyArgs` now take an " "additional ``exception_table`` argument. Using these functions should be " @@ -4351,7 +4367,7 @@ msgstr "" "碼物件,使用編譯器建立一個程式碼物件,然後使用 ``replace`` 方法來得到修改後的" "版本。" -#: ../../whatsnew/3.11.rst:2303 +#: ../../whatsnew/3.11.rst:2318 msgid "" ":c:type:`PyCodeObject` no longer has the ``co_code``, ``co_varnames``, " "``co_cellvars`` and ``co_freevars`` fields. Instead, use :c:func:" @@ -4366,7 +4382,7 @@ msgstr "" "和 :c:func:`PyCode_GetFreevars` 來存取。(由 Brandt Bucher 在 :issue:" "`46841`、Ken Jin 在 :gh:`92154` 與 :gh:`94936` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2311 +#: ../../whatsnew/3.11.rst:2326 msgid "" "The old trashcan macros (``Py_TRASHCAN_SAFE_BEGIN``/" "``Py_TRASHCAN_SAFE_END``) are now deprecated. They should be replaced by the " @@ -4376,15 +4392,15 @@ msgstr "" "``Py_TRASHCAN_SAFE_END``) 現在已經被棄用,它們應被新的巨集 " "``Py_TRASHCAN_BEGIN`` 和 ``Py_TRASHCAN_END`` 所取代。" -#: ../../whatsnew/3.11.rst:2315 +#: ../../whatsnew/3.11.rst:2330 msgid "A tp_dealloc function that has the old macros, such as::" msgstr "一個用到老舊巨集的 tp_dealloc 函式,像是: ::" -#: ../../whatsnew/3.11.rst:2326 +#: ../../whatsnew/3.11.rst:2341 msgid "should migrate to the new macros as follows::" msgstr "應該要搬遷到新的巨集,如下所示: ::" -#: ../../whatsnew/3.11.rst:2337 +#: ../../whatsnew/3.11.rst:2352 msgid "" "Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " "deallocation function it is in." @@ -4392,7 +4408,7 @@ msgstr "" "請注意 ``Py_TRASHCAN_BEGIN`` 有第二個引數,它應該是它所在的釋放函式 " "(deallocation function)。" -#: ../../whatsnew/3.11.rst:2340 +#: ../../whatsnew/3.11.rst:2355 msgid "" "To support older Python versions in the same codebase, you can define the " "following macros and use them throughout the code (credit: these were copied " @@ -4401,7 +4417,7 @@ msgstr "" "為支援舊版 Python 在同一份程式碼中,你可以定義以下巨集並在程式碼中使用它們" "(要歸功於 ``mypy`` 程式碼,這些是從那邊複製過來的): ::" -#: ../../whatsnew/3.11.rst:2352 +#: ../../whatsnew/3.11.rst:2367 msgid "" "The :c:func:`PyType_Ready` function now raises an error if a type is defined " "with the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set but has no traverse function " @@ -4413,7 +4429,7 @@ msgstr "" "`PyType_Ready` 函式現在會引發一個錯誤。(由 Victor Stinner 於 :issue:`44263` " "中貢獻。)" -#: ../../whatsnew/3.11.rst:2357 +#: ../../whatsnew/3.11.rst:2372 msgid "" "Heap types with the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag can now inherit " "the :pep:`590` vectorcall protocol. Previously, this was only possible for :" @@ -4424,7 +4440,7 @@ msgstr "" "`590` 向量呼叫協定 (vectorcall protocol)。以前這僅適用於 :ref:`static types " "`。(由 Erlend E. Aasland 在 :issue:`43908` 中貢獻)。" -#: ../../whatsnew/3.11.rst:2362 +#: ../../whatsnew/3.11.rst:2377 msgid "" "Since :c:func:`Py_TYPE()` is changed to a inline static function, " "``Py_TYPE(obj) = new_type`` must be replaced with ``Py_SET_TYPE(obj, " @@ -4436,11 +4452,11 @@ msgstr "" "c:func:`Py_SET_TYPE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使用這" "個巨集:" -#: ../../whatsnew/3.11.rst:2374 ../../whatsnew/3.11.rst:2388 +#: ../../whatsnew/3.11.rst:2389 ../../whatsnew/3.11.rst:2403 msgid "(Contributed by Victor Stinner in :issue:`39573`.)" msgstr "(由 Victor Stinner 於 :issue:`39573` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2376 +#: ../../whatsnew/3.11.rst:2391 msgid "" "Since :c:func:`Py_SIZE()` is changed to a inline static function, " "``Py_SIZE(obj) = new_size`` must be replaced with ``Py_SET_SIZE(obj, " @@ -4452,7 +4468,7 @@ msgstr "" "`Py_SET_SIZE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使用這個巨" "集:" -#: ../../whatsnew/3.11.rst:2390 +#: ../../whatsnew/3.11.rst:2405 msgid "" "```` no longer includes the header files ````, ````, ```` and ```` when the ``Py_LIMITED_API`` macro is " @@ -4465,7 +4481,7 @@ msgstr "" "和 ````。C 擴充程式應該要清楚的在 ``#include `` 之後引入" "標頭檔案。(由 Victor Stinner 於 :issue:`45434` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2396 +#: ../../whatsnew/3.11.rst:2411 msgid "" "The non-limited API files ``cellobject.h``, ``classobject.h``, ``code.h``, " "``context.h``, ``funcobject.h``, ``genobject.h`` and ``longintrepr.h`` have " @@ -4482,7 +4498,7 @@ msgstr "" "檔案 `。如果它們已被直接引入,請考慮改為引入 ``Python.h``。 " "(由 Victor Stinner 在 :issue:`35134` 中貢獻。)" -#: ../../whatsnew/3.11.rst:2404 +#: ../../whatsnew/3.11.rst:2419 msgid "" "The :c:func:`!PyUnicode_CHECK_INTERNED` macro has been excluded from the " "limited C API. It was never usable there, because it used internal " @@ -4493,7 +4509,7 @@ msgstr "" "使用,因為它使用了受限 C API 不提供的內部結構。(由 Victor Stinner 於 :issue:" "`46007` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2409 +#: ../../whatsnew/3.11.rst:2424 msgid "" "The following frame functions and type are now directly available with " "``#include ``, it's no longer needed to add ``#include " @@ -4502,49 +4518,49 @@ msgstr "" "以下用於幀 (frame) 的函式與型別現在可直接透過 ``#include `` 來使" "用,不必再加上 ``#include ``:" -#: ../../whatsnew/3.11.rst:2413 +#: ../../whatsnew/3.11.rst:2428 msgid ":c:func:`PyFrame_Check`" msgstr ":c:func:`PyFrame_Check`" -#: ../../whatsnew/3.11.rst:2414 +#: ../../whatsnew/3.11.rst:2429 msgid ":c:func:`PyFrame_GetBack`" msgstr ":c:func:`PyFrame_GetBack`" -#: ../../whatsnew/3.11.rst:2415 +#: ../../whatsnew/3.11.rst:2430 msgid ":c:func:`PyFrame_GetBuiltins`" msgstr ":c:func:`PyFrame_GetBuiltins`" -#: ../../whatsnew/3.11.rst:2416 +#: ../../whatsnew/3.11.rst:2431 msgid ":c:func:`PyFrame_GetGenerator`" msgstr ":c:func:`PyFrame_GetGenerator`" -#: ../../whatsnew/3.11.rst:2417 +#: ../../whatsnew/3.11.rst:2432 msgid ":c:func:`PyFrame_GetGlobals`" msgstr ":c:func:`PyFrame_GetGlobals`" -#: ../../whatsnew/3.11.rst:2418 +#: ../../whatsnew/3.11.rst:2433 msgid ":c:func:`PyFrame_GetLasti`" msgstr ":c:func:`PyFrame_GetLasti`" -#: ../../whatsnew/3.11.rst:2419 +#: ../../whatsnew/3.11.rst:2434 msgid ":c:func:`PyFrame_GetLocals`" msgstr ":c:func:`PyFrame_GetLocals`" -#: ../../whatsnew/3.11.rst:2420 +#: ../../whatsnew/3.11.rst:2435 msgid ":c:type:`PyFrame_Type`" msgstr ":c:type:`PyFrame_Type`" -#: ../../whatsnew/3.11.rst:2422 +#: ../../whatsnew/3.11.rst:2437 msgid "(Contributed by Victor Stinner in :gh:`93937`.)" msgstr "(由 Victor Stinner 於 :gh:`93937` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2426 +#: ../../whatsnew/3.11.rst:2441 msgid "" "The :c:type:`PyFrameObject` structure members have been removed from the " "public C API." msgstr ":c:type:`PyFrameObject` 結構成員已經從公開的 C API 中移除。" -#: ../../whatsnew/3.11.rst:2429 +#: ../../whatsnew/3.11.rst:2444 msgid "" "While the documentation notes that the :c:type:`PyFrameObject` fields are " "subject to change at any time, they have been stable for a long time and " @@ -4553,7 +4569,7 @@ msgstr "" "雖然文件指出 :c:type:`PyFrameObject` 欄位隨時可能發生變化,但它們已經穩定了很" "長時間,並被用於幾個流行的擴充套件中。" -#: ../../whatsnew/3.11.rst:2433 +#: ../../whatsnew/3.11.rst:2448 msgid "" "In Python 3.11, the frame struct was reorganized to allow performance " "optimizations. Some fields were removed entirely, as they were details of " @@ -4562,39 +4578,39 @@ msgstr "" "Python 3.11 中,幀的結構被重新編制來為性能做最佳化,有些作為舊版實作細節的欄" "位被整個移除。" -#: ../../whatsnew/3.11.rst:2437 +#: ../../whatsnew/3.11.rst:2452 msgid ":c:type:`PyFrameObject` fields:" msgstr ":c:type:`PyFrameObject` 欄位:" -#: ../../whatsnew/3.11.rst:2439 +#: ../../whatsnew/3.11.rst:2454 msgid "``f_back``: use :c:func:`PyFrame_GetBack`." msgstr "``f_back``:使用 :c:func:`PyFrame_GetBack`。" -#: ../../whatsnew/3.11.rst:2440 +#: ../../whatsnew/3.11.rst:2455 msgid "``f_blockstack``: removed." msgstr "``f_blockstack``:已移除。" -#: ../../whatsnew/3.11.rst:2441 +#: ../../whatsnew/3.11.rst:2456 msgid "``f_builtins``: use :c:func:`PyFrame_GetBuiltins`." msgstr "``f_builtins``:使用 :c:func:`PyFrame_GetBuiltins`。" -#: ../../whatsnew/3.11.rst:2442 +#: ../../whatsnew/3.11.rst:2457 msgid "``f_code``: use :c:func:`PyFrame_GetCode`." msgstr "``f_code``:使用 :c:func:`PyFrame_GetCode`。" -#: ../../whatsnew/3.11.rst:2443 +#: ../../whatsnew/3.11.rst:2458 msgid "``f_gen``: use :c:func:`PyFrame_GetGenerator`." msgstr "``f_gen``:使用 :c:func:`PyFrame_GetGenerator`。" -#: ../../whatsnew/3.11.rst:2444 +#: ../../whatsnew/3.11.rst:2459 msgid "``f_globals``: use :c:func:`PyFrame_GetGlobals`." msgstr "``f_globals``:使用 :c:func:`PyFrame_GetGlobals`。" -#: ../../whatsnew/3.11.rst:2445 +#: ../../whatsnew/3.11.rst:2460 msgid "``f_iblock``: removed." msgstr "``f_iblock``:已移除。" -#: ../../whatsnew/3.11.rst:2446 +#: ../../whatsnew/3.11.rst:2461 msgid "" "``f_lasti``: use :c:func:`PyFrame_GetLasti`. Code using ``f_lasti`` with " "``PyCode_Addr2Line()`` should use :c:func:`PyFrame_GetLineNumber` instead; " @@ -4604,27 +4620,27 @@ msgstr "" "``PyCode_Addr2Line()`` 同時使用的部分應該改用 :c:func:" "`PyFrame_GetLineNumber`;它可能會更快。" -#: ../../whatsnew/3.11.rst:2449 +#: ../../whatsnew/3.11.rst:2464 msgid "``f_lineno``: use :c:func:`PyFrame_GetLineNumber`" msgstr "``f_lineno``:使用 :c:func:`PyFrame_GetLineNumber`" -#: ../../whatsnew/3.11.rst:2450 +#: ../../whatsnew/3.11.rst:2465 msgid "``f_locals``: use :c:func:`PyFrame_GetLocals`." msgstr "``f_locals``:使用 :c:func:`PyFrame_GetLocals`。" -#: ../../whatsnew/3.11.rst:2451 +#: ../../whatsnew/3.11.rst:2466 msgid "``f_stackdepth``: removed." msgstr "``f_stackdepth``:已移除。" -#: ../../whatsnew/3.11.rst:2452 +#: ../../whatsnew/3.11.rst:2467 msgid "``f_state``: no public API (renamed to ``f_frame.f_state``)." msgstr "``f_state``:無公開 API(重新命名為 ``f_frame.f_state``)。" -#: ../../whatsnew/3.11.rst:2453 +#: ../../whatsnew/3.11.rst:2468 msgid "``f_trace``: no public API." msgstr "``f_trace``:無公開 API。" -#: ../../whatsnew/3.11.rst:2454 +#: ../../whatsnew/3.11.rst:2469 msgid "" "``f_trace_lines``: use ``PyObject_GetAttrString((PyObject*)frame, " "\"f_trace_lines\")``." @@ -4632,7 +4648,7 @@ msgstr "" "``f_trace_lines``:使用 ``PyObject_GetAttrString((PyObject*)frame, " "\"f_trace_lines\")``。" -#: ../../whatsnew/3.11.rst:2455 +#: ../../whatsnew/3.11.rst:2470 msgid "" "``f_trace_opcodes``: use ``PyObject_GetAttrString((PyObject*)frame, " "\"f_trace_opcodes\")``." @@ -4640,15 +4656,15 @@ msgstr "" "``f_trace_opcodes``:使用 ``PyObject_GetAttrString((PyObject*)frame, " "\"f_trace_opcodes\")``。" -#: ../../whatsnew/3.11.rst:2456 +#: ../../whatsnew/3.11.rst:2471 msgid "``f_localsplus``: no public API (renamed to ``f_frame.localsplus``)." msgstr "``f_localsplus``:無公開 API(重新命名為 ``f_frame.localsplus``)。" -#: ../../whatsnew/3.11.rst:2457 +#: ../../whatsnew/3.11.rst:2472 msgid "``f_valuestack``: removed." msgstr "``f_valuestack``:已移除。" -#: ../../whatsnew/3.11.rst:2459 +#: ../../whatsnew/3.11.rst:2474 msgid "" "The Python frame object is now created lazily. A side effect is that the :" "attr:`~frame.f_back` member must not be accessed directly, since its value " @@ -4659,7 +4675,7 @@ msgstr "" "員不能被直接存取,因為其職的計算也是惰性的,要改呼叫 :c:func:" "`PyFrame_GetBack`。" -#: ../../whatsnew/3.11.rst:2465 +#: ../../whatsnew/3.11.rst:2480 msgid "" "Debuggers that accessed the :attr:`~frame.f_locals` directly *must* call :c:" "func:`PyFrame_GetLocals` instead. They no longer need to call :c:func:`!" @@ -4672,15 +4688,15 @@ msgstr "" "PyFrame_FastToLocalsWithError` 或 :c:func:`!PyFrame_LocalsToFast`,事實上他們" "不應該呼叫這些函式。框架的必要更新現在由虛擬機管理。" -#: ../../whatsnew/3.11.rst:2471 +#: ../../whatsnew/3.11.rst:2486 msgid "Code defining ``PyFrame_GetCode()`` on Python 3.8 and older::" msgstr "``PyFrame_GetCode()`` 在 Python 3.8 以前的程式定義: ::" -#: ../../whatsnew/3.11.rst:2481 +#: ../../whatsnew/3.11.rst:2496 msgid "Code defining ``PyFrame_GetBack()`` on Python 3.8 and older::" msgstr "``PyFrame_GetBack()`` 在 Python 3.8 以前的程式定義: ::" -#: ../../whatsnew/3.11.rst:2491 +#: ../../whatsnew/3.11.rst:2506 msgid "" "Or use the `pythoncapi_compat project `__ to get these two functions on older Python versions." @@ -4688,11 +4704,11 @@ msgstr "" "或是使用 `pythoncap_compat 計畫 `__\\ 來在舊版 Python 函式中取得這兩個函式。" -#: ../../whatsnew/3.11.rst:2495 +#: ../../whatsnew/3.11.rst:2510 msgid "Changes of the :c:type:`PyThreadState` structure members:" msgstr ":c:type:`PyThreadState` 結構成員的改動:" -#: ../../whatsnew/3.11.rst:2497 +#: ../../whatsnew/3.11.rst:2512 msgid "" "``frame``: removed, use :c:func:`PyThreadState_GetFrame` (function added to " "Python 3.9 by :issue:`40429`). Warning: the function returns a :term:`strong " @@ -4702,7 +4718,7 @@ msgstr "" "於 Python 3.9 新增的函式)。警告:會回傳 :term:`strong reference` 的函式必須" "呼叫 :c:func:`Py_XDECREF`。" -#: ../../whatsnew/3.11.rst:2501 +#: ../../whatsnew/3.11.rst:2516 msgid "" "``tracing``: changed, use :c:func:`PyThreadState_EnterTracing` and :c:func:" "`PyThreadState_LeaveTracing` (functions added to Python 3.11 by :issue:" @@ -4712,7 +4728,7 @@ msgstr "" "`PyThreadState_LeaveTracing`\\ (:issue:`43760` 於 Python 3.11 中新增的函" "式)。" -#: ../../whatsnew/3.11.rst:2504 +#: ../../whatsnew/3.11.rst:2519 msgid "" "``recursion_depth``: removed, use ``(tstate->recursion_limit - tstate-" ">recursion_remaining)`` instead." @@ -4720,15 +4736,15 @@ msgstr "" "``recursion_depth``:已移除,請改用 ``(tstate->recursion_limit - tstate-" ">recursion_remaining)``。" -#: ../../whatsnew/3.11.rst:2506 +#: ../../whatsnew/3.11.rst:2521 msgid "``stackcheck_counter``: removed." msgstr "``stackcheck_counter``:已移除。" -#: ../../whatsnew/3.11.rst:2508 +#: ../../whatsnew/3.11.rst:2523 msgid "Code defining ``PyThreadState_GetFrame()`` on Python 3.8 and older::" msgstr "``PyThreadState_GetFrame()`` 在 Python 3.8 以前的程式定義: ::" -#: ../../whatsnew/3.11.rst:2518 +#: ../../whatsnew/3.11.rst:2533 msgid "" "Code defining ``PyThreadState_EnterTracing()`` and " "``PyThreadState_LeaveTracing()`` on Python 3.10 and older::" @@ -4736,7 +4752,7 @@ msgstr "" "``PyThreadState_EnterTracing()`` 與 ``PyThreadState_LeaveTracing()`` 在 " "Python 3.10 以前的程式定義: ::" -#: ../../whatsnew/3.11.rst:2544 +#: ../../whatsnew/3.11.rst:2559 msgid "" "Or use `the pythoncapi-compat project `__ to get these functions on old Python functions." @@ -4744,13 +4760,13 @@ msgstr "" "或是使用 `pythoncap-compat 計畫 `__\\ 來在舊版 Python 函式中取得它們。" -#: ../../whatsnew/3.11.rst:2548 +#: ../../whatsnew/3.11.rst:2563 msgid "" "Distributors are encouraged to build Python with the optimized Blake2 " "library `libb2`_." msgstr "鼓勵發布者們使用最佳化過的 Blake2 函式庫 `libb2`_ 來建置 Python。" -#: ../../whatsnew/3.11.rst:2551 +#: ../../whatsnew/3.11.rst:2566 msgid "" "The :c:member:`PyConfig.module_search_paths_set` field must now be set to 1 " "for initialization to use :c:member:`PyConfig.module_search_paths` to " @@ -4761,7 +4777,7 @@ msgstr "" "`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須被設為 " "1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` 的值。" -#: ../../whatsnew/3.11.rst:2556 +#: ../../whatsnew/3.11.rst:2571 msgid "" ":c:func:`PyConfig_Read` no longer calculates the initial search path, and " "will not fill any values into :c:member:`PyConfig.module_search_paths`. To " @@ -4774,60 +4790,60 @@ msgstr "" "初始化並使用 :c:func:`PySys_GetObject` 以取得 :data:`sys.path` 作為 Python 列" "表物件並直接修改它。" -#: ../../whatsnew/3.11.rst:2567 +#: ../../whatsnew/3.11.rst:2582 msgid "" "Deprecate the following functions to configure the Python initialization:" msgstr "棄用以下用來配置 Python 初始化的函式:" -#: ../../whatsnew/3.11.rst:2569 +#: ../../whatsnew/3.11.rst:2584 msgid ":c:func:`!PySys_AddWarnOptionUnicode`" msgstr ":c:func:`!PySys_AddWarnOptionUnicode`" -#: ../../whatsnew/3.11.rst:2570 +#: ../../whatsnew/3.11.rst:2585 msgid ":c:func:`!PySys_AddWarnOption`" msgstr ":c:func:`!PySys_AddWarnOption`" -#: ../../whatsnew/3.11.rst:2571 +#: ../../whatsnew/3.11.rst:2586 msgid ":c:func:`!PySys_AddXOption`" msgstr ":c:func:`!PySys_AddXOption`" -#: ../../whatsnew/3.11.rst:2572 +#: ../../whatsnew/3.11.rst:2587 msgid ":c:func:`!PySys_HasWarnOptions`" msgstr ":c:func:`!PySys_HasWarnOptions`" -#: ../../whatsnew/3.11.rst:2573 +#: ../../whatsnew/3.11.rst:2588 msgid ":c:func:`!PySys_SetArgvEx`" msgstr ":c:func:`!PySys_SetArgvEx`" -#: ../../whatsnew/3.11.rst:2574 +#: ../../whatsnew/3.11.rst:2589 msgid ":c:func:`!PySys_SetArgv`" msgstr ":c:func:`!PySys_SetArgv`" -#: ../../whatsnew/3.11.rst:2575 +#: ../../whatsnew/3.11.rst:2590 msgid ":c:func:`!PySys_SetPath`" msgstr ":c:func:`!PySys_SetPath`" -#: ../../whatsnew/3.11.rst:2576 +#: ../../whatsnew/3.11.rst:2591 msgid ":c:func:`!Py_SetPath`" msgstr ":c:func:`!Py_SetPath`" -#: ../../whatsnew/3.11.rst:2577 +#: ../../whatsnew/3.11.rst:2592 msgid ":c:func:`!Py_SetProgramName`" msgstr ":c:func:`!Py_SetProgramName`" -#: ../../whatsnew/3.11.rst:2578 +#: ../../whatsnew/3.11.rst:2593 msgid ":c:func:`!Py_SetPythonHome`" msgstr ":c:func:`!Py_SetPythonHome`" -#: ../../whatsnew/3.11.rst:2579 +#: ../../whatsnew/3.11.rst:2594 msgid ":c:func:`!Py_SetStandardStreamEncoding`" msgstr ":c:func:`!Py_SetStandardStreamEncoding`" -#: ../../whatsnew/3.11.rst:2580 +#: ../../whatsnew/3.11.rst:2595 msgid ":c:func:`!_Py_SetProgramFullPath`" msgstr ":c:func:`!_Py_SetProgramFullPath`" -#: ../../whatsnew/3.11.rst:2582 +#: ../../whatsnew/3.11.rst:2597 msgid "" "Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " "Configuration ` instead (:pep:`587`). (Contributed by Victor " @@ -4836,7 +4852,7 @@ msgstr "" "請改用 :ref:`Python 初始化配置 `\\ 中新的 :c:type:`PyConfig` " "API。(由 Victor Stinner 於 :gh:`88279` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2586 +#: ../../whatsnew/3.11.rst:2601 msgid "" "Deprecate the ``ob_shash`` member of the :c:type:`PyBytesObject`. Use :c:" "func:`PyObject_Hash` instead. (Contributed by Inada Naoki in :issue:`46864`.)" @@ -4844,111 +4860,111 @@ msgstr "" "棄用 :c:type:`PyBytesObject` 中的 ``ob_shash`` 成員。請改用 :c:func:" "`PyObject_Hash`。(由 Inada Naoki 於 :issue:`46864` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2595 +#: ../../whatsnew/3.11.rst:2610 msgid "" "The following C APIs have been deprecated in earlier Python releases, and " "will be removed in Python 3.12." msgstr "以下 C API 已於先前 Python 發布版本中棄用,並將於 Python 3.12 中移除。" -#: ../../whatsnew/3.11.rst:2598 +#: ../../whatsnew/3.11.rst:2613 msgid ":c:func:`!PyUnicode_AS_DATA`" msgstr ":c:func:`!PyUnicode_AS_DATA`" -#: ../../whatsnew/3.11.rst:2599 +#: ../../whatsnew/3.11.rst:2614 msgid ":c:func:`!PyUnicode_AS_UNICODE`" msgstr ":c:func:`!PyUnicode_AS_UNICODE`" -#: ../../whatsnew/3.11.rst:2600 +#: ../../whatsnew/3.11.rst:2615 msgid ":c:func:`!PyUnicode_AsUnicodeAndSize`" msgstr ":c:func:`!PyUnicode_AsUnicodeAndSize`" -#: ../../whatsnew/3.11.rst:2601 +#: ../../whatsnew/3.11.rst:2616 msgid ":c:func:`!PyUnicode_AsUnicode`" msgstr ":c:func:`!PyUnicode_AsUnicode`" -#: ../../whatsnew/3.11.rst:2602 +#: ../../whatsnew/3.11.rst:2617 msgid ":c:func:`!PyUnicode_FromUnicode`" msgstr ":c:func:`!PyUnicode_FromUnicode`" -#: ../../whatsnew/3.11.rst:2603 +#: ../../whatsnew/3.11.rst:2618 msgid ":c:func:`!PyUnicode_GET_DATA_SIZE`" msgstr ":c:func:`!PyUnicode_GET_DATA_SIZE`" -#: ../../whatsnew/3.11.rst:2604 +#: ../../whatsnew/3.11.rst:2619 msgid ":c:func:`!PyUnicode_GET_SIZE`" msgstr ":c:func:`!PyUnicode_GET_SIZE`" -#: ../../whatsnew/3.11.rst:2605 +#: ../../whatsnew/3.11.rst:2620 msgid ":c:func:`!PyUnicode_GetSize`" msgstr ":c:func:`!PyUnicode_GetSize`" -#: ../../whatsnew/3.11.rst:2606 +#: ../../whatsnew/3.11.rst:2621 msgid ":c:func:`!PyUnicode_IS_COMPACT`" msgstr ":c:func:`!PyUnicode_IS_COMPACT`" -#: ../../whatsnew/3.11.rst:2607 +#: ../../whatsnew/3.11.rst:2622 msgid ":c:func:`!PyUnicode_IS_READY`" msgstr ":c:func:`!PyUnicode_IS_READY`" -#: ../../whatsnew/3.11.rst:2608 +#: ../../whatsnew/3.11.rst:2623 msgid ":c:func:`PyUnicode_READY`" msgstr ":c:func:`PyUnicode_READY`" -#: ../../whatsnew/3.11.rst:2609 +#: ../../whatsnew/3.11.rst:2624 msgid ":c:func:`!PyUnicode_WSTR_LENGTH`" msgstr ":c:func:`!PyUnicode_WSTR_LENGTH`" -#: ../../whatsnew/3.11.rst:2610 +#: ../../whatsnew/3.11.rst:2625 msgid ":c:func:`!_PyUnicode_AsUnicode`" msgstr ":c:func:`!_PyUnicode_AsUnicode`" -#: ../../whatsnew/3.11.rst:2611 +#: ../../whatsnew/3.11.rst:2626 msgid ":c:macro:`!PyUnicode_WCHAR_KIND`" msgstr ":c:macro:`!PyUnicode_WCHAR_KIND`" -#: ../../whatsnew/3.11.rst:2612 +#: ../../whatsnew/3.11.rst:2627 msgid ":c:type:`PyUnicodeObject`" msgstr ":c:type:`PyUnicodeObject`" -#: ../../whatsnew/3.11.rst:2613 +#: ../../whatsnew/3.11.rst:2628 msgid ":c:func:`!PyUnicode_InternImmortal`" msgstr ":c:func:`!PyUnicode_InternImmortal`" -#: ../../whatsnew/3.11.rst:2621 +#: ../../whatsnew/3.11.rst:2636 msgid "" ":c:func:`!PyFrame_BlockSetup` and :c:func:`!PyFrame_BlockPop` have been " "removed. (Contributed by Mark Shannon in :issue:`40222`.)" msgstr "" -#: ../../whatsnew/3.11.rst:2625 +#: ../../whatsnew/3.11.rst:2640 msgid "Remove the following math macros using the ``errno`` variable:" msgstr "移除以下使用到 ``errno`` 變數的數學巨集:" -#: ../../whatsnew/3.11.rst:2627 +#: ../../whatsnew/3.11.rst:2642 msgid "``Py_ADJUST_ERANGE1()``" msgstr "``Py_ADJUST_ERANGE1()``" -#: ../../whatsnew/3.11.rst:2628 +#: ../../whatsnew/3.11.rst:2643 msgid "``Py_ADJUST_ERANGE2()``" msgstr "``Py_ADJUST_ERANGE2()``" -#: ../../whatsnew/3.11.rst:2629 +#: ../../whatsnew/3.11.rst:2644 msgid "``Py_OVERFLOWED()``" msgstr "``Py_OVERFLOWED()``" -#: ../../whatsnew/3.11.rst:2630 +#: ../../whatsnew/3.11.rst:2645 msgid "``Py_SET_ERANGE_IF_OVERFLOW()``" msgstr "``Py_SET_ERANGE_IF_OVERFLOW()``" -#: ../../whatsnew/3.11.rst:2631 +#: ../../whatsnew/3.11.rst:2646 msgid "``Py_SET_ERRNO_ON_MATH_ERROR()``" msgstr "``Py_SET_ERRNO_ON_MATH_ERROR()``" -#: ../../whatsnew/3.11.rst:2633 +#: ../../whatsnew/3.11.rst:2648 msgid "(Contributed by Victor Stinner in :issue:`45412`.)" msgstr "(由 Victor Stinner 於 :issue:`45412` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2635 +#: ../../whatsnew/3.11.rst:2650 msgid "" "Remove ``Py_UNICODE_COPY()`` and ``Py_UNICODE_FILL()`` macros, deprecated " "since Python 3.3. Use ``PyUnicode_CopyCharacters()`` or ``memcpy()`` " @@ -4960,7 +4976,7 @@ msgstr "" "和 ``PyUnicode_Fill()`` 函式。(由 Victor Stinner 於 :issue:`41123` 中所貢" "獻。)" -#: ../../whatsnew/3.11.rst:2640 +#: ../../whatsnew/3.11.rst:2655 msgid "" "Remove the ``pystrhex.h`` header file. It only contains private functions. C " "extensions should only include the main ```` header file. " @@ -4969,7 +4985,7 @@ msgstr "" "移除 ``pystrhex.h`` 標頭檔案。它只有包含私有函式。C 的擴充應該只要引入主要的 " "```` 標頭檔案。(由 Victor Stinner 於 :issue:`45434` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2644 +#: ../../whatsnew/3.11.rst:2659 msgid "" "Remove the ``Py_FORCE_DOUBLE()`` macro. It was used by the " "``Py_IS_INFINITY()`` macro. (Contributed by Victor Stinner in :issue:" @@ -4978,41 +4994,41 @@ msgstr "" "移除 ``Py_FORCE_DOUBLE()`` 巨集。它先前被用於 ``Py_IS_INFINITY()`` 巨集。" "(由 Victor Stinner 於 :issue:`45440` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2648 +#: ../../whatsnew/3.11.rst:2663 msgid "" "The following items are no longer available when :c:macro:`Py_LIMITED_API` " "is defined:" msgstr "當 :c:macro:`Py_LIMITED_API` 有被定義時,以下項目將無法被取得:" -#: ../../whatsnew/3.11.rst:2651 +#: ../../whatsnew/3.11.rst:2666 msgid ":c:func:`PyMarshal_WriteLongToFile`" msgstr ":c:func:`PyMarshal_WriteLongToFile`" -#: ../../whatsnew/3.11.rst:2652 +#: ../../whatsnew/3.11.rst:2667 msgid ":c:func:`PyMarshal_WriteObjectToFile`" msgstr ":c:func:`PyMarshal_WriteObjectToFile`" -#: ../../whatsnew/3.11.rst:2653 +#: ../../whatsnew/3.11.rst:2668 msgid ":c:func:`PyMarshal_ReadObjectFromString`" msgstr ":c:func:`PyMarshal_ReadObjectFromString`" -#: ../../whatsnew/3.11.rst:2654 +#: ../../whatsnew/3.11.rst:2669 msgid ":c:func:`PyMarshal_WriteObjectToString`" msgstr ":c:func:`PyMarshal_WriteObjectToString`" -#: ../../whatsnew/3.11.rst:2655 +#: ../../whatsnew/3.11.rst:2670 msgid "the ``Py_MARSHAL_VERSION`` macro" msgstr "``Py_MARSHAL_VERSION`` 巨集" -#: ../../whatsnew/3.11.rst:2657 +#: ../../whatsnew/3.11.rst:2672 msgid "These are not part of the :ref:`limited API `." msgstr "" -#: ../../whatsnew/3.11.rst:2659 +#: ../../whatsnew/3.11.rst:2674 msgid "(Contributed by Victor Stinner in :issue:`45474`.)" msgstr "(由 Victor Stinner 於 :issue:`45474` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2661 +#: ../../whatsnew/3.11.rst:2676 msgid "" "Exclude :c:func:`PyWeakref_GET_OBJECT` from the limited C API. It never " "worked since the :c:type:`!PyWeakReference` structure is opaque in the " @@ -5022,7 +5038,7 @@ msgstr "" "PyWeakReference` 結構在受限 C API 中過於晦澀而從未運作。(由 Victor Stinner " "於 :issue:`35134` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2666 +#: ../../whatsnew/3.11.rst:2681 msgid "" "Remove the ``PyHeapType_GET_MEMBERS()`` macro. It was exposed in the public " "C API by mistake, it must only be used by Python internally. Use the " @@ -5033,7 +5049,7 @@ msgstr "" "該只能被 Python 內部所使用。請改用 ``PyTypeObject.tp_members``。(由 Victor " "Stinner 於 :issue:`40170` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2671 +#: ../../whatsnew/3.11.rst:2686 msgid "" "Remove the ``HAVE_PY_SET_53BIT_PRECISION`` macro (moved to the internal C " "API). (Contributed by Victor Stinner in :issue:`45412`.)" @@ -5041,7 +5057,7 @@ msgstr "" "移除 ``HAVE_PY_SET_53BIT_PRECISION`` 巨集(移動至內部 C API)。(由 Victor " "Stinner 於 :issue:`45412` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2677 +#: ../../whatsnew/3.11.rst:2692 msgid "" "Remove the :c:type:`Py_UNICODE` encoder APIs, as they have been deprecated " "since Python 3.3, are little used and are inefficient relative to the " @@ -5050,63 +5066,63 @@ msgstr "" "移除 :c:type:`Py_UNICODE` 編碼器 API,它們自從 Python 3.3 就被棄用,非常少用" "且和推薦的替代方案已無太大關聯。" -#: ../../whatsnew/3.11.rst:2682 +#: ../../whatsnew/3.11.rst:2697 msgid "The removed functions are:" msgstr "被移除的函式為:" -#: ../../whatsnew/3.11.rst:2684 +#: ../../whatsnew/3.11.rst:2699 msgid ":func:`!PyUnicode_Encode`" msgstr ":func:`!PyUnicode_Encode`" -#: ../../whatsnew/3.11.rst:2685 +#: ../../whatsnew/3.11.rst:2700 msgid ":func:`!PyUnicode_EncodeASCII`" msgstr ":func:`!PyUnicode_EncodeASCII`" -#: ../../whatsnew/3.11.rst:2686 +#: ../../whatsnew/3.11.rst:2701 msgid ":func:`!PyUnicode_EncodeLatin1`" msgstr ":func:`!PyUnicode_EncodeLatin1`" -#: ../../whatsnew/3.11.rst:2687 +#: ../../whatsnew/3.11.rst:2702 msgid ":func:`!PyUnicode_EncodeUTF7`" msgstr ":func:`!PyUnicode_EncodeUTF7`" -#: ../../whatsnew/3.11.rst:2688 +#: ../../whatsnew/3.11.rst:2703 msgid ":func:`!PyUnicode_EncodeUTF8`" msgstr ":func:`!PyUnicode_EncodeUTF8`" -#: ../../whatsnew/3.11.rst:2689 +#: ../../whatsnew/3.11.rst:2704 msgid ":func:`!PyUnicode_EncodeUTF16`" msgstr ":func:`!PyUnicode_EncodeUTF16`" -#: ../../whatsnew/3.11.rst:2690 +#: ../../whatsnew/3.11.rst:2705 msgid ":func:`!PyUnicode_EncodeUTF32`" msgstr ":func:`!PyUnicode_EncodeUTF32`" -#: ../../whatsnew/3.11.rst:2691 +#: ../../whatsnew/3.11.rst:2706 msgid ":func:`!PyUnicode_EncodeUnicodeEscape`" msgstr ":func:`!PyUnicode_EncodeUnicodeEscape`" -#: ../../whatsnew/3.11.rst:2692 +#: ../../whatsnew/3.11.rst:2707 msgid ":func:`!PyUnicode_EncodeRawUnicodeEscape`" msgstr ":func:`!PyUnicode_EncodeRawUnicodeEscape`" -#: ../../whatsnew/3.11.rst:2693 +#: ../../whatsnew/3.11.rst:2708 msgid ":func:`!PyUnicode_EncodeCharmap`" msgstr ":func:`!PyUnicode_EncodeCharmap`" -#: ../../whatsnew/3.11.rst:2694 +#: ../../whatsnew/3.11.rst:2709 msgid ":func:`!PyUnicode_TranslateCharmap`" msgstr ":func:`!PyUnicode_TranslateCharmap`" -#: ../../whatsnew/3.11.rst:2695 +#: ../../whatsnew/3.11.rst:2710 msgid ":func:`!PyUnicode_EncodeDecimal`" msgstr ":func:`!PyUnicode_EncodeDecimal`" -#: ../../whatsnew/3.11.rst:2696 +#: ../../whatsnew/3.11.rst:2711 msgid ":func:`!PyUnicode_TransformDecimalToASCII`" msgstr ":func:`!PyUnicode_TransformDecimalToASCII`" -#: ../../whatsnew/3.11.rst:2698 +#: ../../whatsnew/3.11.rst:2713 msgid "" "See :pep:`624` for details and :pep:`migration guidance <624#alternative-" "apis>`. (Contributed by Inada Naoki in :issue:`44029`.)" @@ -5114,15 +5130,15 @@ msgstr "" "詳情請見 :pep:`624` 與\\ :pep:`搬遷指南 <624#alternative-apis>`。(由 Inada " "Naoki 於 :issue:`44029` 中所貢獻。)" -#: ../../whatsnew/3.11.rst:2704 +#: ../../whatsnew/3.11.rst:2719 msgid "Notable changes in 3.11.4" msgstr "" -#: ../../whatsnew/3.11.rst:2707 +#: ../../whatsnew/3.11.rst:2722 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.11.rst:2709 +#: ../../whatsnew/3.11.rst:2724 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 " @@ -5133,15 +5149,15 @@ msgid "" "Viktorin in :pep:`706`.)" msgstr "" -#: ../../whatsnew/3.11.rst:2721 +#: ../../whatsnew/3.11.rst:2736 msgid "Notable changes in 3.11.5" msgstr "" -#: ../../whatsnew/3.11.rst:2724 +#: ../../whatsnew/3.11.rst:2739 msgid "OpenSSL" msgstr "OpenSSL" -#: ../../whatsnew/3.11.rst:2726 +#: ../../whatsnew/3.11.rst:2741 msgid "" "Windows builds and macOS installers from python.org now use OpenSSL 3.0." msgstr "" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index adfd644211..ad791293bb 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-27 00:03+0000\n" +"POT-Creation-Date: 2024-06-13 00:03+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -933,7 +933,7 @@ msgstr "itertools" #: ../../whatsnew/3.12.rst:742 msgid "" -"Add :class:`itertools.batched()` for collecting into even-sized tuples where " +"Add :func:`itertools.batched` for collecting into even-sized tuples where " "the last batch may be shorter than the rest. (Contributed by Raymond " "Hettinger in :gh:`98363`.)" msgstr "" @@ -1367,11 +1367,11 @@ msgstr "unittest" #: ../../whatsnew/3.12.rst:1039 msgid "" "Add a ``--durations`` command line option, showing the N slowest test cases::" -msgstr "" +msgstr "新增 ``--durations`` 命令列選項,顯示 N 個最慢的測試案例:" #: ../../whatsnew/3.12.rst:1055 msgid "(Contributed by Giampaolo Rodola in :gh:`48330`)" -msgstr "" +msgstr "(由 Giampaolo Rodola 於 :gh:`48330` 中貢獻。)" #: ../../whatsnew/3.12.rst:1058 msgid "uuid" @@ -2461,15 +2461,15 @@ msgstr "``imp.load_source()``" #: ../../whatsnew/3.12.rst:1618 msgid "*See below*" -msgstr "" +msgstr "*見下文*" #: ../../whatsnew/3.12.rst:1621 msgid "Replace ``imp.load_source()`` with::" -msgstr "" +msgstr "用以下取代 ``imp.load_source()``: ::" #: ../../whatsnew/3.12.rst:1636 msgid "Remove :mod:`!imp` functions and attributes with no replacements:" -msgstr "" +msgstr "移除 :mod:`!imp` 函式和屬性、沒有替代方案:" #: ../../whatsnew/3.12.rst:1638 msgid "Undocumented functions:" @@ -3087,17 +3087,19 @@ msgstr "" #: ../../whatsnew/3.12.rst:1983 msgid "Code object constructors:" -msgstr "" +msgstr "程式碼物件建構函式:" #: ../../whatsnew/3.12.rst:1985 msgid "``PyUnstable_Code_New()`` (renamed from ``PyCode_New``)" -msgstr "" +msgstr "``PyUnstable_Code_New()``\\ (自 ``PyCode_New`` 重新命名)" #: ../../whatsnew/3.12.rst:1986 msgid "" "``PyUnstable_Code_NewWithPosOnlyArgs()`` (renamed from " "``PyCode_NewWithPosOnlyArgs``)" msgstr "" +"``PyUnstable_Code_NewWithPosOnlyArgs()``\\ (自 " +"``PyCode_NewWithPosOnlyArgs`` 重新命名)" #: ../../whatsnew/3.12.rst:1988 msgid "Extra storage for code objects (:pep:`523`):" @@ -3108,14 +3110,16 @@ msgid "" "``PyUnstable_Eval_RequestCodeExtraIndex()`` (renamed from " "``_PyEval_RequestCodeExtraIndex``)" msgstr "" +"``PyUnstable_Eval_RequestCodeExtraIndex()``\\ (自 " +"``_PyEval_RequestCodeExtraIndex`` 重新命名)" #: ../../whatsnew/3.12.rst:1991 msgid "``PyUnstable_Code_GetExtra()`` (renamed from ``_PyCode_GetExtra``)" -msgstr "" +msgstr "``PyUnstable_Code_GetExtra()``\\ (自 ``_PyCode_GetExtra`` 重新命名)" #: ../../whatsnew/3.12.rst:1992 msgid "``PyUnstable_Code_SetExtra()`` (renamed from ``_PyCode_SetExtra``)" -msgstr "" +msgstr "``PyUnstable_Code_SetExtra()``\\ (自 ``_PyCode_SetExtra`` 重新命名)" #: ../../whatsnew/3.12.rst:1994 msgid "" @@ -4115,10 +4119,12 @@ msgstr "" #: ../../whatsnew/3.12.rst:2475 msgid "ipaddress" -msgstr "" +msgstr "ipaddress" #: ../../whatsnew/3.12.rst:2477 msgid "" "Fixed ``is_global`` and ``is_private`` behavior in ``IPv4Address``, " "``IPv6Address``, ``IPv4Network`` and ``IPv6Network``." msgstr "" +"修正 ``IPv4Address``、``IPv6Address``、``IPv4Network`` 和 ``IPv6Network`` 中" +"的 ``is_global`` 和 ``is_private`` 行為。" diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 83b13685d7..6e6272f306 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-27 00:03+0000\n" +"POT-Creation-Date: 2024-07-14 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2029,7 +2029,7 @@ msgstr "stat" #: ../../whatsnew/3.4.rst:1498 msgid "" -"The :mod:`stat` module is now backed by a C implementation in :mod:`_stat`. " +"The :mod:`stat` module is now backed by a C implementation in :mod:`!_stat`. " "A C implementation is required as most of the values aren't standardized and " "are platform-dependent. (Contributed by Christian Heimes in :issue:`11016`.)" msgstr "" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 55bfa804a2..b40e71feda 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-18 00:04+0000\n" +"POT-Creation-Date: 2024-07-14 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2377,8 +2377,8 @@ msgstr "tkinter" #: ../../whatsnew/3.5.rst:1938 msgid "" -"The :mod:`tkinter._fix` module used for setting up the Tcl/Tk environment on " -"Windows has been replaced by a private function in the :mod:`_tkinter` " +"The :mod:`!tkinter._fix` module used for setting up the Tcl/Tk environment " +"on Windows has been replaced by a private function in the :mod:`!_tkinter` " "module which makes no permanent changes to environment variables. " "(Contributed by Zachary Ware in :issue:`20035`.)" msgstr "" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 4edd8206af..f53e98b051 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-29 00:04+0000\n" +"POT-Creation-Date: 2024-07-14 00:03+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2883,8 +2883,8 @@ msgstr "threading" #: ../../whatsnew/3.7.rst:2051 msgid "" -":mod:`dummy_threading` and :mod:`_dummy_thread` have been deprecated. It is " -"no longer possible to build Python with threading disabled. Use :mod:" +":mod:`!dummy_threading` and :mod:`!_dummy_thread` have been deprecated. It " +"is no longer possible to build Python with threading disabled. Use :mod:" "`threading` instead. (Contributed by Antoine Pitrou in :issue:`31370`.)" msgstr "" @@ -3075,9 +3075,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:2186 msgid "" -":mod:`asyncio` no longer exports the :mod:`selectors` and :mod:`_overlapped` " -"modules as ``asyncio.selectors`` and ``asyncio._overlapped``. Replace ``from " -"asyncio import selectors`` with ``import selectors``." +":mod:`asyncio` no longer exports the :mod:`selectors` and :mod:`!" +"_overlapped` modules as ``asyncio.selectors`` and ``asyncio._overlapped``. " +"Replace ``from asyncio import selectors`` with ``import selectors``." msgstr "" #: ../../whatsnew/3.7.rst:2191