diff --git a/c-api/frame.po b/c-api/frame.po index 80c27bccfc..362d78c834 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-11 00:15+0000\n" +"POT-Creation-Date: 2026-02-28 00:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -76,81 +76,83 @@ msgid "Get the *frame* next outer frame." msgstr "" #: ../../c-api/frame.rst:51 +#, fuzzy msgid "" -"Return a :term:`strong reference`, or ``NULL`` if *frame* has no outer frame." -msgstr "" +"Return a :term:`strong reference`, or ``NULL`` if *frame* has no outer " +"frame. This raises no exceptions." +msgstr "回傳 :term:`strong reference` 或 ``NULL``。" -#: ../../c-api/frame.rst:59 +#: ../../c-api/frame.rst:60 msgid "Get the *frame*'s :attr:`~frame.f_builtins` attribute." msgstr "取得 *frame* 的 :attr:`~frame.f_builtins` 屬性。" -#: ../../c-api/frame.rst:61 ../../c-api/frame.rst:92 +#: ../../c-api/frame.rst:62 ../../c-api/frame.rst:93 msgid "Return a :term:`strong reference`. The result cannot be ``NULL``." msgstr "回傳 :term:`strong reference`。結果不能為 ``NULL``。" -#: ../../c-api/frame.rst:68 +#: ../../c-api/frame.rst:69 msgid "Get the *frame* code." msgstr "" -#: ../../c-api/frame.rst:70 ../../c-api/frame.rst:136 +#: ../../c-api/frame.rst:71 ../../c-api/frame.rst:137 msgid "Return a :term:`strong reference`." msgstr "回傳 :term:`strong reference`。" -#: ../../c-api/frame.rst:72 +#: ../../c-api/frame.rst:73 msgid "The result (frame code) cannot be ``NULL``." msgstr "" -#: ../../c-api/frame.rst:79 +#: ../../c-api/frame.rst:80 msgid "" "Get the generator, coroutine, or async generator that owns this frame, or " "``NULL`` if this frame is not owned by a generator. Does not raise an " "exception, even if the return value is ``NULL``." msgstr "" -#: ../../c-api/frame.rst:83 +#: ../../c-api/frame.rst:84 msgid "Return a :term:`strong reference`, or ``NULL``." msgstr "回傳 :term:`strong reference` 或 ``NULL``。" -#: ../../c-api/frame.rst:90 +#: ../../c-api/frame.rst:91 msgid "Get the *frame*'s :attr:`~frame.f_globals` attribute." msgstr "取得 *frame* 的 :attr:`~frame.f_globals` 屬性。" -#: ../../c-api/frame.rst:99 +#: ../../c-api/frame.rst:100 msgid "Get the *frame*'s :attr:`~frame.f_lasti` attribute." msgstr "取得 *frame* 的 :attr:`~frame.f_lasti` 屬性。" -#: ../../c-api/frame.rst:101 +#: ../../c-api/frame.rst:102 msgid "Returns -1 if ``frame.f_lasti`` is ``None``." msgstr "如果 ``frame.f_lasti`` 是 ``None`` 則回傳 -1。" -#: ../../c-api/frame.rst:108 +#: ../../c-api/frame.rst:109 msgid "Get the variable *name* of *frame*." msgstr "取得 *frame* 的變數 *name*。" -#: ../../c-api/frame.rst:110 +#: ../../c-api/frame.rst:111 msgid "Return a :term:`strong reference` to the variable value on success." msgstr "在成功時回傳變數值的 :term:`strong reference`。" -#: ../../c-api/frame.rst:111 +#: ../../c-api/frame.rst:112 msgid "" "Raise :exc:`NameError` and return ``NULL`` if the variable does not exist." msgstr "如果變數不存在,則引發 :exc:`NameError` 並回傳 ``NULL``。" -#: ../../c-api/frame.rst:112 +#: ../../c-api/frame.rst:113 msgid "Raise an exception and return ``NULL`` on error." msgstr "在錯誤時引發例外並回傳 ``NULL``。" -#: ../../c-api/frame.rst:114 +#: ../../c-api/frame.rst:115 msgid "*name* type must be a :class:`str`." msgstr "*name* 的型別必須是 :class:`str`。" -#: ../../c-api/frame.rst:121 +#: ../../c-api/frame.rst:122 msgid "" "Similar to :c:func:`PyFrame_GetVar`, but the variable name is a C string " "encoded in UTF-8." msgstr "" -#: ../../c-api/frame.rst:129 +#: ../../c-api/frame.rst:130 msgid "" "Get the *frame*'s :attr:`~frame.f_locals` attribute. If the frame refers to " "an :term:`optimized scope`, this returns a write-through proxy object that " @@ -159,21 +161,21 @@ msgid "" "directly (as described for :func:`locals`)." msgstr "" -#: ../../c-api/frame.rst:140 +#: ../../c-api/frame.rst:141 msgid "" "As part of :pep:`667`, return an instance of :c:var:" "`PyFrameLocalsProxy_Type`." msgstr "" -#: ../../c-api/frame.rst:146 +#: ../../c-api/frame.rst:147 msgid "Return the line number that *frame* is currently executing." msgstr "" -#: ../../c-api/frame.rst:150 +#: ../../c-api/frame.rst:151 msgid "Frame Locals Proxies" msgstr "" -#: ../../c-api/frame.rst:154 +#: ../../c-api/frame.rst:155 msgid "" "The :attr:`~frame.f_locals` attribute on a :ref:`frame object ` is an instance of a \"frame-locals proxy\". The proxy object " @@ -182,34 +184,34 @@ msgid "" "to date with the live local variables in the frame itself." msgstr "" -#: ../../c-api/frame.rst:160 +#: ../../c-api/frame.rst:161 msgid "See :pep:`667` for more information." msgstr "更多資訊請參閱 :pep:`667`。" -#: ../../c-api/frame.rst:164 +#: ../../c-api/frame.rst:165 msgid "The type of frame :func:`locals` proxy objects." msgstr "" -#: ../../c-api/frame.rst:168 +#: ../../c-api/frame.rst:169 msgid "Return non-zero if *obj* is a frame :func:`locals` proxy." msgstr "" -#: ../../c-api/frame.rst:172 +#: ../../c-api/frame.rst:173 msgid "Legacy Local Variable APIs" msgstr "" -#: ../../c-api/frame.rst:174 +#: ../../c-api/frame.rst:175 msgid "" "These APIs are :term:`soft deprecated`. As of Python 3.13, they do nothing. " "They exist solely for backwards compatibility." msgstr "" -#: ../../c-api/frame.rst:180 ../../c-api/frame.rst:194 -#: ../../c-api/frame.rst:207 +#: ../../c-api/frame.rst:181 ../../c-api/frame.rst:195 +#: ../../c-api/frame.rst:208 msgid "This function is :term:`soft deprecated` and does nothing." msgstr "" -#: ../../c-api/frame.rst:182 +#: ../../c-api/frame.rst:183 msgid "" "Prior to Python 3.13, this function would copy the :attr:`~frame.f_locals` " "attribute of *f* to the internal \"fast\" array of local variables, allowing " @@ -218,12 +220,12 @@ msgid "" "dictionary." msgstr "" -#: ../../c-api/frame.rst:188 ../../c-api/frame.rst:201 -#: ../../c-api/frame.rst:213 +#: ../../c-api/frame.rst:189 ../../c-api/frame.rst:202 +#: ../../c-api/frame.rst:214 msgid "This function now does nothing." msgstr "" -#: ../../c-api/frame.rst:196 +#: ../../c-api/frame.rst:197 msgid "" "Prior to Python 3.13, this function would copy the internal \"fast\" array " "of local variables (which is used by the interpreter) to the :attr:`~frame." @@ -231,38 +233,38 @@ msgid "" "visible to frame objects." msgstr "" -#: ../../c-api/frame.rst:209 +#: ../../c-api/frame.rst:210 msgid "" "Prior to Python 3.13, this function was similar to :c:func:" "`PyFrame_FastToLocals`, but would return ``0`` on success, and ``-1`` with " "an exception set on failure." msgstr "" -#: ../../c-api/frame.rst:218 +#: ../../c-api/frame.rst:219 msgid ":pep:`667`" msgstr ":pep:`667`" -#: ../../c-api/frame.rst:222 +#: ../../c-api/frame.rst:223 msgid "Internal Frames" msgstr "" -#: ../../c-api/frame.rst:224 +#: ../../c-api/frame.rst:225 msgid "Unless using :pep:`523`, you will not need this." msgstr "" -#: ../../c-api/frame.rst:228 +#: ../../c-api/frame.rst:229 msgid "The interpreter's internal frame representation." msgstr "" -#: ../../c-api/frame.rst:234 +#: ../../c-api/frame.rst:235 msgid "Return a :term:`strong reference` to the code object for the frame." msgstr "" -#: ../../c-api/frame.rst:241 +#: ../../c-api/frame.rst:242 msgid "Return the byte offset into the last executed instruction." msgstr "" -#: ../../c-api/frame.rst:248 +#: ../../c-api/frame.rst:249 msgid "" "Return the currently executing line number, or -1 if there is no line number." msgstr "" diff --git a/c-api/interp-lifecycle.po b/c-api/interp-lifecycle.po index 2c517d8bfb..461fff3d79 100644 --- a/c-api/interp-lifecycle.po +++ b/c-api/interp-lifecycle.po @@ -7,10 +7,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-24 00:20+0000\n" +"POT-Creation-Date: 2026-02-26 18:22+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-tw)\n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -24,7 +25,9 @@ msgstr "直譯器的初始化與終結化" msgid "" "See :ref:`Python Initialization Configuration ` for details on " "how to configure the interpreter prior to initialization." -msgstr "關於如何在初始化之前設定直譯器的細節,請參見 :ref:`Python 初始化設定 `。" +msgstr "" +"關於如何在初始化之前設定直譯器的細節,請參見 :ref:`Python 初始化設定 `。" #: ../../c-api/interp-lifecycle.rst:14 msgid "Before Python initialization" @@ -273,7 +276,8 @@ msgstr "" msgid "" "Set by the :option:`-B` option and the :envvar:`PYTHONDONTWRITEBYTECODE` " "environment variable." -msgstr "由 :option:`-B` 選項與 :envvar:`PYTHONDONTWRITEBYTECODE` 環境變數設定。" +msgstr "" +"由 :option:`-B` 選項與 :envvar:`PYTHONDONTWRITEBYTECODE` 環境變數設定。" #: ../../c-api/interp-lifecycle.rst:142 msgid "" @@ -297,7 +301,8 @@ msgstr "" msgid "" "Set to ``1`` if the :envvar:`PYTHONHASHSEED` environment variable is set to " "a non-empty string." -msgstr "如果環境變數 :envvar:`PYTHONHASHSEED` 被設定為一個非空字串則設為 ``1``。" +msgstr "" +"如果環境變數 :envvar:`PYTHONHASHSEED` 被設定為一個非空字串則設為 ``1``。" #: ../../c-api/interp-lifecycle.rst:161 msgid "" @@ -317,8 +322,8 @@ msgid "" "Ignore all :envvar:`!PYTHON*` environment variables, e.g. :envvar:" "`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." msgstr "" -"忽略所有可能被設定的 :envvar:`!PYTHON*` 環境變數,例如 :envvar:`PYTHONPATH` 與 " -":envvar:`PYTHONHOME`。" +"忽略所有可能被設定的 :envvar:`!PYTHON*` 環境變數,例如 :envvar:`PYTHONPATH` " +"與 :envvar:`PYTHONHOME`。" #: ../../c-api/interp-lifecycle.rst:176 msgid "Set by the :option:`-E` and :option:`-I` options." @@ -390,7 +395,9 @@ msgstr "" msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " "variable is set to a non-empty string." -msgstr "如果環境變數 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 被設定為一個非空字串則設為 ``1``。" +msgstr "" +"如果環境變數 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 被設定為一個非空字串則設" +"為 ``1``。" #: ../../c-api/interp-lifecycle.rst:237 msgid "See :pep:`529` for more details." @@ -459,7 +466,9 @@ msgstr "" msgid "" "Set by the :option:`-s` and :option:`-I` options, and the :envvar:" "`PYTHONNOUSERSITE` environment variable." -msgstr "由 :option:`-s` 選項、:option:`-I` 選項與 :envvar:`PYTHONNOUSERSITE` 環境變數設定。" +msgstr "" +"由 :option:`-s` 選項、:option:`-I` 選項與 :envvar:`PYTHONNOUSERSITE` 環境變數" +"設定。" #: ../../c-api/interp-lifecycle.rst:296 msgid "" @@ -663,7 +672,9 @@ msgstr "" msgid "" "Raises an :ref:`auditing event ` ``cpython." "_PySys_ClearAuditHooks`` with no arguments." -msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython._PySys_ClearAuditHooks``。" +msgstr "" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." +"_PySys_ClearAuditHooks``。" #: ../../c-api/interp-lifecycle.rst:476 msgid "" @@ -1143,6 +1154,52 @@ msgid "" "`Python Initialization Configuration `." msgstr "" +#: ../../c-api/interp-lifecycle.rst:906 +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/interp-lifecycle.rst:916 +msgid "The *updatepath* value depends on :option:`-I`." +msgstr "" + +#: ../../c-api/interp-lifecycle.rst:923 +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/interp-lifecycle.rst:927 +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/interp-lifecycle.rst:931 +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 " +"execution. No code in the Python interpreter will change the contents of " +"this storage." +msgstr "" + +#: ../../c-api/interp-lifecycle.rst:944 +msgid "" +"Return the default \"home\", that is, the value set by :c:member:`PyConfig." +"home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " +"is set." +msgstr "" + +#: ../../c-api/interp-lifecycle.rst:954 +msgid "" +"Use :c:func:`PyConfig_Get(\"home\") ` or the :envvar:" +"`PYTHONHOME` environment variable instead." +msgstr "" + #: ../../c-api/interp-lifecycle.rst:357 msgid "PyEval_InitThreads()" msgstr "PyEval_InitThreads()" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 69b4349bec..fda0185201 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-01-22 16:55+0000\n" +"POT-Creation-Date: 2026-02-28 00:16+0000\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1330,20 +1330,21 @@ msgstr "" #: ../../c-api/typeobj.rst:1323 ../../c-api/typeobj.rst:1370 #: ../../c-api/typeobj.rst:1396 ../../c-api/typeobj.rst:1415 #: ../../c-api/typeobj.rst:1445 ../../c-api/typeobj.rst:1467 -#: ../../c-api/typeobj.rst:1495 ../../c-api/typeobj.rst:1593 -#: ../../c-api/typeobj.rst:1739 ../../c-api/typeobj.rst:1806 -#: ../../c-api/typeobj.rst:1842 ../../c-api/typeobj.rst:1869 -#: ../../c-api/typeobj.rst:1894 ../../c-api/typeobj.rst:1909 -#: ../../c-api/typeobj.rst:1926 ../../c-api/typeobj.rst:1942 -#: ../../c-api/typeobj.rst:1974 ../../c-api/typeobj.rst:2006 -#: ../../c-api/typeobj.rst:2034 ../../c-api/typeobj.rst:2054 -#: ../../c-api/typeobj.rst:2083 ../../c-api/typeobj.rst:2129 -#: ../../c-api/typeobj.rst:2148 ../../c-api/typeobj.rst:2190 -#: ../../c-api/typeobj.rst:2215 ../../c-api/typeobj.rst:2255 -#: ../../c-api/typeobj.rst:2285 ../../c-api/typeobj.rst:2298 -#: ../../c-api/typeobj.rst:2308 ../../c-api/typeobj.rst:2325 -#: ../../c-api/typeobj.rst:2342 ../../c-api/typeobj.rst:2358 -#: ../../c-api/typeobj.rst:2502 ../../c-api/typeobj.rst:2562 +#: ../../c-api/typeobj.rst:1503 ../../c-api/typeobj.rst:1515 +#: ../../c-api/typeobj.rst:1541 ../../c-api/typeobj.rst:1639 +#: ../../c-api/typeobj.rst:1785 ../../c-api/typeobj.rst:1852 +#: ../../c-api/typeobj.rst:1888 ../../c-api/typeobj.rst:1915 +#: ../../c-api/typeobj.rst:1940 ../../c-api/typeobj.rst:1955 +#: ../../c-api/typeobj.rst:1972 ../../c-api/typeobj.rst:1988 +#: ../../c-api/typeobj.rst:2020 ../../c-api/typeobj.rst:2052 +#: ../../c-api/typeobj.rst:2080 ../../c-api/typeobj.rst:2100 +#: ../../c-api/typeobj.rst:2129 ../../c-api/typeobj.rst:2175 +#: ../../c-api/typeobj.rst:2194 ../../c-api/typeobj.rst:2236 +#: ../../c-api/typeobj.rst:2261 ../../c-api/typeobj.rst:2301 +#: ../../c-api/typeobj.rst:2331 ../../c-api/typeobj.rst:2344 +#: ../../c-api/typeobj.rst:2354 ../../c-api/typeobj.rst:2371 +#: ../../c-api/typeobj.rst:2388 ../../c-api/typeobj.rst:2404 +#: ../../c-api/typeobj.rst:2548 ../../c-api/typeobj.rst:2608 msgid "**Inheritance:**" msgstr "" @@ -1382,10 +1383,10 @@ msgstr "" #: ../../c-api/typeobj.rst:529 ../../c-api/typeobj.rst:811 #: ../../c-api/typeobj.rst:938 ../../c-api/typeobj.rst:1038 -#: ../../c-api/typeobj.rst:1060 ../../c-api/typeobj.rst:1871 -#: ../../c-api/typeobj.rst:1896 ../../c-api/typeobj.rst:2036 -#: ../../c-api/typeobj.rst:2056 ../../c-api/typeobj.rst:2131 -#: ../../c-api/typeobj.rst:2257 ../../c-api/typeobj.rst:2504 +#: ../../c-api/typeobj.rst:1060 ../../c-api/typeobj.rst:1917 +#: ../../c-api/typeobj.rst:1942 ../../c-api/typeobj.rst:2082 +#: ../../c-api/typeobj.rst:2102 ../../c-api/typeobj.rst:2177 +#: ../../c-api/typeobj.rst:2303 ../../c-api/typeobj.rst:2550 msgid "This field is inherited by subtypes." msgstr "" @@ -1772,8 +1773,8 @@ msgid "" "violate any assumptions of the library." msgstr "" -#: ../../c-api/typeobj.rst:815 ../../c-api/typeobj.rst:1750 -#: ../../c-api/typeobj.rst:2517 +#: ../../c-api/typeobj.rst:815 ../../c-api/typeobj.rst:1796 +#: ../../c-api/typeobj.rst:2563 msgid "" ":ref:`life-cycle` for details about how this slot relates to other slots." msgstr "" @@ -1937,11 +1938,11 @@ msgstr "" #: ../../c-api/typeobj.rst:940 ../../c-api/typeobj.rst:1021 #: ../../c-api/typeobj.rst:1062 ../../c-api/typeobj.rst:1089 #: ../../c-api/typeobj.rst:1117 ../../c-api/typeobj.rst:1159 -#: ../../c-api/typeobj.rst:1815 ../../c-api/typeobj.rst:1849 -#: ../../c-api/typeobj.rst:1978 ../../c-api/typeobj.rst:2011 -#: ../../c-api/typeobj.rst:2090 ../../c-api/typeobj.rst:2133 -#: ../../c-api/typeobj.rst:2155 ../../c-api/typeobj.rst:2196 -#: ../../c-api/typeobj.rst:2226 ../../c-api/typeobj.rst:2259 +#: ../../c-api/typeobj.rst:1861 ../../c-api/typeobj.rst:1895 +#: ../../c-api/typeobj.rst:2024 ../../c-api/typeobj.rst:2057 +#: ../../c-api/typeobj.rst:2136 ../../c-api/typeobj.rst:2179 +#: ../../c-api/typeobj.rst:2201 ../../c-api/typeobj.rst:2242 +#: ../../c-api/typeobj.rst:2272 ../../c-api/typeobj.rst:2305 msgid "**Default:**" msgstr "**預設:**" @@ -2031,7 +2032,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:1014 ../../c-api/typeobj.rst:1808 +#: ../../c-api/typeobj.rst:1014 ../../c-api/typeobj.rst:1854 msgid "" "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." "tp_richcompare`" @@ -2264,8 +2265,8 @@ msgid "" "`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1231 ../../c-api/typeobj.rst:1595 -#: ../../c-api/typeobj.rst:1741 +#: ../../c-api/typeobj.rst:1231 ../../c-api/typeobj.rst:1641 +#: ../../c-api/typeobj.rst:1787 msgid "" "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." "tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" @@ -2453,7 +2454,8 @@ msgid "" "`." msgstr "" -#: ../../c-api/typeobj.rst:1398 +#: ../../c-api/typeobj.rst:1398 ../../c-api/typeobj.rst:1505 +#: ../../c-api/typeobj.rst:1517 msgid "This flag is not inherited." msgstr "" @@ -2540,35 +2542,76 @@ msgid "" "in a future version of CPython" msgstr "" -#: ../../c-api/typeobj.rst:1491 +#: ../../c-api/typeobj.rst:1489 +msgid "" +"This is a :term:`soft deprecated` macro that does nothing. Historically, " +"this would indicate that the :c:member:`~PyTypeObject.tp_version_tag` field " +"was available and initialized." +msgstr "" + +#: ../../c-api/typeobj.rst:1497 +msgid "" +"This bit indicates that instances of this type will have an \"inline " +"values\" array (containing the object's attributes) placed directly after " +"the end of the object." +msgstr "" + +#: ../../c-api/typeobj.rst:1501 +#, fuzzy +msgid "This requires that :c:macro:`Py_TPFLAGS_HAVE_GC` is set." +msgstr "如果有設定此旗標,則也應該設定 :c:macro:`Py_TPFLAGS_HAVE_GC`。" + +#: ../../c-api/typeobj.rst:1512 +msgid "" +"This bit indicates that this is an abstract type and therefore cannot be " +"instantiated." +msgstr "" + +#: ../../c-api/typeobj.rst:1520 +msgid ":mod:`abc`" +msgstr "" + +#: ../../c-api/typeobj.rst:1525 +msgid "" +"Internal. Do not set or unset this flag. Historically, this was a reserved " +"flag for use in Stackless Python." +msgstr "" + +#: ../../c-api/typeobj.rst:1529 +msgid "" +"This flag is present in header files, but is not be used. This may be " +"removed in a future version of CPython." +msgstr "" + +#: ../../c-api/typeobj.rst:1537 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " "this type object. This is exposed as the :attr:`~type.__doc__` attribute on " "the type and instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:1497 +#: ../../c-api/typeobj.rst:1543 msgid "This field is *not* inherited by subtypes." msgstr "此欄位不會被子型別繼承。" -#: ../../c-api/typeobj.rst:1504 +#: ../../c-api/typeobj.rst:1550 msgid "" "An optional pointer to a traversal function for the garbage collector. This " "is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1507 +#: ../../c-api/typeobj.rst:1553 msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "int tp_traverse(PyObject *self, visitproc visit, void *arg);" -#: ../../c-api/typeobj.rst:1509 ../../c-api/typeobj.rst:1736 +#: ../../c-api/typeobj.rst:1555 ../../c-api/typeobj.rst:1782 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1512 +#: ../../c-api/typeobj.rst:1558 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " "collector to detect reference cycles. A typical implementation of a :c:" @@ -2578,7 +2621,7 @@ msgid "" "`!_thread` extension module::" msgstr "" -#: ../../c-api/typeobj.rst:1518 +#: ../../c-api/typeobj.rst:1564 msgid "" "static int\n" "local_traverse(PyObject *op, visitproc visit, void *arg)\n" @@ -2600,7 +2643,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1528 +#: ../../c-api/typeobj.rst:1574 msgid "" "Note that :c:func:`Py_VISIT` is called only on those members that can " "participate in reference cycles. Although there is also a ``self->key`` " @@ -2608,29 +2651,29 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../c-api/typeobj.rst:1532 +#: ../../c-api/typeobj.rst:1578 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -#: ../../c-api/typeobj.rst:1536 +#: ../../c-api/typeobj.rst:1582 msgid "" "Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" msgstr "" -#: ../../c-api/typeobj.rst:1538 +#: ../../c-api/typeobj.rst:1584 msgid "Py_VISIT(Py_TYPE(self));" msgstr "Py_VISIT(Py_TYPE(self));" -#: ../../c-api/typeobj.rst:1540 +#: ../../c-api/typeobj.rst:1586 msgid "" "It is only needed since Python 3.9. To support Python 3.8 and older, this " "line must be conditional::" msgstr "" -#: ../../c-api/typeobj.rst:1543 +#: ../../c-api/typeobj.rst:1589 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " Py_VISIT(Py_TYPE(self));\n" @@ -2640,18 +2683,18 @@ msgstr "" " Py_VISIT(Py_TYPE(self));\n" "#endif" -#: ../../c-api/typeobj.rst:1547 +#: ../../c-api/typeobj.rst:1593 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" "`PyObject_VisitManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1551 +#: ../../c-api/typeobj.rst:1597 msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" msgstr "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" -#: ../../c-api/typeobj.rst:1554 +#: ../../c-api/typeobj.rst:1600 msgid "" "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " "that the instance *owns* (by having :term:`strong references ` hold a reference to " "their type. Their traversal function must therefore either visit :c:func:" @@ -2687,20 +2730,20 @@ msgid "" "superclass). If they do not, the type object may not be garbage-collected." msgstr "" -#: ../../c-api/typeobj.rst:1583 +#: ../../c-api/typeobj.rst:1629 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` function can be called from any " "thread." msgstr ":c:member:`~PyTypeObject.tp_traverse` 函式可以從任何執行緒呼叫。" -#: ../../c-api/typeobj.rst:1588 +#: ../../c-api/typeobj.rst:1634 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1597 +#: ../../c-api/typeobj.rst:1643 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" @@ -2708,15 +2751,15 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1607 +#: ../../c-api/typeobj.rst:1653 msgid "An optional pointer to a clear function. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1609 +#: ../../c-api/typeobj.rst:1655 msgid "int tp_clear(PyObject *);" msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1611 +#: ../../c-api/typeobj.rst:1657 msgid "" "The purpose of this function is to break reference cycles that are causing " "a :term:`cyclic isolate` so that the objects can be safely destroyed. A " @@ -2724,7 +2767,7 @@ msgid "" "to satisfy design invariants held during normal use." msgstr "" -#: ../../c-api/typeobj.rst:1616 +#: ../../c-api/typeobj.rst:1662 msgid "" ":c:member:`!tp_clear` does not need to delete references to objects that " "can't participate in reference cycles, such as Python strings or Python " @@ -2735,44 +2778,44 @@ msgid "" "func:`Py_CLEAR`.)" msgstr "" -#: ../../c-api/typeobj.rst:1624 +#: ../../c-api/typeobj.rst:1670 msgid "" "Any non-trivial cleanup should be performed in :c:member:`~PyTypeObject." "tp_finalize` instead of :c:member:`!tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1629 +#: ../../c-api/typeobj.rst:1675 msgid "" "If :c:member:`!tp_clear` fails to break a reference cycle then the objects " "in the :term:`cyclic isolate` may remain indefinitely uncollectable " "(\"leak\"). See :data:`gc.garbage`." msgstr "" -#: ../../c-api/typeobj.rst:1635 +#: ../../c-api/typeobj.rst:1681 msgid "" "Referents (direct and indirect) might have already been cleared; they are " "not guaranteed to be in a consistent state." msgstr "" -#: ../../c-api/typeobj.rst:1640 +#: ../../c-api/typeobj.rst:1686 msgid "" "The :c:member:`~PyTypeObject.tp_clear` function can be called from any " "thread." msgstr ":c:member:`~PyTypeObject.tp_clear` 函式可以從任何執行緒呼叫。" -#: ../../c-api/typeobj.rst:1645 +#: ../../c-api/typeobj.rst:1691 msgid "" "An object is not guaranteed to be automatically cleared before its " "destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called." msgstr "" -#: ../../c-api/typeobj.rst:1648 +#: ../../c-api/typeobj.rst:1694 msgid "" "This function differs from the destructor (:c:member:`~PyTypeObject." "tp_dealloc`) in the following ways:" msgstr "" -#: ../../c-api/typeobj.rst:1651 +#: ../../c-api/typeobj.rst:1697 msgid "" "The purpose of clearing an object is to remove references to other objects " "that might participate in a reference cycle. The purpose of the destructor, " @@ -2782,7 +2825,7 @@ msgid "" "`~PyTypeObject.tp_free`)." msgstr "" -#: ../../c-api/typeobj.rst:1657 +#: ../../c-api/typeobj.rst:1703 msgid "" "When :c:member:`!tp_clear` is called, other objects might still hold " "references to the object being cleared. Because of this, :c:member:`!" @@ -2792,7 +2835,7 @@ msgid "" "object itself by deallocating it." msgstr "" -#: ../../c-api/typeobj.rst:1663 +#: ../../c-api/typeobj.rst:1709 msgid "" ":c:member:`!tp_clear` might never be automatically called. An object's " "destructor, on the other hand, will be automatically called some time after " @@ -2800,20 +2843,20 @@ msgid "" "object or the object is a member of a :term:`cyclic isolate`)." msgstr "" -#: ../../c-api/typeobj.rst:1668 +#: ../../c-api/typeobj.rst:1714 msgid "" "No guarantees are made about when, if, or how often Python automatically " "clears an object, except:" msgstr "" -#: ../../c-api/typeobj.rst:1671 +#: ../../c-api/typeobj.rst:1717 msgid "" "Python will not automatically clear an object if it is reachable, i.e., " "there is a reference to it and it is not a member of a :term:`cyclic " "isolate`." msgstr "" -#: ../../c-api/typeobj.rst:1674 +#: ../../c-api/typeobj.rst:1720 msgid "" "Python will not automatically clear an object if it has not been " "automatically finalized (see :c:member:`~PyTypeObject.tp_finalize`). (If " @@ -2821,14 +2864,14 @@ msgid "" "automatically finalized again before it is cleared.)" msgstr "" -#: ../../c-api/typeobj.rst:1678 +#: ../../c-api/typeobj.rst:1724 msgid "" "If an object is a member of a :term:`cyclic isolate`, Python will not " "automatically clear it if any member of the cyclic isolate has not yet been " "automatically finalized (:c:member:`~PyTypeObject.tp_finalize`)." msgstr "" -#: ../../c-api/typeobj.rst:1681 +#: ../../c-api/typeobj.rst:1727 msgid "" "Python will not destroy an object until after any automatic calls to its :c:" "member:`!tp_clear` function have returned. This ensures that the act of " @@ -2836,20 +2879,20 @@ msgid "" "member:`!tp_clear` is still executing." msgstr "" -#: ../../c-api/typeobj.rst:1685 +#: ../../c-api/typeobj.rst:1731 msgid "" "Python will not automatically call :c:member:`!tp_clear` multiple times " "concurrently." msgstr "" -#: ../../c-api/typeobj.rst:1688 +#: ../../c-api/typeobj.rst:1734 msgid "" "CPython currently only automatically clears objects as needed to break " "reference cycles in a :term:`cyclic isolate`, but future versions might " "clear objects regularly before their destruction." msgstr "" -#: ../../c-api/typeobj.rst:1692 +#: ../../c-api/typeobj.rst:1738 msgid "" "Taken together, all :c:member:`~PyTypeObject.tp_clear` functions in the " "system must combine to break all reference cycles. This is subtle, and if " @@ -2862,7 +2905,7 @@ msgid "" "good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1703 +#: ../../c-api/typeobj.rst:1749 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2870,7 +2913,7 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1707 +#: ../../c-api/typeobj.rst:1753 msgid "" "static int\n" "local_clear(PyObject *op)\n" @@ -2894,7 +2937,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1718 +#: ../../c-api/typeobj.rst:1764 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " "delicate: the reference to the contained object must not be released (via :" @@ -2909,18 +2952,18 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1730 +#: ../../c-api/typeobj.rst:1776 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, the clear function must call :c:func:" "`PyObject_ClearManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1734 +#: ../../c-api/typeobj.rst:1780 msgid "PyObject_ClearManagedDict((PyObject*)self);" msgstr "PyObject_ClearManagedDict((PyObject*)self);" -#: ../../c-api/typeobj.rst:1743 +#: ../../c-api/typeobj.rst:1789 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" @@ -2928,22 +2971,22 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1757 +#: ../../c-api/typeobj.rst:1803 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1759 +#: ../../c-api/typeobj.rst:1805 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1761 +#: ../../c-api/typeobj.rst:1807 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: ../../c-api/typeobj.rst:1764 +#: ../../c-api/typeobj.rst:1810 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2951,50 +2994,50 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1769 +#: ../../c-api/typeobj.rst:1815 msgid "" "The following constants are defined to be used as the third argument for :c:" "member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" msgstr "" -#: ../../c-api/typeobj.rst:1775 +#: ../../c-api/typeobj.rst:1821 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1775 +#: ../../c-api/typeobj.rst:1821 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1777 +#: ../../c-api/typeobj.rst:1823 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1779 +#: ../../c-api/typeobj.rst:1825 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1781 +#: ../../c-api/typeobj.rst:1827 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1783 +#: ../../c-api/typeobj.rst:1829 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1785 +#: ../../c-api/typeobj.rst:1831 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1787 +#: ../../c-api/typeobj.rst:1833 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1790 +#: ../../c-api/typeobj.rst:1836 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1794 +#: ../../c-api/typeobj.rst:1840 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -3002,15 +3045,15 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1800 +#: ../../c-api/typeobj.rst:1846 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: ../../c-api/typeobj.rst:1802 +#: ../../c-api/typeobj.rst:1848 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1810 +#: ../../c-api/typeobj.rst:1856 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" @@ -3018,7 +3061,7 @@ msgid "" "tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1817 +#: ../../c-api/typeobj.rst:1863 msgid "" ":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." "tp_richcompare` implementation, which may be inherited. However, if only :c:" @@ -3027,13 +3070,13 @@ msgid "" "comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1826 +#: ../../c-api/typeobj.rst:1872 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1829 +#: ../../c-api/typeobj.rst:1875 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " @@ -3043,19 +3086,19 @@ msgid "" "`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1836 +#: ../../c-api/typeobj.rst:1882 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1839 +#: ../../c-api/typeobj.rst:1885 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1844 +#: ../../c-api/typeobj.rst:1890 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -3064,7 +3107,7 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1851 +#: ../../c-api/typeobj.rst:1897 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." @@ -3072,32 +3115,32 @@ msgid "" "unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1861 +#: ../../c-api/typeobj.rst:1907 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " "object. Its presence normally signals that the instances of this type are :" "term:`iterable` (although sequences may be iterable without this function)." msgstr "" -#: ../../c-api/typeobj.rst:1865 +#: ../../c-api/typeobj.rst:1911 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1867 +#: ../../c-api/typeobj.rst:1913 msgid "PyObject *tp_iter(PyObject *self);" msgstr "PyObject *tp_iter(PyObject *self);" -#: ../../c-api/typeobj.rst:1878 +#: ../../c-api/typeobj.rst:1924 msgid "" "An optional pointer to a function that returns the next item in an :term:" "`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1881 +#: ../../c-api/typeobj.rst:1927 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "PyObject *tp_iternext(PyObject *self);" -#: ../../c-api/typeobj.rst:1883 +#: ../../c-api/typeobj.rst:1929 msgid "" "When the iterator is exhausted, it must return ``NULL``; a :exc:" "`StopIteration` exception may or may not be set. When another error occurs, " @@ -3105,74 +3148,74 @@ msgid "" "this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1888 +#: ../../c-api/typeobj.rst:1934 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: ../../c-api/typeobj.rst:1892 +#: ../../c-api/typeobj.rst:1938 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1903 +#: ../../c-api/typeobj.rst:1949 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: ../../c-api/typeobj.rst:1906 +#: ../../c-api/typeobj.rst:1952 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1911 +#: ../../c-api/typeobj.rst:1957 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1919 +#: ../../c-api/typeobj.rst:1965 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMemberDef` structures, declaring regular data members (fields or slots) " "of instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1923 +#: ../../c-api/typeobj.rst:1969 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1928 +#: ../../c-api/typeobj.rst:1974 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1936 +#: ../../c-api/typeobj.rst:1982 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyGetSetDef` structures, declaring computed attributes of instances of this " "type." msgstr "" -#: ../../c-api/typeobj.rst:1939 +#: ../../c-api/typeobj.rst:1985 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1944 +#: ../../c-api/typeobj.rst:1990 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1952 +#: ../../c-api/typeobj.rst:1998 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -3180,7 +3223,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1960 +#: ../../c-api/typeobj.rst:2006 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -3188,7 +3231,7 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1965 +#: ../../c-api/typeobj.rst:2011 msgid "" "However, the unary '&' operator applied to a non-static variable like :c:" "data:`PyBaseObject_Type` is not required to produce an address constant. " @@ -3196,27 +3239,27 @@ msgid "" "strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1971 +#: ../../c-api/typeobj.rst:2017 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1976 +#: ../../c-api/typeobj.rst:2022 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1980 +#: ../../c-api/typeobj.rst:2026 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1986 +#: ../../c-api/typeobj.rst:2032 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1988 +#: ../../c-api/typeobj.rst:2034 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " @@ -3227,73 +3270,73 @@ msgid "" "be treated as read-only." msgstr "" -#: ../../c-api/typeobj.rst:1996 +#: ../../c-api/typeobj.rst:2042 msgid "" "Some types may not store their dictionary in this slot. Use :c:func:" "`PyType_GetDict` to retrieve the dictionary for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:2002 +#: ../../c-api/typeobj.rst:2048 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " "Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" "func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:2008 +#: ../../c-api/typeobj.rst:2054 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:2013 +#: ../../c-api/typeobj.rst:2059 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:2018 +#: ../../c-api/typeobj.rst:2064 msgid "" "It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" "member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: ../../c-api/typeobj.rst:2026 +#: ../../c-api/typeobj.rst:2072 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:2028 ../../c-api/typeobj.rst:2046 -#: ../../c-api/typeobj.rst:2112 ../../c-api/typeobj.rst:2144 -#: ../../c-api/typeobj.rst:2169 +#: ../../c-api/typeobj.rst:2074 ../../c-api/typeobj.rst:2092 +#: ../../c-api/typeobj.rst:2158 ../../c-api/typeobj.rst:2190 +#: ../../c-api/typeobj.rst:2215 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2030 +#: ../../c-api/typeobj.rst:2076 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" -#: ../../c-api/typeobj.rst:2043 +#: ../../c-api/typeobj.rst:2089 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:2048 +#: ../../c-api/typeobj.rst:2094 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" msgstr "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" -#: ../../c-api/typeobj.rst:2050 +#: ../../c-api/typeobj.rst:2096 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:2061 +#: ../../c-api/typeobj.rst:2107 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:2064 +#: ../../c-api/typeobj.rst:2110 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " @@ -3301,19 +3344,19 @@ msgid "" "func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:2069 +#: ../../c-api/typeobj.rst:2115 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:2072 +#: ../../c-api/typeobj.rst:2118 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: ../../c-api/typeobj.rst:2074 +#: ../../c-api/typeobj.rst:2120 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" "only. To get the pointer to the dictionary call :c:func:" @@ -3322,13 +3365,13 @@ msgid "" "to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:2080 +#: ../../c-api/typeobj.rst:2126 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit and :c:" "member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: ../../c-api/typeobj.rst:2085 +#: ../../c-api/typeobj.rst:2131 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " @@ -3336,25 +3379,25 @@ msgid "" "`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: ../../c-api/typeobj.rst:2092 +#: ../../c-api/typeobj.rst:2138 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" -#: ../../c-api/typeobj.rst:2095 +#: ../../c-api/typeobj.rst:2141 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " "will be set to ``-1``, to indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:2105 +#: ../../c-api/typeobj.rst:2151 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:2107 +#: ../../c-api/typeobj.rst:2153 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -3362,18 +3405,18 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:2114 +#: ../../c-api/typeobj.rst:2160 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:2116 +#: ../../c-api/typeobj.rst:2162 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " "arguments represent positional and keyword arguments of the call to :meth:" "`~object.__init__`." msgstr "" -#: ../../c-api/typeobj.rst:2120 +#: ../../c-api/typeobj.rst:2166 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " "when an instance is created normally by calling its type, after the type's :" @@ -3385,53 +3428,53 @@ msgid "" "subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:2127 +#: ../../c-api/typeobj.rst:2173 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:2135 +#: ../../c-api/typeobj.rst:2181 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:2142 +#: ../../c-api/typeobj.rst:2188 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:2146 +#: ../../c-api/typeobj.rst:2192 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:2150 +#: ../../c-api/typeobj.rst:2196 msgid "" "Static subtypes inherit this slot, which will be :c:func:" "`PyType_GenericAlloc` if inherited from :class:`object`." msgstr "" -#: ../../c-api/typeobj.rst:2153 ../../c-api/typeobj.rst:2224 +#: ../../c-api/typeobj.rst:2199 ../../c-api/typeobj.rst:2270 msgid ":ref:`Heap subtypes ` do not inherit this slot." msgstr "" -#: ../../c-api/typeobj.rst:2157 +#: ../../c-api/typeobj.rst:2203 msgid "" "For heap subtypes, this field is always set to :c:func:`PyType_GenericAlloc`." msgstr "" -#: ../../c-api/typeobj.rst:2160 ../../c-api/typeobj.rst:2232 +#: ../../c-api/typeobj.rst:2206 ../../c-api/typeobj.rst:2278 msgid "For static subtypes, this slot is inherited (see above)." msgstr "" -#: ../../c-api/typeobj.rst:2167 +#: ../../c-api/typeobj.rst:2213 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:2171 +#: ../../c-api/typeobj.rst:2217 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:2173 +#: ../../c-api/typeobj.rst:2219 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " @@ -3440,7 +3483,7 @@ msgid "" "that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:2179 +#: ../../c-api/typeobj.rst:2225 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " @@ -3452,20 +3495,20 @@ msgid "" "be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:2187 +#: ../../c-api/typeobj.rst:2233 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:2192 +#: ../../c-api/typeobj.rst:2238 msgid "" "This field is inherited by subtypes, except it is not inherited by :ref:" "`static types ` whose :c:member:`~PyTypeObject.tp_base` is " "``NULL`` or ``&PyBaseObject_Type``." msgstr "" -#: ../../c-api/typeobj.rst:2198 +#: ../../c-api/typeobj.rst:2244 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -3473,22 +3516,22 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:2208 +#: ../../c-api/typeobj.rst:2254 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2210 +#: ../../c-api/typeobj.rst:2256 msgid "void tp_free(void *self);" msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:2212 +#: ../../c-api/typeobj.rst:2258 msgid "" "This function must free the memory allocated by :c:member:`~PyTypeObject." "tp_alloc`." msgstr "" -#: ../../c-api/typeobj.rst:2217 +#: ../../c-api/typeobj.rst:2263 msgid "" "Static subtypes inherit this slot, which will be :c:func:`PyObject_Free` if " "inherited from :class:`object`. Exception: If the type supports garbage " @@ -3497,18 +3540,18 @@ msgid "" "this slot is not inherited but instead defaults to :c:func:`PyObject_GC_Del`." msgstr "" -#: ../../c-api/typeobj.rst:2228 +#: ../../c-api/typeobj.rst:2274 msgid "" "For :ref:`heap subtypes `, this slot defaults to a deallocator " "suitable to match :c:func:`PyType_GenericAlloc` and the value of the :c:" "macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" -#: ../../c-api/typeobj.rst:2239 +#: ../../c-api/typeobj.rst:2285 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:2241 +#: ../../c-api/typeobj.rst:2287 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " @@ -3520,93 +3563,93 @@ msgid "" "instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2249 +#: ../../c-api/typeobj.rst:2295 msgid "int tp_is_gc(PyObject *self);" msgstr "int tp_is_gc(PyObject *self);" -#: ../../c-api/typeobj.rst:2251 +#: ../../c-api/typeobj.rst:2297 msgid "" "(The only example of this are types themselves. The metatype, :c:data:" "`PyType_Type`, defines this function to distinguish between statically and :" "ref:`dynamically allocated types `.)" msgstr "" -#: ../../c-api/typeobj.rst:2261 +#: ../../c-api/typeobj.rst:2307 msgid "" "This slot has no default. If this field is ``NULL``, :c:macro:" "`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: ../../c-api/typeobj.rst:2269 +#: ../../c-api/typeobj.rst:2315 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:2271 ../../c-api/typeobj.rst:2295 +#: ../../c-api/typeobj.rst:2317 ../../c-api/typeobj.rst:2341 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized `." msgstr "" -#: ../../c-api/typeobj.rst:2274 +#: ../../c-api/typeobj.rst:2320 msgid "" "For dynamically created classes, the :c:data:`Py_tp_bases` :c:type:`slot " "` can be used instead of the *bases* argument of :c:func:" "`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:2281 +#: ../../c-api/typeobj.rst:2327 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" -#: ../../c-api/typeobj.rst:2287 ../../c-api/typeobj.rst:2310 -#: ../../c-api/typeobj.rst:2327 ../../c-api/typeobj.rst:2344 -#: ../../c-api/typeobj.rst:2360 +#: ../../c-api/typeobj.rst:2333 ../../c-api/typeobj.rst:2356 +#: ../../c-api/typeobj.rst:2373 ../../c-api/typeobj.rst:2390 +#: ../../c-api/typeobj.rst:2406 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:2292 +#: ../../c-api/typeobj.rst:2338 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: ../../c-api/typeobj.rst:2300 +#: ../../c-api/typeobj.rst:2346 msgid "" "This field is not inherited; it is calculated fresh by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2306 +#: ../../c-api/typeobj.rst:2352 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2315 +#: ../../c-api/typeobj.rst:2361 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: ../../c-api/typeobj.rst:2317 +#: ../../c-api/typeobj.rst:2363 msgid "" "To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__`." msgstr "" -#: ../../c-api/typeobj.rst:2322 +#: ../../c-api/typeobj.rst:2368 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" -#: ../../c-api/typeobj.rst:2332 +#: ../../c-api/typeobj.rst:2378 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2337 +#: ../../c-api/typeobj.rst:2383 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " @@ -3614,27 +3657,27 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: ../../c-api/typeobj.rst:2351 +#: ../../c-api/typeobj.rst:2397 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "此欄位已被棄用。請改用 :c:member:`~PyTypeObject.tp_finalize`。" -#: ../../c-api/typeobj.rst:2356 +#: ../../c-api/typeobj.rst:2402 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2367 +#: ../../c-api/typeobj.rst:2413 msgid "" "An optional pointer to an instance finalization function. This is the C " "implementation of the :meth:`~object.__del__` special method. Its signature " "is::" msgstr "" -#: ../../c-api/typeobj.rst:2371 +#: ../../c-api/typeobj.rst:2417 msgid "void tp_finalize(PyObject *self);" msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2373 +#: ../../c-api/typeobj.rst:2419 msgid "" "The primary purpose of finalization is to perform any non-trivial cleanup " "that must be performed before the object is destroyed, while the object and " @@ -3642,7 +3685,7 @@ msgid "" "consistent state. The finalizer is allowed to execute arbitrary Python code." msgstr "" -#: ../../c-api/typeobj.rst:2379 +#: ../../c-api/typeobj.rst:2425 msgid "" "Before Python automatically finalizes an object, some of the object's direct " "or indirect referents might have themselves been automatically finalized. " @@ -3650,14 +3693,14 @@ msgid "" "member:`~PyTypeObject.tp_clear`) yet." msgstr "" -#: ../../c-api/typeobj.rst:2384 +#: ../../c-api/typeobj.rst:2430 msgid "" "Other non-finalized objects might still be using a finalized object, so the " "finalizer must leave the object in a sane state (e.g., invariants are still " "met)." msgstr "" -#: ../../c-api/typeobj.rst:2390 +#: ../../c-api/typeobj.rst:2436 msgid "" "After Python automatically finalizes an object, Python might start " "automatically clearing (:c:member:`~PyTypeObject.tp_clear`) the object and " @@ -3666,7 +3709,7 @@ msgid "" "cleared referents." msgstr "" -#: ../../c-api/typeobj.rst:2398 +#: ../../c-api/typeobj.rst:2444 msgid "" "An object is not guaranteed to be automatically finalized before its " "destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called. It is " @@ -3675,25 +3718,25 @@ msgid "" "finalized before destruction." msgstr "" -#: ../../c-api/typeobj.rst:2406 +#: ../../c-api/typeobj.rst:2452 msgid "" "The :c:member:`~PyTypeObject.tp_finalize` function can be called from any " "thread, although the :term:`GIL` will be held." msgstr "" -#: ../../c-api/typeobj.rst:2411 +#: ../../c-api/typeobj.rst:2457 msgid "" "The :c:member:`!tp_finalize` function can be called during shutdown, after " "some global variables have been deleted. See the documentation of the :meth:" "`~object.__del__` method for details." msgstr "" -#: ../../c-api/typeobj.rst:2415 +#: ../../c-api/typeobj.rst:2461 msgid "" "When Python finalizes an object, it behaves like the following algorithm:" msgstr "" -#: ../../c-api/typeobj.rst:2417 +#: ../../c-api/typeobj.rst:2463 msgid "" "Python might mark the object as *finalized*. Currently, Python always marks " "objects whose type supports garbage collection (i.e., the :c:macro:" @@ -3701,13 +3744,13 @@ msgid "" "never marks other types of objects; this might change in a future version." msgstr "" -#: ../../c-api/typeobj.rst:2422 +#: ../../c-api/typeobj.rst:2468 msgid "" "If the object is not marked as *finalized* and its :c:member:`!tp_finalize` " "finalizer function is non-``NULL``, the finalizer function is called." msgstr "" -#: ../../c-api/typeobj.rst:2425 +#: ../../c-api/typeobj.rst:2471 msgid "" "If the finalizer function was called and the finalizer made the object " "reachable (i.e., there is a reference to the object and it is not a member " @@ -3717,7 +3760,7 @@ msgid "" "make it reachable, i.e., the object is (still) a member of a cyclic isolate." msgstr "" -#: ../../c-api/typeobj.rst:2432 +#: ../../c-api/typeobj.rst:2478 msgid "" "If the finalizer resurrected the object, the object's pending destruction is " "canceled and the object's *finalized* mark might be removed if present. " @@ -3725,7 +3768,7 @@ msgid "" "future version." msgstr "" -#: ../../c-api/typeobj.rst:2437 +#: ../../c-api/typeobj.rst:2483 msgid "" "*Automatic finalization* refers to any finalization performed by Python " "except via calls to :c:func:`PyObject_CallFinalizer` or :c:func:" @@ -3733,14 +3776,14 @@ msgid "" "or how often an object is automatically finalized, except:" msgstr "" -#: ../../c-api/typeobj.rst:2442 +#: ../../c-api/typeobj.rst:2488 msgid "" "Python will not automatically finalize an object if it is reachable, i.e., " "there is a reference to it and it is not a member of a :term:`cyclic " "isolate`." msgstr "" -#: ../../c-api/typeobj.rst:2445 +#: ../../c-api/typeobj.rst:2491 msgid "" "Python will not automatically finalize an object if finalizing it would not " "mark the object as *finalized*. Currently, this applies to objects whose " @@ -3750,53 +3793,53 @@ msgid "" "`PyObject_CallFinalizerFromDealloc`." msgstr "" -#: ../../c-api/typeobj.rst:2451 +#: ../../c-api/typeobj.rst:2497 msgid "" "Python will not automatically finalize any two members of a :term:`cyclic " "isolate` concurrently." msgstr "" -#: ../../c-api/typeobj.rst:2453 +#: ../../c-api/typeobj.rst:2499 msgid "" "Python will not automatically finalize an object after it has automatically " "cleared (:c:member:`~PyTypeObject.tp_clear`) the object." msgstr "" -#: ../../c-api/typeobj.rst:2455 +#: ../../c-api/typeobj.rst:2501 msgid "" "If an object is a member of a :term:`cyclic isolate`, Python will not " "automatically finalize it after automatically clearing (see :c:member:" "`~PyTypeObject.tp_clear`) any other member." msgstr "" -#: ../../c-api/typeobj.rst:2458 +#: ../../c-api/typeobj.rst:2504 msgid "" "Python will automatically finalize every member of a :term:`cyclic isolate` " "before it automatically clears (see :c:member:`~PyTypeObject.tp_clear`) any " "of them." msgstr "" -#: ../../c-api/typeobj.rst:2461 +#: ../../c-api/typeobj.rst:2507 msgid "" "If Python is going to automatically clear an object (:c:member:" "`~PyTypeObject.tp_clear`), it will automatically finalize the object first." msgstr "" -#: ../../c-api/typeobj.rst:2465 +#: ../../c-api/typeobj.rst:2511 msgid "" "Python currently only automatically finalizes objects that are members of a :" "term:`cyclic isolate`, but future versions might finalize objects regularly " "before their destruction." msgstr "" -#: ../../c-api/typeobj.rst:2469 +#: ../../c-api/typeobj.rst:2515 msgid "" "To manually finalize an object, do not call this function directly; call :c:" "func:`PyObject_CallFinalizer` or :c:func:`PyObject_CallFinalizerFromDealloc` " "instead." msgstr "" -#: ../../c-api/typeobj.rst:2473 +#: ../../c-api/typeobj.rst:2519 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should leave the current exception " "status unchanged. The recommended way to write a non-trivial finalizer is " @@ -3807,7 +3850,7 @@ msgid "" "`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. For example::" msgstr "" -#: ../../c-api/typeobj.rst:2482 +#: ../../c-api/typeobj.rst:2528 msgid "" "static void\n" "foo_finalize(PyObject *self)\n" @@ -3830,26 +3873,26 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:2510 +#: ../../c-api/typeobj.rst:2556 msgid "" "Before version 3.8 it was necessary to set the :c:macro:" "`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " "This is no longer required." msgstr "" -#: ../../c-api/typeobj.rst:2516 +#: ../../c-api/typeobj.rst:2562 msgid ":pep:`442`: \"Safe object finalization\"" msgstr "" -#: ../../c-api/typeobj.rst:2519 +#: ../../c-api/typeobj.rst:2565 msgid ":c:func:`PyObject_CallFinalizer`" msgstr ":c:func:`PyObject_CallFinalizer`" -#: ../../c-api/typeobj.rst:2520 +#: ../../c-api/typeobj.rst:2566 msgid ":c:func:`PyObject_CallFinalizerFromDealloc`" msgstr ":c:func:`PyObject_CallFinalizerFromDealloc`" -#: ../../c-api/typeobj.rst:2527 +#: ../../c-api/typeobj.rst:2573 msgid "" "A :ref:`vectorcall function ` to use for calls of this type " "object (rather than instances). In other words, ``tp_vectorcall`` can be " @@ -3857,13 +3900,13 @@ msgid "" "of *type*." msgstr "" -#: ../../c-api/typeobj.rst:2532 +#: ../../c-api/typeobj.rst:2578 msgid "" "As with any vectorcall function, if ``tp_vectorcall`` is ``NULL``, the " "*tp_call* protocol (``Py_TYPE(type)->tp_call``) is used instead." msgstr "" -#: ../../c-api/typeobj.rst:2537 +#: ../../c-api/typeobj.rst:2583 msgid "" "The :ref:`vectorcall protocol ` requires that the vectorcall " "function has the same behavior as the corresponding ``tp_call``. This means " @@ -3871,27 +3914,27 @@ msgid "" ">tp_call``." msgstr "" -#: ../../c-api/typeobj.rst:2542 +#: ../../c-api/typeobj.rst:2588 msgid "" "Specifically, if *type* uses the default metaclass, ``type->tp_vectorcall`` " "must behave the same as :c:expr:`PyType_Type->tp_call`, which:" msgstr "" -#: ../../c-api/typeobj.rst:2546 +#: ../../c-api/typeobj.rst:2592 msgid "calls ``type->tp_new``," msgstr "呼叫 ``type->tp_new``," -#: ../../c-api/typeobj.rst:2548 +#: ../../c-api/typeobj.rst:2594 msgid "" "if the result is a subclass of *type*, calls ``type->tp_init`` on the result " "of ``tp_new``, and" msgstr "" -#: ../../c-api/typeobj.rst:2551 +#: ../../c-api/typeobj.rst:2597 msgid "returns the result of ``tp_new``." msgstr "回傳 ``tp_new`` 的結果。" -#: ../../c-api/typeobj.rst:2553 +#: ../../c-api/typeobj.rst:2599 msgid "" "Typically, ``tp_vectorcall`` is overridden to optimize this process for " "specific :c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject." @@ -3900,65 +3943,65 @@ msgid "" "__init__`, respectively)." msgstr "" -#: ../../c-api/typeobj.rst:2564 +#: ../../c-api/typeobj.rst:2610 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2566 +#: ../../c-api/typeobj.rst:2612 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2571 +#: ../../c-api/typeobj.rst:2617 msgid "Internal. Do not use." msgstr "" -#: ../../c-api/typeobj.rst:2579 +#: ../../c-api/typeobj.rst:2625 msgid "Static Types" msgstr "靜態型別" -#: ../../c-api/typeobj.rst:2581 +#: ../../c-api/typeobj.rst:2627 msgid "" "Traditionally, types defined in C code are *static*, that is, a static :c:" "type:`PyTypeObject` structure is defined directly in code and initialized " "using :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2585 +#: ../../c-api/typeobj.rst:2631 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2587 +#: ../../c-api/typeobj.rst:2633 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2589 +#: ../../c-api/typeobj.rst:2635 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: ../../c-api/typeobj.rst:2591 +#: ../../c-api/typeobj.rst:2637 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2595 +#: ../../c-api/typeobj.rst:2641 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" -#: ../../c-api/typeobj.rst:2603 +#: ../../c-api/typeobj.rst:2649 msgid "Heap Types" msgstr "堆積型別" -#: ../../c-api/typeobj.rst:2605 +#: ../../c-api/typeobj.rst:2651 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " @@ -3966,29 +4009,29 @@ msgid "" "`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2610 +#: ../../c-api/typeobj.rst:2656 msgid "" "This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" "func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" "`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:2618 +#: ../../c-api/typeobj.rst:2664 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2625 +#: ../../c-api/typeobj.rst:2671 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: ../../c-api/typeobj.rst:2631 ../../c-api/typeobj.rst:3087 +#: ../../c-api/typeobj.rst:2677 ../../c-api/typeobj.rst:3133 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2633 +#: ../../c-api/typeobj.rst:2679 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -4076,7 +4119,7 @@ msgstr "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" -#: ../../c-api/typeobj.rst:2678 +#: ../../c-api/typeobj.rst:2724 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -4086,31 +4129,31 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2687 +#: ../../c-api/typeobj.rst:2733 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" -#: ../../c-api/typeobj.rst:2838 +#: ../../c-api/typeobj.rst:2884 msgid "Mapping Object Structures" msgstr "對映物件結構" -#: ../../c-api/typeobj.rst:2845 +#: ../../c-api/typeobj.rst:2891 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: ../../c-api/typeobj.rst:2852 +#: ../../c-api/typeobj.rst:2898 msgid "" "This function is used by :c:func:`PyMapping_Size` and :c:func:" "`PyObject_Size`, and has the same signature. This slot may be set to " "``NULL`` if the object has no defined length." msgstr "" -#: ../../c-api/typeobj.rst:2860 +#: ../../c-api/typeobj.rst:2906 msgid "" "This function is used by :c:func:`PyObject_GetItem` and :c:func:" "`PySequence_GetSlice`, and has the same signature as :c:func:`!" @@ -4118,7 +4161,7 @@ msgid "" "`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2870 +#: ../../c-api/typeobj.rst:2916 msgid "" "This function is used by :c:func:`PyObject_SetItem`, :c:func:" "`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" @@ -4128,17 +4171,17 @@ msgid "" "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2881 +#: ../../c-api/typeobj.rst:2927 msgid "Sequence Object Structures" msgstr "序列物件結構" -#: ../../c-api/typeobj.rst:2888 +#: ../../c-api/typeobj.rst:2934 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2895 +#: ../../c-api/typeobj.rst:2941 msgid "" "This function is used by :c:func:`PySequence_Size` and :c:func:" "`PyObject_Size`, and has the same signature. It is also used for handling " @@ -4146,21 +4189,21 @@ msgid "" "member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2904 +#: ../../c-api/typeobj.rst:2950 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2912 +#: ../../c-api/typeobj.rst:2958 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2920 +#: ../../c-api/typeobj.rst:2966 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -4169,7 +4212,7 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2926 +#: ../../c-api/typeobj.rst:2972 msgid "" "Negative indexes are handled as follows: if the :c:member:" "`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " @@ -4178,7 +4221,7 @@ msgid "" "index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2935 +#: ../../c-api/typeobj.rst:2981 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " "signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" @@ -4187,14 +4230,14 @@ msgid "" "``NULL`` if the object does not support item assignment and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2946 +#: ../../c-api/typeobj.rst:2992 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: ../../c-api/typeobj.rst:2955 +#: ../../c-api/typeobj.rst:3001 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -4204,7 +4247,7 @@ msgid "" "c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2966 +#: ../../c-api/typeobj.rst:3012 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -4214,76 +4257,76 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2977 +#: ../../c-api/typeobj.rst:3023 msgid "Buffer Object Structures" msgstr "緩衝區物件結構" -#: ../../c-api/typeobj.rst:2985 +#: ../../c-api/typeobj.rst:3031 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol `. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: ../../c-api/typeobj.rst:2993 ../../c-api/typeobj.rst:3044 -#: ../../c-api/typeobj.rst:3100 ../../c-api/typeobj.rst:3113 -#: ../../c-api/typeobj.rst:3127 ../../c-api/typeobj.rst:3139 +#: ../../c-api/typeobj.rst:3039 ../../c-api/typeobj.rst:3090 +#: ../../c-api/typeobj.rst:3146 ../../c-api/typeobj.rst:3159 +#: ../../c-api/typeobj.rst:3173 ../../c-api/typeobj.rst:3185 msgid "The signature of this function is::" msgstr "函式的簽名為: ::" -#: ../../c-api/typeobj.rst:2995 +#: ../../c-api/typeobj.rst:3041 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" -#: ../../c-api/typeobj.rst:2997 +#: ../../c-api/typeobj.rst:3043 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: ../../c-api/typeobj.rst:3001 +#: ../../c-api/typeobj.rst:3047 msgid "" "Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" "expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:3004 +#: ../../c-api/typeobj.rst:3050 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:3006 +#: ../../c-api/typeobj.rst:3052 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:3008 +#: ../../c-api/typeobj.rst:3054 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:3010 +#: ../../c-api/typeobj.rst:3056 msgid "Return ``0``." msgstr "回傳 ``0``。" -#: ../../c-api/typeobj.rst:3012 +#: ../../c-api/typeobj.rst:3058 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:3015 +#: ../../c-api/typeobj.rst:3061 msgid "" "Re-export: Each member of the tree acts as the exporting object and sets :c:" "expr:`view->obj` to a new reference to itself." msgstr "" -#: ../../c-api/typeobj.rst:3018 +#: ../../c-api/typeobj.rst:3064 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " "Here, :c:expr:`view->obj` will be a new reference to the root object." msgstr "" -#: ../../c-api/typeobj.rst:3022 +#: ../../c-api/typeobj.rst:3068 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -4291,7 +4334,7 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:3027 +#: ../../c-api/typeobj.rst:3073 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " "exporter and must remain valid until there are no consumers left. :c:member:" @@ -4300,23 +4343,23 @@ msgid "" "internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:3034 +#: ../../c-api/typeobj.rst:3080 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: ../../c-api/typeobj.rst:3037 +#: ../../c-api/typeobj.rst:3083 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:3046 +#: ../../c-api/typeobj.rst:3092 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "void (PyObject *exporter, Py_buffer *view);" -#: ../../c-api/typeobj.rst:3048 +#: ../../c-api/typeobj.rst:3094 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -4324,15 +4367,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:3053 +#: ../../c-api/typeobj.rst:3099 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:3055 +#: ../../c-api/typeobj.rst:3101 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:3057 +#: ../../c-api/typeobj.rst:3103 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -4340,30 +4383,30 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:3063 +#: ../../c-api/typeobj.rst:3109 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: ../../c-api/typeobj.rst:3068 +#: ../../c-api/typeobj.rst:3114 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:3076 +#: ../../c-api/typeobj.rst:3122 msgid "Async Object Structures" msgstr "非同步物件結構" -#: ../../c-api/typeobj.rst:3084 +#: ../../c-api/typeobj.rst:3130 msgid "" "This structure holds pointers to the functions required to implement :term:" "`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:3089 +#: ../../c-api/typeobj.rst:3135 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -4379,62 +4422,62 @@ msgstr "" " sendfunc am_send;\n" "} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:3102 +#: ../../c-api/typeobj.rst:3148 msgid "PyObject *am_await(PyObject *self);" msgstr "PyObject *am_await(PyObject *self);" -#: ../../c-api/typeobj.rst:3104 +#: ../../c-api/typeobj.rst:3150 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: ../../c-api/typeobj.rst:3107 +#: ../../c-api/typeobj.rst:3153 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:3115 +#: ../../c-api/typeobj.rst:3161 msgid "PyObject *am_aiter(PyObject *self);" msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:3117 +#: ../../c-api/typeobj.rst:3163 msgid "" "Must return an :term:`asynchronous iterator` object. See :meth:`~object." "__anext__` for details." msgstr "" -#: ../../c-api/typeobj.rst:3120 +#: ../../c-api/typeobj.rst:3166 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:3129 +#: ../../c-api/typeobj.rst:3175 msgid "PyObject *am_anext(PyObject *self);" msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:3131 +#: ../../c-api/typeobj.rst:3177 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:3141 +#: ../../c-api/typeobj.rst:3187 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:3143 +#: ../../c-api/typeobj.rst:3189 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:3152 +#: ../../c-api/typeobj.rst:3198 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:3156 +#: ../../c-api/typeobj.rst:3202 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " @@ -4448,80 +4491,80 @@ msgid "" "length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:3166 +#: ../../c-api/typeobj.rst:3212 msgid "" "This function should not do any other instance initialization, not even to " "allocate additional memory; that should be done by :c:member:`~PyTypeObject." "tp_new`." msgstr "" -#: ../../c-api/typeobj.rst:3173 +#: ../../c-api/typeobj.rst:3219 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:3177 +#: ../../c-api/typeobj.rst:3223 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:3181 +#: ../../c-api/typeobj.rst:3227 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:3185 +#: ../../c-api/typeobj.rst:3231 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:3189 ../../c-api/typeobj.rst:3198 +#: ../../c-api/typeobj.rst:3235 ../../c-api/typeobj.rst:3244 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:3193 ../../c-api/typeobj.rst:3204 +#: ../../c-api/typeobj.rst:3239 ../../c-api/typeobj.rst:3250 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: ../../c-api/typeobj.rst:3200 +#: ../../c-api/typeobj.rst:3246 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:3207 +#: ../../c-api/typeobj.rst:3253 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:3211 +#: ../../c-api/typeobj.rst:3257 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:3215 +#: ../../c-api/typeobj.rst:3261 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:3219 +#: ../../c-api/typeobj.rst:3265 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:3223 +#: ../../c-api/typeobj.rst:3269 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:3227 +#: ../../c-api/typeobj.rst:3273 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:3231 +#: ../../c-api/typeobj.rst:3277 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:3245 +#: ../../c-api/typeobj.rst:3291 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:3261 +#: ../../c-api/typeobj.rst:3307 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:3263 +#: ../../c-api/typeobj.rst:3309 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -4529,11 +4572,11 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:3268 +#: ../../c-api/typeobj.rst:3314 msgid "A basic :ref:`static type `::" msgstr "" -#: ../../c-api/typeobj.rst:3270 +#: ../../c-api/typeobj.rst:3316 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4565,13 +4608,13 @@ msgstr "" " .tp_repr = (reprfunc)myobj_repr,\n" "};" -#: ../../c-api/typeobj.rst:3285 +#: ../../c-api/typeobj.rst:3331 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:3288 +#: ../../c-api/typeobj.rst:3334 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4655,11 +4698,11 @@ msgstr "" " myobj_new, /* tp_new */\n" "};" -#: ../../c-api/typeobj.rst:3329 +#: ../../c-api/typeobj.rst:3375 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:3331 +#: ../../c-api/typeobj.rst:3377 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4685,14 +4728,14 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:3354 +#: ../../c-api/typeobj.rst:3400 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " "instances (e.g. uses a separate factory func) using :c:macro:" "`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: ../../c-api/typeobj.rst:3358 +#: ../../c-api/typeobj.rst:3404 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4710,12 +4753,12 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:3373 +#: ../../c-api/typeobj.rst:3419 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:3375 +#: ../../c-api/typeobj.rst:3421 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4735,13 +4778,13 @@ msgstr "" " .tp_name = \"mymod.MyObject\",\n" "};" -#: ../../c-api/typeobj.rst:3384 +#: ../../c-api/typeobj.rst:3430 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" -#: ../../c-api/typeobj.rst:3386 +#: ../../c-api/typeobj.rst:3432 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" diff --git a/library/stdtypes.po b/library/stdtypes.po index 0d51b5d38e..ee016e14be 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-26 00:17+0000\n" +"POT-Creation-Date: 2026-02-26 18:22+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -139,8 +139,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:292 #: ../../library/stdtypes.rst:432 ../../library/stdtypes.rst:1015 -#: ../../library/stdtypes.rst:1237 ../../library/stdtypes.rst:3113 -#: ../../library/stdtypes.rst:4373 +#: ../../library/stdtypes.rst:1237 ../../library/stdtypes.rst:3130 +#: ../../library/stdtypes.rst:4390 msgid "Notes" msgstr "註解" @@ -154,7 +154,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:90 ../../library/stdtypes.rst:1017 #: ../../library/stdtypes.rst:1020 ../../library/stdtypes.rst:1252 -#: ../../library/stdtypes.rst:3119 ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:3136 ../../library/stdtypes.rst:4396 msgid "\\(1)" msgstr "\\(1)" @@ -168,8 +168,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:93 ../../library/stdtypes.rst:305 #: ../../library/stdtypes.rst:325 ../../library/stdtypes.rst:1263 -#: ../../library/stdtypes.rst:3123 ../../library/stdtypes.rst:3125 -#: ../../library/stdtypes.rst:4383 ../../library/stdtypes.rst:4385 +#: ../../library/stdtypes.rst:3140 ../../library/stdtypes.rst:3142 +#: ../../library/stdtypes.rst:4400 ../../library/stdtypes.rst:4402 msgid "\\(2)" msgstr "\\(2)" @@ -181,18 +181,18 @@ msgstr "``not x``" msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" -#: ../../library/stdtypes.rst:96 ../../library/stdtypes.rst:3127 -#: ../../library/stdtypes.rst:3129 ../../library/stdtypes.rst:3131 -#: ../../library/stdtypes.rst:3133 ../../library/stdtypes.rst:4387 -#: ../../library/stdtypes.rst:4389 ../../library/stdtypes.rst:4391 -#: ../../library/stdtypes.rst:4393 +#: ../../library/stdtypes.rst:96 ../../library/stdtypes.rst:3144 +#: ../../library/stdtypes.rst:3146 ../../library/stdtypes.rst:3148 +#: ../../library/stdtypes.rst:3150 ../../library/stdtypes.rst:4404 +#: ../../library/stdtypes.rst:4406 ../../library/stdtypes.rst:4408 +#: ../../library/stdtypes.rst:4410 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:105 ../../library/stdtypes.rst:336 #: ../../library/stdtypes.rst:450 ../../library/stdtypes.rst:1059 -#: ../../library/stdtypes.rst:1267 ../../library/stdtypes.rst:3159 -#: ../../library/stdtypes.rst:4423 +#: ../../library/stdtypes.rst:1267 ../../library/stdtypes.rst:3176 +#: ../../library/stdtypes.rst:4440 msgid "Notes:" msgstr "註解:" @@ -239,9 +239,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:146 ../../library/stdtypes.rst:3090 -#: ../../library/stdtypes.rst:3113 ../../library/stdtypes.rst:4350 -#: ../../library/stdtypes.rst:4373 +#: ../../library/stdtypes.rst:146 ../../library/stdtypes.rst:3107 +#: ../../library/stdtypes.rst:3130 ../../library/stdtypes.rst:4367 +#: ../../library/stdtypes.rst:4390 msgid "Meaning" msgstr "含義" @@ -420,8 +420,8 @@ msgid "" "has operands of different built-in numeric types, the operand with the " "\"narrower\" type is widened to that of the other:" msgstr "" -"Python 完全支援混和運算:當一個二元運算子的運算元有不同內建數值型別時,「較窄」型" -"別的運算元會被拓寬到另一個型別的運算元:" +"Python 完全支援混和運算:當一個二元運算子的運算元有不同內建數值型別時,「較" +"窄」型別的運算元會被拓寬到另一個型別的運算元:" #: ../../library/stdtypes.rst:274 msgid "If both arguments are complex numbers, no conversion is performed;" @@ -591,8 +591,8 @@ msgid "" "zero." msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" -#: ../../library/stdtypes.rst:318 ../../library/stdtypes.rst:3121 -#: ../../library/stdtypes.rst:4410 +#: ../../library/stdtypes.rst:318 ../../library/stdtypes.rst:3138 +#: ../../library/stdtypes.rst:4427 msgid "\\(6)" msgstr "\\(6)" @@ -629,9 +629,9 @@ msgid "*x* to the power *y*" msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:327 ../../library/stdtypes.rst:329 -#: ../../library/stdtypes.rst:3146 ../../library/stdtypes.rst:3149 -#: ../../library/stdtypes.rst:3152 ../../library/stdtypes.rst:4406 -#: ../../library/stdtypes.rst:4413 +#: ../../library/stdtypes.rst:3163 ../../library/stdtypes.rst:3166 +#: ../../library/stdtypes.rst:3169 ../../library/stdtypes.rst:4423 +#: ../../library/stdtypes.rst:4430 msgid "\\(5)" msgstr "\\(5)" @@ -789,9 +789,9 @@ msgid "bitwise :dfn:`or` of *x* and *y*" msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:437 -#: ../../library/stdtypes.rst:440 ../../library/stdtypes.rst:3135 -#: ../../library/stdtypes.rst:3139 ../../library/stdtypes.rst:4395 -#: ../../library/stdtypes.rst:4399 +#: ../../library/stdtypes.rst:440 ../../library/stdtypes.rst:3152 +#: ../../library/stdtypes.rst:3156 ../../library/stdtypes.rst:4412 +#: ../../library/stdtypes.rst:4416 msgid "\\(4)" msgstr "\\(4)" @@ -3141,7 +3141,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1917 ../../library/stdtypes.rst:3549 +#: ../../library/stdtypes.rst:1917 ../../library/stdtypes.rst:3566 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -3177,11 +3177,11 @@ msgstr "" ">>> encoded_str_to_bytes\n" "b'Python'" -#: ../../library/stdtypes.rst:1940 ../../library/stdtypes.rst:3568 +#: ../../library/stdtypes.rst:1940 ../../library/stdtypes.rst:3585 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1943 ../../library/stdtypes.rst:3571 +#: ../../library/stdtypes.rst:1943 ../../library/stdtypes.rst:3588 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." @@ -3572,8 +3572,9 @@ msgstr "" #: ../../library/stdtypes.rst:2241 ../../library/stdtypes.rst:2268 #: ../../library/stdtypes.rst:2323 ../../library/stdtypes.rst:2396 -#: ../../library/stdtypes.rst:2515 ../../library/stdtypes.rst:2694 -#: ../../library/stdtypes.rst:2716 ../../library/stdtypes.rst:2730 +#: ../../library/stdtypes.rst:2507 ../../library/stdtypes.rst:2528 +#: ../../library/stdtypes.rst:2707 ../../library/stdtypes.rst:2729 +#: ../../library/stdtypes.rst:2743 ../../library/stdtypes.rst:2836 msgid "For example:" msgstr "舉例來說:" @@ -3683,7 +3684,7 @@ msgstr "" ">>> 'Monty Python'.ljust(10, '.')\n" "'Monty Python'" -#: ../../library/stdtypes.rst:2334 +#: ../../library/stdtypes.rst:2334 ../../library/stdtypes.rst:2845 msgid "See also :meth:`rjust`." msgstr "另請參閱 :meth:`rjust`。" @@ -3927,7 +3928,27 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2510 +#: ../../library/stdtypes.rst:2509 +msgid "" +">>> 'Python'.rjust(10)\n" +"' Python'\n" +">>> 'Python'.rjust(10, '.')\n" +"'....Python'\n" +">>> 'Monty Python'.rjust(10, '.')\n" +"'Monty Python'" +msgstr "" +">>> 'Python'.rjust(10)\n" +"' Python'\n" +">>> 'Python'.rjust(10, '.')\n" +"'....Python'\n" +">>> 'Monty Python'.rjust(10, '.')\n" +"'Monty Python'" + +#: ../../library/stdtypes.rst:2518 +msgid "See also :meth:`ljust` and :meth:`zfill`." +msgstr "另請參閱 :meth:`ljust` 和 :meth:`zfill`。" + +#: ../../library/stdtypes.rst:2523 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3935,7 +3956,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2517 +#: ../../library/stdtypes.rst:2530 msgid "" ">>> 'Monty Python'.rpartition(' ')\n" "('Monty', ' ', 'Python')\n" @@ -3951,11 +3972,11 @@ msgstr "" ">>> 'Monty Python'.rpartition('-')\n" "('', '', 'Monty Python')" -#: ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2539 msgid "See also :meth:`partition`." msgstr "另請參閱 :meth:`partition`。" -#: ../../library/stdtypes.rst:2531 +#: ../../library/stdtypes.rst:2544 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -3964,7 +3985,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2540 +#: ../../library/stdtypes.rst:2553 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3973,7 +3994,7 @@ msgid "" "are stripped. For example:" msgstr "" -#: ../../library/stdtypes.rst:2546 +#: ../../library/stdtypes.rst:2559 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -3985,13 +4006,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2553 +#: ../../library/stdtypes.rst:2566 msgid "" "See :meth:`removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2556 +#: ../../library/stdtypes.rst:2569 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -4003,11 +4024,11 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2561 +#: ../../library/stdtypes.rst:2574 msgid "See also :meth:`strip`." msgstr "另請參閱 :meth:`strip`。" -#: ../../library/stdtypes.rst:2566 +#: ../../library/stdtypes.rst:2579 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -4016,7 +4037,7 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2572 +#: ../../library/stdtypes.rst:2585 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " @@ -4026,21 +4047,20 @@ msgid "" "``['']``." msgstr "" -#: ../../library/stdtypes.rst:2579 ../../library/stdtypes.rst:2597 -#: ../../library/stdtypes.rst:2609 ../../library/stdtypes.rst:2663 -#: ../../library/stdtypes.rst:2753 ../../library/stdtypes.rst:2823 -#: ../../library/stdtypes.rst:2918 ../../library/stdtypes.rst:3884 -#: ../../library/stdtypes.rst:3902 ../../library/stdtypes.rst:3992 -#: ../../library/stdtypes.rst:4008 ../../library/stdtypes.rst:4033 -#: ../../library/stdtypes.rst:4047 ../../library/stdtypes.rst:4075 -#: ../../library/stdtypes.rst:4089 ../../library/stdtypes.rst:4107 -#: ../../library/stdtypes.rst:4134 ../../library/stdtypes.rst:4157 -#: ../../library/stdtypes.rst:4184 ../../library/stdtypes.rst:4226 -#: ../../library/stdtypes.rst:4250 +#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:2610 +#: ../../library/stdtypes.rst:2622 ../../library/stdtypes.rst:2676 +#: ../../library/stdtypes.rst:2766 ../../library/stdtypes.rst:2935 +#: ../../library/stdtypes.rst:3901 ../../library/stdtypes.rst:3919 +#: ../../library/stdtypes.rst:4009 ../../library/stdtypes.rst:4025 +#: ../../library/stdtypes.rst:4050 ../../library/stdtypes.rst:4064 +#: ../../library/stdtypes.rst:4092 ../../library/stdtypes.rst:4106 +#: ../../library/stdtypes.rst:4124 ../../library/stdtypes.rst:4151 +#: ../../library/stdtypes.rst:4174 ../../library/stdtypes.rst:4201 +#: ../../library/stdtypes.rst:4243 ../../library/stdtypes.rst:4267 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2581 +#: ../../library/stdtypes.rst:2594 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -4060,7 +4080,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2590 +#: ../../library/stdtypes.rst:2603 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, " @@ -4070,7 +4090,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2599 +#: ../../library/stdtypes.rst:2612 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -4086,13 +4106,13 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2606 +#: ../../library/stdtypes.rst:2619 msgid "" "If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only " "leading runs of consecutive whitespace are considered." msgstr "" -#: ../../library/stdtypes.rst:2611 +#: ../../library/stdtypes.rst:2624 msgid "" ">>> \"\".split(None, 0)\n" "[]\n" @@ -4108,124 +4128,124 @@ msgstr "" ">>> \" foo \".split(maxsplit=0)\n" "['foo ']" -#: ../../library/stdtypes.rst:2618 +#: ../../library/stdtypes.rst:2631 msgid "See also :meth:`join`." msgstr "另請參閱 :meth:`join`。" -#: ../../library/stdtypes.rst:2626 +#: ../../library/stdtypes.rst:2639 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:2630 +#: ../../library/stdtypes.rst:2643 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2634 +#: ../../library/stdtypes.rst:2647 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2634 +#: ../../library/stdtypes.rst:2647 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2636 +#: ../../library/stdtypes.rst:2649 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2636 +#: ../../library/stdtypes.rst:2649 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2638 +#: ../../library/stdtypes.rst:2651 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2638 +#: ../../library/stdtypes.rst:2651 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2640 +#: ../../library/stdtypes.rst:2653 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2640 +#: ../../library/stdtypes.rst:2653 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2642 +#: ../../library/stdtypes.rst:2655 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2642 +#: ../../library/stdtypes.rst:2655 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2644 +#: ../../library/stdtypes.rst:2657 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2644 +#: ../../library/stdtypes.rst:2657 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2646 +#: ../../library/stdtypes.rst:2659 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2646 +#: ../../library/stdtypes.rst:2659 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2648 +#: ../../library/stdtypes.rst:2661 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2648 +#: ../../library/stdtypes.rst:2661 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2650 +#: ../../library/stdtypes.rst:2663 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2650 +#: ../../library/stdtypes.rst:2663 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2652 +#: ../../library/stdtypes.rst:2665 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2652 +#: ../../library/stdtypes.rst:2665 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2654 +#: ../../library/stdtypes.rst:2667 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2654 +#: ../../library/stdtypes.rst:2667 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2656 +#: ../../library/stdtypes.rst:2669 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2656 +#: ../../library/stdtypes.rst:2669 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2661 +#: ../../library/stdtypes.rst:2674 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2665 +#: ../../library/stdtypes.rst:2678 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -4237,14 +4257,14 @@ msgstr "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: ../../library/stdtypes.rst:2670 +#: ../../library/stdtypes.rst:2683 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:2674 +#: ../../library/stdtypes.rst:2687 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -4256,11 +4276,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2679 +#: ../../library/stdtypes.rst:2692 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2681 +#: ../../library/stdtypes.rst:2694 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -4272,7 +4292,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2689 +#: ../../library/stdtypes.rst:2702 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -4280,7 +4300,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2696 +#: ../../library/stdtypes.rst:2709 msgid "" ">>> 'Python'.startswith('Py')\n" "True\n" @@ -4296,11 +4316,11 @@ msgstr "" ">>> 'Python is amazing'.startswith('is', 7)\n" "True" -#: ../../library/stdtypes.rst:2705 +#: ../../library/stdtypes.rst:2718 msgid "See also :meth:`endswith` and :meth:`removeprefix`." msgstr "另請參閱 :meth:`endswith` 和 :meth:`removeprefix`。" -#: ../../library/stdtypes.rst:2710 +#: ../../library/stdtypes.rst:2723 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 " @@ -4309,7 +4329,7 @@ msgid "" "all combinations of its values are stripped." msgstr "" -#: ../../library/stdtypes.rst:2718 +#: ../../library/stdtypes.rst:2731 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -4321,7 +4341,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2725 +#: ../../library/stdtypes.rst:2738 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -4329,7 +4349,7 @@ msgid "" "A similar action takes place on the trailing end." msgstr "" -#: ../../library/stdtypes.rst:2732 +#: ../../library/stdtypes.rst:2745 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -4339,24 +4359,24 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2738 +#: ../../library/stdtypes.rst:2751 msgid "See also :meth:`rstrip`." msgstr "另請參閱 :meth:`rstrip`。" -#: ../../library/stdtypes.rst:2743 +#: ../../library/stdtypes.rst:2756 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:2750 +#: ../../library/stdtypes.rst:2763 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:2755 +#: ../../library/stdtypes.rst:2768 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -4364,7 +4384,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2758 ../../library/stdtypes.rst:4194 +#: ../../library/stdtypes.rst:2771 ../../library/stdtypes.rst:4211 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 " @@ -4372,7 +4392,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2763 +#: ../../library/stdtypes.rst:2776 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -4380,19 +4400,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2766 +#: ../../library/stdtypes.rst:2779 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2769 +#: ../../library/stdtypes.rst:2782 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2772 +#: ../../library/stdtypes.rst:2785 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -4412,11 +4432,11 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2781 +#: ../../library/stdtypes.rst:2794 msgid "See also :meth:`istitle`." msgstr "另請參閱 :meth:`istitle`。" -#: ../../library/stdtypes.rst:2786 +#: ../../library/stdtypes.rst:2799 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 " @@ -4428,19 +4448,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2795 +#: ../../library/stdtypes.rst:2808 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2798 +#: ../../library/stdtypes.rst:2811 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2804 +#: ../../library/stdtypes.rst:2817 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`` " @@ -4449,14 +4469,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2810 +#: ../../library/stdtypes.rst:2823 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2817 +#: ../../library/stdtypes.rst:2830 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 " @@ -4464,7 +4484,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2825 +#: ../../library/stdtypes.rst:2838 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -4476,27 +4496,27 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2848 +#: ../../library/stdtypes.rst:2865 msgid "Formatted String Literals (f-strings)" msgstr "" -#: ../../library/stdtypes.rst:2851 +#: ../../library/stdtypes.rst:2868 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" -#: ../../library/stdtypes.rst:2854 +#: ../../library/stdtypes.rst:2871 msgid "Added the debug specifier (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2856 +#: ../../library/stdtypes.rst:2873 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../library/stdtypes.rst:2860 +#: ../../library/stdtypes.rst:2877 msgid "" "An :dfn:`f-string` (formally a :dfn:`formatted string literal`) is a string " "literal that is prefixed with ``f`` or ``F``. This type of string literal " @@ -4505,29 +4525,29 @@ msgid "" "replacement field must contain an expression, optionally followed by:" msgstr "" -#: ../../library/stdtypes.rst:2867 +#: ../../library/stdtypes.rst:2884 msgid "a *debug specifier* -- an equal sign (``=``);" msgstr "" -#: ../../library/stdtypes.rst:2868 +#: ../../library/stdtypes.rst:2885 msgid "a *conversion specifier* -- ``!s``, ``!r`` or ``!a``; and/or" msgstr "" -#: ../../library/stdtypes.rst:2869 +#: ../../library/stdtypes.rst:2886 msgid "a *format specifier* prefixed with a colon (``:``)." msgstr "" -#: ../../library/stdtypes.rst:2871 +#: ../../library/stdtypes.rst:2888 msgid "" "See the :ref:`Lexical Analysis section on f-strings ` for details " "on the syntax of these fields." msgstr "" -#: ../../library/stdtypes.rst:2875 +#: ../../library/stdtypes.rst:2892 msgid "Debug specifier" msgstr "" -#: ../../library/stdtypes.rst:2879 +#: ../../library/stdtypes.rst:2896 msgid "" "If a debug specifier -- an equal sign (``=``) -- appears after the " "replacement field expression, the resulting f-string will contain the " @@ -4535,7 +4555,7 @@ msgid "" "is often useful for debugging::" msgstr "" -#: ../../library/stdtypes.rst:2884 +#: ../../library/stdtypes.rst:2901 msgid "" ">>> number = 14.3\n" ">>> f'{number=}'\n" @@ -4545,13 +4565,13 @@ msgstr "" ">>> f'{number=}'\n" "'number=14.3'" -#: ../../library/stdtypes.rst:2888 +#: ../../library/stdtypes.rst:2905 msgid "" "Whitespace before, inside and after the expression, as well as whitespace " "after the equal sign, is significant --- it is retained in the result::" msgstr "" -#: ../../library/stdtypes.rst:2891 +#: ../../library/stdtypes.rst:2908 msgid "" ">>> f'{ number - 4 = }'\n" "' number - 4 = 10.3'" @@ -4559,17 +4579,17 @@ msgstr "" ">>> f'{ number - 4 = }'\n" "' number - 4 = 10.3'" -#: ../../library/stdtypes.rst:2896 +#: ../../library/stdtypes.rst:2913 msgid "Conversion specifier" msgstr "" -#: ../../library/stdtypes.rst:2898 +#: ../../library/stdtypes.rst:2915 msgid "" "By default, the value of a replacement field expression is converted to a " "string using :func:`str`::" msgstr "" -#: ../../library/stdtypes.rst:2901 +#: ../../library/stdtypes.rst:2918 msgid "" ">>> from fractions import Fraction\n" ">>> one_third = Fraction(1, 3)\n" @@ -4581,13 +4601,13 @@ msgstr "" ">>> f'{one_third}'\n" "'1/3'" -#: ../../library/stdtypes.rst:2906 +#: ../../library/stdtypes.rst:2923 msgid "" "When a debug specifier but no format specifier is used, the default " "conversion instead uses :func:`repr`::" msgstr "" -#: ../../library/stdtypes.rst:2909 +#: ../../library/stdtypes.rst:2926 msgid "" ">>> f'{one_third = }'\n" "'one_third = Fraction(1, 3)'" @@ -4595,24 +4615,24 @@ msgstr "" ">>> f'{one_third = }'\n" "'one_third = Fraction(1, 3)'" -#: ../../library/stdtypes.rst:2912 +#: ../../library/stdtypes.rst:2929 msgid "" "The conversion can be specified explicitly using one of these specifiers:" msgstr "" -#: ../../library/stdtypes.rst:2914 +#: ../../library/stdtypes.rst:2931 msgid "``!s`` for :func:`str`" msgstr "``!s`` 用於 :func:`str`" -#: ../../library/stdtypes.rst:2915 +#: ../../library/stdtypes.rst:2932 msgid "``!r`` for :func:`repr`" msgstr "``!r`` 用於 :func:`repr`" -#: ../../library/stdtypes.rst:2916 +#: ../../library/stdtypes.rst:2933 msgid "``!a`` for :func:`ascii`" msgstr "``!a`` 用於 :func:`ascii`" -#: ../../library/stdtypes.rst:2920 +#: ../../library/stdtypes.rst:2937 msgid "" ">>> str(one_third)\n" "'1/3'\n" @@ -4644,11 +4664,11 @@ msgstr "" ">>> f'{string = !a}'\n" "\"string = '\\\\xa1ko\\\\u010dka \\\\U0001f638!'\"" -#: ../../library/stdtypes.rst:2937 +#: ../../library/stdtypes.rst:2954 msgid "Format specifier" msgstr "" -#: ../../library/stdtypes.rst:2939 +#: ../../library/stdtypes.rst:2956 msgid "" "After the expression has been evaluated, and possibly converted using an " "explicit conversion specifier, it is formatted using the :func:`format` " @@ -4658,7 +4678,7 @@ msgid "" "the replacement field. For example::" msgstr "" -#: ../../library/stdtypes.rst:2946 +#: ../../library/stdtypes.rst:2963 msgid "" ">>> from fractions import Fraction\n" ">>> one_third = Fraction(1, 3)\n" @@ -4682,29 +4702,29 @@ msgstr "" ">>> f'{one_third = :~>10}~'\n" "'one_third = ~~~~~~~1/3~'" -#: ../../library/stdtypes.rst:2960 +#: ../../library/stdtypes.rst:2977 msgid "Template String Literals (t-strings)" msgstr "模板字串字面值 (t-strings)" -#: ../../library/stdtypes.rst:2962 +#: ../../library/stdtypes.rst:2979 msgid "" "An :dfn:`t-string` (formally a :dfn:`template string literal`) is a string " "literal that is prefixed with ``t`` or ``T``." msgstr "" -#: ../../library/stdtypes.rst:2965 +#: ../../library/stdtypes.rst:2982 msgid "" "These strings follow the same syntax and evaluation rules as :ref:`formatted " "string literals `, with for the following differences:" msgstr "" -#: ../../library/stdtypes.rst:2969 +#: ../../library/stdtypes.rst:2986 msgid "" "Rather than evaluating to a ``str`` object, template string literals " "evaluate to a :class:`string.templatelib.Template` object." msgstr "" -#: ../../library/stdtypes.rst:2972 +#: ../../library/stdtypes.rst:2989 msgid "" "The :func:`format` protocol is not used. Instead, the format specifier and " "conversions (if any) are passed to a new :class:`~string.templatelib." @@ -4713,7 +4733,7 @@ msgid "" "Template` object to decide how to handle format specifiers and conversions." msgstr "" -#: ../../library/stdtypes.rst:2979 +#: ../../library/stdtypes.rst:2996 msgid "" "Format specifiers containing nested replacement fields are evaluated " "eagerly, prior to being passed to the :class:`~string.templatelib." @@ -4723,7 +4743,7 @@ msgid "" "to be ``2``, the resulting format specifier would be ``'.2f'``." msgstr "" -#: ../../library/stdtypes.rst:2987 +#: ../../library/stdtypes.rst:3004 msgid "" "When the equals sign ``'='`` is provided in an interpolation expression, the " "text of the expression is appended to the literal string that precedes the " @@ -4735,18 +4755,18 @@ msgid "" "behaviour." msgstr "" -#: ../../library/stdtypes.rst:3001 +#: ../../library/stdtypes.rst:3018 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:3014 +#: ../../library/stdtypes.rst:3031 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " "dictionaries correctly)." msgstr "" -#: ../../library/stdtypes.rst:3018 +#: ../../library/stdtypes.rst:3035 msgid "" "Using :ref:`formatted string literals `, the :meth:`str.format` " "interface, or :class:`string.Template` may help avoid these errors. Each of " @@ -4754,7 +4774,7 @@ msgid "" "flexibility, and/or extensibility." msgstr "" -#: ../../library/stdtypes.rst:3023 +#: ../../library/stdtypes.rst:3040 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -4764,7 +4784,7 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:3030 +#: ../../library/stdtypes.rst:3047 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." @@ -4772,7 +4792,7 @@ msgstr "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." -#: ../../library/stdtypes.rst:3035 +#: ../../library/stdtypes.rst:3052 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 " @@ -4780,36 +4800,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3045 ../../library/stdtypes.rst:4305 +#: ../../library/stdtypes.rst:3062 ../../library/stdtypes.rst:4322 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:3048 ../../library/stdtypes.rst:4308 +#: ../../library/stdtypes.rst:3065 ../../library/stdtypes.rst:4325 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:3050 ../../library/stdtypes.rst:4310 +#: ../../library/stdtypes.rst:3067 ../../library/stdtypes.rst:4327 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:3053 ../../library/stdtypes.rst:4313 +#: ../../library/stdtypes.rst:3070 ../../library/stdtypes.rst:4330 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:3056 ../../library/stdtypes.rst:4316 +#: ../../library/stdtypes.rst:3073 ../../library/stdtypes.rst:4333 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:3060 ../../library/stdtypes.rst:4320 +#: ../../library/stdtypes.rst:3077 ../../library/stdtypes.rst:4337 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -4817,15 +4837,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:3065 ../../library/stdtypes.rst:4325 +#: ../../library/stdtypes.rst:3082 ../../library/stdtypes.rst:4342 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:3067 ../../library/stdtypes.rst:4327 +#: ../../library/stdtypes.rst:3084 ../../library/stdtypes.rst:4344 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:3069 +#: ../../library/stdtypes.rst:3086 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 " @@ -4833,279 +4853,279 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3078 ../../library/stdtypes.rst:4338 +#: ../../library/stdtypes.rst:3095 ../../library/stdtypes.rst:4355 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:3081 ../../library/stdtypes.rst:4341 +#: ../../library/stdtypes.rst:3098 ../../library/stdtypes.rst:4358 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:3090 ../../library/stdtypes.rst:4350 +#: ../../library/stdtypes.rst:3107 ../../library/stdtypes.rst:4367 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:3092 ../../library/stdtypes.rst:4352 +#: ../../library/stdtypes.rst:3109 ../../library/stdtypes.rst:4369 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:3092 ../../library/stdtypes.rst:4352 +#: ../../library/stdtypes.rst:3109 ../../library/stdtypes.rst:4369 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:3095 ../../library/stdtypes.rst:4355 +#: ../../library/stdtypes.rst:3112 ../../library/stdtypes.rst:4372 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:3095 ../../library/stdtypes.rst:4355 +#: ../../library/stdtypes.rst:3112 ../../library/stdtypes.rst:4372 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:3097 ../../library/stdtypes.rst:4357 +#: ../../library/stdtypes.rst:3114 ../../library/stdtypes.rst:4374 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:3097 ../../library/stdtypes.rst:4357 +#: ../../library/stdtypes.rst:3114 ../../library/stdtypes.rst:4374 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:3100 ../../library/stdtypes.rst:4360 +#: ../../library/stdtypes.rst:3117 ../../library/stdtypes.rst:4377 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:3100 ../../library/stdtypes.rst:4360 +#: ../../library/stdtypes.rst:3117 ../../library/stdtypes.rst:4377 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:3103 ../../library/stdtypes.rst:4363 +#: ../../library/stdtypes.rst:3120 ../../library/stdtypes.rst:4380 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:3103 ../../library/stdtypes.rst:4363 +#: ../../library/stdtypes.rst:3120 ../../library/stdtypes.rst:4380 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:3107 ../../library/stdtypes.rst:4367 +#: ../../library/stdtypes.rst:3124 ../../library/stdtypes.rst:4384 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:3110 ../../library/stdtypes.rst:4370 +#: ../../library/stdtypes.rst:3127 ../../library/stdtypes.rst:4387 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:3113 ../../library/stdtypes.rst:4373 +#: ../../library/stdtypes.rst:3130 ../../library/stdtypes.rst:4390 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:3115 ../../library/stdtypes.rst:4375 +#: ../../library/stdtypes.rst:3132 ../../library/stdtypes.rst:4392 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:3115 ../../library/stdtypes.rst:3117 -#: ../../library/stdtypes.rst:4375 ../../library/stdtypes.rst:4377 +#: ../../library/stdtypes.rst:3132 ../../library/stdtypes.rst:3134 +#: ../../library/stdtypes.rst:4392 ../../library/stdtypes.rst:4394 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:3117 ../../library/stdtypes.rst:4377 +#: ../../library/stdtypes.rst:3134 ../../library/stdtypes.rst:4394 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:3119 ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:3136 ../../library/stdtypes.rst:4396 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:3119 ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:3136 ../../library/stdtypes.rst:4396 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:3121 ../../library/stdtypes.rst:4381 +#: ../../library/stdtypes.rst:3138 ../../library/stdtypes.rst:4398 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:3121 ../../library/stdtypes.rst:4381 +#: ../../library/stdtypes.rst:3138 ../../library/stdtypes.rst:4398 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:3123 ../../library/stdtypes.rst:4383 +#: ../../library/stdtypes.rst:3140 ../../library/stdtypes.rst:4400 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:3123 ../../library/stdtypes.rst:4383 +#: ../../library/stdtypes.rst:3140 ../../library/stdtypes.rst:4400 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:3125 ../../library/stdtypes.rst:4385 +#: ../../library/stdtypes.rst:3142 ../../library/stdtypes.rst:4402 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:3125 ../../library/stdtypes.rst:4385 +#: ../../library/stdtypes.rst:3142 ../../library/stdtypes.rst:4402 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:3127 ../../library/stdtypes.rst:4387 +#: ../../library/stdtypes.rst:3144 ../../library/stdtypes.rst:4404 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:3127 ../../library/stdtypes.rst:4387 +#: ../../library/stdtypes.rst:3144 ../../library/stdtypes.rst:4404 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:3129 ../../library/stdtypes.rst:4389 +#: ../../library/stdtypes.rst:3146 ../../library/stdtypes.rst:4406 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:3129 ../../library/stdtypes.rst:4389 +#: ../../library/stdtypes.rst:3146 ../../library/stdtypes.rst:4406 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:3131 ../../library/stdtypes.rst:4391 +#: ../../library/stdtypes.rst:3148 ../../library/stdtypes.rst:4408 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:3131 ../../library/stdtypes.rst:3133 -#: ../../library/stdtypes.rst:4391 ../../library/stdtypes.rst:4393 +#: ../../library/stdtypes.rst:3148 ../../library/stdtypes.rst:3150 +#: ../../library/stdtypes.rst:4408 ../../library/stdtypes.rst:4410 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:3133 ../../library/stdtypes.rst:4393 +#: ../../library/stdtypes.rst:3150 ../../library/stdtypes.rst:4410 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:3135 ../../library/stdtypes.rst:4395 +#: ../../library/stdtypes.rst:3152 ../../library/stdtypes.rst:4412 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:3135 ../../library/stdtypes.rst:4395 +#: ../../library/stdtypes.rst:3152 ../../library/stdtypes.rst:4412 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:3139 ../../library/stdtypes.rst:4399 +#: ../../library/stdtypes.rst:3156 ../../library/stdtypes.rst:4416 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:3139 ../../library/stdtypes.rst:4399 +#: ../../library/stdtypes.rst:3156 ../../library/stdtypes.rst:4416 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:3143 ../../library/stdtypes.rst:4403 +#: ../../library/stdtypes.rst:3160 ../../library/stdtypes.rst:4420 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:3143 +#: ../../library/stdtypes.rst:3160 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:3146 ../../library/stdtypes.rst:4416 +#: ../../library/stdtypes.rst:3163 ../../library/stdtypes.rst:4433 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:3146 +#: ../../library/stdtypes.rst:3163 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:3149 ../../library/stdtypes.rst:4410 +#: ../../library/stdtypes.rst:3166 ../../library/stdtypes.rst:4427 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:3149 +#: ../../library/stdtypes.rst:3166 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:3152 ../../library/stdtypes.rst:4413 +#: ../../library/stdtypes.rst:3169 ../../library/stdtypes.rst:4430 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:3152 +#: ../../library/stdtypes.rst:3169 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:3155 ../../library/stdtypes.rst:4419 +#: ../../library/stdtypes.rst:3172 ../../library/stdtypes.rst:4436 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:3155 ../../library/stdtypes.rst:4419 +#: ../../library/stdtypes.rst:3172 ../../library/stdtypes.rst:4436 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:3162 ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:3179 ../../library/stdtypes.rst:4443 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:3166 ../../library/stdtypes.rst:4430 +#: ../../library/stdtypes.rst:3183 ../../library/stdtypes.rst:4447 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:3170 ../../library/stdtypes.rst:4434 +#: ../../library/stdtypes.rst:3187 ../../library/stdtypes.rst:4451 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:3173 ../../library/stdtypes.rst:4437 +#: ../../library/stdtypes.rst:3190 ../../library/stdtypes.rst:4454 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:3177 ../../library/stdtypes.rst:4441 +#: ../../library/stdtypes.rst:3194 ../../library/stdtypes.rst:4458 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:3180 ../../library/stdtypes.rst:4444 +#: ../../library/stdtypes.rst:3197 ../../library/stdtypes.rst:4461 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:3184 ../../library/stdtypes.rst:4448 +#: ../../library/stdtypes.rst:3201 ../../library/stdtypes.rst:4465 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:3187 ../../library/stdtypes.rst:4457 +#: ../../library/stdtypes.rst:3204 ../../library/stdtypes.rst:4474 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:3189 +#: ../../library/stdtypes.rst:3206 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:3194 +#: ../../library/stdtypes.rst:3211 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:3205 +#: ../../library/stdtypes.rst:3222 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:3213 +#: ../../library/stdtypes.rst:3230 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 :" @@ -5113,17 +5133,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:3218 +#: ../../library/stdtypes.rst:3235 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:3224 +#: ../../library/stdtypes.rst:3241 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:3228 +#: ../../library/stdtypes.rst:3245 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -5131,40 +5151,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:3236 +#: ../../library/stdtypes.rst:3253 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:3239 +#: ../../library/stdtypes.rst:3256 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:3240 +#: ../../library/stdtypes.rst:3257 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:3241 +#: ../../library/stdtypes.rst:3258 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:3243 +#: ../../library/stdtypes.rst:3260 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:3247 +#: ../../library/stdtypes.rst:3264 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:3251 +#: ../../library/stdtypes.rst:3268 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -5177,29 +5197,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:3261 +#: ../../library/stdtypes.rst:3278 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:3264 +#: ../../library/stdtypes.rst:3281 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:3265 +#: ../../library/stdtypes.rst:3282 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:3266 +#: ../../library/stdtypes.rst:3283 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:3268 +#: ../../library/stdtypes.rst:3285 msgid "Also see the :ref:`bytes ` built-in." msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:3270 +#: ../../library/stdtypes.rst:3287 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -5207,38 +5227,38 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:3276 +#: ../../library/stdtypes.rst:3293 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:3283 +#: ../../library/stdtypes.rst:3300 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:3287 +#: ../../library/stdtypes.rst:3304 msgid "" ":meth:`bytes.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-like " "objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3291 +#: ../../library/stdtypes.rst:3308 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3297 ../../library/stdtypes.rst:3388 +#: ../../library/stdtypes.rst:3314 ../../library/stdtypes.rst:3405 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:3303 +#: ../../library/stdtypes.rst:3320 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, " @@ -5247,13 +5267,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:3320 +#: ../../library/stdtypes.rst:3337 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:3324 +#: ../../library/stdtypes.rst:3341 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 " @@ -5261,58 +5281,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3329 +#: ../../library/stdtypes.rst:3346 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:3337 +#: ../../library/stdtypes.rst:3354 msgid "Bytearray Objects" msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:3341 +#: ../../library/stdtypes.rst:3358 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:3347 +#: ../../library/stdtypes.rst:3364 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:3350 +#: ../../library/stdtypes.rst:3367 msgid "Creating an empty instance: ``bytearray()``" msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:3351 +#: ../../library/stdtypes.rst:3368 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:3352 +#: ../../library/stdtypes.rst:3369 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:3353 +#: ../../library/stdtypes.rst:3370 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:3355 +#: ../../library/stdtypes.rst:3372 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:3359 +#: ../../library/stdtypes.rst:3376 msgid "Also see the :ref:`bytearray ` built-in." msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:3361 +#: ../../library/stdtypes.rst:3378 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -5320,64 +5340,64 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:3367 +#: ../../library/stdtypes.rst:3384 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:3374 +#: ../../library/stdtypes.rst:3391 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:3378 +#: ../../library/stdtypes.rst:3395 msgid "" ":meth:`bytearray.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-" "like objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3382 +#: ../../library/stdtypes.rst:3399 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3396 +#: ../../library/stdtypes.rst:3413 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:3403 +#: ../../library/stdtypes.rst:3420 msgid "" "Resize the :class:`bytearray` to contain *size* bytes. *size* must be " "greater than or equal to 0." msgstr "" -#: ../../library/stdtypes.rst:3406 +#: ../../library/stdtypes.rst:3423 msgid "" "If the :class:`bytearray` needs to shrink, bytes beyond *size* are truncated." msgstr "" -#: ../../library/stdtypes.rst:3408 +#: ../../library/stdtypes.rst:3425 msgid "" "If the :class:`bytearray` needs to grow, all new bytes, those beyond *size*, " "will be set to null bytes." msgstr "" -#: ../../library/stdtypes.rst:3412 +#: ../../library/stdtypes.rst:3429 msgid "This is equivalent to:" msgstr "等同於:" -#: ../../library/stdtypes.rst:3420 +#: ../../library/stdtypes.rst:3437 msgid "Examples:" msgstr "範例:" -#: ../../library/stdtypes.rst:3433 +#: ../../library/stdtypes.rst:3450 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 " @@ -5385,7 +5405,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3438 +#: ../../library/stdtypes.rst:3455 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -5393,11 +5413,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:3447 +#: ../../library/stdtypes.rst:3464 msgid "Bytes and Bytearray Operations" msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:3452 +#: ../../library/stdtypes.rst:3469 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -5406,14 +5426,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:3460 +#: ../../library/stdtypes.rst:3477 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:3464 +#: ../../library/stdtypes.rst:3481 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -5421,11 +5441,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:3467 +#: ../../library/stdtypes.rst:3484 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:3469 +#: ../../library/stdtypes.rst:3486 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -5433,60 +5453,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:3472 +#: ../../library/stdtypes.rst:3489 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:3477 +#: ../../library/stdtypes.rst:3494 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:3480 +#: ../../library/stdtypes.rst:3497 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:3486 +#: ../../library/stdtypes.rst:3503 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:3490 ../../library/stdtypes.rst:3595 -#: ../../library/stdtypes.rst:3617 ../../library/stdtypes.rst:3683 -#: ../../library/stdtypes.rst:3696 +#: ../../library/stdtypes.rst:3507 ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:3634 ../../library/stdtypes.rst:3700 +#: ../../library/stdtypes.rst:3713 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:3493 +#: ../../library/stdtypes.rst:3510 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:3496 ../../library/stdtypes.rst:3607 -#: ../../library/stdtypes.rst:3620 ../../library/stdtypes.rst:3686 -#: ../../library/stdtypes.rst:3699 +#: ../../library/stdtypes.rst:3513 ../../library/stdtypes.rst:3624 +#: ../../library/stdtypes.rst:3637 ../../library/stdtypes.rst:3703 +#: ../../library/stdtypes.rst:3716 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:3503 +#: ../../library/stdtypes.rst:3520 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:3507 +#: ../../library/stdtypes.rst:3524 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -5498,32 +5518,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:3512 +#: ../../library/stdtypes.rst:3529 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" -#: ../../library/stdtypes.rst:3516 ../../library/stdtypes.rst:3538 -#: ../../library/stdtypes.rst:3671 ../../library/stdtypes.rst:3764 -#: ../../library/stdtypes.rst:3778 ../../library/stdtypes.rst:3808 -#: ../../library/stdtypes.rst:3822 ../../library/stdtypes.rst:3863 -#: ../../library/stdtypes.rst:3933 ../../library/stdtypes.rst:3951 -#: ../../library/stdtypes.rst:3979 ../../library/stdtypes.rst:4118 -#: ../../library/stdtypes.rst:4173 ../../library/stdtypes.rst:4216 -#: ../../library/stdtypes.rst:4237 ../../library/stdtypes.rst:4259 -#: ../../library/stdtypes.rst:4461 +#: ../../library/stdtypes.rst:3533 ../../library/stdtypes.rst:3555 +#: ../../library/stdtypes.rst:3688 ../../library/stdtypes.rst:3781 +#: ../../library/stdtypes.rst:3795 ../../library/stdtypes.rst:3825 +#: ../../library/stdtypes.rst:3839 ../../library/stdtypes.rst:3880 +#: ../../library/stdtypes.rst:3950 ../../library/stdtypes.rst:3968 +#: ../../library/stdtypes.rst:3996 ../../library/stdtypes.rst:4135 +#: ../../library/stdtypes.rst:4190 ../../library/stdtypes.rst:4233 +#: ../../library/stdtypes.rst:4254 ../../library/stdtypes.rst:4276 +#: ../../library/stdtypes.rst:4478 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:3525 +#: ../../library/stdtypes.rst:3542 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:3529 +#: ../../library/stdtypes.rst:3546 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -5535,15 +5555,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:3534 +#: ../../library/stdtypes.rst:3551 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3547 +#: ../../library/stdtypes.rst:3564 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:3552 +#: ../../library/stdtypes.rst:3569 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -5551,21 +5571,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:3558 +#: ../../library/stdtypes.rst:3575 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:3564 +#: ../../library/stdtypes.rst:3581 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:3579 +#: ../../library/stdtypes.rst:3596 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -5573,11 +5593,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3584 +#: ../../library/stdtypes.rst:3601 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3590 +#: ../../library/stdtypes.rst:3607 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 " @@ -5585,14 +5605,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3600 +#: ../../library/stdtypes.rst:3617 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:3604 +#: ../../library/stdtypes.rst:3621 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -5600,13 +5620,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:3614 +#: ../../library/stdtypes.rst:3631 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:3627 +#: ../../library/stdtypes.rst:3644 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 " @@ -5616,7 +5636,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:3638 +#: ../../library/stdtypes.rst:3655 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 " @@ -5624,7 +5644,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:3649 +#: ../../library/stdtypes.rst:3666 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 " @@ -5633,24 +5653,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:3656 ../../library/stdtypes.rst:3713 +#: ../../library/stdtypes.rst:3673 ../../library/stdtypes.rst:3730 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3662 +#: ../../library/stdtypes.rst:3679 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:3666 +#: ../../library/stdtypes.rst:3683 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3678 +#: ../../library/stdtypes.rst:3695 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -5658,13 +5678,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:3693 +#: ../../library/stdtypes.rst:3710 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3706 +#: ../../library/stdtypes.rst:3723 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 " @@ -5673,7 +5693,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:3719 +#: ../../library/stdtypes.rst:3736 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -5681,11 +5701,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3724 +#: ../../library/stdtypes.rst:3741 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3730 +#: ../../library/stdtypes.rst:3747 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 " @@ -5693,18 +5713,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3735 +#: ../../library/stdtypes.rst:3752 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3738 +#: ../../library/stdtypes.rst:3755 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3741 +#: ../../library/stdtypes.rst:3758 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -5712,11 +5732,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3744 +#: ../../library/stdtypes.rst:3761 msgid "*delete* is now supported as a keyword argument." msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3748 +#: ../../library/stdtypes.rst:3765 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 " @@ -5725,7 +5745,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3757 +#: ../../library/stdtypes.rst:3774 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). " @@ -5733,7 +5753,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3771 +#: ../../library/stdtypes.rst:3788 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). " @@ -5741,7 +5761,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3785 +#: ../../library/stdtypes.rst:3802 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -5750,7 +5770,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:3808 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -5762,14 +5782,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3796 +#: ../../library/stdtypes.rst:3813 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:3801 +#: ../../library/stdtypes.rst:3818 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -5781,7 +5801,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:3832 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). " @@ -5789,7 +5809,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3829 +#: ../../library/stdtypes.rst:3846 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 " @@ -5799,7 +5819,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3840 +#: ../../library/stdtypes.rst:3857 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -5808,7 +5828,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3846 +#: ../../library/stdtypes.rst:3863 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -5820,14 +5840,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3851 +#: ../../library/stdtypes.rst:3868 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:3856 +#: ../../library/stdtypes.rst:3873 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -5839,7 +5859,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3870 +#: ../../library/stdtypes.rst:3887 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 " @@ -5848,7 +5868,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3876 +#: ../../library/stdtypes.rst:3893 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',')`` " @@ -5859,7 +5879,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3886 +#: ../../library/stdtypes.rst:3903 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -5879,7 +5899,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3895 +#: ../../library/stdtypes.rst:3912 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 " @@ -5889,7 +5909,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3905 +#: ../../library/stdtypes.rst:3922 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -5905,7 +5925,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3916 +#: ../../library/stdtypes.rst:3933 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *bytes* argument is a binary sequence specifying the set of " @@ -5914,7 +5934,7 @@ msgid "" "or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3923 +#: ../../library/stdtypes.rst:3940 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -5926,13 +5946,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3928 +#: ../../library/stdtypes.rst:3945 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3937 +#: ../../library/stdtypes.rst:3954 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 " @@ -5940,14 +5960,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3945 +#: ../../library/stdtypes.rst:3962 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:3958 +#: ../../library/stdtypes.rst:3975 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 " @@ -5963,7 +5983,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3972 +#: ../../library/stdtypes.rst:3989 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -5975,7 +5995,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3986 +#: ../../library/stdtypes.rst:4003 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -5984,7 +6004,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3994 +#: ../../library/stdtypes.rst:4011 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -5996,7 +6016,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:4003 +#: ../../library/stdtypes.rst:4020 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -6004,7 +6024,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:4010 +#: ../../library/stdtypes.rst:4027 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -6016,20 +6036,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:4019 +#: ../../library/stdtypes.rst:4036 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:4029 +#: ../../library/stdtypes.rst:4046 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:4035 +#: ../../library/stdtypes.rst:4052 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -6041,13 +6061,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:4044 +#: ../../library/stdtypes.rst:4061 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:4049 +#: ../../library/stdtypes.rst:4066 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -6059,16 +6079,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:4054 ../../library/stdtypes.rst:4096 -#: ../../library/stdtypes.rst:4112 ../../library/stdtypes.rst:4162 -#: ../../library/stdtypes.rst:4231 +#: ../../library/stdtypes.rst:4071 ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:4129 ../../library/stdtypes.rst:4179 +#: ../../library/stdtypes.rst:4248 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:4062 +#: ../../library/stdtypes.rst:4079 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -6076,14 +6096,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:4088 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:4077 +#: ../../library/stdtypes.rst:4094 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -6095,14 +6115,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:4086 +#: ../../library/stdtypes.rst:4103 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:4091 +#: ../../library/stdtypes.rst:4108 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -6114,13 +6134,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:4104 +#: ../../library/stdtypes.rst:4121 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:4109 +#: ../../library/stdtypes.rst:4126 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -6128,7 +6148,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:4129 +#: ../../library/stdtypes.rst:4146 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 " @@ -6136,7 +6156,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:4136 +#: ../../library/stdtypes.rst:4153 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -6148,14 +6168,14 @@ msgstr "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:4141 +#: ../../library/stdtypes.rst:4158 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:4145 +#: ../../library/stdtypes.rst:4162 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -6167,13 +6187,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:4154 +#: ../../library/stdtypes.rst:4171 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:4159 +#: ../../library/stdtypes.rst:4176 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -6181,7 +6201,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:4166 +#: ../../library/stdtypes.rst:4183 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -6189,14 +6209,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:4180 +#: ../../library/stdtypes.rst:4197 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:4186 +#: ../../library/stdtypes.rst:4203 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -6204,7 +6224,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:4189 +#: ../../library/stdtypes.rst:4206 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -6212,7 +6232,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:4199 +#: ../../library/stdtypes.rst:4216 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -6220,12 +6240,12 @@ msgstr "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:4202 +#: ../../library/stdtypes.rst:4219 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:4204 +#: ../../library/stdtypes.rst:4221 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -6247,13 +6267,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:4223 +#: ../../library/stdtypes.rst:4240 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:4228 +#: ../../library/stdtypes.rst:4245 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -6261,7 +6281,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:4244 +#: ../../library/stdtypes.rst:4261 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 " @@ -6270,7 +6290,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:4252 +#: ../../library/stdtypes.rst:4269 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -6282,11 +6302,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:4266 +#: ../../library/stdtypes.rst:4283 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:4283 +#: ../../library/stdtypes.rst:4300 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 " @@ -6294,7 +6314,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:4288 +#: ../../library/stdtypes.rst:4305 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -6304,7 +6324,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:4295 +#: ../../library/stdtypes.rst:4312 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 " @@ -6312,7 +6332,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:4329 +#: ../../library/stdtypes.rst:4346 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 " @@ -6320,77 +6340,77 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:4381 +#: ../../library/stdtypes.rst:4398 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/stdtypes.rst:4403 +#: ../../library/stdtypes.rst:4420 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:4406 +#: ../../library/stdtypes.rst:4423 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:4406 +#: ../../library/stdtypes.rst:4423 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:4410 +#: ../../library/stdtypes.rst:4427 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4413 +#: ../../library/stdtypes.rst:4430 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:4416 +#: ../../library/stdtypes.rst:4433 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4416 +#: ../../library/stdtypes.rst:4433 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:4451 +#: ../../library/stdtypes.rst:4468 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4454 +#: ../../library/stdtypes.rst:4471 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4466 +#: ../../library/stdtypes.rst:4483 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:4473 +#: ../../library/stdtypes.rst:4490 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:4475 +#: ../../library/stdtypes.rst:4492 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:4481 +#: ../../library/stdtypes.rst:4498 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:4485 +#: ../../library/stdtypes.rst:4502 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 " @@ -6398,32 +6418,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:4490 +#: ../../library/stdtypes.rst:4507 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:4494 +#: ../../library/stdtypes.rst:4511 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:4497 +#: ../../library/stdtypes.rst:4514 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:4500 +#: ../../library/stdtypes.rst:4517 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:4503 +#: ../../library/stdtypes.rst:4520 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -6445,7 +6465,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:4513 +#: ../../library/stdtypes.rst:4530 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 " @@ -6456,11 +6476,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:4522 +#: ../../library/stdtypes.rst:4539 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:4524 +#: ../../library/stdtypes.rst:4541 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -6482,13 +6502,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:4534 +#: ../../library/stdtypes.rst:4551 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:4537 +#: ../../library/stdtypes.rst:4554 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -6528,14 +6548,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:4555 +#: ../../library/stdtypes.rst:4572 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:4559 +#: ../../library/stdtypes.rst:4576 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -6553,44 +6573,44 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:4567 +#: ../../library/stdtypes.rst:4584 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:4571 +#: ../../library/stdtypes.rst:4588 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:4575 +#: ../../library/stdtypes.rst:4592 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:4578 +#: ../../library/stdtypes.rst:4595 msgid "memoryview is now a :term:`generic type`." msgstr "" -#: ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:4598 msgid ":class:`memoryview` has several methods:" msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:4585 +#: ../../library/stdtypes.rst:4602 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:4589 +#: ../../library/stdtypes.rst:4606 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:4592 +#: ../../library/stdtypes.rst:4609 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -6624,14 +6644,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:4608 +#: ../../library/stdtypes.rst:4625 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:4612 +#: ../../library/stdtypes.rst:4629 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -6657,25 +6677,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:4624 +#: ../../library/stdtypes.rst:4641 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:4627 +#: ../../library/stdtypes.rst:4644 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:4633 +#: ../../library/stdtypes.rst:4650 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:4636 +#: ../../library/stdtypes.rst:4653 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -6689,7 +6709,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:4642 +#: ../../library/stdtypes.rst:4659 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -6697,7 +6717,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:4647 +#: ../../library/stdtypes.rst:4664 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' " @@ -6706,13 +6726,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:4657 +#: ../../library/stdtypes.rst:4674 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:4660 +#: ../../library/stdtypes.rst:4677 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -6722,18 +6742,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:4666 +#: ../../library/stdtypes.rst:4683 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:4673 +#: ../../library/stdtypes.rst:4690 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:4675 +#: ../../library/stdtypes.rst:4692 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -6751,19 +6771,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:4683 +#: ../../library/stdtypes.rst:4700 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:4690 +#: ../../library/stdtypes.rst:4707 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:4693 +#: ../../library/stdtypes.rst:4710 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -6789,7 +6809,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:4709 +#: ../../library/stdtypes.rst:4726 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 :" @@ -6798,14 +6818,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:4715 +#: ../../library/stdtypes.rst:4732 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:4719 +#: ../../library/stdtypes.rst:4736 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -6821,13 +6841,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4726 +#: ../../library/stdtypes.rst:4743 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4729 +#: ../../library/stdtypes.rst:4746 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -6847,7 +6867,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4743 +#: ../../library/stdtypes.rst:4760 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 " @@ -6856,7 +6876,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4749 +#: ../../library/stdtypes.rst:4766 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 " @@ -6864,11 +6884,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4755 +#: ../../library/stdtypes.rst:4772 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4757 +#: ../../library/stdtypes.rst:4774 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -6912,11 +6932,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4778 +#: ../../library/stdtypes.rst:4795 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4780 +#: ../../library/stdtypes.rst:4797 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -6940,11 +6960,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4791 +#: ../../library/stdtypes.rst:4808 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4793 +#: ../../library/stdtypes.rst:4810 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -6994,11 +7014,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4817 +#: ../../library/stdtypes.rst:4834 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4819 +#: ../../library/stdtypes.rst:4836 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -7020,33 +7040,33 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4831 +#: ../../library/stdtypes.rst:4848 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4836 +#: ../../library/stdtypes.rst:4853 msgid "Count the number of occurrences of *value*." msgstr "計算 *value* 的出現次數" -#: ../../library/stdtypes.rst:4842 +#: ../../library/stdtypes.rst:4859 msgid "" "Return the index of the first occurrence of *value* (at or after index " "*start* and before index *stop*)." msgstr "" -#: ../../library/stdtypes.rst:4845 +#: ../../library/stdtypes.rst:4862 msgid "Raises a :exc:`ValueError` if *value* cannot be found." msgstr "在找不到 *value* 時引發 :exc:`ValueError`。" -#: ../../library/stdtypes.rst:4849 +#: ../../library/stdtypes.rst:4866 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4853 +#: ../../library/stdtypes.rst:4870 msgid "The underlying object of the memoryview::" msgstr "memoryview 的底層物件: ::" -#: ../../library/stdtypes.rst:4855 +#: ../../library/stdtypes.rst:4872 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -7058,14 +7078,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4864 +#: ../../library/stdtypes.rst:4881 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:4868 +#: ../../library/stdtypes.rst:4885 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -7097,11 +7117,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4883 +#: ../../library/stdtypes.rst:4900 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4885 +#: ../../library/stdtypes.rst:4902 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -7125,11 +7145,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4900 +#: ../../library/stdtypes.rst:4917 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4904 +#: ../../library/stdtypes.rst:4921 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 " @@ -7137,17 +7157,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4909 +#: ../../library/stdtypes.rst:4926 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:4915 +#: ../../library/stdtypes.rst:4932 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4917 +#: ../../library/stdtypes.rst:4934 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -7167,49 +7187,49 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4928 +#: ../../library/stdtypes.rst:4945 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4933 +#: ../../library/stdtypes.rst:4950 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:4936 ../../library/stdtypes.rst:4944 +#: ../../library/stdtypes.rst:4953 ../../library/stdtypes.rst:4961 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4941 +#: ../../library/stdtypes.rst:4958 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:4949 +#: ../../library/stdtypes.rst:4966 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4953 +#: ../../library/stdtypes.rst:4970 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4959 +#: ../../library/stdtypes.rst:4976 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4965 +#: ../../library/stdtypes.rst:4982 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4973 +#: ../../library/stdtypes.rst:4990 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4977 +#: ../../library/stdtypes.rst:4994 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -7219,7 +7239,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4984 +#: ../../library/stdtypes.rst:5001 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 " @@ -7227,7 +7247,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4989 +#: ../../library/stdtypes.rst:5006 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -7239,18 +7259,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:4998 +#: ../../library/stdtypes.rst:5015 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:5002 +#: ../../library/stdtypes.rst:5019 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:5007 +#: ../../library/stdtypes.rst:5024 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 " @@ -7258,92 +7278,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:5013 +#: ../../library/stdtypes.rst:5030 msgid "Sets can be created by several means:" msgstr "集合可以以多種方式建立:" -#: ../../library/stdtypes.rst:5015 +#: ../../library/stdtypes.rst:5032 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:5016 +#: ../../library/stdtypes.rst:5033 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:5017 +#: ../../library/stdtypes.rst:5034 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:5019 +#: ../../library/stdtypes.rst:5036 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:5024 +#: ../../library/stdtypes.rst:5041 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:5028 +#: ../../library/stdtypes.rst:5045 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:5032 +#: ../../library/stdtypes.rst:5049 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:5037 +#: ../../library/stdtypes.rst:5054 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:5044 +#: ../../library/stdtypes.rst:5061 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:5048 +#: ../../library/stdtypes.rst:5065 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:5055 +#: ../../library/stdtypes.rst:5072 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:5059 +#: ../../library/stdtypes.rst:5076 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:5066 +#: ../../library/stdtypes.rst:5083 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:5072 +#: ../../library/stdtypes.rst:5089 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:5078 +#: ../../library/stdtypes.rst:5095 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:5084 +#: ../../library/stdtypes.rst:5101 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:5089 +#: ../../library/stdtypes.rst:5106 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:5092 +#: ../../library/stdtypes.rst:5109 msgid "" "Note, the non-operator versions of :meth:`~frozenset.union`, :meth:" "`~frozenset.intersection`, :meth:`~frozenset.difference`, :meth:`~frozenset." @@ -7354,7 +7374,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:5099 +#: ../../library/stdtypes.rst:5116 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 " @@ -7364,14 +7384,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:5106 +#: ../../library/stdtypes.rst:5123 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:5110 +#: ../../library/stdtypes.rst:5127 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 " @@ -7379,78 +7399,78 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:5115 +#: ../../library/stdtypes.rst:5132 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:5118 +#: ../../library/stdtypes.rst:5135 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:5120 +#: ../../library/stdtypes.rst:5137 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:5124 +#: ../../library/stdtypes.rst:5141 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:5130 +#: ../../library/stdtypes.rst:5147 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:5135 +#: ../../library/stdtypes.rst:5152 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:5140 +#: ../../library/stdtypes.rst:5157 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:5145 +#: ../../library/stdtypes.rst:5162 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:5149 +#: ../../library/stdtypes.rst:5166 msgid "Add element *elem* to the set." msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:5153 +#: ../../library/stdtypes.rst:5170 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:5158 +#: ../../library/stdtypes.rst:5175 msgid "Remove element *elem* from the set if it is present." msgstr "如果 *elem* 存在於集合中則將其移除。" -#: ../../library/stdtypes.rst:5162 +#: ../../library/stdtypes.rst:5179 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:5167 +#: ../../library/stdtypes.rst:5184 msgid "Remove all elements from the set." msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:5170 +#: ../../library/stdtypes.rst:5187 msgid "" "Note, the non-operator versions of the :meth:`~set.update`, :meth:`~set." "intersection_update`, :meth:`~set.difference_update`, and :meth:`~set." "symmetric_difference_update` methods will accept any iterable as an argument." msgstr "" -#: ../../library/stdtypes.rst:5175 +#: ../../library/stdtypes.rst:5192 msgid "" "Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:`~set." "remove`, and :meth:`~set.discard` methods may be a set. To support " @@ -7458,11 +7478,11 @@ msgid "" "*elem*." msgstr "" -#: ../../library/stdtypes.rst:5184 +#: ../../library/stdtypes.rst:5201 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:5194 +#: ../../library/stdtypes.rst:5211 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -7471,7 +7491,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:5200 +#: ../../library/stdtypes.rst:5217 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -7480,33 +7500,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:5211 +#: ../../library/stdtypes.rst:5228 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:5214 +#: ../../library/stdtypes.rst:5231 msgid "Dictionaries can be created by several means:" msgstr "字典可以用數種方式建立:" -#: ../../library/stdtypes.rst:5216 +#: ../../library/stdtypes.rst:5233 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:5218 +#: ../../library/stdtypes.rst:5235 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:5219 +#: ../../library/stdtypes.rst:5236 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:5222 +#: ../../library/stdtypes.rst:5239 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it defines a ``keys()`` method, a " @@ -7519,7 +7539,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:5232 +#: ../../library/stdtypes.rst:5249 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 " @@ -7527,7 +7547,7 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:5237 +#: ../../library/stdtypes.rst:5254 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -7536,7 +7556,7 @@ msgid "" "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:5243 +#: ../../library/stdtypes.rst:5260 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -7556,19 +7576,19 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:5252 +#: ../../library/stdtypes.rst:5269 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:5255 +#: ../../library/stdtypes.rst:5272 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:5258 +#: ../../library/stdtypes.rst:5275 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7600,33 +7620,33 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:5273 +#: ../../library/stdtypes.rst:5290 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:5277 +#: ../../library/stdtypes.rst:5294 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:5282 +#: ../../library/stdtypes.rst:5299 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5286 +#: ../../library/stdtypes.rst:5303 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5290 +#: ../../library/stdtypes.rst:5307 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:5295 +#: ../../library/stdtypes.rst:5312 msgid "" "If a subclass of dict defines a method :meth:`~object.__missing__` and *key* " "is not present, the ``d[key]`` operation calls that method with the key " @@ -7637,7 +7657,7 @@ msgid "" "__missing__` must be a method; it cannot be an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:5303 +#: ../../library/stdtypes.rst:5320 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -7661,51 +7681,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:5314 +#: ../../library/stdtypes.rst:5331 msgid "" "The example above shows part of the implementation of :class:`collections." "Counter`. A different :meth:`!__missing__` method is used by :class:" "`collections.defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:5321 +#: ../../library/stdtypes.rst:5338 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:5325 +#: ../../library/stdtypes.rst:5342 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "從 *d* 中移除 ``d[key]``。若 *key* 不在對映中則引發 :exc:`KeyError`。" -#: ../../library/stdtypes.rst:5330 +#: ../../library/stdtypes.rst:5347 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:5334 +#: ../../library/stdtypes.rst:5351 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:5338 +#: ../../library/stdtypes.rst:5355 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5343 +#: ../../library/stdtypes.rst:5360 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:5347 +#: ../../library/stdtypes.rst:5364 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5351 +#: ../../library/stdtypes.rst:5368 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:5353 +#: ../../library/stdtypes.rst:5370 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 " @@ -7714,70 +7734,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:5361 +#: ../../library/stdtypes.rst:5378 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:5367 +#: ../../library/stdtypes.rst:5384 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5372 +#: ../../library/stdtypes.rst:5389 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:5378 +#: ../../library/stdtypes.rst:5395 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:5384 +#: ../../library/stdtypes.rst:5401 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:5387 +#: ../../library/stdtypes.rst:5404 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:5391 +#: ../../library/stdtypes.rst:5408 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:5397 +#: ../../library/stdtypes.rst:5414 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:5421 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:5412 +#: ../../library/stdtypes.rst:5429 msgid "" "Update the dictionary with the key/value pairs from *mapping* or *iterable* " "and *kwargs*, overwriting existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:5415 +#: ../../library/stdtypes.rst:5432 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -7786,20 +7806,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:5423 +#: ../../library/stdtypes.rst:5440 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5426 +#: ../../library/stdtypes.rst:5443 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:5430 +#: ../../library/stdtypes.rst:5447 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -7809,25 +7829,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:5436 +#: ../../library/stdtypes.rst:5453 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:5444 +#: ../../library/stdtypes.rst:5461 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:5450 +#: ../../library/stdtypes.rst:5467 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:5452 +#: ../../library/stdtypes.rst:5469 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7849,27 +7869,27 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:5462 +#: ../../library/stdtypes.rst:5479 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5467 +#: ../../library/stdtypes.rst:5484 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:5473 +#: ../../library/stdtypes.rst:5490 msgid "" "For detailed information on thread-safety guarantees for :class:`dict` " "objects, see :ref:`thread-safety-dict`." msgstr "" -#: ../../library/stdtypes.rst:5480 +#: ../../library/stdtypes.rst:5497 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:5482 +#: ../../library/stdtypes.rst:5499 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 " @@ -7877,23 +7897,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:5487 +#: ../../library/stdtypes.rst:5504 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:5492 +#: ../../library/stdtypes.rst:5509 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5496 +#: ../../library/stdtypes.rst:5513 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5499 +#: ../../library/stdtypes.rst:5516 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -7901,39 +7921,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:5504 +#: ../../library/stdtypes.rst:5521 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:5507 +#: ../../library/stdtypes.rst:5524 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:5512 +#: ../../library/stdtypes.rst:5529 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:5517 +#: ../../library/stdtypes.rst:5534 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:5520 +#: ../../library/stdtypes.rst:5537 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5525 +#: ../../library/stdtypes.rst:5542 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:5530 +#: ../../library/stdtypes.rst:5547 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 " @@ -7947,11 +7967,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:5542 +#: ../../library/stdtypes.rst:5559 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:5544 +#: ../../library/stdtypes.rst:5561 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -7992,11 +8012,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:5586 +#: ../../library/stdtypes.rst:5603 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:5593 +#: ../../library/stdtypes.rst:5610 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 " @@ -8007,7 +8027,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:5601 +#: ../../library/stdtypes.rst:5618 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 " @@ -8018,7 +8038,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:5606 +#: ../../library/stdtypes.rst:5623 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -8027,7 +8047,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:5610 +#: ../../library/stdtypes.rst:5627 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 " @@ -8041,7 +8061,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5620 +#: ../../library/stdtypes.rst:5637 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -8053,7 +8073,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5625 +#: ../../library/stdtypes.rst:5642 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -8064,14 +8084,14 @@ msgstr "" "keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續傳播 " "(propagate)。" -#: ../../library/stdtypes.rst:5630 +#: ../../library/stdtypes.rst:5647 msgid "" "If this method raises an exception while handling an earlier exception from " "the :keyword:`with` block, the new exception is raised, and the original " "exception is stored in its :attr:`~BaseException.__context__` attribute." msgstr "" -#: ../../library/stdtypes.rst:5634 +#: ../../library/stdtypes.rst:5651 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -8083,7 +8103,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" "`~object.__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5640 +#: ../../library/stdtypes.rst:5657 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -8095,7 +8115,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5646 +#: ../../library/stdtypes.rst:5663 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -8110,7 +8130,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5653 +#: ../../library/stdtypes.rst:5670 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 " @@ -8122,7 +8142,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5661 +#: ../../library/stdtypes.rst:5678 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -8130,7 +8150,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5666 +#: ../../library/stdtypes.rst:5683 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -8138,11 +8158,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5673 +#: ../../library/stdtypes.rst:5690 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5679 +#: ../../library/stdtypes.rst:5696 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -8158,7 +8178,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5689 +#: ../../library/stdtypes.rst:5706 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -8166,7 +8186,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5692 +#: ../../library/stdtypes.rst:5709 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -8174,7 +8194,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5695 +#: ../../library/stdtypes.rst:5712 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 " @@ -8186,7 +8206,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5701 +#: ../../library/stdtypes.rst:5718 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 " @@ -8198,7 +8218,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5707 +#: ../../library/stdtypes.rst:5724 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 " @@ -8210,7 +8230,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5713 +#: ../../library/stdtypes.rst:5730 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." @@ -8223,7 +8243,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5719 +#: ../../library/stdtypes.rst:5736 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -8232,7 +8252,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:5725 +#: ../../library/stdtypes.rst:5742 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -8242,7 +8262,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:5730 +#: ../../library/stdtypes.rst:5747 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -8250,7 +8270,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5733 +#: ../../library/stdtypes.rst:5750 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 " @@ -8261,7 +8281,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5738 +#: ../../library/stdtypes.rst:5755 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -8269,7 +8289,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5741 +#: ../../library/stdtypes.rst:5758 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -8277,7 +8297,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5744 +#: ../../library/stdtypes.rst:5761 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -8289,7 +8309,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5749 +#: ../../library/stdtypes.rst:5766 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -8301,7 +8321,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5755 +#: ../../library/stdtypes.rst:5772 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -8311,13 +8331,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5759 +#: ../../library/stdtypes.rst:5776 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5762 +#: ../../library/stdtypes.rst:5779 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -8335,13 +8355,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5770 +#: ../../library/stdtypes.rst:5787 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5772 +#: ../../library/stdtypes.rst:5789 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -8355,7 +8375,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5778 +#: ../../library/stdtypes.rst:5795 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -8363,7 +8383,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5781 +#: ../../library/stdtypes.rst:5798 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -8375,7 +8395,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5786 +#: ../../library/stdtypes.rst:5803 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -8385,7 +8405,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5790 +#: ../../library/stdtypes.rst:5807 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -8397,253 +8417,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5797 +#: ../../library/stdtypes.rst:5814 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5799 +#: ../../library/stdtypes.rst:5816 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5802 +#: ../../library/stdtypes.rst:5819 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5803 +#: ../../library/stdtypes.rst:5820 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5804 +#: ../../library/stdtypes.rst:5821 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5805 +#: ../../library/stdtypes.rst:5822 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5806 +#: ../../library/stdtypes.rst:5823 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5807 +#: ../../library/stdtypes.rst:5824 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5808 +#: ../../library/stdtypes.rst:5825 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5809 +#: ../../library/stdtypes.rst:5826 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5810 +#: ../../library/stdtypes.rst:5827 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5811 +#: ../../library/stdtypes.rst:5828 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5812 +#: ../../library/stdtypes.rst:5829 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5813 +#: ../../library/stdtypes.rst:5830 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5814 +#: ../../library/stdtypes.rst:5831 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5815 +#: ../../library/stdtypes.rst:5832 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5816 +#: ../../library/stdtypes.rst:5833 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5817 +#: ../../library/stdtypes.rst:5834 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5818 +#: ../../library/stdtypes.rst:5835 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5819 +#: ../../library/stdtypes.rst:5836 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5820 +#: ../../library/stdtypes.rst:5837 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5821 +#: ../../library/stdtypes.rst:5838 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5822 +#: ../../library/stdtypes.rst:5839 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5823 +#: ../../library/stdtypes.rst:5840 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5824 +#: ../../library/stdtypes.rst:5841 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5825 +#: ../../library/stdtypes.rst:5842 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5826 +#: ../../library/stdtypes.rst:5843 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5827 +#: ../../library/stdtypes.rst:5844 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5828 +#: ../../library/stdtypes.rst:5845 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5829 +#: ../../library/stdtypes.rst:5846 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5830 +#: ../../library/stdtypes.rst:5847 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5831 +#: ../../library/stdtypes.rst:5848 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5832 +#: ../../library/stdtypes.rst:5849 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5833 +#: ../../library/stdtypes.rst:5850 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5834 +#: ../../library/stdtypes.rst:5851 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5835 +#: ../../library/stdtypes.rst:5852 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5836 +#: ../../library/stdtypes.rst:5853 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5837 +#: ../../library/stdtypes.rst:5854 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5838 +#: ../../library/stdtypes.rst:5855 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5839 +#: ../../library/stdtypes.rst:5856 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5840 +#: ../../library/stdtypes.rst:5857 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5841 +#: ../../library/stdtypes.rst:5858 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5842 +#: ../../library/stdtypes.rst:5859 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5843 +#: ../../library/stdtypes.rst:5860 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5844 +#: ../../library/stdtypes.rst:5861 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5845 +#: ../../library/stdtypes.rst:5862 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5846 +#: ../../library/stdtypes.rst:5863 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5847 +#: ../../library/stdtypes.rst:5864 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5848 +#: ../../library/stdtypes.rst:5865 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5849 +#: ../../library/stdtypes.rst:5866 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5850 +#: ../../library/stdtypes.rst:5867 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5851 +#: ../../library/stdtypes.rst:5868 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5852 +#: ../../library/stdtypes.rst:5869 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5853 +#: ../../library/stdtypes.rst:5870 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5854 +#: ../../library/stdtypes.rst:5871 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5855 +#: ../../library/stdtypes.rst:5872 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5856 +#: ../../library/stdtypes.rst:5873 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5857 +#: ../../library/stdtypes.rst:5874 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5862 +#: ../../library/stdtypes.rst:5879 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5864 +#: ../../library/stdtypes.rst:5881 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5868 +#: ../../library/stdtypes.rst:5885 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5870 +#: ../../library/stdtypes.rst:5887 msgid "" ">>> list[int].__origin__\n" "" @@ -8651,7 +8671,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5876 +#: ../../library/stdtypes.rst:5893 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 " @@ -8660,7 +8680,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5880 +#: ../../library/stdtypes.rst:5897 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -8668,7 +8688,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5886 +#: ../../library/stdtypes.rst:5903 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -8676,7 +8696,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5889 +#: ../../library/stdtypes.rst:5906 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -8690,7 +8710,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5897 +#: ../../library/stdtypes.rst:5914 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -8700,7 +8720,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5904 +#: ../../library/stdtypes.rst:5921 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -8708,19 +8728,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5912 +#: ../../library/stdtypes.rst:5929 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5913 +#: ../../library/stdtypes.rst:5930 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5915 +#: ../../library/stdtypes.rst:5932 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5916 +#: ../../library/stdtypes.rst:5933 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -8729,7 +8749,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5920 +#: ../../library/stdtypes.rst:5937 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -8737,18 +8757,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5921 +#: ../../library/stdtypes.rst:5938 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5930 +#: ../../library/stdtypes.rst:5947 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5936 +#: ../../library/stdtypes.rst:5953 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -8761,7 +8781,7 @@ msgstr "" "釋 (type annotation) `。與下標 :data:`typing.Union` 相比,聯合型" "別運算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5943 +#: ../../library/stdtypes.rst:5960 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 " @@ -8772,7 +8792,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5948 +#: ../../library/stdtypes.rst:5965 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -8780,7 +8800,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5953 +#: ../../library/stdtypes.rst:5970 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 " @@ -8793,40 +8813,40 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5961 +#: ../../library/stdtypes.rst:5978 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5963 +#: ../../library/stdtypes.rst:5980 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5965 +#: ../../library/stdtypes.rst:5982 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5967 +#: ../../library/stdtypes.rst:5984 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5969 +#: ../../library/stdtypes.rst:5986 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5971 +#: ../../library/stdtypes.rst:5988 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5973 +#: ../../library/stdtypes.rst:5990 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5975 +#: ../../library/stdtypes.rst:5992 msgid "It creates instances of :class:`typing.Union`::" msgstr "它會建立 :class:`typing.Union` 的實例: ::" -#: ../../library/stdtypes.rst:5977 +#: ../../library/stdtypes.rst:5994 msgid "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" @@ -8834,21 +8854,21 @@ msgstr "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" -#: ../../library/stdtypes.rst:5980 +#: ../../library/stdtypes.rst:5997 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5982 +#: ../../library/stdtypes.rst:5999 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5987 +#: ../../library/stdtypes.rst:6004 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5990 +#: ../../library/stdtypes.rst:6007 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -8856,14 +8876,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5993 +#: ../../library/stdtypes.rst:6010 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5996 +#: ../../library/stdtypes.rst:6013 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -8873,7 +8893,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:6003 +#: ../../library/stdtypes.rst:6020 msgid "" "The user-exposed type for the union object can be accessed from :class:" "`typing.Union` and used for :func:`isinstance` checks::" @@ -8881,7 +8901,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`typing." "Union` 存取並用於 :func:`isinstance` 檢查: ::" -#: ../../library/stdtypes.rst:6006 +#: ../../library/stdtypes.rst:6023 msgid "" ">>> import typing\n" ">>> isinstance(int | str, typing.Union)\n" @@ -8899,7 +8919,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'typing.Union' instances" -#: ../../library/stdtypes.rst:6015 +#: ../../library/stdtypes.rst:6032 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 " @@ -8908,7 +8928,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:6019 +#: ../../library/stdtypes.rst:6036 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -8934,32 +8954,32 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:6035 +#: ../../library/stdtypes.rst:6052 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:6041 +#: ../../library/stdtypes.rst:6058 msgid "" "Union objects are now instances of :class:`typing.Union`. Previously, they " "were instances of :class:`types.UnionType`, which remains an alias for :" "class:`typing.Union`." msgstr "" -#: ../../library/stdtypes.rst:6048 +#: ../../library/stdtypes.rst:6065 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:6050 +#: ../../library/stdtypes.rst:6067 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:6057 +#: ../../library/stdtypes.rst:6074 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:6059 +#: ../../library/stdtypes.rst:6076 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 " @@ -8970,7 +8990,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:6066 +#: ../../library/stdtypes.rst:6083 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -8981,32 +9001,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:6074 +#: ../../library/stdtypes.rst:6091 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:6082 +#: ../../library/stdtypes.rst:6099 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:6084 +#: ../../library/stdtypes.rst:6101 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:6090 +#: ../../library/stdtypes.rst:6107 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:6092 +#: ../../library/stdtypes.rst:6109 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:6095 +#: ../../library/stdtypes.rst:6112 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -9014,15 +9034,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:6099 +#: ../../library/stdtypes.rst:6116 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:6105 +#: ../../library/stdtypes.rst:6122 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:6109 +#: ../../library/stdtypes.rst:6126 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -9030,7 +9050,7 @@ msgid "" "methods>`. Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:6115 +#: ../../library/stdtypes.rst:6132 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:" @@ -9043,7 +9063,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:6126 +#: ../../library/stdtypes.rst:6143 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -9054,7 +9074,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:6134 +#: ../../library/stdtypes.rst:6151 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -9082,15 +9102,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:6149 +#: ../../library/stdtypes.rst:6166 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:6157 +#: ../../library/stdtypes.rst:6174 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:6163 +#: ../../library/stdtypes.rst:6180 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -9100,7 +9120,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:6170 +#: ../../library/stdtypes.rst:6187 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -9109,21 +9129,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:6177 +#: ../../library/stdtypes.rst:6194 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:6180 +#: ../../library/stdtypes.rst:6197 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:6186 +#: ../../library/stdtypes.rst:6203 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:6192 +#: ../../library/stdtypes.rst:6209 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 " @@ -9131,30 +9151,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:6197 +#: ../../library/stdtypes.rst:6214 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:6203 +#: ../../library/stdtypes.rst:6220 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:6205 +#: ../../library/stdtypes.rst:6222 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:6209 +#: ../../library/stdtypes.rst:6226 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:6216 +#: ../../library/stdtypes.rst:6233 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:6218 +#: ../../library/stdtypes.rst:6235 msgid "" "This object is commonly used to indicate that something is omitted. It " "supports no special operations. There is exactly one ellipsis object, " @@ -9162,63 +9182,63 @@ msgid "" "the :const:`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:6223 +#: ../../library/stdtypes.rst:6240 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:6225 +#: ../../library/stdtypes.rst:6242 msgid "" "In typical use, ``...`` as the ``Ellipsis`` object appears in a few " "different places, for instance:" msgstr "" -#: ../../library/stdtypes.rst:6228 +#: ../../library/stdtypes.rst:6245 msgid "" "In type annotations, such as :ref:`callable arguments ` or :ref:`tuple elements `." msgstr "" -#: ../../library/stdtypes.rst:6231 +#: ../../library/stdtypes.rst:6248 msgid "" "As the body of a function instead of a :ref:`pass statement `." msgstr "" -#: ../../library/stdtypes.rst:6233 +#: ../../library/stdtypes.rst:6250 msgid "" "In third-party libraries, such as `Numpy's slicing and striding `_." msgstr "" -#: ../../library/stdtypes.rst:6236 +#: ../../library/stdtypes.rst:6253 msgid "" "Python also uses three dots in ways that are not ``Ellipsis`` objects, for " "instance:" msgstr "" -#: ../../library/stdtypes.rst:6238 +#: ../../library/stdtypes.rst:6255 msgid "" "Doctest's :const:`ELLIPSIS `, as a pattern for missing " "content." msgstr "" -#: ../../library/stdtypes.rst:6240 +#: ../../library/stdtypes.rst:6257 msgid "" "The default Python prompt of the :term:`interactive` shell when partial " "input is incomplete." msgstr "" -#: ../../library/stdtypes.rst:6242 +#: ../../library/stdtypes.rst:6259 msgid "" "Lastly, the Python documentation often uses three dots in conventional " "English usage to mean omitted content, even in code examples that also use " "them as the ``Ellipsis``." msgstr "" -#: ../../library/stdtypes.rst:6250 +#: ../../library/stdtypes.rst:6267 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:6252 +#: ../../library/stdtypes.rst:6269 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 " @@ -9226,64 +9246,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:6257 +#: ../../library/stdtypes.rst:6274 msgid "It is written as :code:`NotImplemented`." msgstr "它被寫為 :code:`NotImplemented`。" -#: ../../library/stdtypes.rst:6263 +#: ../../library/stdtypes.rst:6280 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:6265 +#: ../../library/stdtypes.rst:6282 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:6273 +#: ../../library/stdtypes.rst:6290 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:6275 +#: ../../library/stdtypes.rst:6292 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:6282 +#: ../../library/stdtypes.rst:6299 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:6288 +#: ../../library/stdtypes.rst:6305 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:6296 +#: ../../library/stdtypes.rst:6313 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:6301 +#: ../../library/stdtypes.rst:6318 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:6306 +#: ../../library/stdtypes.rst:6323 msgid "" "The :ref:`type parameters ` of generic classes, functions, and :" "ref:`type aliases `. For classes and functions that are not " "generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:6316 +#: ../../library/stdtypes.rst:6333 msgid "Integer string conversion length limitation" msgstr "整數字串轉換長度限制" -#: ../../library/stdtypes.rst:6318 +#: ../../library/stdtypes.rst:6335 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 " @@ -9295,7 +9315,7 @@ msgstr "" "進位的數值。十六進位、八進位,還有二進位的轉換則沒有長度限制。此限制值可以被" "調整。" -#: ../../library/stdtypes.rst:6323 +#: ../../library/stdtypes.rst:6340 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 " @@ -9305,24 +9325,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:6330 +#: ../../library/stdtypes.rst:6347 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:6332 +#: ../../library/stdtypes.rst:6349 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:6336 +#: ../../library/stdtypes.rst:6353 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:6338 +#: ../../library/stdtypes.rst:6355 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -9346,7 +9366,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:6358 +#: ../../library/stdtypes.rst:6375 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -9354,11 +9374,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:6363 +#: ../../library/stdtypes.rst:6380 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:6365 +#: ../../library/stdtypes.rst:6382 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -9376,11 +9396,11 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:6378 +#: ../../library/stdtypes.rst:6395 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:6380 +#: ../../library/stdtypes.rst:6397 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" @@ -9388,74 +9408,74 @@ msgstr "" "此限制僅適用於 :class:`int` 與 :class:`str` 或 :class:`bytes` 之間可能較慢的" "轉換:" -#: ../../library/stdtypes.rst:6383 +#: ../../library/stdtypes.rst:6400 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:6384 +#: ../../library/stdtypes.rst:6401 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "``int(string, base)`` 用於所有非 2 冪次方的底。" -#: ../../library/stdtypes.rst:6385 +#: ../../library/stdtypes.rst:6402 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:6386 +#: ../../library/stdtypes.rst:6403 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:6387 +#: ../../library/stdtypes.rst:6404 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:6390 +#: ../../library/stdtypes.rst:6407 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:6392 +#: ../../library/stdtypes.rst:6409 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "``int(string, base)`` 以 2、4、8、16 或 32 為底。" -#: ../../library/stdtypes.rst:6393 +#: ../../library/stdtypes.rst:6410 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:6394 +#: ../../library/stdtypes.rst:6411 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:6395 +#: ../../library/stdtypes.rst:6412 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr ":ref:`formatspec` 用於十六進位、八進位和二進位數字。" -#: ../../library/stdtypes.rst:6396 +#: ../../library/stdtypes.rst:6413 msgid ":class:`str` to :class:`float`." msgstr ":class:`str` 轉換為 :class:`float`。" -#: ../../library/stdtypes.rst:6397 +#: ../../library/stdtypes.rst:6414 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr ":class:`str` 轉換為 :class:`decimal.Decimal`。" -#: ../../library/stdtypes.rst:6400 +#: ../../library/stdtypes.rst:6417 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:6402 +#: ../../library/stdtypes.rst:6419 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:6405 +#: ../../library/stdtypes.rst:6422 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:6408 +#: ../../library/stdtypes.rst:6425 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -9463,7 +9483,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:6410 +#: ../../library/stdtypes.rst:6427 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 " @@ -9472,38 +9492,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:6416 +#: ../../library/stdtypes.rst:6433 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:6419 +#: ../../library/stdtypes.rst:6436 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:6423 +#: ../../library/stdtypes.rst:6440 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:6425 +#: ../../library/stdtypes.rst:6442 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:6427 +#: ../../library/stdtypes.rst:6444 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:6434 +#: ../../library/stdtypes.rst:6451 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 " @@ -9515,7 +9535,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:6443 +#: ../../library/stdtypes.rst:6460 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 " @@ -9523,11 +9543,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:6449 +#: ../../library/stdtypes.rst:6466 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:6451 +#: ../../library/stdtypes.rst:6468 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 " @@ -9535,11 +9555,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:6456 +#: ../../library/stdtypes.rst:6473 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:6458 +#: ../../library/stdtypes.rst:6475 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -9561,38 +9581,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:6468 +#: ../../library/stdtypes.rst:6485 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:6472 +#: ../../library/stdtypes.rst:6489 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:6473 +#: ../../library/stdtypes.rst:6490 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:6476 +#: ../../library/stdtypes.rst:6493 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:6479 +#: ../../library/stdtypes.rst:6496 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:6481 +#: ../../library/stdtypes.rst:6498 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:6484 +#: ../../library/stdtypes.rst:6501 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -9605,13 +9625,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:332 #: ../../library/stdtypes.rst:409 ../../library/stdtypes.rst:1002 #: ../../library/stdtypes.rst:1192 ../../library/stdtypes.rst:1214 -#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:5186 -#: ../../library/stdtypes.rst:6188 +#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:5203 +#: ../../library/stdtypes.rst:6205 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1229 -#: ../../library/stdtypes.rst:5186 +#: ../../library/stdtypes.rst:5203 msgid "statement" msgstr "statement(陳述式)" @@ -9733,11 +9753,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1214 ../../library/stdtypes.rst:1379 #: ../../library/stdtypes.rst:1463 ../../library/stdtypes.rst:1507 #: ../../library/stdtypes.rst:1628 ../../library/stdtypes.rst:1758 -#: ../../library/stdtypes.rst:3207 ../../library/stdtypes.rst:3226 -#: ../../library/stdtypes.rst:3339 ../../library/stdtypes.rst:4975 -#: ../../library/stdtypes.rst:5186 ../../library/stdtypes.rst:5675 -#: ../../library/stdtypes.rst:5932 ../../library/stdtypes.rst:6107 -#: ../../library/stdtypes.rst:6152 +#: ../../library/stdtypes.rst:3224 ../../library/stdtypes.rst:3243 +#: ../../library/stdtypes.rst:3356 ../../library/stdtypes.rst:4992 +#: ../../library/stdtypes.rst:5203 ../../library/stdtypes.rst:5692 +#: ../../library/stdtypes.rst:5949 ../../library/stdtypes.rst:6124 +#: ../../library/stdtypes.rst:6169 msgid "object" msgstr "object(物件)" @@ -9829,9 +9849,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:1002 -#: ../../library/stdtypes.rst:1192 ../../library/stdtypes.rst:5186 -#: ../../library/stdtypes.rst:6159 ../../library/stdtypes.rst:6173 -#: ../../library/stdtypes.rst:6188 +#: ../../library/stdtypes.rst:1192 ../../library/stdtypes.rst:5203 +#: ../../library/stdtypes.rst:6176 ../../library/stdtypes.rst:6190 +#: ../../library/stdtypes.rst:6205 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -9847,8 +9867,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3083 -#: ../../library/stdtypes.rst:4343 +#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3100 +#: ../../library/stdtypes.rst:4360 msgid "+ (plus)" msgstr "+ (加號)" @@ -9860,13 +9880,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3083 -#: ../../library/stdtypes.rst:4343 +#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3100 +#: ../../library/stdtypes.rst:4360 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3040 -#: ../../library/stdtypes.rst:4300 +#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3057 +#: ../../library/stdtypes.rst:4317 msgid "* (asterisk)" msgstr "* (星號)" @@ -9878,8 +9898,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3003 -#: ../../library/stdtypes.rst:4268 +#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3020 +#: ../../library/stdtypes.rst:4285 msgid "% (percent)" msgstr "% (百分號)" @@ -9889,7 +9909,7 @@ msgstr "**" #: ../../library/stdtypes.rst:332 ../../library/stdtypes.rst:409 #: ../../library/stdtypes.rst:1002 ../../library/stdtypes.rst:1229 -#: ../../library/stdtypes.rst:5186 +#: ../../library/stdtypes.rst:5203 msgid "operations on" msgstr "operations on(操作於)" @@ -9898,7 +9918,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:351 ../../library/stdtypes.rst:1826 -#: ../../library/stdtypes.rst:3207 ../../library/stdtypes.rst:6188 +#: ../../library/stdtypes.rst:3224 ../../library/stdtypes.rst:6205 msgid "module" msgstr "模組" @@ -9966,7 +9986,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:899 ../../library/stdtypes.rst:5588 +#: ../../library/stdtypes.rst:899 ../../library/stdtypes.rst:5605 msgid "protocol" msgstr "protocol(協定)" @@ -9992,7 +10012,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:1002 ../../library/stdtypes.rst:5186 +#: ../../library/stdtypes.rst:1002 ../../library/stdtypes.rst:5203 msgid "len" msgstr "len" @@ -10061,14 +10081,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1214 ../../library/stdtypes.rst:3207 -#: ../../library/stdtypes.rst:3339 ../../library/stdtypes.rst:3449 -#: ../../library/stdtypes.rst:4268 +#: ../../library/stdtypes.rst:1214 ../../library/stdtypes.rst:3224 +#: ../../library/stdtypes.rst:3356 ../../library/stdtypes.rst:3466 +#: ../../library/stdtypes.rst:4285 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:5186 -#: ../../library/stdtypes.rst:5932 ../../library/stdtypes.rst:6188 +#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:5203 +#: ../../library/stdtypes.rst:5949 ../../library/stdtypes.rst:6205 msgid "type" msgstr "type(型別)" @@ -10076,7 +10096,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:5186 +#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:5203 msgid "del" msgstr "del" @@ -10085,8 +10105,8 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1628 ../../library/stdtypes.rst:1771 -#: ../../library/stdtypes.rst:1818 ../../library/stdtypes.rst:2831 -#: ../../library/stdtypes.rst:3003 +#: ../../library/stdtypes.rst:1818 ../../library/stdtypes.rst:2848 +#: ../../library/stdtypes.rst:3020 msgid "string" msgstr "string(字串)" @@ -10107,17 +10127,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1791 ../../library/stdtypes.rst:3199 +#: ../../library/stdtypes.rst:1791 ../../library/stdtypes.rst:3216 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1791 ../../library/stdtypes.rst:3207 -#: ../../library/stdtypes.rst:3226 ../../library/stdtypes.rst:3449 -#: ../../library/stdtypes.rst:4268 +#: ../../library/stdtypes.rst:1791 ../../library/stdtypes.rst:3224 +#: ../../library/stdtypes.rst:3243 ../../library/stdtypes.rst:3466 +#: ../../library/stdtypes.rst:4285 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1818 ../../library/stdtypes.rst:3449 +#: ../../library/stdtypes.rst:1818 ../../library/stdtypes.rst:3466 msgid "methods" msgstr "methods(方法)" @@ -10125,239 +10145,239 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2621 ../../library/stdtypes.rst:4122 +#: ../../library/stdtypes.rst:2634 ../../library/stdtypes.rst:4139 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2621 +#: ../../library/stdtypes.rst:2634 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "! formatted string literal" msgstr "! formatted string literals(! 格式化字串常數)" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "formatted string literals" msgstr "formatted string literals(格式化字串常數)" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "! f-string" msgstr "! f-string(! f 字串)" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "! (exclamation mark)" msgstr "! (驚嘆號)" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "= (equals)" msgstr "= (等號)" -#: ../../library/stdtypes.rst:2831 +#: ../../library/stdtypes.rst:2848 msgid "for help in debugging using string literals" msgstr "" -#: ../../library/stdtypes.rst:3003 +#: ../../library/stdtypes.rst:3020 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:3003 +#: ../../library/stdtypes.rst:3020 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:3003 +#: ../../library/stdtypes.rst:3020 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:3003 +#: ../../library/stdtypes.rst:3020 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:3003 ../../library/stdtypes.rst:4268 +#: ../../library/stdtypes.rst:3020 ../../library/stdtypes.rst:4285 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:3003 ../../library/stdtypes.rst:4268 +#: ../../library/stdtypes.rst:3020 ../../library/stdtypes.rst:4285 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:3040 ../../library/stdtypes.rst:4300 +#: ../../library/stdtypes.rst:3057 ../../library/stdtypes.rst:4317 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:3040 ../../library/stdtypes.rst:3083 -#: ../../library/stdtypes.rst:4300 ../../library/stdtypes.rst:4343 +#: ../../library/stdtypes.rst:3057 ../../library/stdtypes.rst:3100 +#: ../../library/stdtypes.rst:4317 ../../library/stdtypes.rst:4360 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:3040 ../../library/stdtypes.rst:4300 +#: ../../library/stdtypes.rst:3057 ../../library/stdtypes.rst:4317 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:3083 ../../library/stdtypes.rst:4343 +#: ../../library/stdtypes.rst:3100 ../../library/stdtypes.rst:4360 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:3083 ../../library/stdtypes.rst:4343 +#: ../../library/stdtypes.rst:3100 ../../library/stdtypes.rst:4360 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:3199 +#: ../../library/stdtypes.rst:3216 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:3207 +#: ../../library/stdtypes.rst:3224 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:3207 +#: ../../library/stdtypes.rst:3224 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:4122 +#: ../../library/stdtypes.rst:4139 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:4122 +#: ../../library/stdtypes.rst:4139 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:4268 +#: ../../library/stdtypes.rst:4285 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:4268 +#: ../../library/stdtypes.rst:4285 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:4268 +#: ../../library/stdtypes.rst:4285 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:4268 +#: ../../library/stdtypes.rst:4285 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4975 +#: ../../library/stdtypes.rst:4992 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:5186 +#: ../../library/stdtypes.rst:5203 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:5186 +#: ../../library/stdtypes.rst:5203 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:5293 +#: ../../library/stdtypes.rst:5310 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:5588 +#: ../../library/stdtypes.rst:5605 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:5588 +#: ../../library/stdtypes.rst:5605 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:5588 +#: ../../library/stdtypes.rst:5605 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5663 +#: ../../library/stdtypes.rst:5680 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5663 +#: ../../library/stdtypes.rst:5680 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5675 +#: ../../library/stdtypes.rst:5692 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5675 +#: ../../library/stdtypes.rst:5692 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5675 +#: ../../library/stdtypes.rst:5692 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5932 +#: ../../library/stdtypes.rst:5949 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5932 +#: ../../library/stdtypes.rst:5949 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:6107 +#: ../../library/stdtypes.rst:6124 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:6152 +#: ../../library/stdtypes.rst:6169 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:6152 +#: ../../library/stdtypes.rst:6169 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:6159 +#: ../../library/stdtypes.rst:6176 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:6159 +#: ../../library/stdtypes.rst:6176 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:6173 +#: ../../library/stdtypes.rst:6190 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:6173 +#: ../../library/stdtypes.rst:6190 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:6212 +#: ../../library/stdtypes.rst:6229 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:6212 +#: ../../library/stdtypes.rst:6229 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號字面值)" diff --git a/library/typing.po b/library/typing.po index eb4aec48d9..08b1e84550 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-18 00:20+0000\n" +"POT-Creation-Date: 2026-02-26 18:22+0000\n" "PO-Revision-Date: 2024-07-11 11:12+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -390,7 +390,7 @@ msgstr "" "class:`str`。" #: ../../library/typing.rst:215 ../../library/typing.rst:3296 -#: ../../library/typing.rst:3482 +#: ../../library/typing.rst:3494 msgid "For example:" msgstr "舉例來說:" @@ -513,7 +513,7 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:287 ../../library/typing.rst:4013 +#: ../../library/typing.rst:287 ../../library/typing.rst:4025 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." @@ -1476,8 +1476,8 @@ msgid "" "``Iterable[int]`` by static type checkers. This is known as *structural " "subtyping* (or static duck-typing)::" msgstr "" -":pep:`544` 讓使用者可以撰寫上方的程式碼,且不用在類別定義中寫基底類別來解決這個問" -"題,讓 ``Bucket`` 被靜態型別檢查器隱性認為是 ``Sized`` 以及 " +":pep:`544` 讓使用者可以撰寫上方的程式碼,且不用在類別定義中寫基底類別來解決這" +"個問題,讓 ``Bucket`` 被靜態型別檢查器隱性認為是 ``Sized`` 以及 " "``Iterable[int]`` 兩者的子型別。這就是眾所周知的\\ *結構子型別*\\ (或是靜態" "鴨子型別): ::" @@ -1581,7 +1581,7 @@ msgstr "" #: ../../library/typing.rst:1048 ../../library/typing.rst:1230 #: ../../library/typing.rst:1317 ../../library/typing.rst:1359 #: ../../library/typing.rst:1568 ../../library/typing.rst:1629 -#: ../../library/typing.rst:3233 ../../library/typing.rst:3467 +#: ../../library/typing.rst:3233 ../../library/typing.rst:3479 msgid "For example::" msgstr "舉例來說: ::" @@ -3832,7 +3832,7 @@ msgid "Typed version of :func:`collections.namedtuple`." msgstr "" #: ../../library/typing.rst:2362 ../../library/typing.rst:2462 -#: ../../library/typing.rst:3571 +#: ../../library/typing.rst:3583 msgid "Usage::" msgstr "用法: ::" @@ -5358,8 +5358,8 @@ msgstr "" #: ../../library/typing.rst:3350 msgid "" -"Return a dictionary containing type hints for a function, method, module or " -"class object." +"Return a dictionary containing type hints for a function, method, module, " +"class object, or other callable object." msgstr "" #: ../../library/typing.rst:3353 @@ -5411,7 +5411,7 @@ msgid "" "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:3381 ../../library/typing.rst:3532 +#: ../../library/typing.rst:3381 ../../library/typing.rst:3544 msgid "" "This function may execute arbitrary code contained in annotations. See :ref:" "`annotationlib-security` for more information." @@ -5426,7 +5426,14 @@ msgid "" "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:3392 +#: ../../library/typing.rst:3394 +msgid "" +"Calling :func:`get_type_hints` on an instance is not supported. To retrieve " +"annotations for an instance, call :func:`get_type_hints` on the instance's " +"class instead (for example, ``get_type_hints(type(obj))``)." +msgstr "" + +#: ../../library/typing.rst:3399 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." @@ -5434,20 +5441,27 @@ msgstr "" "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" "`Annotated` 的文件。" -#: ../../library/typing.rst:3396 +#: ../../library/typing.rst:3403 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:3403 +#: ../../library/typing.rst:3408 +msgid "" +"Calling :func:`get_type_hints` on instances is no longer supported. Some " +"instances were accepted in earlier versions as an undocumented " +"implementation detail." +msgstr "" + +#: ../../library/typing.rst:3415 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3406 +#: ../../library/typing.rst:3418 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 :" @@ -5455,11 +5469,11 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3412 ../../library/typing.rst:3436 +#: ../../library/typing.rst:3424 ../../library/typing.rst:3448 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3414 +#: ../../library/typing.rst:3426 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -5477,13 +5491,13 @@ msgstr "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3428 +#: ../../library/typing.rst:3440 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:3431 +#: ../../library/typing.rst:3443 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 " @@ -5491,7 +5505,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3438 +#: ../../library/typing.rst:3450 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -5501,11 +5515,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3448 +#: ../../library/typing.rst:3460 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3450 +#: ../../library/typing.rst:3462 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -5521,15 +5535,15 @@ msgstr "" ">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" "True" -#: ../../library/typing.rst:3459 +#: ../../library/typing.rst:3471 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3465 +#: ../../library/typing.rst:3477 msgid "Determine if a type is a :class:`Protocol`." msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3469 +#: ../../library/typing.rst:3481 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5545,11 +5559,11 @@ msgstr "" "is_protocol(P) # => True\n" "is_protocol(int) # => False" -#: ../../library/typing.rst:3480 +#: ../../library/typing.rst:3492 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3484 +#: ../../library/typing.rst:3496 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5563,57 +5577,57 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3501 +#: ../../library/typing.rst:3513 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3503 +#: ../../library/typing.rst:3515 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. :class:`!ForwardRef` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3508 +#: ../../library/typing.rst:3520 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:3514 +#: ../../library/typing.rst:3526 msgid "" "This is now an alias for :class:`annotationlib.ForwardRef`. Several " "undocumented behaviors of this class have been changed; for example, after a " "``ForwardRef`` has been evaluated, the evaluated value is no longer cached." msgstr "" -#: ../../library/typing.rst:3521 +#: ../../library/typing.rst:3533 msgid "Evaluate an :class:`annotationlib.ForwardRef` as a :term:`type hint`." msgstr "" -#: ../../library/typing.rst:3523 +#: ../../library/typing.rst:3535 msgid "" "This is similar to calling :meth:`annotationlib.ForwardRef.evaluate`, but " "unlike that method, :func:`!evaluate_forward_ref` also recursively evaluates " "forward references nested within the type hint." msgstr "" -#: ../../library/typing.rst:3527 +#: ../../library/typing.rst:3539 msgid "" "See the documentation for :meth:`annotationlib.ForwardRef.evaluate` for the " "meaning of the *owner*, *globals*, *locals*, *type_params*, and *format* " "parameters." msgstr "" -#: ../../library/typing.rst:3539 +#: ../../library/typing.rst:3551 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3542 +#: ../../library/typing.rst:3554 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5629,17 +5643,17 @@ msgstr "" ">>> S.__default__ is None\n" "True" -#: ../../library/typing.rst:3554 +#: ../../library/typing.rst:3566 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3558 +#: ../../library/typing.rst:3570 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It's ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3561 +#: ../../library/typing.rst:3573 msgid "" "A module which is expensive to import, and which only contain types used for " "typing annotations, can be safely imported inside an ``if TYPE_CHECKING:`` " @@ -5651,7 +5665,7 @@ msgid "" "will be checked properly during such analysis." msgstr "" -#: ../../library/typing.rst:3573 +#: ../../library/typing.rst:3585 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -5665,7 +5679,7 @@ msgstr "" "def fun(arg: expensive_mod.SomeType) -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3579 +#: ../../library/typing.rst:3591 msgid "" "If you occasionally need to examine type annotations at runtime which may " "contain undefined symbols, use :meth:`annotationlib.get_annotations` with a " @@ -5674,11 +5688,11 @@ msgid "" "raising :exc:`NameError`." msgstr "" -#: ../../library/typing.rst:3592 +#: ../../library/typing.rst:3604 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3594 +#: ../../library/typing.rst:3606 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the :mod:`!typing` module " @@ -5687,7 +5701,7 @@ msgid "" "pre-existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3601 +#: ../../library/typing.rst:3613 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 " @@ -5695,7 +5709,7 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3606 +#: ../../library/typing.rst:3618 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 " @@ -5703,38 +5717,38 @@ msgid "" "`!typing` module without deprecation warnings until at least Python 3.14." msgstr "" -#: ../../library/typing.rst:3611 +#: ../../library/typing.rst:3623 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:3617 +#: ../../library/typing.rst:3629 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3621 +#: ../../library/typing.rst:3633 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3623 +#: ../../library/typing.rst:3635 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:3627 +#: ../../library/typing.rst:3639 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3633 +#: ../../library/typing.rst:3645 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3635 +#: ../../library/typing.rst:3647 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Sequence` or :class:" @@ -5742,136 +5756,136 @@ msgid "" "typing.List`." msgstr "" -#: ../../library/typing.rst:3640 +#: ../../library/typing.rst:3652 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3646 +#: ../../library/typing.rst:3658 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3648 +#: ../../library/typing.rst:3660 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`collections.abc.Set` rather than to use :" "class:`set` or :class:`typing.Set`." msgstr "" -#: ../../library/typing.rst:3652 +#: ../../library/typing.rst:3664 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3658 +#: ../../library/typing.rst:3670 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3660 +#: ../../library/typing.rst:3672 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3667 +#: ../../library/typing.rst:3679 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3669 +#: ../../library/typing.rst:3681 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3672 +#: ../../library/typing.rst:3684 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3678 +#: ../../library/typing.rst:3690 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3680 +#: ../../library/typing.rst:3692 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3685 +#: ../../library/typing.rst:3697 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3692 +#: ../../library/typing.rst:3704 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3696 +#: ../../library/typing.rst:3708 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3700 +#: ../../library/typing.rst:3712 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3706 +#: ../../library/typing.rst:3718 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3710 +#: ../../library/typing.rst:3722 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3716 +#: ../../library/typing.rst:3728 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3720 +#: ../../library/typing.rst:3732 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3726 +#: ../../library/typing.rst:3738 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3730 +#: ../../library/typing.rst:3742 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3736 +#: ../../library/typing.rst:3748 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3740 +#: ../../library/typing.rst:3752 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3747 +#: ../../library/typing.rst:3759 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3752 +#: ../../library/typing.rst:3764 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3755 +#: ../../library/typing.rst:3767 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -5879,29 +5893,29 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3760 +#: ../../library/typing.rst:3772 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3766 +#: ../../library/typing.rst:3778 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3768 +#: ../../library/typing.rst:3780 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:3772 +#: ../../library/typing.rst:3784 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:3775 +#: ../../library/typing.rst:3787 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" @@ -5909,32 +5923,32 @@ msgstr "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" -#: ../../library/typing.rst:3780 +#: ../../library/typing.rst:3792 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:3790 +#: ../../library/typing.rst:3802 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3794 +#: ../../library/typing.rst:3806 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3796 +#: ../../library/typing.rst:3808 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3802 +#: ../../library/typing.rst:3814 msgid "Deprecated alias to :class:`collections.abc.ByteString`." msgstr "棄用 :class:`collections.abc.ByteString` 的別名。" -#: ../../library/typing.rst:3804 +#: ../../library/typing.rst:3816 msgid "" "Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " "implements the :ref:`buffer protocol ` at runtime. For use in " @@ -5947,7 +5961,7 @@ msgstr "" "用 :class:`~collections.abc.Buffer` 或明確指定你的程式碼所支援型別的聯集(例" "如 ``bytes | bytearray | memoryview``)。" -#: ../../library/typing.rst:3810 +#: ../../library/typing.rst:3822 msgid "" ":class:`!ByteString` was originally intended to be an abstract class that " "would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " @@ -5963,286 +5977,286 @@ msgstr "" "其他常見的緩衝區型別如 :class:`memoryview` 也從未被理解為 :class:`!" "ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" -#: ../../library/typing.rst:3818 +#: ../../library/typing.rst:3830 msgid "See :pep:`PEP 688 <688#current-options>` for more details." msgstr "更多細節請見 :pep:`PEP 688 <688#current-options>`。" -#: ../../library/typing.rst:3824 +#: ../../library/typing.rst:3836 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3828 +#: ../../library/typing.rst:3840 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3834 +#: ../../library/typing.rst:3846 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3836 +#: ../../library/typing.rst:3848 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3842 +#: ../../library/typing.rst:3854 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3844 +#: ../../library/typing.rst:3856 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3850 +#: ../../library/typing.rst:3862 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3852 +#: ../../library/typing.rst:3864 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3858 +#: ../../library/typing.rst:3870 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3860 +#: ../../library/typing.rst:3872 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3866 +#: ../../library/typing.rst:3878 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3868 +#: ../../library/typing.rst:3880 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3874 +#: ../../library/typing.rst:3886 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3876 +#: ../../library/typing.rst:3888 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3883 +#: ../../library/typing.rst:3895 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3885 +#: ../../library/typing.rst:3897 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3892 +#: ../../library/typing.rst:3904 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3894 +#: ../../library/typing.rst:3906 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3900 +#: ../../library/typing.rst:3912 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3902 +#: ../../library/typing.rst:3914 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3908 +#: ../../library/typing.rst:3920 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3910 +#: ../../library/typing.rst:3922 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3917 +#: ../../library/typing.rst:3929 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中非同步 ABC 的別名" -#: ../../library/typing.rst:3921 +#: ../../library/typing.rst:3933 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3923 +#: ../../library/typing.rst:3935 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." msgstr "" -#: ../../library/typing.rst:3929 +#: ../../library/typing.rst:3941 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3935 +#: ../../library/typing.rst:3947 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3937 +#: ../../library/typing.rst:3949 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " "annotations." msgstr "" -#: ../../library/typing.rst:3943 +#: ../../library/typing.rst:3955 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3948 +#: ../../library/typing.rst:3960 msgid "The ``SendType`` parameter now has a default." msgstr "``SendType`` 參數現在有預設值。" -#: ../../library/typing.rst:3953 +#: ../../library/typing.rst:3965 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3957 +#: ../../library/typing.rst:3969 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3963 +#: ../../library/typing.rst:3975 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3967 +#: ../../library/typing.rst:3979 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3973 +#: ../../library/typing.rst:3985 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3977 +#: ../../library/typing.rst:3989 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3984 +#: ../../library/typing.rst:3996 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3988 +#: ../../library/typing.rst:4000 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3990 +#: ../../library/typing.rst:4002 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3996 +#: ../../library/typing.rst:4008 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3998 +#: ../../library/typing.rst:4010 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4004 +#: ../../library/typing.rst:4016 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:4006 +#: ../../library/typing.rst:4018 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:4009 +#: ../../library/typing.rst:4021 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4019 +#: ../../library/typing.rst:4031 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:4021 +#: ../../library/typing.rst:4033 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Generator` and ``typing.Generator`` in type annotations." msgstr "" -#: ../../library/typing.rst:4025 +#: ../../library/typing.rst:4037 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4029 +#: ../../library/typing.rst:4041 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:4034 +#: ../../library/typing.rst:4046 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:4036 +#: ../../library/typing.rst:4048 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:4041 +#: ../../library/typing.rst:4053 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:4043 +#: ../../library/typing.rst:4055 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4049 +#: ../../library/typing.rst:4061 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:4051 +#: ../../library/typing.rst:4063 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:4057 +#: ../../library/typing.rst:4069 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:4061 +#: ../../library/typing.rst:4073 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:4063 +#: ../../library/typing.rst:4075 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__enter__` method. The optional second type parameter, " @@ -6250,21 +6264,21 @@ msgid "" "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:4070 +#: ../../library/typing.rst:4082 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4075 +#: ../../library/typing.rst:4087 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:4080 +#: ../../library/typing.rst:4092 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:4082 +#: ../../library/typing.rst:4094 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__aenter__` method. The optional second type parameter, " @@ -6272,21 +6286,21 @@ msgid "" "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:4089 +#: ../../library/typing.rst:4101 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4094 +#: ../../library/typing.rst:4106 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:4098 +#: ../../library/typing.rst:4110 msgid "Deprecation Timeline of Major Features" msgstr "主要功能的棄用時程表" -#: ../../library/typing.rst:4100 +#: ../../library/typing.rst:4112 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -6294,112 +6308,112 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:4107 +#: ../../library/typing.rst:4119 msgid "Feature" msgstr "" -#: ../../library/typing.rst:4108 +#: ../../library/typing.rst:4120 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:4109 +#: ../../library/typing.rst:4121 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:4110 +#: ../../library/typing.rst:4122 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:4111 +#: ../../library/typing.rst:4123 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:4112 ../../library/typing.rst:4116 +#: ../../library/typing.rst:4124 ../../library/typing.rst:4128 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:4113 +#: ../../library/typing.rst:4125 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:4114 +#: ../../library/typing.rst:4126 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:4115 +#: ../../library/typing.rst:4127 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:4117 +#: ../../library/typing.rst:4129 msgid "3.17" msgstr "3.17" -#: ../../library/typing.rst:4118 +#: ../../library/typing.rst:4130 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:4119 +#: ../../library/typing.rst:4131 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:4120 +#: ../../library/typing.rst:4132 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:4121 ../../library/typing.rst:4125 -#: ../../library/typing.rst:4129 +#: ../../library/typing.rst:4133 ../../library/typing.rst:4137 +#: ../../library/typing.rst:4141 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:4122 +#: ../../library/typing.rst:4134 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:4123 +#: ../../library/typing.rst:4135 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:4124 ../../library/typing.rst:4128 +#: ../../library/typing.rst:4136 ../../library/typing.rst:4140 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:4126 +#: ../../library/typing.rst:4138 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:4127 +#: ../../library/typing.rst:4139 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:4130 +#: ../../library/typing.rst:4142 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:4131 +#: ../../library/typing.rst:4143 msgid ":func:`@typing.no_type_check_decorator `" msgstr ":func:`@typing.no_type_check_decorator `" -#: ../../library/typing.rst:4132 ../../library/typing.rst:4136 +#: ../../library/typing.rst:4144 ../../library/typing.rst:4148 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:4133 +#: ../../library/typing.rst:4145 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:4134 +#: ../../library/typing.rst:4146 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:4135 +#: ../../library/typing.rst:4147 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:4137 +#: ../../library/typing.rst:4149 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:4138 +#: ../../library/typing.rst:4150 msgid ":gh:`105578`" msgstr ":gh:`105578`"