diff --git a/c-api/bytes.po b/c-api/bytes.po index 86da7979be..0186c931cc 100644 --- a/c-api/bytes.po +++ b/c-api/bytes.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2018-05-23 14:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -159,8 +159,8 @@ msgid "``%zd``" msgstr "``%zd``" #: ../../c-api/bytes.rst:84 -msgid ":c:type:` Py_ssize_t`" -msgstr ":c:type:` Py_ssize_t`" +msgid ":c:type:`\\ Py_ssize_t`" +msgstr ":c:type:`\\ Py_ssize_t`" #: ../../c-api/bytes.rst:84 msgid "Equivalent to ``printf(\"%zd\")``. [1]_" diff --git a/c-api/intro.po b/c-api/intro.po index 456e744317..d53f508f9c 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-01-16 00:15+0000\n" +"POT-Creation-Date: 2026-02-05 00:20+0000\n" "PO-Revision-Date: 2023-04-25 18:01+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -232,6 +232,47 @@ msgid "" msgstr "" #: ../../c-api/intro.rst:132 +msgid "Specify alignment to *num* bytes on compilers that support it." +msgstr "" + +#: ../../c-api/intro.rst:134 +msgid "Consider using the C11 standard ``_Alignas`` specifier over this macro." +msgstr "" + +#: ../../c-api/intro.rst:138 +msgid "" +"Similar to ``integer >> positions``, but forces sign extension, as the C " +"standard does not define whether a right-shift of a signed integer will " +"perform sign extension or a zero-fill." +msgstr "" + +#: ../../c-api/intro.rst:142 +msgid "" +"*integer* should be any signed integer type. *positions* is the number of " +"positions to shift to the right." +msgstr "" + +#: ../../c-api/intro.rst:145 +msgid "" +"Both *integer* and *positions* can be evaluated more than once; " +"consequently, avoid directly passing a function call or some other operation " +"with side-effects to this macro. Instead, store the result as a variable and " +"then pass it." +msgstr "" + +#: ../../c-api/intro.rst:150 +msgid "" +"*type* is unused and only kept for backwards compatibility. Historically, " +"*type* was used to cast *integer*." +msgstr "" + +#: ../../c-api/intro.rst:155 +msgid "" +"This macro is now valid for all signed integer types, not just those for " +"which ``unsigned type`` is legal. As a result, *type* is no longer used." +msgstr "" + +#: ../../c-api/intro.rst:161 msgid "" "Ask the compiler to always inline a static inline function. The compiler can " "ignore it and decide to not inline the function." @@ -239,7 +280,7 @@ msgstr "" "要求編譯器總是嵌入靜態行內函式 (static inline function),編譯器可以忽略它並決" "定不嵌入該函式。" -#: ../../c-api/intro.rst:135 +#: ../../c-api/intro.rst:164 msgid "" "It can be used to inline performance critical static inline functions when " "building Python in debug mode with function inlining disabled. For example, " @@ -248,7 +289,7 @@ msgstr "" "在禁用函式嵌入的除錯模式下建置 Python 時,它可用於嵌入有性能要求的靜態行內函" "式。例如,MSC 在除錯模式下建置時禁用函式嵌入。" -#: ../../c-api/intro.rst:139 +#: ../../c-api/intro.rst:168 msgid "" "Marking blindly a static inline function with Py_ALWAYS_INLINE can result in " "worse performances (due to increased code size for example). The compiler is " @@ -257,7 +298,7 @@ msgstr "" "盲目地使用 Py_ALWAYS_INLINE 標記靜態行內函式可能會導致更差的性能(例如程式碼" "大小增加)。在成本/收益分析方面,編譯器通常比開發人員更聰明。" -#: ../../c-api/intro.rst:143 +#: ../../c-api/intro.rst:172 msgid "" "If Python is :ref:`built in debug mode ` (if the :c:macro:" "`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` macro does " @@ -266,15 +307,26 @@ msgstr "" "如果 Python 是\\ :ref:`在除錯模式下建置 `\\ (如果 :c:macro:" "`Py_DEBUG` 巨集有被定義),:c:macro:`Py_ALWAYS_INLINE` 巨集就什麼都不會做。" -#: ../../c-api/intro.rst:146 +#: ../../c-api/intro.rst:175 msgid "It must be specified before the function return type. Usage::" msgstr "它必須在函式回傳型別之前被指定。用法: ::" -#: ../../c-api/intro.rst:148 +#: ../../c-api/intro.rst:177 msgid "static inline Py_ALWAYS_INLINE int random(void) { return 4; }" msgstr "static inline Py_ALWAYS_INLINE int random(void) { return 4; }" -#: ../../c-api/intro.rst:154 +#: ../../c-api/intro.rst:183 +msgid "" +"If this macro is defined, then the current system is able to start threads." +msgstr "" + +#: ../../c-api/intro.rst:185 +msgid "" +"Currently, all systems supported by CPython (per :pep:`11`), with the " +"exception of some WebAssembly platforms, support starting threads." +msgstr "" + +#: ../../c-api/intro.rst:192 msgid "" "Argument must be a character or an integer in the range [-128, 127] or [0, " "255]. This macro returns ``c`` cast to an ``unsigned char``." @@ -282,26 +334,44 @@ msgstr "" "引數必須是 [-128, 127] 或 [0, 255] 範圍內的字元或整數。這個巨集會將 ``c`` 轉" "換為 ``unsigned char`` 並回傳。" -#: ../../c-api/intro.rst:159 +#: ../../c-api/intro.rst:197 msgid "" "Use this for deprecated declarations. The macro must be placed before the " "symbol name." msgstr "將其用於已棄用的聲明。巨集必須放在符號名稱之前。" -#: ../../c-api/intro.rst:162 ../../c-api/intro.rst:298 -#: ../../c-api/intro.rst:316 +#: ../../c-api/intro.rst:200 ../../c-api/intro.rst:384 +#: ../../c-api/intro.rst:402 msgid "Example::" msgstr "範例: ::" -#: ../../c-api/intro.rst:164 +#: ../../c-api/intro.rst:202 msgid "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);" msgstr "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);" -#: ../../c-api/intro.rst:166 +#: ../../c-api/intro.rst:204 msgid "MSVC support was added." msgstr "新增了 MSVC 支援。" -#: ../../c-api/intro.rst:171 +#: ../../c-api/intro.rst:209 +msgid "" +"This is equivalent to ``X``, which is useful for token-pasting in macros, as " +"macro expansions in *X* are forcefully evaluated by the preprocessor." +msgstr "" + +#: ../../c-api/intro.rst:215 +msgid "" +"Use a GCC attribute *name*, hiding it from compilers that don't support GCC " +"attributes (such as MSVC)." +msgstr "" + +#: ../../c-api/intro.rst:218 +msgid "" +"This expands to ``__attribute__((name))`` on a GCC compiler, and expands to " +"nothing on compilers that don't support GCC attributes." +msgstr "" + +#: ../../c-api/intro.rst:223 msgid "" "Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the " "command line (see :c:member:`PyConfig.use_environment`)." @@ -309,40 +379,56 @@ msgstr "" "類似於 ``getenv(s)``,但如果在命令列上傳遞了 :option:`-E` 則回傳 ``NULL`` " "(請見 :c:member:`PyConfig.use_environment`)。" -#: ../../c-api/intro.rst:176 +#: ../../c-api/intro.rst:228 +msgid "Use *number* as a ``long long`` integer literal." +msgstr "" + +#: ../../c-api/intro.rst:230 +msgid "" +"This usally expands to *number* followed by ``LL``, but will expand to some " +"compiler-specific suffixes (such as ``I64``) on older compilers." +msgstr "" + +#: ../../c-api/intro.rst:233 +msgid "" +"In modern versions of Python, this macro is not very useful, as C99 and " +"later require the ``LL`` suffix to be valid for an integer." +msgstr "" + +#: ../../c-api/intro.rst:238 msgid "" "Declare a function returning the specified *type* using a fast-calling " "qualifier for functions that are local to the current file. Semantically, " "this is equivalent to ``static type``." msgstr "" -#: ../../c-api/intro.rst:182 +#: ../../c-api/intro.rst:244 msgid "" "Equivalent to :c:macro:`Py_LOCAL` but additionally requests the function be " "inlined." msgstr "" -#: ../../c-api/intro.rst:187 +#: ../../c-api/intro.rst:249 msgid "" "Macro used to declare a symbol as local to the shared library (hidden). On " "supported platforms, it ensures the symbol is not exported." msgstr "" -#: ../../c-api/intro.rst:190 +#: ../../c-api/intro.rst:252 msgid "" "On compatible versions of GCC/Clang, it expands to " "``__attribute__((visibility(\"hidden\")))``." msgstr "" -#: ../../c-api/intro.rst:195 +#: ../../c-api/intro.rst:257 msgid "Return the maximum value between ``x`` and ``y``." msgstr "回傳 ``x`` 和 ``y`` 之間的最大值。" -#: ../../c-api/intro.rst:201 +#: ../../c-api/intro.rst:263 msgid "Return the size of a structure (``type``) ``member`` in bytes." msgstr "以位元組為單位回傳結構 (``type``) ``member`` 的大小。" -#: ../../c-api/intro.rst:207 +#: ../../c-api/intro.rst:269 msgid "" "This is a :term:`soft deprecated` alias to :c:func:`!memcpy`. Use :c:func:`!" "memcpy` directly instead." @@ -350,15 +436,15 @@ msgstr "" "這是 :c:func:`!memcpy` 的已\\ :term:`軟性棄用 `\\ 別名。請直" "接使用 :c:func:`!memcpy`。" -#: ../../c-api/intro.rst:210 +#: ../../c-api/intro.rst:272 msgid "The macro is :term:`soft deprecated`." msgstr "這個巨集已被\\ :term:`軟性棄用 `。" -#: ../../c-api/intro.rst:215 +#: ../../c-api/intro.rst:277 msgid "Return the minimum value between ``x`` and ``y``." msgstr "回傳 ``x`` 和 ``y`` 之間的最小值。" -#: ../../c-api/intro.rst:221 +#: ../../c-api/intro.rst:283 msgid "" "Disable inlining on a function. For example, it reduces the C stack " "consumption: useful on LTO+PGO builds which heavily inline code (see :issue:" @@ -367,21 +453,58 @@ msgstr "" "禁用函式的嵌入。例如,它減少了 C 堆疊的消耗:對大量嵌入程式碼的 LTO+PGO 建置" "很有用(請參閱 :issue:`33720`)。" -#: ../../c-api/intro.rst:225 +#: ../../c-api/intro.rst:287 msgid "Usage::" msgstr "用法: ::" -#: ../../c-api/intro.rst:227 +#: ../../c-api/intro.rst:289 msgid "Py_NO_INLINE static int random(void) { return 4; }" msgstr "Py_NO_INLINE static int random(void) { return 4; }" -#: ../../c-api/intro.rst:233 +#: ../../c-api/intro.rst:295 +msgid "" +"Cast *value* to type *smaller* from type *larger*, validating that no " +"information was lost." +msgstr "" + +#: ../../c-api/intro.rst:298 +msgid "" +"On release builds of Python, this is roughly equivalent to ``(smaller) " +"value`` (in C++, ``static_cast(value)`` will be used instead)." +msgstr "" + +#: ../../c-api/intro.rst:302 +msgid "" +"On debug builds (implying that :c:macro:`Py_DEBUG` is defined), this asserts " +"that no information was lost with the cast from *larger* to *smaller*." +msgstr "" + +#: ../../c-api/intro.rst:305 +msgid "" +"*value*, *larger*, and *smaller* may all be evaluated more than once in the " +"expression; consequently, do not pass an expression with side-effects " +"directly to this macro." +msgstr "" + +#: ../../c-api/intro.rst:311 msgid "" "Convert ``x`` to a C string. E.g. ``Py_STRINGIFY(123)`` returns ``\"123\"``." msgstr "" "將 ``x`` 轉換為 C 字串。例如 ``Py_STRINGIFY(123)`` 會回傳 ``\"123\"``。" -#: ../../c-api/intro.rst:240 +#: ../../c-api/intro.rst:318 +msgid "" +"Similar to :c:macro:`Py_LL`, but *number* will be an ``unsigned long long`` " +"literal instead. This is done by appending ``U`` to the result of ``Py_LL``." +msgstr "" + +#: ../../c-api/intro.rst:321 +msgid "" +"In modern versions of Python, this macro is not very useful, as C99 and " +"later require the ``ULL``/``LLU`` suffixes to be valid for an integer." +msgstr "" + +#: ../../c-api/intro.rst:326 msgid "" "Use this when you have a code path that cannot be reached by design. For " "example, in the ``default:`` clause in a ``switch`` statement for which all " @@ -392,7 +515,7 @@ msgstr "" "蓋了所有可能值的 ``switch`` 陳述式中的 ``default:`` 子句。在你可能想要呼叫 " "``assert(0)`` 或 ``abort()`` 的地方使用它。" -#: ../../c-api/intro.rst:245 +#: ../../c-api/intro.rst:331 msgid "" "In release mode, the macro helps the compiler to optimize the code, and " "avoids a warning about unreachable code. For example, the macro is " @@ -402,7 +525,7 @@ msgstr "" "程式碼的警告。例如該巨集是在發布模式下於 GCC 使用 " "``__builtin_unreachable()`` 來實作。" -#: ../../c-api/intro.rst:249 +#: ../../c-api/intro.rst:335 msgid "" "A use for ``Py_UNREACHABLE()`` is following a call a function that never " "returns but that is not declared :c:macro:`_Py_NO_RETURN`." @@ -410,7 +533,7 @@ msgstr "" "``Py_UNREACHABLE()`` 的一個用途是,在對一個永不回傳但並未聲明為 :c:macro:" "`_Py_NO_RETURN` 的函式之呼叫後使用。" -#: ../../c-api/intro.rst:252 +#: ../../c-api/intro.rst:338 msgid "" "If a code path is very unlikely code but can be reached under exceptional " "case, this macro must not be used. For example, under low memory condition " @@ -422,7 +545,7 @@ msgstr "" "憶體條件下或系統呼叫回傳了超出預期範圍的值。在這種情況下,最好將錯誤回報給呼" "叫者。如果無法回報錯誤則可以使用 :c:func:`Py_FatalError`。" -#: ../../c-api/intro.rst:262 +#: ../../c-api/intro.rst:348 msgid "" "Use this for unused arguments in a function definition to silence compiler " "warnings. Example: ``int func(int a, int Py_UNUSED(b)) { return a; }``." @@ -430,29 +553,29 @@ msgstr "" "將此用於函式定義中未使用的參數以消除編譯器警告。例如:``int func(int a, int " "Py_UNUSED(b)) { return a; }``。" -#: ../../c-api/intro.rst:269 +#: ../../c-api/intro.rst:355 msgid "" "Asserts a compile-time condition *cond*, as a statement. The build will fail " "if the condition is false or cannot be evaluated at compile time." msgstr "" -#: ../../c-api/intro.rst:272 ../../c-api/intro.rst:283 -#: ../../c-api/intro.rst:328 +#: ../../c-api/intro.rst:358 ../../c-api/intro.rst:369 +#: ../../c-api/intro.rst:414 msgid "For example::" msgstr "範例: ::" -#: ../../c-api/intro.rst:274 +#: ../../c-api/intro.rst:360 msgid "Py_BUILD_ASSERT(sizeof(PyTime_t) == sizeof(int64_t));" msgstr "Py_BUILD_ASSERT(sizeof(PyTime_t) == sizeof(int64_t));" -#: ../../c-api/intro.rst:280 +#: ../../c-api/intro.rst:366 msgid "" "Asserts a compile-time condition *cond*, as an expression that evaluates to " "``0``. The build will fail if the condition is false or cannot be evaluated " "at compile time." msgstr "" -#: ../../c-api/intro.rst:285 +#: ../../c-api/intro.rst:371 msgid "" "#define foo_to_char(foo) \\\n" " ((char *)(foo) + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))" @@ -460,7 +583,7 @@ msgstr "" "#define foo_to_char(foo) \\\n" " ((char *)(foo) + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))" -#: ../../c-api/intro.rst:292 +#: ../../c-api/intro.rst:378 msgid "" "Creates a variable with name *name* that can be used in docstrings. If " "Python is built without docstrings, the value will be empty." @@ -468,7 +591,7 @@ msgstr "" "建立一個名為 *name* 的變數,可以在文件字串中使用。如果 Python 是在沒有文件字" "串的情況下建置,則該值將為空。" -#: ../../c-api/intro.rst:295 +#: ../../c-api/intro.rst:381 msgid "" "Use :c:macro:`PyDoc_STRVAR` for docstrings to support building Python " "without docstrings, as specified in :pep:`7`." @@ -476,7 +599,7 @@ msgstr "" "如 :pep:`7` 中所指明,使用 :c:macro:`PyDoc_STRVAR` 作為文件字串可以支援在沒有" "文件字串的情況下建置 Python。" -#: ../../c-api/intro.rst:300 +#: ../../c-api/intro.rst:386 msgid "" "PyDoc_STRVAR(pop_doc, \"Remove and return the rightmost element.\");\n" "\n" @@ -494,13 +617,13 @@ msgstr "" " // ...\n" "}" -#: ../../c-api/intro.rst:310 +#: ../../c-api/intro.rst:396 msgid "" "Creates a docstring for the given input string or an empty string if " "docstrings are disabled." msgstr "為給定的輸入字串建立一個文件字串,如果文件字串被禁用則建立空字串。" -#: ../../c-api/intro.rst:313 +#: ../../c-api/intro.rst:399 msgid "" "Use :c:macro:`PyDoc_STR` in specifying docstrings to support building Python " "without docstrings, as specified in :pep:`7`." @@ -508,7 +631,7 @@ msgstr "" "如 :pep:`7` 中所指明,使用 :c:macro:`PyDoc_STR` 指定文件字串以支援在沒有文件" "字串下建置 Python。" -#: ../../c-api/intro.rst:318 +#: ../../c-api/intro.rst:404 msgid "" "static PyMethodDef pysqlite_row_methods[] = {\n" " {\"keys\", (PyCFunction)pysqlite_row_keys, METH_NOARGS,\n" @@ -522,11 +645,11 @@ msgstr "" " {NULL, NULL}\n" "};" -#: ../../c-api/intro.rst:326 +#: ../../c-api/intro.rst:412 msgid "Declares a static character array variable with the given name *name*." msgstr "" -#: ../../c-api/intro.rst:330 +#: ../../c-api/intro.rst:416 msgid "" "PyDoc_VAR(python_doc) = PyDoc_STR(\"A genus of constricting snakes in the " "Pythonidae family native \"\n" @@ -538,11 +661,11 @@ msgstr "" " \"to the tropics and subtropics of the " "Eastern Hemisphere.\");" -#: ../../c-api/intro.rst:335 +#: ../../c-api/intro.rst:421 msgid "Compute the length of a statically allocated C array at compile time." msgstr "" -#: ../../c-api/intro.rst:337 +#: ../../c-api/intro.rst:423 msgid "" "The *array* argument must be a C array with a size known at compile time. " "Passing an array with an unknown size, such as a heap-allocated array, will " @@ -550,15 +673,15 @@ msgid "" "incorrect results." msgstr "" -#: ../../c-api/intro.rst:342 +#: ../../c-api/intro.rst:428 msgid "This is roughly equivalent to::" msgstr "這大致上相當於: ::" -#: ../../c-api/intro.rst:344 +#: ../../c-api/intro.rst:430 msgid "sizeof(array) / sizeof((array)[0])" msgstr "sizeof(array) / sizeof((array)[0])" -#: ../../c-api/intro.rst:349 +#: ../../c-api/intro.rst:435 msgid "" "Macro used to declare a symbol (function or data) as exported. On Windows, " "this expands to ``__declspec(dllexport)``. On compatible versions of GCC/" @@ -566,14 +689,14 @@ msgid "" "macro is for defining the C API itself; extension modules should not use it." msgstr "" -#: ../../c-api/intro.rst:358 +#: ../../c-api/intro.rst:444 msgid "" "Macro used to declare a symbol as imported. On Windows, this expands to " "``__declspec(dllimport)``. This macro is for defining the C API itself; " "extension modules should not use it." msgstr "" -#: ../../c-api/intro.rst:365 +#: ../../c-api/intro.rst:451 msgid "" "Macro used by CPython to declare a function as part of the C API. Its " "expansion depends on the platform and build configuration. This macro is " @@ -581,7 +704,7 @@ msgid "" "use it for their own symbols." msgstr "" -#: ../../c-api/intro.rst:373 +#: ../../c-api/intro.rst:459 msgid "" "Macro used by CPython to declare a public global variable as part of the C " "API. Its expansion depends on the platform and build configuration. This " @@ -589,11 +712,30 @@ msgid "" "should not use it for their own symbols." msgstr "" -#: ../../c-api/intro.rst:382 +#: ../../c-api/intro.rst:466 +#, fuzzy +msgid "" +"This is a :term:`soft deprecated` alias to the C99-standard ``va_copy`` " +"function." +msgstr "" +"這是 :c:func:`!memcpy` 的已\\ :term:`軟性棄用 `\\ 別名。請直" +"接使用 :c:func:`!memcpy`。" + +#: ../../c-api/intro.rst:469 +msgid "" +"Historically, this would use a compiler-specific method to copy a " +"``va_list``." +msgstr "" + +#: ../../c-api/intro.rst:471 +msgid "This is now an alias to ``va_copy``." +msgstr "" + +#: ../../c-api/intro.rst:478 msgid "Objects, Types and Reference Counts" msgstr "物件、型別和參照計數" -#: ../../c-api/intro.rst:386 +#: ../../c-api/intro.rst:482 msgid "" "Most Python/C API functions have one or more arguments as well as a return " "value of type :c:expr:`PyObject*`. This type is a pointer to an opaque data " @@ -616,7 +758,7 @@ msgstr "" "別物件;由於它們絕不能被釋放,因此它們通常是靜態 :c:type:`PyTypeObject` 物" "件。" -#: ../../c-api/intro.rst:397 +#: ../../c-api/intro.rst:493 msgid "" "All Python objects (even Python integers) have a :dfn:`type` and a :dfn:" "`reference count`. An object's type determines what kind of object it is (e." @@ -632,11 +774,11 @@ msgstr "" "`types`\\ )。對於每個眾所周知的型別,都有一個巨集來檢查物件是否屬於該型別;" "例如,若(且唯若)*a* 指向的物件是 Python list 時,``PyList_Check(a)`` 為真。" -#: ../../c-api/intro.rst:408 +#: ../../c-api/intro.rst:504 msgid "Reference Counts" msgstr "參照計數" -#: ../../c-api/intro.rst:410 +#: ../../c-api/intro.rst:506 msgid "" "The reference count is important because today's computers have a finite " "(and often severely limited) memory size; it counts how many different " @@ -659,7 +801,7 @@ msgstr "" "則可以依次為那些其他物件解除配置,依此類推。(此處相互參照物件的存在是個明顯" "的問題;目前,解決方案是「就不要那樣做」。)" -#: ../../c-api/intro.rst:427 +#: ../../c-api/intro.rst:523 msgid "" "Reference counts are always manipulated explicitly. The normal way is to " "use the macro :c:func:`Py_INCREF` to take a new reference to an object (i.e. " @@ -687,7 +829,7 @@ msgstr "" "元會被使用(假設 ``sizeof(Py_ssize_t) >= sizeof(void*)``)。因此參照計數增加" "是一個簡單的操作。" -#: ../../c-api/intro.rst:443 +#: ../../c-api/intro.rst:539 msgid "" "It is not necessary to hold a :term:`strong reference` (i.e. increment the " "reference count) for every local variable that contains a pointer to an " @@ -713,7 +855,7 @@ msgstr "" "種情況的一個重要情況是在從 Python 呼叫的擴充模組中作為引數傳遞給 C 函式的物" "件;呼叫機制保證在呼叫期間保持對每個參數的參照。" -#: ../../c-api/intro.rst:459 +#: ../../c-api/intro.rst:555 msgid "" "However, a common pitfall is to extract an object from a list and hold on to " "it for a while without taking a new reference. Some other operation might " @@ -729,7 +871,7 @@ msgstr "" "程式碼路徑允許控制權從 :c:func:`Py_DECREF` 回歸使用者,因此幾乎任何操作都有潛" "在危險。" -#: ../../c-api/intro.rst:467 +#: ../../c-api/intro.rst:563 msgid "" "A safe approach is to always use the generic operations (functions whose " "name begins with ``PyObject_``, ``PyNumber_``, ``PySequence_`` or " @@ -744,11 +886,11 @@ msgstr "" "計數)。這讓呼叫者有責任在處理完結果後呼叫 :c:func:`Py_DECREF`;這就成為第二" "本質。" -#: ../../c-api/intro.rst:478 +#: ../../c-api/intro.rst:574 msgid "Reference Count Details" msgstr "參照計數詳細資訊" -#: ../../c-api/intro.rst:480 +#: ../../c-api/intro.rst:576 msgid "" "The reference count behavior of functions in the Python/C API is best " "explained in terms of *ownership of references*. Ownership pertains to " @@ -773,7 +915,7 @@ msgstr "" "照。當沒有所有權轉移時,呼叫者被稱為\\ *借用*\\ 參照。如果是\\ :term:`借用參" "照 `\\ 就不需要做任何事情。" -#: ../../c-api/intro.rst:493 +#: ../../c-api/intro.rst:589 msgid "" "Conversely, when a calling function passes in a reference to an object, " "there are two possibilities: the function *steals* a reference to the " @@ -785,7 +927,7 @@ msgstr "" "物件的參照,或者沒有。 *竊取參照*\\ 意味著當你將參照傳遞給函式時,該函式假定" "它現在擁有該參照,並且你不再對它負責。" -#: ../../c-api/intro.rst:503 +#: ../../c-api/intro.rst:599 msgid "" "Few functions steal references; the two notable exceptions are :c:func:" "`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a reference to " @@ -802,7 +944,7 @@ msgstr "" "慣,這些函式旨在竊取參照;例如,建立 tuple ``(1, 2, \"three\")`` 的程式碼可以" "如下所示(先暫時忘記錯誤處理;更好的編寫方式如下所示):" -#: ../../c-api/intro.rst:511 +#: ../../c-api/intro.rst:607 msgid "" "PyObject *t;\n" "\n" @@ -818,7 +960,7 @@ msgstr "" "PyTuple_SetItem(t, 1, PyLong_FromLong(2L));\n" "PyTuple_SetItem(t, 2, PyUnicode_FromString(\"three\"));" -#: ../../c-api/intro.rst:518 +#: ../../c-api/intro.rst:614 msgid "" "Here, :c:func:`PyLong_FromLong` returns a new reference which is immediately " "stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object " @@ -829,7 +971,7 @@ msgstr "" "`PyTuple_SetItem` 竊取。如果你想繼續使用一個物件,儘管對它的參照將被竊取,請" "在呼叫參照竊取函式之前使用 :c:func:`Py_INCREF` 來取得另一個參照。" -#: ../../c-api/intro.rst:523 +#: ../../c-api/intro.rst:619 msgid "" "Incidentally, :c:func:`PyTuple_SetItem` is the *only* way to set tuple " "items; :c:func:`PySequence_SetItem` and :c:func:`PyObject_SetItem` refuse to " @@ -841,7 +983,7 @@ msgstr "" "tuple 是一種不可變 (immutable) 的資料型別。你應該只對你自己建立的 tuple 使" "用 :c:func:`PyTuple_SetItem`。" -#: ../../c-api/intro.rst:528 +#: ../../c-api/intro.rst:624 msgid "" "Equivalent code for populating a list can be written using :c:func:" "`PyList_New` and :c:func:`PyList_SetItem`." @@ -849,7 +991,7 @@ msgstr "" "可以使用 :c:func:`PyList_New` 和 :c:func:`PyList_SetItem` 編寫用於填充列表的" "等效程式碼。" -#: ../../c-api/intro.rst:531 +#: ../../c-api/intro.rst:627 msgid "" "However, in practice, you will rarely use these ways of creating and " "populating a tuple or list. There's a generic function, :c:func:" @@ -862,7 +1004,7 @@ msgstr "" "string` 引導。例如上面的兩個程式碼可以用以下程式碼替換(它還負責了錯誤檢" "查): ::" -#: ../../c-api/intro.rst:537 +#: ../../c-api/intro.rst:633 msgid "" "PyObject *tuple, *list;\n" "\n" @@ -874,7 +1016,7 @@ msgstr "" "tuple = Py_BuildValue(\"(iis)\", 1, 2, \"three\");\n" "list = Py_BuildValue(\"[iis]\", 1, 2, \"three\");" -#: ../../c-api/intro.rst:542 +#: ../../c-api/intro.rst:638 msgid "" "It is much more common to use :c:func:`PyObject_SetItem` and friends with " "items whose references you are only borrowing, like arguments that were " @@ -889,7 +1031,7 @@ msgstr "" "穩健,因為你不取得新的一個參照就可以放棄參照(「讓它被竊取」)。例如,此函式" "將 list(實際上是任何可變序列)的所有項目設定於給定項目:" -#: ../../c-api/intro.rst:549 +#: ../../c-api/intro.rst:645 msgid "" "int\n" "set_all(PyObject *target, PyObject *item)\n" @@ -933,7 +1075,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/intro.rst:572 +#: ../../c-api/intro.rst:668 msgid "" "The situation is slightly different for function return values. While " "passing a reference to most functions does not change your ownership " @@ -951,7 +1093,7 @@ msgstr "" "照的通用函式,如 :c:func:`PyObject_GetItem` 和 :c:func:`PySequence_GetItem`," "總是回傳一個新的參照(呼叫者成為參照的所有者)。" -#: ../../c-api/intro.rst:581 +#: ../../c-api/intro.rst:677 msgid "" "It is important to realize that whether you own a reference returned by a " "function depends on which function you call only --- *the plumage* (the type " @@ -967,7 +1109,7 @@ msgstr "" "但如果你使用 :c:func:`PySequence_GetItem` 從同一 list 中取得相同的項目(且恰" "好使用完全相同的引數),你確實會擁有對回傳物件的參照。" -#: ../../c-api/intro.rst:593 +#: ../../c-api/intro.rst:689 msgid "" "Here is an example of how you could write a function that computes the sum " "of the items in a list of integers; once using :c:func:`PyList_GetItem`, " @@ -976,7 +1118,7 @@ msgstr "" "以下是一個範例,說明如何編寫函式來計算一個整數 list 中項目的總和;一次使用 :" "c:func:`PyList_GetItem`,一次使用 :c:func:`PySequence_GetItem`: ::" -#: ../../c-api/intro.rst:597 +#: ../../c-api/intro.rst:693 msgid "" "long\n" "sum_list(PyObject *list)\n" @@ -1022,7 +1164,7 @@ msgstr "" " return total;\n" "}" -#: ../../c-api/intro.rst:623 +#: ../../c-api/intro.rst:719 msgid "" "long\n" "sum_sequence(PyObject *sequence)\n" @@ -1080,11 +1222,11 @@ msgstr "" " return total;\n" "}" -#: ../../c-api/intro.rst:657 +#: ../../c-api/intro.rst:753 msgid "Types" msgstr "型別" -#: ../../c-api/intro.rst:659 +#: ../../c-api/intro.rst:755 msgid "" "There are few other data types that play a significant role in the Python/C " "API; most are simple C types such as :c:expr:`int`, :c:expr:`long`, :c:expr:" @@ -1099,7 +1241,7 @@ msgstr "" "一些結構型別被用於描述用於列出模組所匯出的函式或新物件型別的資料屬性的靜態" "表,其他則用於描述複數的值。這些將與使用它們的函式一起討論。" -#: ../../c-api/intro.rst:669 +#: ../../c-api/intro.rst:765 msgid "" "A signed integral type such that ``sizeof(Py_ssize_t) == sizeof(size_t)``. " "C99 doesn't define such a thing directly (size_t is an unsigned integral " @@ -1110,11 +1252,11 @@ msgstr "" "有直接定義這樣的東西(size_t 是無符號整數型別)。有關詳細資訊,請參閱 :pep:" "`353`。 ``PY_SSIZE_T_MAX`` 是 :c:type:`Py_ssize_t` 型別的最大正值。" -#: ../../c-api/intro.rst:678 +#: ../../c-api/intro.rst:774 msgid "Exceptions" msgstr "例外" -#: ../../c-api/intro.rst:680 +#: ../../c-api/intro.rst:776 msgid "" "The Python programmer only needs to deal with exceptions if specific error " "handling is required; unhandled exceptions are automatically propagated to " @@ -1126,7 +1268,7 @@ msgstr "" "給呼叫者,然後傳遞給呼叫者的呼叫者,依此類推,直到它們到達頂層直譯器,在那裡" "它們透過堆疊回溯 (stack trace) 回報給使用者。" -#: ../../c-api/intro.rst:688 +#: ../../c-api/intro.rst:784 msgid "" "For C programmers, however, error checking always has to be explicit. All " "functions in the Python/C API can raise exceptions, unless an explicit claim " @@ -1148,7 +1290,7 @@ msgstr "" "確的錯誤指示器或者有不明確的回傳值,而需要使用 :c:func:`PyErr_Occurred` 明確" "測試錯誤。這些例外都會被明確地記錄於文件。" -#: ../../c-api/intro.rst:703 +#: ../../c-api/intro.rst:799 msgid "" "Exception state is maintained in per-thread storage (this is equivalent to " "using global storage in an unthreaded application). A thread can be in one " @@ -1167,7 +1309,7 @@ msgstr "" "func:`PyErr_SetString` 是最常見的(儘管不是最通用的)設定例外狀態的函式,而 :" "c:func:`PyErr_Clear` 是用來清除例外狀態。" -#: ../../c-api/intro.rst:713 +#: ../../c-api/intro.rst:809 msgid "" "The full exception state consists of three objects (all of which can be " "``NULL``): the exception type, the corresponding exception value, and the " @@ -1186,7 +1328,7 @@ msgstr "" "達 Python 位元組碼直譯器的主迴圈,該迴圈負責將它傳遞給 ``sys.exc_info()`` 和" "其系列函式。" -#: ../../c-api/intro.rst:725 +#: ../../c-api/intro.rst:821 msgid "" "Note that starting with Python 1.5, the preferred, thread-safe way to access " "the exception state from Python code is to call the function :func:`sys." @@ -1206,7 +1348,7 @@ msgstr "" "式碼中的常見錯誤,這些錯誤是由看似無辜的函式覆蓋了正在處理的例外而引起的;它" "還替回溯中被堆疊框 (stack frame) 參照的物件減少了通常不需要的生命週期延長。" -#: ../../c-api/intro.rst:736 +#: ../../c-api/intro.rst:832 msgid "" "As a general principle, a function that calls another function to perform " "some task should check whether the called function raised an exception, and " @@ -1221,7 +1363,7 @@ msgstr "" "並回傳一個錯誤指示符,但它\\ *不應該*\\ 設定另一個例外 --- 這將覆蓋剛剛引發的" "例外,並丟失關於錯誤確切原因的重要資訊。" -#: ../../c-api/intro.rst:745 +#: ../../c-api/intro.rst:841 msgid "" "A simple example of detecting exceptions and passing them on is shown in " "the :c:func:`!sum_sequence` example above. It so happens that this example " @@ -1233,7 +1375,7 @@ msgstr "" "巧這個例子在檢測到錯誤時不需要清理任何擁有的參照。以下範例函式展示了一些錯誤" "清理。首先,為了提醒你為什麼喜歡 Python,我們展示了等效的 Python 程式碼: ::" -#: ../../c-api/intro.rst:751 +#: ../../c-api/intro.rst:847 msgid "" "def incr_item(dict, key):\n" " try:\n" @@ -1249,11 +1391,11 @@ msgstr "" " item = 0\n" " dict[key] = item + 1" -#: ../../c-api/intro.rst:760 +#: ../../c-api/intro.rst:856 msgid "Here is the corresponding C code, in all its glory::" msgstr "這是相應的 C 程式碼:" -#: ../../c-api/intro.rst:762 +#: ../../c-api/intro.rst:858 msgid "" "int\n" "incr_item(PyObject *dict, PyObject *key)\n" @@ -1299,7 +1441,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/intro.rst:812 +#: ../../c-api/intro.rst:908 msgid "" "This example represents an endorsed use of the ``goto`` statement in C! It " "illustrates the use of :c:func:`PyErr_ExceptionMatches` and :c:func:" @@ -1318,11 +1460,11 @@ msgstr "" "於保存擁有的參照的變數被初始化為 ``NULL`` 以使其能夠順利作用;同樣地,回傳值" "被初始化為 ``-1``\\ (失敗),並且僅在最後一次呼叫成功後才設定為成功。" -#: ../../c-api/intro.rst:826 +#: ../../c-api/intro.rst:922 msgid "Embedding Python" msgstr "嵌入式Python" -#: ../../c-api/intro.rst:828 +#: ../../c-api/intro.rst:924 msgid "" "The one important task that only embedders (as opposed to extension writers) " "of the Python interpreter have to worry about is the initialization, and " @@ -1332,7 +1474,7 @@ msgstr "" "只有 Python 直譯器的嵌入者(而不是擴充編寫者)需要擔心的一項重要任務是 " "Python 直譯器的初始化與完成階段。直譯器的大部分功能只能在直譯器初始化後使用。" -#: ../../c-api/intro.rst:841 +#: ../../c-api/intro.rst:937 msgid "" "The basic initialization function is :c:func:`Py_Initialize`. This " "initializes the table of loaded modules, and creates the fundamental " @@ -1343,7 +1485,7 @@ msgstr "" "立基礎模組 :mod:`builtins`、:mod:`__main__` 和 :mod:`sys`。它還會初始化模組搜" "索路徑 (``sys.path``)。" -#: ../../c-api/intro.rst:846 +#: ../../c-api/intro.rst:942 msgid "" ":c:func:`Py_Initialize` does not set the \"script argument list\" (``sys." "argv``). If this variable is needed by Python code that will be executed " @@ -1355,7 +1497,7 @@ msgstr "" "`PyConfig.argv` 和 :c:member:`PyConfig.parse_argv`,請見 :ref:`Python 初始化" "配置 `。" -#: ../../c-api/intro.rst:851 +#: ../../c-api/intro.rst:947 msgid "" "On most systems (in particular, on Unix and Windows, although the details " "are slightly different), :c:func:`Py_Initialize` calculates the module " @@ -1373,7 +1515,7 @@ msgstr "" "file:`python` 的可執行檔案,並在其父目錄中查找一個名為 :file:`lib/python{X.Y}" "` 的目錄的相對位置。" -#: ../../c-api/intro.rst:860 +#: ../../c-api/intro.rst:956 msgid "" "For instance, if the Python executable is found in :file:`/usr/local/bin/" "python`, it will assume that the libraries are in :file:`/usr/local/lib/" @@ -1390,7 +1532,7 @@ msgstr "" "`PYTHONHOME`,或者透過設定 :envvar:`PYTHONPATH` 在標準路徑前面插入額外的目" "錄。" -#: ../../c-api/intro.rst:874 +#: ../../c-api/intro.rst:970 msgid "" "The embedding application can steer the search by setting :c:member:" "`PyConfig.program_name` *before* calling :c:func:`Py_InitializeFromConfig`. " @@ -1407,7 +1549,7 @@ msgstr "" "func:`Py_GetExecPrefix` 和 :c:func:`Py_GetProgramFullPath`\\(全部定義在 :" "file:`Modules/getpath.c`)。" -#: ../../c-api/intro.rst:885 +#: ../../c-api/intro.rst:981 msgid "" "Sometimes, it is desirable to \"uninitialize\" Python. For instance, the " "application may want to start over (make another call to :c:func:" @@ -1428,11 +1570,11 @@ msgstr "" "`Py_FinalizeEx` *不會*\\ 釋放由 Python 直譯器分配的所有記憶體,例如目前無法釋" "放被擴充模組所分配的記憶體。" -#: ../../c-api/intro.rst:899 +#: ../../c-api/intro.rst:995 msgid "Debugging Builds" msgstr "除錯建置" -#: ../../c-api/intro.rst:901 +#: ../../c-api/intro.rst:997 msgid "" "Python can be built with several macros to enable extra checks of the " "interpreter and extension modules. These checks tend to add a large amount " @@ -1441,7 +1583,7 @@ msgstr "" "Python 可以在建置時使用多個巨集來啟用對直譯器和擴充模組的額外檢查,這些檢查往" "往會在執行環境 (runtime) 增加大量開銷 (overhead),因此預設情況下不啟用它們。" -#: ../../c-api/intro.rst:905 +#: ../../c-api/intro.rst:1001 msgid "" "A full list of the various types of debugging builds is in the file :file:" "`Misc/SpecialBuilds.txt` in the Python source distribution. Builds are " @@ -1454,7 +1596,7 @@ msgstr "" "錯構置的完整列表,為支援追蹤參照計數、為記憶體分配器除錯或對主直譯器迴圈進行" "低階分析的建置。本節的其餘部分將僅描述最常用的建置。" -#: ../../c-api/intro.rst:913 +#: ../../c-api/intro.rst:1009 msgid "" "Compiling the interpreter with the :c:macro:`!Py_DEBUG` macro defined " "produces what is generally meant by :ref:`a debug build of Python `." @@ -1478,7 +1620,7 @@ msgstr "" "除了下面描述的參照計數除錯之外,還會執行額外的檢查,請參閱 :ref:`Python 除錯" "建置 `。" -#: ../../c-api/intro.rst:924 +#: ../../c-api/intro.rst:1020 msgid "" "Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see the :option:" "`configure --with-trace-refs option <--with-trace-refs>`). When defined, a " @@ -1493,7 +1635,7 @@ msgstr "" "linked list)。全體分配也有被追蹤。退出時將印出所有現行參照。(在交互模式下," "這發生在直譯器運行的每個陳述句之後。)" -#: ../../c-api/intro.rst:931 +#: ../../c-api/intro.rst:1027 msgid "" "Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source " "distribution for more detailed information." @@ -1501,11 +1643,11 @@ msgstr "" "有關更多詳細資訊,請參閱 Python 原始碼發布版中的 :file:`Misc/SpecialBuilds." "txt`。" -#: ../../c-api/intro.rst:938 +#: ../../c-api/intro.rst:1034 msgid "Recommended third party tools" msgstr "建議的第三方工具" -#: ../../c-api/intro.rst:940 +#: ../../c-api/intro.rst:1036 msgid "" "The following third party tools offer both simpler and more sophisticated " "approaches to creating C, C++ and Rust extensions for Python:" @@ -1513,39 +1655,39 @@ msgstr "" "以下第三方工具提供了更簡單且更細緻的方法來為 Python 建立 C、C++ 和 Rust 擴充" "模組:" -#: ../../c-api/intro.rst:943 +#: ../../c-api/intro.rst:1039 msgid "`Cython `_" msgstr "`Cython `_" -#: ../../c-api/intro.rst:944 +#: ../../c-api/intro.rst:1040 msgid "`cffi `_" msgstr "`cffi `_" -#: ../../c-api/intro.rst:945 +#: ../../c-api/intro.rst:1041 msgid "`HPy `_" msgstr "`HPy `_" -#: ../../c-api/intro.rst:946 +#: ../../c-api/intro.rst:1042 msgid "`nanobind `_ (C++)" msgstr "`nanobind `_ (C++)" -#: ../../c-api/intro.rst:947 +#: ../../c-api/intro.rst:1043 msgid "`Numba `_" msgstr "`Numba `_" -#: ../../c-api/intro.rst:948 +#: ../../c-api/intro.rst:1044 msgid "`pybind11 `_ (C++)" msgstr "`pybind11 `_ (C++)" -#: ../../c-api/intro.rst:949 +#: ../../c-api/intro.rst:1045 msgid "`PyO3 `_ (Rust)" msgstr "`PyO3 `_ (Rust)" -#: ../../c-api/intro.rst:950 +#: ../../c-api/intro.rst:1046 msgid "`SWIG `_" msgstr "`SWIG `_" -#: ../../c-api/intro.rst:952 +#: ../../c-api/intro.rst:1048 msgid "" "Using tools such as these can help avoid writing code that is tightly bound " "to a particular version of CPython, avoid reference counting errors, and " @@ -1556,7 +1698,7 @@ msgid "" "sources." msgstr "" -#: ../../c-api/intro.rst:959 +#: ../../c-api/intro.rst:1055 msgid "" "These projects are not supported by the same people who maintain Python, and " "issues need to be raised with the projects directly. Remember to check that " @@ -1564,139 +1706,139 @@ msgid "" "outdated." msgstr "" -#: ../../c-api/intro.rst:966 +#: ../../c-api/intro.rst:1062 msgid "" "`Python Packaging User Guide: Binary Extensions `_" msgstr "" -#: ../../c-api/intro.rst:967 +#: ../../c-api/intro.rst:1063 msgid "" "The Python Packaging User Guide not only covers several available tools that " "simplify the creation of binary extensions, but also discusses the various " "reasons why creating an extension module may be desirable in the first place." msgstr "" -#: ../../c-api/intro.rst:384 +#: ../../c-api/intro.rst:480 msgid "object" msgstr "object(物件)" -#: ../../c-api/intro.rst:384 +#: ../../c-api/intro.rst:480 msgid "type" msgstr "type(型別)" -#: ../../c-api/intro.rst:423 +#: ../../c-api/intro.rst:519 msgid "Py_INCREF (C function)" msgstr "Py_INCREF(C 函式)" -#: ../../c-api/intro.rst:423 +#: ../../c-api/intro.rst:519 msgid "Py_DECREF (C function)" msgstr "Py_DECREF(C 函式)" -#: ../../c-api/intro.rst:499 +#: ../../c-api/intro.rst:595 msgid "PyList_SetItem (C function)" msgstr "PyList_SetItem(C 函式)" -#: ../../c-api/intro.rst:499 +#: ../../c-api/intro.rst:595 msgid "PyTuple_SetItem (C function)" msgstr "PyTuple_SetItem(C 函式)" -#: ../../c-api/intro.rst:570 +#: ../../c-api/intro.rst:666 msgid "set_all()" msgstr "set_all()" -#: ../../c-api/intro.rst:589 +#: ../../c-api/intro.rst:685 msgid "PyList_GetItem (C function)" msgstr "PyList_GetItem(C 函式)" -#: ../../c-api/intro.rst:589 +#: ../../c-api/intro.rst:685 msgid "PySequence_GetItem (C function)" msgstr "PySequence_GetItem(C 函式)" -#: ../../c-api/intro.rst:619 +#: ../../c-api/intro.rst:715 msgid "sum_list()" msgstr "sum_list()" -#: ../../c-api/intro.rst:651 ../../c-api/intro.rst:743 +#: ../../c-api/intro.rst:747 ../../c-api/intro.rst:839 msgid "sum_sequence()" msgstr "sum_sequence()" -#: ../../c-api/intro.rst:686 +#: ../../c-api/intro.rst:782 msgid "PyErr_Occurred (C function)" msgstr "PyErr_Occurred(C 函式)" -#: ../../c-api/intro.rst:699 +#: ../../c-api/intro.rst:795 msgid "PyErr_SetString (C function)" msgstr "PyErr_SetString(C 函式)" -#: ../../c-api/intro.rst:699 ../../c-api/intro.rst:807 +#: ../../c-api/intro.rst:795 ../../c-api/intro.rst:903 msgid "PyErr_Clear (C function)" msgstr "PyErr_Clear(C 函式)" -#: ../../c-api/intro.rst:723 +#: ../../c-api/intro.rst:819 msgid "exc_info (in module sys)" msgstr "exc_info (sys 模組中)" -#: ../../c-api/intro.rst:758 ../../c-api/intro.rst:805 +#: ../../c-api/intro.rst:854 ../../c-api/intro.rst:901 msgid "incr_item()" msgstr "incr_item()" -#: ../../c-api/intro.rst:807 +#: ../../c-api/intro.rst:903 msgid "PyErr_ExceptionMatches (C function)" msgstr "PyErr_ExceptionMatches(C 函式)" -#: ../../c-api/intro.rst:807 +#: ../../c-api/intro.rst:903 msgid "Py_XDECREF (C function)" msgstr "Py_XDECREF(C 函式)" -#: ../../c-api/intro.rst:833 +#: ../../c-api/intro.rst:929 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/intro.rst:833 +#: ../../c-api/intro.rst:929 msgid "module" msgstr "module(模組)" -#: ../../c-api/intro.rst:833 +#: ../../c-api/intro.rst:929 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/intro.rst:833 +#: ../../c-api/intro.rst:929 msgid "__main__" msgstr "__main__" -#: ../../c-api/intro.rst:833 +#: ../../c-api/intro.rst:929 msgid "sys" msgstr "sys" -#: ../../c-api/intro.rst:833 +#: ../../c-api/intro.rst:929 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/intro.rst:833 +#: ../../c-api/intro.rst:929 msgid "path" msgstr "path(路徑)" -#: ../../c-api/intro.rst:833 +#: ../../c-api/intro.rst:929 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/intro.rst:868 +#: ../../c-api/intro.rst:964 msgid "Py_GetPath (C function)" msgstr "Py_GetPath(C 函式)" -#: ../../c-api/intro.rst:868 +#: ../../c-api/intro.rst:964 msgid "Py_GetPrefix (C function)" msgstr "Py_GetPrefix(C 函式)" -#: ../../c-api/intro.rst:868 +#: ../../c-api/intro.rst:964 msgid "Py_GetExecPrefix (C function)" msgstr "Py_GetExecPrefix(C 函式)" -#: ../../c-api/intro.rst:868 +#: ../../c-api/intro.rst:964 msgid "Py_GetProgramFullPath (C function)" msgstr "Py_GetProgramFullPath(C 函式)" -#: ../../c-api/intro.rst:883 +#: ../../c-api/intro.rst:979 msgid "Py_IsInitialized (C function)" msgstr "Py_IsInitialized(C 函式)" diff --git a/c-api/module.po b/c-api/module.po index 71f6d4b155..573e2f5c8f 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-27 00:14+0000\n" +"POT-Creation-Date: 2026-01-28 00:16+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -784,7 +784,11 @@ msgid "" "``PyModule_FromDefAndSpec``)." msgstr "" -#: ../../c-api/module.rst:682 +#: ../../c-api/module.rst:678 +msgid "Return ``0`` on success. Return ``-1`` with an exception set on error." +msgstr "成功時回傳 ``0``。在失敗時回傳 ``-1`` 並設定例外。" + +#: ../../c-api/module.rst:685 msgid "" "Indicate that *module* does or does not support running without the global " "interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. " @@ -796,11 +800,11 @@ msgid "" "on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:696 +#: ../../c-api/module.rst:699 msgid "Module lookup (single-phase initialization)" msgstr "" -#: ../../c-api/module.rst:698 +#: ../../c-api/module.rst:701 msgid "" "The legacy :ref:`single-phase initialization ` " "initialization scheme creates singleton modules that can be looked up in the " @@ -808,14 +812,14 @@ msgid "" "retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:703 +#: ../../c-api/module.rst:706 msgid "" "These functions will not work on modules created using multi-phase " "initialization, since multiple such modules can be created from a single " "definition." msgstr "" -#: ../../c-api/module.rst:708 +#: ../../c-api/module.rst:711 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -824,18 +828,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:715 +#: ../../c-api/module.rst:718 msgid "" "Attaches the module object passed to the function to the interpreter state. " "This allows the module object to be accessible via :c:func:" "`PyState_FindModule`." msgstr "" -#: ../../c-api/module.rst:718 +#: ../../c-api/module.rst:721 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:720 +#: ../../c-api/module.rst:723 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module " "that uses :ref:`single-phase initialization `, " @@ -847,21 +851,21 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:729 +#: ../../c-api/module.rst:732 msgid "" "If a module was attached previously using the same *def*, it is replaced by " "the new *module*." msgstr "" -#: ../../c-api/module.rst:732 ../../c-api/module.rst:743 +#: ../../c-api/module.rst:735 ../../c-api/module.rst:746 msgid "The caller must have an :term:`attached thread state`." msgstr "" -#: ../../c-api/module.rst:734 +#: ../../c-api/module.rst:737 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:740 +#: ../../c-api/module.rst:743 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." diff --git a/c-api/object.po b/c-api/object.po index 5cdde8ebd5..76d98cf41c 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-05 00:16+0000\n" +"POT-Creation-Date: 2026-02-03 00:20+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -821,14 +821,14 @@ msgstr "" #: ../../c-api/object.rst:668 msgid "" ":c:func:`PyUnstable_EnableTryIncRef` must have been called earlier on *obj* " -"or this function may spuriously return ``0`` in the :term:`free threading` " -"build." +"or this function may spuriously return ``0`` in the :term:`free-threaded " +"build`." msgstr "" #: ../../c-api/object.rst:672 msgid "" "This function is logically equivalent to the following C code, except that " -"it behaves atomically in the :term:`free threading` build::" +"it behaves atomically in the :term:`free-threaded build`::" msgstr "" #: ../../c-api/object.rst:675 @@ -922,10 +922,10 @@ msgstr "" #: ../../c-api/object.rst:750 msgid "" -"On a :term:`free threaded ` build, this checks if *op*'s :" -"term:`reference count` is equal to one and additionally checks if *op* is " -"only used by this thread. :c:expr:`Py_REFCNT(op) == 1` is **not** thread-" -"safe on free threaded builds; prefer this function." +"On a :term:`free-threaded build`, this checks if *op*'s :term:`reference " +"count` is equal to one and additionally checks if *op* is only used by this " +"thread. :c:expr:`Py_REFCNT(op) == 1` is **not** thread-safe on free-threaded " +"builds; prefer this function." msgstr "" #: ../../c-api/object.rst:755 diff --git a/c-api/refcounting.po b/c-api/refcounting.po index 3ad5095d4d..168fb2024b 100644 --- a/c-api/refcounting.po +++ b/c-api/refcounting.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2026-02-03 00:20+0000\n" "PO-Revision-Date: 2023-08-06 14:19+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,10 +37,10 @@ msgstr "取得物件 *o* 的參照計數。" #: ../../c-api/refcounting.rst:18 msgid "" "Note that the returned value may not actually reflect how many references to " -"the object are actually held. For example, some objects " -"are :term:`immortal` and have a very high refcount that does not reflect the " -"actual number of references. Consequently, do not rely on the returned " -"value to be accurate, other than a value of 0 or 1." +"the object are actually held. For example, some objects are :term:" +"`immortal` and have a very high refcount that does not reflect the actual " +"number of references. Consequently, do not rely on the returned value to be " +"accurate, other than a value of 0 or 1." msgstr "" "請注意,回傳的值可能實際上並不反映實際保存了多少對該物件的參照。例如,某些物" "件是「:term:`不滅的 (immortal) `」,並且具有非常高的參照計數,不能" @@ -53,7 +53,7 @@ msgstr "使用 :c:func:`Py_SET_REFCNT()` 函式設定物件參照計數。" #: ../../c-api/refcounting.rst:28 msgid "" -"On :term:`free threaded ` builds of Python, returning 1 " +"On :term:`free-threaded builds ` of Python, returning 1 " "isn't sufficient to determine if it's safe to treat *o* as having no access " "by other threads. Use :c:func:`PyUnstable_Object_IsUniquelyReferenced` for " "that instead." @@ -61,8 +61,8 @@ msgstr "" #: ../../c-api/refcounting.rst:33 msgid "" -"See also the " -"function :c:func:`PyUnstable_Object_IsUniqueReferencedTemporary()`." +"See also the function :c:func:" +"`PyUnstable_Object_IsUniqueReferencedTemporary()`." msgstr "" #: ../../c-api/refcounting.rst:35 @@ -106,8 +106,8 @@ msgstr "" #: ../../c-api/refcounting.rst:64 msgid "" -"This function is usually used to convert a :term:`borrowed reference` to " -"a :term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be " +"This function is usually used to convert a :term:`borrowed reference` to a :" +"term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be " "used to create a new :term:`strong reference`." msgstr "" "此函式通常用於將\\ :term:`借用參照 `\\ 原地 (in-place) 轉" @@ -123,13 +123,13 @@ msgid "" "The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, " "use :c:func:`Py_XINCREF`." msgstr "" -"該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請使" -"用 :c:func:`Py_XINCREF`。" +"該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請使用 :c:func:" +"`Py_XINCREF`。" #: ../../c-api/refcounting.rst:73 msgid "" -"Do not expect this function to actually modify *o* in any way. For at " -"least :pep:`some objects <0683>`, this function has no effect." +"Do not expect this function to actually modify *o* in any way. For at least :" +"pep:`some objects <0683>`, this function has no effect." msgstr "" "不要期望此函式會以任何方式實際修改 *o*,至少對於\\ :pep:`某些物件 <0683>`\\ " "來說,此函式沒有任何效果。" @@ -151,24 +151,24 @@ msgid "" "Create a new :term:`strong reference` to an object: call :c:func:`Py_INCREF` " "on *o* and return the object *o*." msgstr "" -"建立對物件的新\\ :term:`強參照 `:於 *o* 呼" -"叫 :c:func:`Py_INCREF` 並回傳物件 *o*。" +"建立對物件的新\\ :term:`強參照 `:於 *o* 呼叫 :c:func:" +"`Py_INCREF` 並回傳物件 *o*。" #: ../../c-api/refcounting.rst:94 msgid "" "When the :term:`strong reference` is no longer needed, :c:func:`Py_DECREF` " "should be called on it to release the reference." msgstr "" -"當不再需要\\ :term:`強參照 `\\ 時,應對其呼" -"叫 :c:func:`Py_DECREF` 以釋放該參照。" +"當不再需要\\ :term:`強參照 `\\ 時,應對其呼叫 :c:func:" +"`Py_DECREF` 以釋放該參照。" #: ../../c-api/refcounting.rst:97 msgid "" "The object *o* must not be ``NULL``; use :c:func:`Py_XNewRef` if *o* can be " "``NULL``." msgstr "" -"物件 *o* 不能為 ``NULL``;如果 *o* 可以為 ``NULL``,則使" -"用 :c:func:`Py_XNewRef`。" +"物件 *o* 不能為 ``NULL``;如果 *o* 可以為 ``NULL``,則使用 :c:func:" +"`Py_XNewRef`。" #: ../../c-api/refcounting.rst:100 msgid "For example::" @@ -232,21 +232,21 @@ msgid "" "The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, " "use :c:func:`Py_XDECREF`." msgstr "" -"該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請改" -"用 :c:func:`Py_XDECREF`。" +"該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請改用 :c:func:" +"`Py_XDECREF`。" #: ../../c-api/refcounting.rst:141 msgid "" -"Do not expect this function to actually modify *o* in any way. For at " -"least :pep:`some objects <683>`, this function has no effect." +"Do not expect this function to actually modify *o* in any way. For at least :" +"pep:`some objects <683>`, this function has no effect." msgstr "" "不要期望此函式會以任何方式實際修改 *o*,至少對於\\ :pep:`某些物件 <683>`\\ 來" "說,此函式沒有任何效果。" #: ../../c-api/refcounting.rst:147 msgid "" -"The deallocation function can cause arbitrary Python code to be invoked " -"(e.g. when a class instance with a :meth:`~object.__del__` method is " +"The deallocation function can cause arbitrary Python code to be invoked (e." +"g. when a class instance with a :meth:`~object.__del__` method is " "deallocated). While exceptions in such code are not propagated, the " "executed code has free access to all Python global variables. This means " "that any object that is reachable from a global variable should be in a " @@ -255,12 +255,12 @@ msgid "" "object in a temporary variable, update the list data structure, and then " "call :c:func:`Py_DECREF` for the temporary variable." msgstr "" -"釋放函式可以導致任意 Python 程式碼被叫用(例如,當釋放具" -"有 :meth:`~object.__del__` 方法的類別實例時)。雖然此類程式碼中的例外不會被傳" -"遞出來,但​​執行的程式碼可以自由存取所有 Python 全域變數。這意味著在叫" -"用 :c:func:`Py_DECREF` 之前,可從全域變數存取的任何物件都應處於一致狀態。例" -"如,從 list 中刪除物件的程式碼應將已刪除物件的參照複製到臨時變數中,更新 " -"list 資料結構,然後為臨時變數呼叫 :c:func:`Py_DECREF`。" +"釋放函式可以導致任意 Python 程式碼被叫用(例如,當釋放具有 :meth:`~object." +"__del__` 方法的類別實例時)。雖然此類程式碼中的例外不會被傳遞出來,但​​執行的程" +"式碼可以自由存取所有 Python 全域變數。這意味著在叫用 :c:func:`Py_DECREF` 之" +"前,可從全域變數存取的任何物件都應處於一致狀態。例如,從 list 中刪除物件的程" +"式碼應將已刪除物件的參照複製到臨時變數中,更新 list 資料結構,然後為臨時變數" +"呼叫 :c:func:`Py_DECREF`。" #: ../../c-api/refcounting.rst:162 msgid "" @@ -307,15 +307,13 @@ msgid "" "version of :c:func:`Py_XINCREF`. It can be used for runtime dynamic " "embedding of Python." msgstr "" -"代表取得對於物件 *o* 的\\ :term:`強參照 `。:c:func:`Py_XINCREF` 的函式版本。它可用於 Python 的 runtime 動態" -"嵌入。" +"代表取得對於物件 *o* 的\\ :term:`強參照 `。:c:func:" +"`Py_XINCREF` 的函式版本。它可用於 Python 的 runtime 動態嵌入。" #: ../../c-api/refcounting.rst:194 msgid "" -"Release a :term:`strong reference` to object *o*. A function version " -"of :c:func:`Py_XDECREF`. It can be used for runtime dynamic embedding of " -"Python." +"Release a :term:`strong reference` to object *o*. A function version of :c:" +"func:`Py_XDECREF`. It can be used for runtime dynamic embedding of Python." msgstr "" "釋放對物件 *o* 的\\ :term:`強參照 `。:c:func:`Py_XDECREF` " "的函式版本。它可用於 Python 的 runtime 動態嵌入。" @@ -369,5 +367,5 @@ msgid "" "Variant of :c:macro:`Py_SETREF` macro that uses :c:func:`Py_XDECREF` instead " "of :c:func:`Py_DECREF`." msgstr "" -":c:macro:`Py_SETREF` 巨集的變體,請改用 :c:func:`Py_XDECREF` 而" -"非 :c:func:`Py_DECREF`。" +":c:macro:`Py_SETREF` 巨集的變體,請改用 :c:func:`Py_XDECREF` 而非 :c:func:" +"`Py_DECREF`。" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 927b3d0ae6..69b4349bec 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-15 00:15+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+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-" @@ -93,8 +93,8 @@ msgstr "I" msgid " :c:member:`~PyTypeObject.tp_name`" msgstr " :c:member:`~PyTypeObject.tp_name`" -#: ../../c-api/typeobj.rst:44 ../../c-api/typeobj.rst:86 -#: ../../c-api/typeobj.rst:372 ../../c-api/typeobj.rst:377 +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:44 +#: ../../c-api/typeobj.rst:86 msgid "const char *" msgstr "const char *" @@ -125,11 +125,10 @@ msgstr "X" msgid ":c:member:`~PyTypeObject.tp_basicsize`" msgstr ":c:member:`~PyTypeObject.tp_basicsize`" -#: ../../c-api/typeobj.rst:46 ../../c-api/typeobj.rst:48 -#: ../../c-api/typeobj.rst:52 ../../c-api/typeobj.rst:99 -#: ../../c-api/typeobj.rst:120 ../../c-api/typeobj.rst:343 -#: ../../c-api/typeobj.rst:417 ../../c-api/typeobj.rst:448 -#: ../../c-api/typeobj.rst:453 +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:46 +#: ../../c-api/typeobj.rst:48 ../../c-api/typeobj.rst:52 +#: ../../c-api/typeobj.rst:99 ../../c-api/typeobj.rst:120 +#: ../../c-api/typeobj.rst:417 msgid ":c:type:`Py_ssize_t`" msgstr ":c:type:`Py_ssize_t`" @@ -403,8 +402,7 @@ msgstr ":c:type:`PyGetSetDef` []" msgid ":c:member:`~PyTypeObject.tp_base`" msgstr ":c:member:`~PyTypeObject.tp_base`" -#: ../../c-api/typeobj.rst:111 ../../c-api/typeobj.rst:342 -#: ../../c-api/typeobj.rst:357 +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:111 msgid ":c:type:`PyTypeObject` *" msgstr ":c:type:`PyTypeObject` *" @@ -416,32 +414,18 @@ msgstr "__base__" msgid ":c:member:`~PyTypeObject.tp_dict`" msgstr ":c:member:`~PyTypeObject.tp_dict`" -#: ../../c-api/typeobj.rst:113 ../../c-api/typeobj.rst:132 -#: ../../c-api/typeobj.rst:134 ../../c-api/typeobj.rst:136 -#: ../../c-api/typeobj.rst:140 ../../c-api/typeobj.rst:342 -#: ../../c-api/typeobj.rst:347 ../../c-api/typeobj.rst:351 -#: ../../c-api/typeobj.rst:357 ../../c-api/typeobj.rst:358 -#: ../../c-api/typeobj.rst:359 ../../c-api/typeobj.rst:363 -#: ../../c-api/typeobj.rst:364 ../../c-api/typeobj.rst:365 -#: ../../c-api/typeobj.rst:369 ../../c-api/typeobj.rst:371 -#: ../../c-api/typeobj.rst:376 ../../c-api/typeobj.rst:378 -#: ../../c-api/typeobj.rst:382 ../../c-api/typeobj.rst:383 -#: ../../c-api/typeobj.rst:387 ../../c-api/typeobj.rst:388 -#: ../../c-api/typeobj.rst:389 ../../c-api/typeobj.rst:393 -#: ../../c-api/typeobj.rst:394 ../../c-api/typeobj.rst:395 -#: ../../c-api/typeobj.rst:399 ../../c-api/typeobj.rst:400 -#: ../../c-api/typeobj.rst:401 ../../c-api/typeobj.rst:405 -#: ../../c-api/typeobj.rst:407 ../../c-api/typeobj.rst:408 -#: ../../c-api/typeobj.rst:413 ../../c-api/typeobj.rst:415 -#: ../../c-api/typeobj.rst:417 ../../c-api/typeobj.rst:419 -#: ../../c-api/typeobj.rst:425 ../../c-api/typeobj.rst:430 -#: ../../c-api/typeobj.rst:432 ../../c-api/typeobj.rst:436 -#: ../../c-api/typeobj.rst:437 ../../c-api/typeobj.rst:441 -#: ../../c-api/typeobj.rst:442 ../../c-api/typeobj.rst:443 -#: ../../c-api/typeobj.rst:447 ../../c-api/typeobj.rst:452 -#: ../../c-api/typeobj.rst:454 ../../c-api/typeobj.rst:458 -#: ../../c-api/typeobj.rst:459 ../../c-api/typeobj.rst:463 -#: ../../c-api/typeobj.rst:464 ../../c-api/typeobj.rst:465 +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:113 +#: ../../c-api/typeobj.rst:132 ../../c-api/typeobj.rst:134 +#: ../../c-api/typeobj.rst:136 ../../c-api/typeobj.rst:140 +#: ../../c-api/typeobj.rst:342 ../../c-api/typeobj.rst:347 +#: ../../c-api/typeobj.rst:357 ../../c-api/typeobj.rst:369 +#: ../../c-api/typeobj.rst:371 ../../c-api/typeobj.rst:382 +#: ../../c-api/typeobj.rst:393 ../../c-api/typeobj.rst:405 +#: ../../c-api/typeobj.rst:407 ../../c-api/typeobj.rst:413 +#: ../../c-api/typeobj.rst:415 ../../c-api/typeobj.rst:417 +#: ../../c-api/typeobj.rst:430 ../../c-api/typeobj.rst:432 +#: ../../c-api/typeobj.rst:436 ../../c-api/typeobj.rst:441 +#: ../../c-api/typeobj.rst:447 msgid ":c:type:`PyObject` *" msgstr ":c:type:`PyObject` *" @@ -549,8 +533,8 @@ msgstr "[:c:member:`~PyTypeObject.tp_cache`]" msgid "[:c:member:`~PyTypeObject.tp_subclasses`]" msgstr "[:c:member:`~PyTypeObject.tp_subclasses`]" -#: ../../c-api/typeobj.rst:138 ../../c-api/typeobj.rst:279 -#: ../../c-api/typeobj.rst:349 ../../c-api/typeobj.rst:353 +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:138 +#: ../../c-api/typeobj.rst:279 ../../c-api/typeobj.rst:349 msgid "void *" msgstr "void *" @@ -1133,8 +1117,8 @@ msgid ":c:func:`releasebufferproc`" msgstr ":c:func:`releasebufferproc`" #: ../../c-api/typeobj.rst:330 -msgid "__release_ buffer\\__" -msgstr "__release_ buffer\\__" +msgid "__release_\\ buffer\\__" +msgstr "__release_\\ buffer\\__" #: ../../c-api/typeobj.rst:337 msgid "slot typedefs" @@ -1157,16 +1141,16 @@ msgstr "" msgid "void" msgstr "void" -#: ../../c-api/typeobj.rst:352 +#: ../../c-api/typeobj.rst:0 msgid ":c:type:`visitproc`" msgstr ":c:type:`visitproc`" -#: ../../c-api/typeobj.rst:351 ../../c-api/typeobj.rst:363 -#: ../../c-api/typeobj.rst:376 ../../c-api/typeobj.rst:387 -#: ../../c-api/typeobj.rst:399 ../../c-api/typeobj.rst:409 -#: ../../c-api/typeobj.rst:419 ../../c-api/typeobj.rst:421 -#: ../../c-api/typeobj.rst:430 ../../c-api/typeobj.rst:452 -#: ../../c-api/typeobj.rst:458 ../../c-api/typeobj.rst:463 +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:351 +#: ../../c-api/typeobj.rst:363 ../../c-api/typeobj.rst:376 +#: ../../c-api/typeobj.rst:387 ../../c-api/typeobj.rst:399 +#: ../../c-api/typeobj.rst:419 ../../c-api/typeobj.rst:430 +#: ../../c-api/typeobj.rst:452 ../../c-api/typeobj.rst:458 +#: ../../c-api/typeobj.rst:463 msgid "int" msgstr "int" @@ -1178,7 +1162,7 @@ msgstr "Py_hash_t" msgid ":c:type:`getbufferproc`" msgstr ":c:type:`getbufferproc`" -#: ../../c-api/typeobj.rst:420 ../../c-api/typeobj.rst:426 +#: ../../c-api/typeobj.rst:0 msgid ":c:type:`Py_buffer` *" msgstr ":c:type:`Py_buffer` *" @@ -2444,7 +2428,8 @@ msgid "" "Renamed to the current name, without the leading underscore. The old " "provisional name is :term:`soft deprecated`." msgstr "" -"重新命名為目前的名稱,沒有前導底線。舊的臨時名稱已被 :term:`軟性棄用 `。" +"重新命名為目前的名稱,沒有前導底線。舊的臨時名稱已被 :term:`軟性棄用 `。" #: ../../c-api/typeobj.rst:1384 msgid "" diff --git a/faq/programming.po b/faq/programming.po index 2c133e52fc..065139b57e 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2026-01-27 00:17+0000\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,8 +45,8 @@ msgstr "有的。" #: ../../faq/programming.rst:19 msgid "" -"Several debuggers for Python are described below, and the built-in " -"function :func:`breakpoint` allows you to drop into any of them." +"Several debuggers for Python are described below, and the built-in function :" +"func:`breakpoint` allows you to drop into any of them." msgstr "" "下面描述了幾個 Python 除錯器,內建函式 :func:`breakpoint` 允許你進入其中任何" "一個。" @@ -177,9 +177,9 @@ msgid "" "standard Python modules." msgstr "" "一種是使用 freeze 工具,它位於 Python 原始碼樹中的 `Tools/freeze `_。它將 Python 位元組碼轉" -"換為 C 陣列;使用 C 編譯器,你可以將所有模組嵌入到一個新程式中,然後將其與標" -"準 Python 模組連結。" +"github.com/python/cpython/tree/main/Tools/freeze>`_。它將 Python 位元組碼轉換" +"為 C 陣列;使用 C 編譯器,你可以將所有模組嵌入到一個新程式中,然後將其與標準 " +"Python 模組連結。" #: ../../faq/programming.rst:87 #, fuzzy @@ -338,11 +338,10 @@ msgid "" "a component of an imported module. This clutter would defeat the usefulness " "of the ``global`` declaration for identifying side-effects." msgstr "" -"雖然起初有點令人驚訝,但稍加考慮就可以解釋這一點。一方面,要" -"求 :keyword:`global` 分配的變數可以防止意外的副作用。另一方面,如果所有全域參" -"照都需要 ``global``,那麼你將一直使用 ``global``。你必須將對內建函式或引入模" -"組的組件的每個參照聲明為全域。這種混亂會破壞用於識別副作用的 ``global`` 聲明" -"的有用性。" +"雖然起初有點令人驚訝,但稍加考慮就可以解釋這一點。一方面,要求 :keyword:" +"`global` 分配的變數可以防止意外的副作用。另一方面,如果所有全域參照都需要 " +"``global``,那麼你將一直使用 ``global``。你必須將對內建函式或引入模組的組件的" +"每個參照聲明為全域。這種混亂會破壞用於識別副作用的 ``global`` 聲明的有用性。" #: ../../faq/programming.rst:208 msgid "" @@ -555,8 +554,8 @@ msgstr "如果你按以下順序引入模組,這是一個很好的做法:" #: ../../faq/programming.rst:301 msgid "" -"standard library modules -- " -"e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :mod:`re`" +"standard library modules -- e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :" +"mod:`re`" msgstr "" "標準函式庫模組 —— 例如 :mod:`sys`、:mod:`os`、:mod:`argparse`、:mod:`re`" @@ -636,8 +635,8 @@ msgstr "" "入移動到局部範圍內,例如在函式定義內。如果根據程式的執行方式,許多引入是不必" "要的,則此技術特別有用。如果模組僅在該函式中使用,你可能還想將引入移動到該函" "式中。請注意,由於模組的一次性初始化,第一次載入模組可能很昂貴,但多次載入模" -"組實際上是免費的,只需幾次字典查詢。即使模組名稱超出範圍,該模組也可能" -"在 :data:`sys.modules` 中可用。" +"組實際上是免費的,只需幾次字典查詢。即使模組名稱超出範圍,該模組也可能在 :" +"data:`sys.modules` 中可用。" #: ../../faq/programming.rst:338 msgid "Why are default values shared between objects?" @@ -769,7 +768,6 @@ msgid "" msgstr "你可以使用包含字典的全域變數而不是預設值;這取決於喜好。" #: ../../faq/programming.rst:394 -#, fuzzy msgid "" "How can I pass optional or keyword parameters from one function to another?" msgstr "如何將可選參數或關鍵字參數從一個函式傳遞到另一個函式?" @@ -808,13 +806,13 @@ msgstr "引數 (arguments) 和參數 (parameters) 有什麼區別?" msgid "" ":term:`Parameters ` are defined by the names that appear in a " "function definition, whereas :term:`arguments ` are the values " -"actually passed to a function when calling it. Parameters define " -"what :term:`kind of arguments ` a function can accept. For " -"example, given the function definition::" +"actually passed to a function when calling it. Parameters define what :term:" +"`kind of arguments ` a function can accept. For example, given " +"the function definition::" msgstr "" ":term:`參數 `\\ 由出現在函式定義中的名稱定義,而\\ :term:`引數 " -"`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的" -"\\ :term:`引數種類 `。例如,給定以下函式定義: ::" +"`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的\\ :term:" +"`引數種類 `。例如,給定以下函式定義: ::" #: ../../faq/programming.rst:423 msgid "" @@ -893,13 +891,12 @@ msgid "" msgstr "list 是 :term:`mutable`,這意味著你可以變更它們的內容。" #: ../../faq/programming.rst:457 -#, fuzzy msgid "" "After the call to :meth:`~sequence.append`, the content of the mutable " "object has changed from ``[]`` to ``[10]``. Since both the variables refer " "to the same object, using either name accesses the modified value ``[10]``." msgstr "" -"在呼叫 :meth:`!append` 之後,可變物件的內容從 ``[]`` 變成了 ``[10]``。由於這" +"在呼叫 :meth:`~sequence.append` 之後,可變物件的內容從 ``[]`` 變成了 ``[10]``。由於這" "兩個變數都參照同一個物件,因此使用任一名稱都可以存取修改後的值 ``[10]``。" #: ../../faq/programming.rst:461 @@ -956,9 +953,9 @@ msgstr "" "一些操作(例如 ``y.append(10)`` 和 ``y.sort()``)會改變物件,而表面上相似的操" "作(例如 ``y = y + [10]`` 和: func:`sorted(y) `) 建立一個新物件。通" "常在 Python 中(以及在標準函式庫中的所有情況下)改變物件的方法將回傳 " -"``None`` 以幫助避免混淆這兩種型別的操作。因此,如果你錯誤地編寫了 " -"``y.sort()``,認為它會為你提供 ``y`` 的排序副本,那麼你最終會得到 ``None``," -"這可能會導致你的程式生成一個容易診斷的錯誤。" +"``None`` 以幫助避免混淆這兩種型別的操作。因此,如果你錯誤地編寫了 ``y." +"sort()``,認為它會為你提供 ``y`` 的排序副本,那麼你最終會得到 ``None``,這可" +"能會導致你的程式生成一個容易診斷的錯誤。" #: ../../faq/programming.rst:488 #, fuzzy @@ -1002,13 +999,12 @@ msgstr "" "新物件。" #: ../../faq/programming.rst:505 -#, fuzzy msgid "" "If you want to know if two variables refer to the same object or not, you " "can use the :keyword:`is` operator, or the built-in function :func:`id`." msgstr "" -"如果你想知道兩個變數是否參照同一個物件,你可以使用 :keyword:`is` 運算子,或內" -"置函式 :func:`id`。" +"如果你想知道兩個變數是否參照同一個物件,你可以使用 :keyword:`is` 運算子或內" +"建函式 :func:`id`。" #: ../../faq/programming.rst:510 msgid "How do I write a function with output parameters (call by reference)?" @@ -1292,8 +1288,8 @@ msgstr "" #: ../../faq/programming.rst:641 #, fuzzy msgid "" -"Some objects can be copied more easily. Dictionaries have " -"a :meth:`~dict.copy` method::" +"Some objects can be copied more easily. Dictionaries have a :meth:`~dict." +"copy` method::" msgstr "可以更輕鬆地複製某些物件。字典有一個 :meth:`~dict.copy` 方法: ::" #: ../../faq/programming.rst:644 @@ -1428,12 +1424,11 @@ msgstr "" "(False, 'a')" #: ../../faq/programming.rst:708 -#, fuzzy msgid "" "Since the comma is not an operator, but a separator between expressions the " "above is evaluated as if you had entered::" msgstr "" -"由於逗號不是運算子,而是運算式之間的分隔符,因此上面的計算就像你輸入的那" +"由於逗號不是運算子,而是運算式之間的分隔符,因此上面的計算就會像你輸入的那" "樣: ::" #: ../../faq/programming.rst:711 @@ -1562,8 +1557,8 @@ msgid "" "only parameters. Its documentation looks like this::" msgstr "" "函式引數list中的斜線表示它前面的參數是位置參數。僅位置參數是沒有外部可用名稱" -"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例" -"如,:func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" +"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例如,:" +"func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" #: ../../faq/programming.rst:786 msgid "" @@ -1585,8 +1580,8 @@ msgid "" "positional-only. Thus, calling :func:`divmod` with keyword arguments would " "lead to an error::" msgstr "" -"參數串列最後的斜線表示兩個參數都是僅限位置參數。因此使用關鍵字引數呼" -"叫 :func:`divmod` 會導致錯誤: ::" +"參數串列最後的斜線表示兩個參數都是僅限位置參數。因此使用關鍵字引數呼叫 :func:" +"`divmod` 會導致錯誤: ::" #: ../../faq/programming.rst:796 msgid "" @@ -1701,8 +1696,8 @@ msgstr "如何取得 int 文字屬性而不是 SyntaxError?" #: ../../faq/programming.rst:850 msgid "" -"Trying to lookup an ``int`` literal attribute in the normal manner gives " -"a :exc:`SyntaxError` because the period is seen as a decimal point::" +"Trying to lookup an ``int`` literal attribute in the normal manner gives a :" +"exc:`SyntaxError` because the period is seen as a decimal point::" msgstr "" "嘗試以正常方式查找 ``int`` 字面值屬性會給出一個 :exc:`SyntaxError`,因為句點" "被視為小數點: ::" @@ -1738,8 +1733,8 @@ msgid "" "``int('144') == 144``. Similarly, :func:`float` converts to a floating-" "point number, e.g. ``float('144') == 144.0``." msgstr "" -"對於整數,使用內建的 int 型別建構函式,例如``int('144') == 144``。同" -"樣,:func:`float` 轉換為浮點數,例如``浮動('144')== 144.0``。" +"對於整數,使用內建的 int 型別建構函式,例如``int('144') == 144``。同樣,:" +"func:`float` 轉換為浮點數,例如``浮動('144')== 144.0``。" #: ../../faq/programming.rst:875 #, fuzzy @@ -1793,14 +1788,14 @@ msgid "" "in type constructor :func:`str`. If you want a hexadecimal or octal " "representation, use the built-in functions :func:`hex` or :func:`oct`. For " "fancy formatting, see the :ref:`f-strings` and :ref:`formatstrings` " -"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}" -"\".format(1.0/3.0)`` yields ``'0.333'``." +"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}\"." +"format(1.0/3.0)`` yields ``'0.333'``." msgstr "" -"例如,要將數字 ``144`` 轉換為字串 ``'144'``,請使用內建型別建構函" -"式 :func:`str`。如果你想要十六進製或八進製表示,請使用內建函式 :func:`hex` " -"或 :func:`oct`。對於精美的格式,請參閱:ref:`f-strings` " -"和:ref:`formatstrings` 部分,例如``\"{:04d}\".format(144)`` 產生 ``'0144'`` " -"和 ``\"{:.3f}\".format(1.0/3.0)`` 產生 ``'0.333'`` ." +"例如,要將數字 ``144`` 轉換為字串 ``'144'``,請使用內建型別建構函式 :func:" +"`str`。如果你想要十六進製或八進製表示,請使用內建函式 :func:`hex` 或 :func:" +"`oct`。對於精美的格式,請參閱:ref:`f-strings` 和:ref:`formatstrings` 部分,例" +"如``\"{:04d}\".format(144)`` 產生 ``'0144'`` 和 ``\"{:.3f}\"." +"format(1.0/3.0)`` 產生 ``'0.333'`` ." #: ../../faq/programming.rst:906 msgid "How do I modify a string in place?" @@ -2017,15 +2012,15 @@ msgstr "不是這樣的。" msgid "" "For simple input parsing, the easiest approach is usually to split the line " "into whitespace-delimited words using the :meth:`~str.split` method of " -"string objects and then convert decimal strings to numeric values " -"using :func:`int` or :func:`float`. :meth:`!split` supports an optional " -"\"sep\" parameter which is useful if the line uses something other than " -"whitespace as a separator." +"string objects and then convert decimal strings to numeric values using :" +"func:`int` or :func:`float`. :meth:`!split` supports an optional \"sep\" " +"parameter which is useful if the line uses something other than whitespace " +"as a separator." msgstr "" "對於簡單的輸入解析,最簡單的方法通常是使用字串物件的 :meth:`~str.split` 方法" -"將行拆分為以空格分隔的單詞,然後使用 :func:`int` 或將十進製字串轉換為數" -"值:func:`浮動`。 :meth:`!split` 支援可選的 \"sep\" 參數,如果該行使用空格以外" -"的其他內容作為分隔符,該參數很有用。" +"將行拆分為以空格分隔的單詞,然後使用 :func:`int` 或將十進製字串轉換為數值:" +"func:`浮動`。 :meth:`!split` 支援可選的 \"sep\" 參數,如果該行使用空格以外的" +"其他內容作為分隔符,該參數很有用。" #: ../../faq/programming.rst:1019 #, fuzzy @@ -2175,8 +2170,8 @@ msgid "" "You should always find the hot spots in your program *before* attempting to " "optimize any code (see the :mod:`profile` module)." msgstr "" -"在嘗試最佳化任何程式碼\\ *之前*,你應該始終找到程式中的熱點(請參" -"閱 :mod:`profile` 模組)。" +"在嘗試最佳化任何程式碼\\ *之前*,你應該始終找到程式中的熱點(請參閱 :mod:" +"`profile` 模組)。" #: ../../faq/programming.rst:1084 #, fuzzy @@ -2231,9 +2226,9 @@ msgid "" "When the standard library provides a primitive for doing something, it is " "likely (although not guaranteed) to be faster than any alternative you may " "come up with. This is doubly true for primitives written in C, such as " -"builtins and some extension types. For example, be sure to use either " -"the :meth:`list.sort` built-in method or the related :func:`sorted` function " -"to do sorting (and see the :ref:`sortinghowto` for examples of moderately " +"builtins and some extension types. For example, be sure to use either the :" +"meth:`list.sort` built-in method or the related :func:`sorted` function to " +"do sorting (and see the :ref:`sortinghowto` for examples of moderately " "advanced usage)." msgstr "" "當標準函式庫提供用於執行某些操作的原語時,它很可能(儘管不能保證)比你可能想" @@ -2269,8 +2264,8 @@ msgstr "" "如果你已經達到純 Python 所能允許的極限,可以使用一些工具讓你走得更遠。例如," "`Cython `_ 可以將稍微修改過的 Python 程式碼編譯成 C 擴" "充,並且可以在許多不同的平台上使用。Cython 可以利用編譯(和可選的型別註釋)使" -"你的程式碼比解釋時快得多。如果你對自己的 C 程式設計技能有信心,你也可以" -"\\ :ref:`自己編寫一個 C 擴充模組 `。" +"你的程式碼比解釋時快得多。如果你對自己的 C 程式設計技能有信心,你也可以\\ :" +"ref:`自己編寫一個 C 擴充模組 `。" #: ../../faq/programming.rst:1125 msgid "" @@ -2303,8 +2298,8 @@ msgid "" "To accumulate many :class:`str` objects, the recommended idiom is to place " "them into a list and call :meth:`str.join` at the end::" msgstr "" -"要累積許多 :class:`str` 物件,推薦的習慣用法是將它們放入list中並在末尾呼" -"叫 :meth:`str.join`: ::" +"要累積許多 :class:`str` 物件,推薦的習慣用法是將它們放入list中並在末尾呼叫 :" +"meth:`str.join`: ::" #: ../../faq/programming.rst:1141 msgid "" @@ -2476,8 +2471,8 @@ msgstr "" #: ../../faq/programming.rst:1220 msgid "" -"If all elements of the list may be used as set keys (i.e. they are " -"all :term:`hashable`) this is often faster ::" +"If all elements of the list may be used as set keys (i.e. they are all :term:" +"`hashable`) this is often faster ::" msgstr "" "如果串列的所有元素都可以做為集合的鍵(即它們都必須是 :term:`hashable`),那這" "通常會更快: ::" @@ -2493,7 +2488,8 @@ msgid "" msgstr "這會將串列轉換為一個集合,從而刪除重複項,然後再轉換回串列。" #: ../../faq/programming.rst:1230 -msgid "How do you remove multiple items from a list" +#, fuzzy +msgid "How do you remove multiple items from a list?" msgstr "如何從串列中刪除多個項目" #: ../../faq/programming.rst:1232 @@ -2502,7 +2498,7 @@ msgid "" "As with removing duplicates, explicitly iterating in reverse with a delete " "condition is one possibility. However, it is easier and faster to use slice " "replacement with an implicit or explicit forward iteration. Here are three " -"variations.::" +"variations::" msgstr "" "與刪除重複項一樣,使用刪除條件顯式反向疊代是一種可能性。但是,透過隱式或顯式" "前向疊代使用切片替換更容易和更快。這是三種變體: ::" @@ -2673,8 +2669,8 @@ msgstr "如何將方法或函式應用於物件序列?" #: ../../faq/programming.rst:1327 #, fuzzy msgid "" -"To call a method or function and accumulate the return values is a list, " -"a :term:`list comprehension` is an elegant solution::" +"To call a method or function and accumulate the return values is a list, a :" +"term:`list comprehension` is an elegant solution::" msgstr "" "呼叫一個方法或函式並累積回傳值是一個list,一個 :term:`list comprehension` 是" "一個優雅的解決方案: ::" @@ -2834,14 +2830,14 @@ msgid "" "augmented assignment is executed, and its return value is what gets used in " "the assignment statement; and (b) for lists, :meth:`!__iadd__` is equivalent " "to calling :meth:`~sequence.extend` on the list and returning the list. " -"That's why we say that for lists, ``+=`` is a \"shorthand\" " -"for :meth:`list.extend`::" +"That's why we say that for lists, ``+=`` is a \"shorthand\" for :meth:`list." +"extend`::" msgstr "" -"要了解為什麼會發生這種情況,你需要知道 (a) 如果一個物件實作了一" -"個 :meth:`~object.__iadd__` 魔術方法,它會在執行 ``+=`` 增廣賦值時被呼叫,並" -"且它的回傳value 是賦值陳述式中使用的值; (b) 對於list,:meth:`!__iadd__` 相當" -"於在list上呼叫 :meth:`!extend` 並回傳list。這就是為什麼我們說對於list," -"``+=`` 是 :meth:`!list.extend` 的「簡寫」: ::" +"要了解為什麼會發生這種情況,你需要知道 (a) 如果一個物件實作了一個 :meth:" +"`~object.__iadd__` 魔術方法,它會在執行 ``+=`` 增廣賦值時被呼叫,並且它的回傳" +"value 是賦值陳述式中使用的值; (b) 對於list,:meth:`!__iadd__` 相當於在list上" +"呼叫 :meth:`!extend` 並回傳list。這就是為什麼我們說對於list,``+=`` 是 :meth:" +"`!list.extend` 的「簡寫」: ::" #: ../../faq/programming.rst:1404 msgid "" @@ -3012,8 +3008,8 @@ msgstr "什麼是方法 (method)?" #: ../../faq/programming.rst:1481 #, fuzzy msgid "" -"A method is a function on some object ``x`` that you normally call as " -"``x.name(arguments...)``. Methods are defined as functions inside the class " +"A method is a function on some object ``x`` that you normally call as ``x." +"name(arguments...)``. Methods are defined as functions inside the class " "definition::" msgstr "" "方法是一些物件 ``x`` 上的函式,你通常將其稱為 ``x.name(arguments...)`` 。方法" @@ -3072,15 +3068,15 @@ msgstr "" #: ../../faq/programming.rst:1511 msgid "" -"Note that :func:`isinstance` also checks for virtual inheritance from " -"an :term:`abstract base class`. So, the test will return ``True`` for a " +"Note that :func:`isinstance` also checks for virtual inheritance from an :" +"term:`abstract base class`. So, the test will return ``True`` for a " "registered class even if hasn't directly or indirectly inherited from it. " "To test for \"true inheritance\", scan the :term:`MRO` of the class:" msgstr "" "請注意,:func:`isinstance` 還會檢查來自\\ :term:`抽象基底類別 (abstract base " "class) ` 的虛擬繼承。因此對已註冊類別的檢驗會回傳 " -"``True``,即使沒有直接或間接繼承自它。要測試「真正繼承」,請掃描該類別" -"的 :term:`MRO`:" +"``True``,即使沒有直接或間接繼承自它。要測試「真正繼承」,請掃描該類別的 :" +"term:`MRO`:" #: ../../faq/programming.rst:1516 msgid "" @@ -3249,29 +3245,29 @@ msgstr "" #, fuzzy msgid "" "Here the ``UpperOut`` class redefines the ``write()`` method to convert the " -"argument string to uppercase before calling the underlying " -"``self._outfile.write()`` method. All other methods are delegated to the " -"underlying ``self._outfile`` object. The delegation is accomplished via " -"the :meth:`~object.__getattr__` method; consult :ref:`the language reference " -"` for more information about controlling attribute access." +"argument string to uppercase before calling the underlying ``self._outfile." +"write()`` method. All other methods are delegated to the underlying ``self." +"_outfile`` object. The delegation is accomplished via the :meth:`~object." +"__getattr__` method; consult :ref:`the language reference ` for more information about controlling attribute access." msgstr "" -"這裡的 ``UpperOut`` 類別重新定義了``write()`` 方法,在呼叫底層的" -"``self._outfile.write()`` 方法之前將引數字串轉換為大寫。所有其他方法都委託給" -"底層的 ``self._outfile`` 物件。委託是透過 :meth:`~object.__getattr__` 方法完" -"成的;有關控制屬性存取的更多資訊,請參閱語言參考 。" +"這裡的 ``UpperOut`` 類別重新定義了``write()`` 方法,在呼叫底層的``self." +"_outfile.write()`` 方法之前將引數字串轉換為大寫。所有其他方法都委託給底層的 " +"``self._outfile`` 物件。委託是透過 :meth:`~object.__getattr__` 方法完成的;有" +"關控制屬性存取的更多資訊,請參閱語言參考 。" #: ../../faq/programming.rst:1605 #, fuzzy msgid "" "Note that for more general cases delegation can get trickier. When " -"attributes must be set as well as retrieved, the class must define " -"a :meth:`~object.__setattr__` method too, and it must do so carefully. The " -"basic implementation of :meth:`!__setattr__` is roughly equivalent to the " +"attributes must be set as well as retrieved, the class must define a :meth:" +"`~object.__setattr__` method too, and it must do so carefully. The basic " +"implementation of :meth:`!__setattr__` is roughly equivalent to the " "following::" msgstr "" "請注意,對於更一般的情況,委託可能會變得更加棘手。當必須設定和檢索屬性時,該" -"類別也必須定義一個 :meth:`~object.__setattr__` 方法,而且必須小心謹" -"慎。 :meth:`!__setattr__` 的基本實作大致等同於以下: ::" +"類別也必須定義一個 :meth:`~object.__setattr__` 方法,而且必須小心謹慎。 :" +"meth:`!__setattr__` 的基本實作大致等同於以下: ::" #: ../../faq/programming.rst:1610 msgid "" @@ -3289,9 +3285,8 @@ msgstr "" #: ../../faq/programming.rst:1616 msgid "" -"Many :meth:`~object.__setattr__` implementations call :meth:`!" -"object.__setattr__` to set an attribute on self without causing infinite " -"recursion::" +"Many :meth:`~object.__setattr__` implementations call :meth:`!object." +"__setattr__` to set an attribute on self without causing infinite recursion::" msgstr "" "許多 :meth:`~object.__setattr__` 的實作會呼叫 :meth:`!object.__setattr__` 以" "設定 self 的屬性,而不會導致無限遞迴。" @@ -3310,8 +3305,8 @@ msgstr "" #: ../../faq/programming.rst:1624 msgid "" -"Alternatively, it is possible to set attributes by inserting entries " -"into :attr:`self.__dict__ ` directly." +"Alternatively, it is possible to set attributes by inserting entries into :" +"attr:`self.__dict__ ` directly." msgstr "" #: ../../faq/programming.rst:1629 @@ -3630,9 +3625,9 @@ msgstr "這有幾個可能的原因。" #: ../../faq/programming.rst:1782 msgid "" -"The :keyword:`del` statement does not necessarily " -"call :meth:`~object.__del__` -- it simply decrements the object's reference " -"count, and if this reaches zero :meth:`!__del__` is called." +"The :keyword:`del` statement does not necessarily call :meth:`~object." +"__del__` -- it simply decrements the object's reference count, and if this " +"reaches zero :meth:`!__del__` is called." msgstr "" ":keyword:`del` 陳述式不一定會呼叫 :meth:`~object.__del__` -- 它只是減少物件的" "參照計數,如果達到零則呼叫 :meth:`!__del__`。" @@ -3691,8 +3686,8 @@ msgid "" "Finally, if your :meth:`!__del__` method raises an exception, a warning " "message is printed to :data:`sys.stderr`." msgstr "" -"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出" -"到 :data:`sys.stderr`。" +"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出到 :data:" +"`sys.stderr`。" #: ../../faq/programming.rst:1822 msgid "How do I get a list of all instances of a given class?" @@ -3871,8 +3866,8 @@ msgid "" "implement a method that behaves like :meth:`dict.pop`:" msgstr "" "當 ``None`` 是有效輸入值時,檢測可選引數可能會很棘手。在這些情況下,你可以建" -"立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似" -"於 :meth:`dict.pop` 的方法:" +"立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似於 :" +"meth:`dict.pop` 的方法:" #: ../../faq/programming.rst:1917 msgid "" @@ -3909,8 +3904,8 @@ msgstr "" #: ../../faq/programming.rst:1934 msgid "" -"For example, here is the implementation of :meth:`!" -"collections.abc.Sequence.__contains__`::" +"For example, here is the implementation of :meth:`!collections.abc.Sequence." +"__contains__`::" msgstr "" "例如,以下是 :meth:`!collections.abc.Sequence.__contains__` 的實作: ::" @@ -3941,9 +3936,9 @@ msgid "" "*after* an instance is created, which is too late to alter data in an " "immutable instance." msgstr "" -"當對不可變型別進行子類別化時,覆蓋 :meth:`~object.__new__` 方法而不" -"是 :meth:`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法" -"更改不可變實例中的資料。" +"當對不可變型別進行子類別化時,覆蓋 :meth:`~object.__new__` 方法而不是 :meth:" +"`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法更改不可變" +"實例中的資料。" #: ../../faq/programming.rst:1952 msgid "" @@ -4026,14 +4021,12 @@ msgstr "如何快取方法呼叫?" #: ../../faq/programming.rst:1997 #, fuzzy msgid "" -"The two principal tools for caching methods " -"are :func:`functools.cached_property` and :func:`functools.lru_cache`. The " -"former stores results at the instance level and the latter at the class " -"level." +"The two principal tools for caching methods are :func:`functools." +"cached_property` and :func:`functools.lru_cache`. The former stores results " +"at the instance level and the latter at the class level." msgstr "" -"快取方法的兩個主要工具是 func:`functools.cached_property` " -"和 :func:`functools.lru_cache`。前者在實例級別儲存結果,後者在類別級別儲存結" -"果。" +"快取方法的兩個主要工具是 func:`functools.cached_property` 和 :func:" +"`functools.lru_cache`。前者在實例級別儲存結果,後者在類別級別儲存結果。" #: ../../faq/programming.rst:2002 #, fuzzy @@ -4118,13 +4111,12 @@ msgstr "" #, fuzzy msgid "" "To make the *lru_cache* approach work when the *station_id* is mutable, the " -"class needs to define the :meth:`~object.__eq__` " -"and :meth:`~object.__hash__` methods so that the cache can detect relevant " -"attribute updates::" +"class needs to define the :meth:`~object.__eq__` and :meth:`~object." +"__hash__` methods so that the cache can detect relevant attribute updates::" msgstr "" -"要在 *station_id* 可變時使 *lru_cache* 方法起作用,該類別需要定" -"義 :meth:`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測" -"相關屬性更新: ::" +"要在 *station_id* 可變時使 *lru_cache* 方法起作用,該類別需要定義 :meth:" +"`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測相關屬性更" +"新: ::" #: ../../faq/programming.rst:2053 msgid "" @@ -4171,8 +4163,8 @@ msgstr "" "第一次引入模組時(或者源檔案自建立目前編譯檔案後發生更改時)應在 " "``__pycache__`` 的子目錄中建立包含編譯程式碼的 ``.pyc`` 檔案包含 .py 檔案的目" "錄。 ``.pyc`` 檔案的檔案名以與``.py`` 檔案相同的名稱開頭,以``.pyc`` 結尾,中" -"間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參" -"閱 :pep:`3147`。)" +"間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參閱 :" +"pep:`3147`。)" #: ../../faq/programming.rst:2088 #, fuzzy @@ -4203,10 +4195,10 @@ msgstr "" #: ../../faq/programming.rst:2098 #, fuzzy msgid "" -"Running Python on a top level script is not considered an import and no " -"``.pyc`` will be created. For example, if you have a top-level module " -"``foo.py`` that imports another module ``xyz.py``, when you run ``foo`` (by " -"typing ``python foo.py`` as a shell command), a ``.pyc`` will be created for " +"Running Python on a top level script is not considered an import and no ``." +"pyc`` will be created. For example, if you have a top-level module ``foo." +"py`` that imports another module ``xyz.py``, when you run ``foo`` (by typing " +"``python foo.py`` as a shell command), a ``.pyc`` will be created for " "``xyz`` because ``xyz`` is imported, but no ``.pyc`` file will be created " "for ``foo`` since ``foo.py`` isn't being imported." msgstr "" @@ -4217,9 +4209,9 @@ msgstr "" #: ../../faq/programming.rst:2105 msgid "" -"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a " -"``.pyc`` file for a module that is not imported -- you can, using " -"the :mod:`py_compile` and :mod:`compileall` modules." +"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." +"pyc`` file for a module that is not imported -- you can, using the :mod:" +"`py_compile` and :mod:`compileall` modules." msgstr "" "如果你需要為 ``foo`` 建立一個 ``.pyc`` 檔案 —— 也就是說,要為一個未引入的模組" "建立一個 ``.pyc`` 檔案 —— 你可以使用 :mod:`py_compile` 和 :mod:`compileall` " @@ -4397,11 +4389,11 @@ msgstr "此問題有(至少)三種可能的解決方法。" #: ../../faq/programming.rst:2178 #, fuzzy msgid "" -"Guido van Rossum recommends avoiding all uses of ``from " -"import ...``, and placing all code inside functions. Initializations of " -"global variables and class variables should use constants or built-in " -"functions only. This means everything from an imported module is referenced " -"as ``.``." +"Guido van Rossum recommends avoiding all uses of ``from import ..." +"``, and placing all code inside functions. Initializations of global " +"variables and class variables should use constants or built-in functions " +"only. This means everything from an imported module is referenced as " +"``.``." msgstr "" "Guido van Rossum 建議避免使用``from import ...``,並將所有程式碼放在" "函式中。全域變數和類別變數的初始化應該只使用常數或內建函式。這意味著來自引入" diff --git a/glossary.po b/glossary.po index adfd51e065..219ecfc4ff 100644 --- a/glossary.po +++ b/glossary.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-17 17:02+0000\n" +"POT-Creation-Date: 2026-02-05 14:10+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -358,8 +358,8 @@ msgid "" "On most builds of Python, having an attached thread state implies that the " "caller holds the :term:`GIL` for the current interpreter, so only one OS " "thread can have an attached thread state at a given moment. In :term:`free-" -"threaded ` builds of Python, threads can concurrently hold " -"an attached thread state, allowing for true parallelism of the bytecode " +"threaded builds ` of Python, threads can concurrently " +"hold an attached thread state, allowing for true parallelism of the bytecode " "interpreter." msgstr "" @@ -1293,10 +1293,25 @@ msgstr "" "一個執行緒執行 Python 位元組碼。請參閱 :pep:`703`。" #: ../../glossary.rst:582 +#, fuzzy +msgid "free-threaded build" +msgstr "free threading(自由執行緒)" + +#: ../../glossary.rst:585 +msgid "" +"A build of :term:`CPython` that supports :term:`free threading`, configured " +"using the :option:`--disable-gil` option before compilation." +msgstr "" + +#: ../../glossary.rst:588 +msgid "See :ref:`freethreading-python-howto`." +msgstr "" + +#: ../../glossary.rst:589 msgid "free variable" msgstr "free variable(自由變數)" -#: ../../glossary.rst:584 +#: ../../glossary.rst:591 msgid "" "Formally, as defined in the :ref:`language execution model `, a " "free variable is any variable used in a namespace which is not a local " @@ -1306,11 +1321,11 @@ msgid "" "variable`." msgstr "" -#: ../../glossary.rst:589 +#: ../../glossary.rst:596 msgid "function" msgstr "function(函式)" -#: ../../glossary.rst:591 +#: ../../glossary.rst:598 msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " @@ -1322,15 +1337,15 @@ msgstr "" "`parameter`\\ (參數)、:term:`method`\\ (方法),以及\\ :ref:`function`\\ " "章節。" -#: ../../glossary.rst:595 +#: ../../glossary.rst:602 msgid "function annotation" msgstr "function annotation(函式註釋)" -#: ../../glossary.rst:597 +#: ../../glossary.rst:604 msgid "An :term:`annotation` of a function parameter or return value." msgstr "函式參數或回傳值的一個 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:599 +#: ../../glossary.rst:606 msgid "" "Function annotations are usually used for :term:`type hints `: " "for example, this function is expected to take two :class:`int` arguments " @@ -1339,7 +1354,7 @@ msgstr "" "函式註釋通常被使用於\\ :term:`型別提示 `:例如,這個函式預期會得到" "兩個 :class:`int` 引數,並會有一個 :class:`int` 回傳值: ::" -#: ../../glossary.rst:604 +#: ../../glossary.rst:611 msgid "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" @@ -1347,11 +1362,11 @@ msgstr "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" -#: ../../glossary.rst:607 +#: ../../glossary.rst:614 msgid "Function annotation syntax is explained in section :ref:`function`." msgstr "函式註釋的語法在\\ :ref:`function`\\ 章節有詳細解釋。" -#: ../../glossary.rst:609 +#: ../../glossary.rst:616 msgid "" "See :term:`variable annotation` and :pep:`484`, which describe this " "functionality. Also see :ref:`annotations-howto` for best practices on " @@ -1360,11 +1375,11 @@ msgstr "" "請參閱 :term:`variable annotation` 和 :pep:`484`,皆有此功能的描述。關於註釋" "的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:613 +#: ../../glossary.rst:620 msgid "__future__" msgstr "__future__" -#: ../../glossary.rst:615 +#: ../../glossary.rst:622 msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " @@ -1380,7 +1395,7 @@ msgstr "" "import 此模組並對其變數求值,你可以看見一個新的功能是何時首次被新增到此語言" "中,以及它何時將會(或已經)成為預設的功能: ::" -#: ../../glossary.rst:623 +#: ../../glossary.rst:630 msgid "" ">>> import __future__\n" ">>> __future__.division\n" @@ -1390,11 +1405,11 @@ msgstr "" ">>> __future__.division\n" "_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" -#: ../../glossary.rst:626 +#: ../../glossary.rst:633 msgid "garbage collection" msgstr "garbage collection(垃圾回收)" -#: ../../glossary.rst:628 +#: ../../glossary.rst:635 msgid "" "The process of freeing memory when it is not used anymore. Python performs " "garbage collection via reference counting and a cyclic garbage collector " @@ -1406,11 +1421,11 @@ msgstr "" "垃圾回收器 (cyclic garbage collector) 來完成。垃圾回收器可以使用 :mod:`gc` 模" "組對其進行控制。" -#: ../../glossary.rst:633 ../../glossary.rst:634 +#: ../../glossary.rst:640 ../../glossary.rst:641 msgid "generator" msgstr "generator(產生器)" -#: ../../glossary.rst:636 +#: ../../glossary.rst:643 msgid "" "A function which returns a :term:`generator iterator`. It looks like a " "normal function except that it contains :keyword:`yield` expressions for " @@ -1421,7 +1436,7 @@ msgstr "" "個正常的函式,但不同的是它包含了 :keyword:`yield` 運算式,能產生一系列的值," "這些值可用於 for 迴圈,或是以 :func:`next` 函式,每次檢索其中的一個值。" -#: ../../glossary.rst:641 +#: ../../glossary.rst:648 msgid "" "Usually refers to a generator function, but may refer to a *generator " "iterator* in some contexts. In cases where the intended meaning isn't " @@ -1430,15 +1445,15 @@ msgstr "" "這個術語通常用來表示一個產生器函式,但在某些情境中,也可能是表示\\ *產生器疊" "代器*。萬一想表達的意思不夠清楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:644 +#: ../../glossary.rst:651 msgid "generator iterator" msgstr "generator iterator(產生器疊代器)" -#: ../../glossary.rst:646 +#: ../../glossary.rst:653 msgid "An object created by a :term:`generator` function." msgstr "一個由 :term:`generator`\\ (產生器)函式所建立的物件。" -#: ../../glossary.rst:648 +#: ../../glossary.rst:655 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "execution state (including local variables and pending try-statements). " @@ -1449,11 +1464,11 @@ msgstr "" "try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與那些" "每次呼叫時都要重新開始的函式有所不同)。" -#: ../../glossary.rst:654 ../../glossary.rst:655 +#: ../../glossary.rst:661 ../../glossary.rst:662 msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../glossary.rst:657 +#: ../../glossary.rst:664 msgid "" "An :term:`expression` that returns an :term:`iterator`. It looks like a " "normal expression followed by a :keyword:`!for` clause defining a loop " @@ -1465,7 +1480,7 @@ msgstr "" "變數、範圍以及一個選擇性的 :keyword:`!if` 子句。該組合運算式會為外層函式產生" "多個值: ::" -#: ../../glossary.rst:662 +#: ../../glossary.rst:669 msgid "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" @@ -1473,11 +1488,11 @@ msgstr "" ">>> sum(i*i for i in range(10)) # 平方之和 0, 1, 4, ... 81\n" "285" -#: ../../glossary.rst:664 +#: ../../glossary.rst:671 msgid "generic function" msgstr "generic function(泛型函式)" -#: ../../glossary.rst:666 +#: ../../glossary.rst:673 msgid "" "A function composed of multiple functions implementing the same operation " "for different types. Which implementation should be used during a call is " @@ -1486,7 +1501,7 @@ msgstr "" "一個由多個函式組成的函式,該函式會對不同的型別實作相同的運算。呼叫期間應該使" "用哪種實作,是由調度演算法 (dispatch algorithm) 來決定。" -#: ../../glossary.rst:670 +#: ../../glossary.rst:677 msgid "" "See also the :term:`single dispatch` glossary entry, the :func:`functools." "singledispatch` decorator, and :pep:`443`." @@ -1494,11 +1509,11 @@ msgstr "" "另請參閱 :term:`single dispatch`\\ (單一調度)術語表條目、:func:`functools." "singledispatch` 裝飾器和 :pep:`443`。" -#: ../../glossary.rst:672 +#: ../../glossary.rst:679 msgid "generic type" msgstr "generic type(泛型型別)" -#: ../../glossary.rst:674 +#: ../../glossary.rst:681 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " "class` such as :class:`list` or :class:`dict`. Used for :" @@ -1508,7 +1523,7 @@ msgstr "" "`容器型別 `,像是 :class:`list` 和 :class:`dict`。它被用於" "\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" -#: ../../glossary.rst:679 +#: ../../glossary.rst:686 msgid "" "For more details, see :ref:`generic alias types`, :pep:" "`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." @@ -1516,19 +1531,19 @@ msgstr "" "詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:" "`484`、:pep:`585` 和 :mod:`typing` 模組。" -#: ../../glossary.rst:681 +#: ../../glossary.rst:688 msgid "GIL" msgstr "GIL" -#: ../../glossary.rst:683 +#: ../../glossary.rst:690 msgid "See :term:`global interpreter lock`." msgstr "請參閱 :term:`global interpreter lock`\\ (全域直譯器鎖)。" -#: ../../glossary.rst:684 +#: ../../glossary.rst:691 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../glossary.rst:686 +#: ../../glossary.rst:693 msgid "" "The mechanism used by the :term:`CPython` interpreter to assure that only " "one thread executes Python :term:`bytecode` at a time. This simplifies the " @@ -1545,7 +1560,7 @@ msgstr "" "(multi-threaded),但代價是會犧牲掉多處理器的機器能夠提供的一大部分平行性 " "(parallelism)。" -#: ../../glossary.rst:695 +#: ../../glossary.rst:702 msgid "" "However, some extension modules, either standard or third-party, are " "designed so as to release the GIL when doing computationally intensive tasks " @@ -1556,7 +1571,7 @@ msgstr "" "計算密集 (computationally intensive) 的任務時,可以解除 GIL。另外,在執行 I/" "O 時,GIL 總是會被解除。" -#: ../../glossary.rst:700 +#: ../../glossary.rst:707 msgid "" "As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` " "build configuration. After building Python with this option, code must be " @@ -1571,18 +1586,18 @@ msgstr "" "多執行緒應用程式的效能,並使多核心 CPU 的高效使用變得更加容易。有關更多詳細資" "訊,請參閱 :pep:`703`。" -#: ../../glossary.rst:707 +#: ../../glossary.rst:714 msgid "" "In prior versions of Python's C API, a function might declare that it " "requires the GIL to be held in order to use it. This refers to having an :" "term:`attached thread state`." msgstr "" -#: ../../glossary.rst:710 +#: ../../glossary.rst:717 msgid "global state" msgstr "" -#: ../../glossary.rst:712 +#: ../../glossary.rst:719 msgid "" "Data that is accessible throughout a program, such as module-level " "variables, class variables, or C static variables in :term:`extension " @@ -1591,11 +1606,11 @@ msgid "" "`race conditions ` and :term:`data races `." msgstr "" -#: ../../glossary.rst:718 +#: ../../glossary.rst:725 msgid "hash-based pyc" msgstr "hash-based pyc(雜湊架構的 pyc)" -#: ../../glossary.rst:720 +#: ../../glossary.rst:727 msgid "" "A bytecode cache file that uses the hash rather than the last-modified time " "of the corresponding source file to determine its validity. See :ref:`pyc-" @@ -1604,11 +1619,11 @@ msgstr "" "一個位元組碼 (bytecode) 暫存檔,它使用雜湊值而不是對應原始檔案的最後修改時" "間,來確定其有效性。請參閱\\ :ref:`pyc-invalidation`。" -#: ../../glossary.rst:723 +#: ../../glossary.rst:730 msgid "hashable" msgstr "hashable(可雜湊的)" -#: ../../glossary.rst:725 +#: ../../glossary.rst:732 msgid "" "An object is *hashable* if it has a hash value which never changes during " "its lifetime (it needs a :meth:`~object.__hash__` method), and can be " @@ -1620,7 +1635,7 @@ msgstr "" "`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結果為相等的" "多個可雜湊物件,它們必須擁有相同的雜湊值。" -#: ../../glossary.rst:731 +#: ../../glossary.rst:738 msgid "" "Hashability makes an object usable as a dictionary key and a set member, " "because these data structures use the hash value internally." @@ -1628,7 +1643,7 @@ msgstr "" "可雜湊性 (hashability) 使一個物件可用作 dictionary(字典)的鍵和 set(集合)" "的成員,因為這些資料結構都在其內部使用了雜湊值。" -#: ../../glossary.rst:734 +#: ../../glossary.rst:741 msgid "" "Most of Python's immutable built-in objects are hashable; mutable containers " "(such as lists or dictionaries) are not; immutable containers (such as " @@ -1643,11 +1658,11 @@ msgstr "" "則這些物件會被預設為可雜湊的。它們在互相比較時都是不相等的(除非它們與自己比" "較),而它們的雜湊值則是衍生自它們的 :func:`id`。" -#: ../../glossary.rst:741 +#: ../../glossary.rst:748 msgid "IDLE" msgstr "IDLE" -#: ../../glossary.rst:743 +#: ../../glossary.rst:750 msgid "" "An Integrated Development and Learning Environment for Python. :ref:`idle` " "is a basic editor and interpreter environment which ships with the standard " @@ -1657,17 +1672,17 @@ msgstr "" "境)。:ref:`idle` 是一個基本的編輯器和直譯器環境,它和 Python 的標準發行版本" "一起被提供。" -#: ../../glossary.rst:746 +#: ../../glossary.rst:753 msgid "immortal" msgstr "immortal(不滅)" -#: ../../glossary.rst:748 +#: ../../glossary.rst:755 msgid "" "*Immortal objects* are a CPython implementation detail introduced in :pep:" "`683`." msgstr "*不滅物件 (Immortal objects)* 是 :pep:`683` 引入的 CPython 實作細節。" -#: ../../glossary.rst:751 +#: ../../glossary.rst:758 msgid "" "If an object is immortal, its :term:`reference count` is never modified, and " "therefore it is never deallocated while the interpreter is running. For " @@ -1677,17 +1692,17 @@ msgstr "" "修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` 和 :const:" "`None` 在 CPython 中是不滅的。" -#: ../../glossary.rst:755 +#: ../../glossary.rst:762 msgid "" "Immortal objects can be identified via :func:`sys._is_immortal`, or via :c:" "func:`PyUnstable_IsImmortal` in the C API." msgstr "" -#: ../../glossary.rst:757 +#: ../../glossary.rst:764 msgid "immutable" msgstr "immutable(不可變物件)" -#: ../../glossary.rst:759 +#: ../../glossary.rst:766 msgid "" "An object with a fixed value. Immutable objects include numbers, strings " "and tuples. Such an object cannot be altered. A new object has to be " @@ -1698,16 +1713,16 @@ msgid "" "improperly synchronized :term:`concurrent modification`." msgstr "" "一個具有固定值的物件。不可變物件包括數字、字串和 tuple(元組)。這類物件是不" -"能被改變的。如果必須儲存一個不同的值,則需要建立一個新的物件。它們在需要恆" -"定雜湊值的地方扮演重要的角色,例如 dictionary 中的一個鍵。不可變物件本" -"質上是\\ :term:`執行緒安全的 `,因為它們的狀態在建立後無法被修改," -"從而消除了對不當同步的\\ :term:`並行修改 `\\ 的疑慮。" +"能被改變的。如果必須儲存一個不同的值,則需要建立一個新的物件。它們在需要恆定" +"雜湊值的地方扮演重要的角色,例如 dictionary 中的一個鍵。不可變物件本質上是" +"\\ :term:`執行緒安全的 `,因為它們的狀態在建立後無法被修改,從而" +"消除了對不當同步的\\ :term:`並行修改 `\\ 的疑慮。" -#: ../../glossary.rst:766 +#: ../../glossary.rst:773 msgid "import path" msgstr "import path(引入路徑)" -#: ../../glossary.rst:768 +#: ../../glossary.rst:775 msgid "" "A list of locations (or :term:`path entries `) that are searched " "by the :term:`path based finder` for modules to import. During import, this " @@ -1719,11 +1734,11 @@ msgstr "" "的位置。在 import 期間,此位置列表通常是來自 :data:`sys.path`,但對於子套件 " "(subpackage) 而言,它也可能是來自父套件的 ``__path__`` 屬性。" -#: ../../glossary.rst:773 +#: ../../glossary.rst:780 msgid "importing" msgstr "importing(引入)" -#: ../../glossary.rst:775 +#: ../../glossary.rst:782 msgid "" "The process by which Python code in one module is made available to Python " "code in another module." @@ -1731,11 +1746,11 @@ msgstr "" "一個過程。一個模組中的 Python 程式碼可以透過此過程,被另一個模組中的 Python " "程式碼使用。" -#: ../../glossary.rst:777 +#: ../../glossary.rst:784 msgid "importer" msgstr "importer(引入器)" -#: ../../glossary.rst:779 +#: ../../glossary.rst:786 msgid "" "An object that both finds and loads a module; both a :term:`finder` and :" "term:`loader` object." @@ -1743,11 +1758,39 @@ msgstr "" "一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也是 :term:" "`loader`\\ (載入器)物件。" -#: ../../glossary.rst:781 +#: ../../glossary.rst:788 +#, fuzzy +msgid "index" +msgstr "finder(尋檢器)" + +#: ../../glossary.rst:790 +msgid "" +"A numeric value that represents the position of an element in a :term:" +"`sequence`." +msgstr "" + +#: ../../glossary.rst:793 +msgid "" +"In Python, indexing starts at zero. For example, ``things[0]`` names the " +"*first* element of ``things``; ``things[1]`` names the second one." +msgstr "" + +#: ../../glossary.rst:797 +msgid "" +"In some contexts, Python allows negative indexes for counting from the end " +"of a sequence, and indexing using :term:`slices `." +msgstr "" + +#: ../../glossary.rst:800 +#, fuzzy +msgid "See also :term:`subscript`." +msgstr "另請參閱 :term:`module`\\ (模組)。" + +#: ../../glossary.rst:801 msgid "interactive" msgstr "interactive(互動的)" -#: ../../glossary.rst:783 +#: ../../glossary.rst:803 msgid "" "Python has an interactive interpreter which means you can enter statements " "and expressions at the interpreter prompt, immediately execute them and see " @@ -1761,11 +1804,11 @@ msgstr "" "從你的電腦的主選單選擇它)。這是測試新想法或檢查模組和包的非常強大的方法(請" "記住help(x))。更多互動式模式相關資訊請見 :ref:`tut-interac`。" -#: ../../glossary.rst:790 +#: ../../glossary.rst:810 msgid "interpreted" msgstr "interpreted(直譯的)" -#: ../../glossary.rst:792 +#: ../../glossary.rst:812 msgid "" "Python is an interpreted language, as opposed to a compiled one, though the " "distinction can be blurry because of the presence of the bytecode compiler. " @@ -1779,11 +1822,11 @@ msgstr "" "一個執行檔,然後再執行它。直譯語言通常比編譯語言有更短的開發/除錯週期,不過" "它們的程式通常也運行得較慢。另請參閱 :term:`interactive`\\ (互動的)。" -#: ../../glossary.rst:799 +#: ../../glossary.rst:819 msgid "interpreter shutdown" msgstr "interpreter shutdown(直譯器關閉)" -#: ../../glossary.rst:801 +#: ../../glossary.rst:821 msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " @@ -1801,18 +1844,18 @@ msgstr "" "段被執行的程式碼會遇到各種例外,因為它所依賴的資源可能不再有作用了(常見的例" "子是函式庫模組或是警告機制)。" -#: ../../glossary.rst:810 +#: ../../glossary.rst:830 msgid "" "The main reason for interpreter shutdown is that the ``__main__`` module or " "the script being run has finished executing." msgstr "" "直譯器關閉的主要原因,是 ``__main__`` 模組或正被運行的腳本已經執行完成。" -#: ../../glossary.rst:812 +#: ../../glossary.rst:832 msgid "iterable" msgstr "iterable(可疊代物件)" -#: ../../glossary.rst:814 +#: ../../glossary.rst:834 msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " @@ -1827,7 +1870,7 @@ msgstr "" "只要那些 class 有實作 :term:`sequence`\\ (序列)語意的 :meth:`~object." "__iter__` 或是 :meth:`~object.__getitem__` method,該物件就是可疊代物件。" -#: ../../glossary.rst:822 +#: ../../glossary.rst:842 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " @@ -1847,11 +1890,11 @@ msgstr "" "數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代器)、:" "term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" -#: ../../glossary.rst:832 +#: ../../glossary.rst:852 msgid "iterator" msgstr "iterator(疊代器)" -#: ../../glossary.rst:834 +#: ../../glossary.rst:854 msgid "" "An object representing a stream of data. Repeated calls to the iterator's :" "meth:`~iterator.__next__` method (or passing it to the built-in function :" @@ -1880,11 +1923,11 @@ msgstr "" "此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一個已被用盡的疊代器物" "件,使其看起來就像一個空的容器。" -#: ../../glossary.rst:849 +#: ../../glossary.rst:869 msgid "More information can be found in :ref:`typeiter`." msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" -#: ../../glossary.rst:853 +#: ../../glossary.rst:873 msgid "" "CPython does not consistently apply the requirement that an iterator define :" "meth:`~iterator.__iter__`. And also please note that :term:`free-threaded " @@ -1893,13 +1936,24 @@ msgid "" msgstr "" "CPython 並不是始終如一地都會檢查「疊代器有定義 :meth:`~iterator." "__iter__`\\ 」這個規定。另請注意,:term:`free-threading(自由執行緒)` CPython 不保證疊代器操作的\\ :term:`執行緒安全 ` 行為。" +"threading>` CPython 不保證疊代器操作的\\ :term:`執行緒安全 ` 行" +"為。" -#: ../../glossary.rst:859 +#: ../../glossary.rst:878 +msgid "key" +msgstr "" + +#: ../../glossary.rst:880 +msgid "" +"A value that identifies an entry in a :term:`mapping`. See also :term:" +"`subscript`." +msgstr "" + +#: ../../glossary.rst:882 msgid "key function" msgstr "key function(鍵函式)" -#: ../../glossary.rst:861 +#: ../../glossary.rst:884 msgid "" "A key function or collation function is a callable that returns a value used " "for sorting or ordering. For example, :func:`locale.strxfrm` is used to " @@ -1909,7 +1963,7 @@ msgstr "" "一個用於排序 (sorting) 或定序 (ordering) 的值。例如,:func:`locale.strxfrm` " "被用來產生一個了解區域特定排序慣例的排序鍵。" -#: ../../glossary.rst:866 +#: ../../glossary.rst:889 msgid "" "A number of tools in Python accept key functions to control how elements are " "ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" @@ -1921,7 +1975,7 @@ msgstr "" "merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` 和 :func:`itertools." "groupby`。" -#: ../../glossary.rst:872 +#: ../../glossary.rst:895 msgid "" "There are several ways to create a key function. For example. the :meth:" "`str.casefold` method can serve as a key function for case insensitive " @@ -1931,26 +1985,26 @@ msgid "" "are three key function constructors. See the :ref:`Sorting HOW TO " "` for examples of how to create and use key functions." msgstr "" -"有幾種方法可以建立一個鍵函式。例如,:meth:`str.casefold` method 可以作為不分大小" -"寫排序的鍵函式。或者,一個鍵函式也可以從 :keyword:`lambda` 運算式被建造,例" -"如 ``lambda r: (r[0], r[2])``。另外,:func:`operator.attrgetter`、:func:" +"有幾種方法可以建立一個鍵函式。例如,:meth:`str.casefold` method 可以作為不分" +"大小寫排序的鍵函式。或者,一個鍵函式也可以從 :keyword:`lambda` 運算式被建造," +"例如 ``lambda r: (r[0], r[2])``。另外,:func:`operator.attrgetter`、:func:" "`operator.itemgetter` 和 :func:`operator.methodcaller` 為三個鍵函式的建構函" "式 (constructor)。關於如何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 " "`。" -#: ../../glossary.rst:879 +#: ../../glossary.rst:902 msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:881 ../../glossary.rst:1248 +#: ../../glossary.rst:904 ../../glossary.rst:1271 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" -#: ../../glossary.rst:882 +#: ../../glossary.rst:905 msgid "lambda" msgstr "lambda" -#: ../../glossary.rst:884 +#: ../../glossary.rst:907 msgid "" "An anonymous inline function consisting of a single :term:`expression` which " "is evaluated when the function is called. The syntax to create a lambda " @@ -1960,11 +2014,11 @@ msgstr "" "function),於該函式被呼叫時求值。建立 lambda 函式的語法是 ``lambda " "[parameters]: expression``" -#: ../../glossary.rst:887 +#: ../../glossary.rst:910 msgid "LBYL" msgstr "LBYL" -#: ../../glossary.rst:889 +#: ../../glossary.rst:912 msgid "" "Look before you leap. This coding style explicitly tests for pre-conditions " "before making calls or lookups. This style contrasts with the :term:`EAFP` " @@ -1975,7 +2029,7 @@ msgstr "" "地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許多 :" "keyword:`if` 陳述式的存在。" -#: ../../glossary.rst:894 +#: ../../glossary.rst:917 msgid "" "In a multi-threaded environment, the LBYL approach can risk introducing a :" "term:`race condition` between \"the looking\" and \"the leaping\". For " @@ -1984,25 +2038,25 @@ msgid "" "lookup. This issue can be solved with :term:`locks ` or by using the :" "term:`EAFP` approach. See also :term:`thread-safe`." msgstr "" -"在一個多執行緒環境中,LBYL 方式有在「三思」和「後行」之間引入\\ :term:`競爭條件 " -"` 的風險。例如以下程式碼 ``if key in mapping: return " +"在一個多執行緒環境中,LBYL 方式有在「三思」和「後行」之間引入\\ :term:`競爭條" +"件 ` 的風險。例如以下程式碼 ``if key in mapping: return " "mapping[key]``,如果另一個執行緒在測試之後但在查找之前,從 *mapping* 中移除" -"了 *key*,則該程式碼就會失效。這個問題可以用\\ :term:`鎖 `\\ 或使用 :term:" -"`EAFP` 編碼方式來解決。另請參閱\\ :term:`執行緒安全 `。" +"了 *key*,則該程式碼就會失效。這個問題可以用\\ :term:`鎖 `\\ 或使用 :" +"term:`EAFP` 編碼方式來解決。另請參閱\\ :term:`執行緒安全 `。" -#: ../../glossary.rst:900 +#: ../../glossary.rst:923 msgid "lexical analyzer" msgstr "lexical analyzer(詞法分析器)" -#: ../../glossary.rst:903 +#: ../../glossary.rst:926 msgid "Formal name for the *tokenizer*; see :term:`token`." msgstr "tokenizer 的正式名稱;請參閱 :term:`token`。" -#: ../../glossary.rst:904 +#: ../../glossary.rst:927 msgid "list" msgstr "list(串列)" -#: ../../glossary.rst:906 +#: ../../glossary.rst:929 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " @@ -2012,11 +2066,11 @@ msgstr "" "似其他語言中的一個陣列 (array) 而較不像一個鏈結串列 (linked list),因為存取元" "素的時間複雜度是 *O*\\ (1)。" -#: ../../glossary.rst:909 +#: ../../glossary.rst:932 msgid "list comprehension" msgstr "list comprehension(串列綜合運算)" -#: ../../glossary.rst:911 +#: ../../glossary.rst:934 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -2030,11 +2084,11 @@ msgstr "" "keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有元素都會被" "處理。" -#: ../../glossary.rst:917 +#: ../../glossary.rst:940 msgid "lock" msgstr "lock(鎖)" -#: ../../glossary.rst:919 +#: ../../glossary.rst:942 msgid "" "A :term:`synchronization primitive` that allows only one thread at a time to " "access a shared resource. A thread must acquire a lock before accessing the " @@ -2049,11 +2103,11 @@ msgid "" "`reentrant`." msgstr "" -#: ../../glossary.rst:930 +#: ../../glossary.rst:953 msgid "loader" msgstr "loader(載入器)" -#: ../../glossary.rst:932 +#: ../../glossary.rst:955 msgid "" "An object that loads a module. It must define the :meth:`!exec_module` and :" "meth:`!create_module` methods to implement the :class:`~importlib.abc." @@ -2064,23 +2118,23 @@ msgstr "" "create_module` 方法以實作 :class:`~importlib.abc.Loader` 介面。載入器通常是" "被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱:" -#: ../../glossary.rst:938 +#: ../../glossary.rst:961 msgid ":ref:`finders-and-loaders`" msgstr ":ref:`finders-and-loaders`" -#: ../../glossary.rst:939 +#: ../../glossary.rst:962 msgid ":class:`importlib.abc.Loader`" msgstr ":class:`importlib.abc.Loader`" -#: ../../glossary.rst:940 +#: ../../glossary.rst:963 msgid ":pep:`302`" msgstr ":pep:`302`" -#: ../../glossary.rst:941 +#: ../../glossary.rst:964 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:943 +#: ../../glossary.rst:966 msgid "" "On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" "`locale.setlocale(locale.LC_CTYPE, new_locale) `." @@ -2088,36 +2142,36 @@ msgstr "" "在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 :func:`locale." "setlocale(locale.LC_CTYPE, new_locale) ` 來設定。" -#: ../../glossary.rst:946 +#: ../../glossary.rst:969 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "在 Windows 上,它是 ANSI 碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:948 +#: ../../glossary.rst:971 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "在 Android 和 VxWorks 上,Python 使用 ``\"utf-8\"`` 作為區域編碼。" -#: ../../glossary.rst:950 +#: ../../glossary.rst:973 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr ":func:`locale.getencoding` 可以用來取得區域編碼。" -#: ../../glossary.rst:952 +#: ../../glossary.rst:975 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "也請參考 :term:`filesystem encoding and error handler`。" -#: ../../glossary.rst:953 +#: ../../glossary.rst:976 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:957 +#: ../../glossary.rst:980 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:958 +#: ../../glossary.rst:981 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:960 +#: ../../glossary.rst:983 msgid "" "A container object that supports arbitrary key lookups and implements the " "methods specified in the :class:`collections.abc.Mapping` or :class:" @@ -2132,11 +2186,11 @@ msgstr "" "包括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections." "OrderedDict` 和 :class:`collections.Counter`。" -#: ../../glossary.rst:966 +#: ../../glossary.rst:989 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:968 +#: ../../glossary.rst:991 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders ` " "相關但是不同。" -#: ../../glossary.rst:972 +#: ../../glossary.rst:995 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`。" -#: ../../glossary.rst:974 +#: ../../glossary.rst:997 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:976 +#: ../../glossary.rst:999 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -2177,15 +2231,15 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:986 +#: ../../glossary.rst:1009 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:955 ../../glossary.rst:987 ../../glossary.rst:1430 +#: ../../glossary.rst:978 ../../glossary.rst:1010 ../../glossary.rst:1454 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:989 +#: ../../glossary.rst:1012 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " @@ -2197,11 +2251,11 @@ msgstr "" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:993 +#: ../../glossary.rst:1016 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:995 +#: ../../glossary.rst:1018 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " @@ -2210,11 +2264,11 @@ msgstr "" "方法解析順序是在查找某個成員的過程中,base class(基底類別)被搜尋的順序。關" "於 Python 自 2.3 版直譯器所使用的演算法細節,請參閱 :ref:`python_2.3_mro`。" -#: ../../glossary.rst:998 +#: ../../glossary.rst:1021 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:1000 +#: ../../glossary.rst:1023 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -2224,15 +2278,15 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:1004 +#: ../../glossary.rst:1027 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:1005 +#: ../../glossary.rst:1028 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:1007 +#: ../../glossary.rst:1030 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." @@ -2240,23 +2294,23 @@ msgstr "" "一個命名空間,它包含用於載入模組的 import 相關資訊。它是 :class:`importlib." "machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:1010 +#: ../../glossary.rst:1033 msgid "See also :ref:`module-specs`." msgstr "另請參閱 :ref:`module-specs`。" -#: ../../glossary.rst:1011 +#: ../../glossary.rst:1034 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:1013 +#: ../../glossary.rst:1036 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:1014 +#: ../../glossary.rst:1037 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:1016 +#: ../../glossary.rst:1039 msgid "" "An :term:`object` with state that is allowed to change during the course of " "the program. In multi-threaded programs, mutable objects that are shared " @@ -2265,11 +2319,11 @@ msgid "" "safe`, and :term:`concurrent modification`." msgstr "" -#: ../../glossary.rst:1021 +#: ../../glossary.rst:1044 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:1023 +#: ../../glossary.rst:1046 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -2279,7 +2333,7 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:1027 +#: ../../glossary.rst:1050 msgid "" "Several built-in types are named tuples, including the values returned by :" "func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." @@ -2288,7 +2342,7 @@ msgstr "" "有些內建型別是 named tuple,包括由 :func:`time.localtime` 和 :func:`os.stat` " "回傳的值。另一個例子是 :data:`sys.float_info`: ::" -#: ../../glossary.rst:1031 +#: ../../glossary.rst:1054 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -2304,7 +2358,7 @@ msgstr "" ">>> isinstance(sys.float_info, tuple) # 屬於 tuple 型別\n" "True" -#: ../../glossary.rst:1038 +#: ../../glossary.rst:1061 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " @@ -2321,11 +2375,11 @@ msgstr "" "namedtuple` 來建立。後者技術也增加了一些額外的 method,這些 method 可能是在手" "寫或內建的 named tuple 中,無法找到的。" -#: ../../glossary.rst:1046 +#: ../../glossary.rst:1069 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:1048 +#: ../../glossary.rst:1071 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " @@ -2345,11 +2399,11 @@ msgstr "" "func:`itertools.islice` 明確地表示,這些函式分別是由 :mod:`random` 和 :mod:" "`itertools` 模組在實作。" -#: ../../glossary.rst:1058 +#: ../../glossary.rst:1081 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:1060 +#: ../../glossary.rst:1083 msgid "" "A :term:`package` which serves only as a container for subpackages. " "Namespace packages may have no physical representation, and specifically are " @@ -2359,7 +2413,7 @@ msgstr "" "名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:`regular " "package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" -#: ../../glossary.rst:1065 +#: ../../glossary.rst:1088 msgid "" "Namespace packages allow several individually installable packages to have a " "common parent package. Otherwise, it is recommended to use a :term:`regular " @@ -2368,20 +2422,20 @@ msgstr "" "命名空間套件允許數個可獨立安裝的套件擁有一個共同的父套件。除此之外,建議使" "用 :term:`regular package`。" -#: ../../glossary.rst:1068 +#: ../../glossary.rst:1091 msgid "" "For more information, see :pep:`420` and :ref:`reference-namespace-package`." msgstr "更多資訊,請參閱 :pep:`420` 和 :ref:`reference-namespace-package`。" -#: ../../glossary.rst:1070 +#: ../../glossary.rst:1093 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:1071 +#: ../../glossary.rst:1094 msgid "native code" msgstr "" -#: ../../glossary.rst:1073 +#: ../../glossary.rst:1096 msgid "" "Code that is compiled to machine instructions and runs directly on the " "processor, as opposed to code that is interpreted or runs in a virtual " @@ -2390,11 +2444,11 @@ msgid "" "can be called from Python. See also :term:`extension module`." msgstr "" -#: ../../glossary.rst:1078 +#: ../../glossary.rst:1101 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:1080 +#: ../../glossary.rst:1103 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2409,11 +2463,11 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。:keyword:`nonlocal` 容許" "對外層作用域進行寫入。" -#: ../../glossary.rst:1087 +#: ../../glossary.rst:1110 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:1089 +#: ../../glossary.rst:1112 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " @@ -2425,11 +2479,11 @@ msgstr "" "__slots__`、描述器 (descriptor)、屬性 (property)、:meth:`~object." "__getattribute__`、class method(類別方法)和 static method(靜態方法)。" -#: ../../glossary.rst:1094 +#: ../../glossary.rst:1117 msgid "non-deterministic" msgstr "" -#: ../../glossary.rst:1096 +#: ../../glossary.rst:1119 msgid "" "Behavior where the outcome of a program can vary between executions with the " "same inputs. In multi-threaded programs, non-deterministic behavior often " @@ -2439,11 +2493,11 @@ msgid "" "` helps ensure deterministic behavior." msgstr "" -#: ../../glossary.rst:1103 +#: ../../glossary.rst:1126 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:1105 +#: ../../glossary.rst:1128 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." @@ -2451,11 +2505,11 @@ msgstr "" "具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任何 :term:" "`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:1108 +#: ../../glossary.rst:1131 msgid "optimized scope" msgstr "optimized scope(最佳化作用域)" -#: ../../glossary.rst:1110 +#: ../../glossary.rst:1133 msgid "" "A scope where target local variable names are reliably known to the compiler " "when the code is compiled, allowing optimization of read and write access to " @@ -2466,11 +2520,11 @@ msgid "" "to optimized scopes." msgstr "" -#: ../../glossary.rst:1117 +#: ../../glossary.rst:1140 msgid "optional module" msgstr "optional module(可選模組)" -#: ../../glossary.rst:1119 +#: ../../glossary.rst:1142 msgid "" "An :term:`extension module` that is part of the :term:`standard library`, " "but may be absent in some builds of :term:`CPython`, usually due to missing " @@ -2478,17 +2532,17 @@ msgid "" "platform." msgstr "" -#: ../../glossary.rst:1124 +#: ../../glossary.rst:1147 msgid "" "See :ref:`optional-module-requirements` for a list of optional modules that " "require third-party libraries." msgstr "" -#: ../../glossary.rst:1126 +#: ../../glossary.rst:1149 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:1128 +#: ../../glossary.rst:1151 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2498,17 +2552,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:1132 +#: ../../glossary.rst:1155 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace " "package`\\ (命名空間套件)。" -#: ../../glossary.rst:1133 +#: ../../glossary.rst:1156 msgid "parallelism" msgstr "" -#: ../../glossary.rst:1135 +#: ../../glossary.rst:1158 msgid "" "Executing multiple operations at the same time (e.g. on multiple CPU " "cores). In Python builds with the :term:`global interpreter lock (GIL) " @@ -2519,11 +2573,11 @@ msgid "" "threads can run Python code simultaneously on different cores." msgstr "" -#: ../../glossary.rst:1143 +#: ../../glossary.rst:1166 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:1145 +#: ../../glossary.rst:1168 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2533,7 +2587,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:1149 +#: ../../glossary.rst:1172 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally ` or as a :term:`keyword argument " @@ -2544,11 +2598,11 @@ msgstr "" "置 `\\ 或是作為\\ :term:`關鍵字引數 `\\ 被傳遞的引數。這" "是參數的預設類型,例如以下的 *foo* 和 *bar*: ::" -#: ../../glossary.rst:1154 +#: ../../glossary.rst:1177 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:1158 +#: ../../glossary.rst:1181 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2559,11 +2613,11 @@ msgstr "" "式定義的參數列表中包含一個 ``/`` 字元,就可以在該字元前面定義僅限位置參數,例" "如以下的 *posonly1* 和 *posonly2*: ::" -#: ../../glossary.rst:1163 +#: ../../glossary.rst:1186 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -#: ../../glossary.rst:1167 +#: ../../glossary.rst:1190 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2576,11 +2630,11 @@ msgstr "" "單純的 ``*`` 字元,就可以在其後方定義僅限關鍵字參數,例如以下的 *kw_only1* " "和 *kw_only2*: ::" -#: ../../glossary.rst:1173 +#: ../../glossary.rst:1196 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -#: ../../glossary.rst:1175 +#: ../../glossary.rst:1198 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2592,11 +2646,11 @@ msgstr "" "數(在已被其他參數接受的任何位置引數之外)。這類參數是透過在其參數名稱字首加" "上 ``*`` 來定義的,例如以下的 *args*: ::" -#: ../../glossary.rst:1181 +#: ../../glossary.rst:1204 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -#: ../../glossary.rst:1183 +#: ../../glossary.rst:1206 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2607,14 +2661,14 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:1189 +#: ../../glossary.rst:1212 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:1192 +#: ../../glossary.rst:1215 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -2625,11 +2679,11 @@ msgstr "" "參數之間的差異 `、:class:`inspect.Parameter` " "class、:ref:`function`\\ 章節,以及 :pep:`362`。" -#: ../../glossary.rst:1196 +#: ../../glossary.rst:1219 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:1198 +#: ../../glossary.rst:1221 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2637,11 +2691,11 @@ msgstr "" "在 :term:`import path`\\ (引入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:1200 +#: ../../glossary.rst:1223 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:1202 +#: ../../glossary.rst:1225 msgid "" "A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" "term:`path entry hook`) which knows how to locate modules given a :term:" @@ -2651,7 +2705,7 @@ msgstr "" "`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一個 :term:" "`path entry`\\ 定位模組。" -#: ../../glossary.rst:1206 +#: ../../glossary.rst:1229 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." @@ -2659,11 +2713,11 @@ msgstr "" "關於路徑項目尋檢器實作的 method,請參閱 :class:`importlib.abc." "PathEntryFinder`。" -#: ../../glossary.rst:1208 +#: ../../glossary.rst:1231 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:1210 +#: ../../glossary.rst:1233 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2673,11 +2727,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:1213 +#: ../../glossary.rst:1236 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:1215 +#: ../../glossary.rst:1238 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." @@ -2685,11 +2739,11 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) ` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:1217 +#: ../../glossary.rst:1240 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:1219 +#: ../../glossary.rst:1242 msgid "" "An object representing a file system path. A path-like object is either a :" "class:`str` or :class:`bytes` object representing a path, or an object " @@ -2707,11 +2761,11 @@ msgstr "" "`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結果。由 :" "pep:`519` 引入。" -#: ../../glossary.rst:1227 +#: ../../glossary.rst:1250 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:1229 +#: ../../glossary.rst:1252 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2722,7 +2776,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:1235 +#: ../../glossary.rst:1258 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2734,15 +2788,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:1241 +#: ../../glossary.rst:1264 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`。" -#: ../../glossary.rst:1242 +#: ../../glossary.rst:1265 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1244 +#: ../../glossary.rst:1267 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2750,15 +2804,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1246 +#: ../../glossary.rst:1269 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1249 +#: ../../glossary.rst:1272 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1251 +#: ../../glossary.rst:1274 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2774,7 +2828,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1260 +#: ../../glossary.rst:1283 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2783,7 +2837,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1264 +#: ../../glossary.rst:1287 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2792,19 +2846,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1267 +#: ../../glossary.rst:1290 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1269 +#: ../../glossary.rst:1292 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1270 +#: ../../glossary.rst:1293 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1272 +#: ../../glossary.rst:1295 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2813,11 +2867,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1275 +#: ../../glossary.rst:1298 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1277 +#: ../../glossary.rst:1300 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2831,7 +2885,7 @@ msgstr "" "keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並沒有" "這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" -#: ../../glossary.rst:1284 +#: ../../glossary.rst:1307 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -2839,11 +2893,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" -#: ../../glossary.rst:1287 +#: ../../glossary.rst:1310 msgid "As opposed to the cleaner, Pythonic method::" msgstr "相較之下,以下方法更簡潔、更具有 Python 風格: ::" -#: ../../glossary.rst:1289 +#: ../../glossary.rst:1312 msgid "" "for piece in food:\n" " print(piece)" @@ -2851,11 +2905,11 @@ msgstr "" "for piece in food:\n" " print(piece)" -#: ../../glossary.rst:1291 +#: ../../glossary.rst:1314 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1293 +#: ../../glossary.rst:1316 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2866,7 +2920,7 @@ msgstr "" "或 method 的「路徑」,如 :pep:`3155` 中的定義。對於頂層的函式和 class 而言," "限定名稱與其物件名稱相同: ::" -#: ../../glossary.rst:1298 +#: ../../glossary.rst:1321 msgid "" ">>> class C:\n" "... class D:\n" @@ -2892,7 +2946,7 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../glossary.rst:1310 +#: ../../glossary.rst:1333 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " "dotted path to the module, including any parent packages, e.g. ``email.mime." @@ -2901,7 +2955,7 @@ msgstr "" "當用於引用模組時,*完全限定名稱 (fully qualified name)* 是表示該模組的完整點" "分隔路徑,包括任何的父套件,例如 ``email.mime.text``: ::" -#: ../../glossary.rst:1314 +#: ../../glossary.rst:1337 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -2911,11 +2965,11 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" -#: ../../glossary.rst:1317 +#: ../../glossary.rst:1340 msgid "race condition" msgstr "" -#: ../../glossary.rst:1319 +#: ../../glossary.rst:1342 msgid "" "A condition of a program where the its behavior depends on the relative " "timing or ordering of events, particularly in multi-threaded programs. Race " @@ -2927,11 +2981,11 @@ msgid "" "primitives ` helps prevent race conditions." msgstr "" -#: ../../glossary.rst:1329 +#: ../../glossary.rst:1352 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1331 +#: ../../glossary.rst:1354 msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Some objects are :term:`immortal` " @@ -2947,7 +3001,7 @@ msgstr "" "看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :" "func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1340 +#: ../../glossary.rst:1363 msgid "" "In :term:`CPython`, reference counts are not considered to be stable or well-" "defined values; the number of references to an object, and how that number " @@ -2956,11 +3010,11 @@ msgstr "" "在 :term:`CPython` 中,參照計數不被視為穩定或明確定義的值;對物件的參照數量," "以及該數量如何受到 Python 程式碼的影響,在不同版本之間可能會有所不同。" -#: ../../glossary.rst:1344 +#: ../../glossary.rst:1367 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1346 +#: ../../glossary.rst:1369 msgid "" "A traditional :term:`package`, such as a directory containing an ``__init__." "py`` file." @@ -2968,22 +3022,22 @@ msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1349 +#: ../../glossary.rst:1372 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1350 +#: ../../glossary.rst:1373 msgid "reentrant" msgstr "" -#: ../../glossary.rst:1352 +#: ../../glossary.rst:1375 msgid "" "A property of a function or :term:`lock` that allows it to be called or " "acquired multiple times by the same thread without causing errors or a :term:" "`deadlock`." msgstr "" -#: ../../glossary.rst:1356 +#: ../../glossary.rst:1379 msgid "" "For functions, reentrancy means the function can be safely called again " "before a previous invocation has completed, which is important when " @@ -2992,7 +3046,7 @@ msgid "" "a multithreaded program." msgstr "" -#: ../../glossary.rst:1362 +#: ../../glossary.rst:1385 msgid "" "For locks, Python's :class:`threading.RLock` (reentrant lock) is reentrant, " "meaning a thread that already holds the lock can acquire it again without " @@ -3000,15 +3054,15 @@ msgid "" "attempting to acquire it twice from the same thread will cause a deadlock." msgstr "" -#: ../../glossary.rst:1368 +#: ../../glossary.rst:1391 msgid "See also :term:`lock` and :term:`deadlock`." msgstr "另請參閱 :term:`lock` 和 :term:`deadlock`。" -#: ../../glossary.rst:1369 +#: ../../glossary.rst:1392 msgid "REPL" msgstr "REPL" -#: ../../glossary.rst:1371 +#: ../../glossary.rst:1394 msgid "" "An acronym for the \"read–eval–print loop\", another name for the :term:" "`interactive` interpreter shell." @@ -3016,11 +3070,11 @@ msgstr "" "「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " "`\\ 直譯器 shell 的另一個名稱。" -#: ../../glossary.rst:1373 +#: ../../glossary.rst:1396 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1375 +#: ../../glossary.rst:1398 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -3033,11 +3087,11 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1380 +#: ../../glossary.rst:1403 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1382 +#: ../../glossary.rst:1405 msgid "" "An :term:`iterable` which supports efficient element access using integer " "indices via the :meth:`~object.__getitem__` special method and defines a :" @@ -3056,7 +3110,7 @@ msgstr "" "為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` 鍵," "而不是整數。" -#: ../../glossary.rst:1391 +#: ../../glossary.rst:1414 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " "richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" @@ -3073,11 +3127,11 @@ msgstr "" "別,可以使用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於序列方法的文" "件,請見\\ :ref:`常見序列操作 `。" -#: ../../glossary.rst:1401 +#: ../../glossary.rst:1424 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1403 +#: ../../glossary.rst:1426 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " @@ -3088,11 +3142,11 @@ msgstr "" "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:1407 +#: ../../glossary.rst:1430 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1409 +#: ../../glossary.rst:1432 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -3100,27 +3154,23 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1411 +#: ../../glossary.rst:1434 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1413 +#: ../../glossary.rst:1436 msgid "" -"An object usually containing a portion of a :term:`sequence`. A slice is " -"created using the subscript notation, ``[]`` with colons between numbers " -"when several are given, such as in ``variable_name[1:3:5]``. The bracket " -"(subscript) notation uses :class:`slice` objects internally." +"An object of type :class:`slice`, used to describe a portion of a :term:" +"`sequence`. A slice object is created when using the :ref:`slicing " +"` form of :ref:`subscript notation `, with colons " +"inside square brackets, such as in ``variable_name[1:3:5]``." msgstr "" -"一個物件,它通常包含一段 :term:`sequence`\\ (序列)的某一部分。建立一段切片" -"的方法是使用下標符號 (subscript notation) ``[]``,若要給出多個數字,則在數字" -"之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" -"用 :class:`slice` 物件。" -#: ../../glossary.rst:1417 +#: ../../glossary.rst:1441 msgid "soft deprecated" msgstr "soft deprecated(軟性棄用)" -#: ../../glossary.rst:1419 +#: ../../glossary.rst:1443 msgid "" "A soft deprecated API should not be used in new code, but it is safe for " "already existing code to use it. The API remains documented and tested, but " @@ -3129,13 +3179,13 @@ msgstr "" "被軟性棄用的 API 代表不應再用於新程式碼中,但在現有程式碼中繼續使用它仍會是安" "全的。API 仍會以文件記錄並會被測試,但不會被繼續改進。" -#: ../../glossary.rst:1423 +#: ../../glossary.rst:1447 msgid "" "Soft deprecation, unlike normal deprecation, does not plan on removing the " "API and will not emit warnings." msgstr "與正常棄用不同,軟性棄用沒有刪除 API 的規劃,也不會發出警告。" -#: ../../glossary.rst:1426 +#: ../../glossary.rst:1450 msgid "" "See `PEP 387: Soft Deprecation `_." @@ -3143,11 +3193,11 @@ msgstr "" "請參閱 `PEP 387:軟性棄用 `_。" -#: ../../glossary.rst:1428 +#: ../../glossary.rst:1452 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1432 +#: ../../glossary.rst:1456 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " @@ -3158,11 +3208,11 @@ msgstr "" "種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在\\ :ref:" "`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1436 +#: ../../glossary.rst:1460 msgid "standard library" msgstr "標準函式庫" -#: ../../glossary.rst:1438 +#: ../../glossary.rst:1462 msgid "" "The collection of :term:`packages `, :term:`modules ` and :" "term:`extension modules ` distributed as a part of the " @@ -3175,7 +3225,7 @@ msgstr "" "行。該集合的成員可能會因平台、可用的系統函式庫或其他條件而有所不同。相關文件" "可以在 :ref:`library-index` 中找到。" -#: ../../glossary.rst:1444 +#: ../../glossary.rst:1468 msgid "" "See also :data:`sys.stdlib_module_names` for a list of all possible standard " "library module names." @@ -3183,11 +3233,11 @@ msgstr "" "請參閱 :data:`sys.stdlib_module_names` 以取得所有可能的標準函式庫模組名稱的列" "表。" -#: ../../glossary.rst:1446 +#: ../../glossary.rst:1470 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1448 +#: ../../glossary.rst:1472 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " "an :term:`expression` or one of several constructs with a keyword, such as :" @@ -3197,11 +3247,11 @@ msgstr "" "term:`expression`\\ (運算式),或是含有關鍵字(例如 :keyword:`if`、:keyword:" "`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1451 +#: ../../glossary.rst:1475 msgid "static type checker" msgstr "static type checker(靜態型別檢查器)" -#: ../../glossary.rst:1453 +#: ../../glossary.rst:1477 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " "such as incorrect types. See also :term:`type hints ` and the :" @@ -3211,19 +3261,19 @@ msgstr "" "另請參閱\\ :term:`型別提示 (type hints) ` 以及 :mod:`typing` 模" "組。" -#: ../../glossary.rst:1456 +#: ../../glossary.rst:1480 msgid "stdlib" msgstr "stdlib(標準函式庫)" -#: ../../glossary.rst:1458 +#: ../../glossary.rst:1482 msgid "An abbreviation of :term:`standard library`." msgstr ":term:`standard library` 的縮寫。" -#: ../../glossary.rst:1459 +#: ../../glossary.rst:1483 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1461 +#: ../../glossary.rst:1485 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " @@ -3234,7 +3284,7 @@ msgstr "" "有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透過 :c:" "func:`Py_DECREF` 釋放強參照。" -#: ../../glossary.rst:1467 +#: ../../glossary.rst:1491 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -3244,15 +3294,29 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1472 +#: ../../glossary.rst:1496 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1473 +#: ../../glossary.rst:1497 +#, fuzzy +msgid "subscript" +msgstr "descriptor(描述器)" + +#: ../../glossary.rst:1499 +msgid "" +"The expression in square brackets of a :ref:`subscription expression " +"`, for example, the ``3`` in ``items[3]``. Usually used to " +"select an element of a container. Also called a :term:`key` when " +"subscripting a :term:`mapping`, or an :term:`index` when subscripting a :" +"term:`sequence`." +msgstr "" + +#: ../../glossary.rst:1505 msgid "synchronization primitive" msgstr "" -#: ../../glossary.rst:1475 +#: ../../glossary.rst:1507 msgid "" "A basic building block for coordinating (synchronizing) the execution of " "multiple threads to ensure :term:`thread-safe` access to shared resources. " @@ -3266,15 +3330,15 @@ msgid "" "term:`lock`." msgstr "" -#: ../../glossary.rst:1485 +#: ../../glossary.rst:1517 msgid "t-string" msgstr "t-string(t 字串)" -#: ../../glossary.rst:1486 +#: ../../glossary.rst:1518 msgid "t-strings" msgstr "t-strings(t 字串)" -#: ../../glossary.rst:1488 +#: ../../glossary.rst:1520 msgid "" "String literals prefixed with ``t`` or ``T`` are commonly called \"t-" "strings\" which is short for :ref:`template string literals `." @@ -3282,11 +3346,11 @@ msgstr "" "以 ``t`` 或 ``T`` 為前綴的字串文本通常被稱為「t 字串」,它是\\ :ref:`模板化的" "字串文本 `\\ 的縮寫。" -#: ../../glossary.rst:1491 +#: ../../glossary.rst:1523 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1493 +#: ../../glossary.rst:1525 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -3296,7 +3360,7 @@ msgstr "" "``U+0000`` -- ``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一" "個位元組序列。" -#: ../../glossary.rst:1497 +#: ../../glossary.rst:1529 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -3304,7 +3368,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1500 +#: ../../glossary.rst:1532 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." @@ -3312,11 +3376,11 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs `),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1503 +#: ../../glossary.rst:1535 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1505 +#: ../../glossary.rst:1537 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " "text file actually accesses a byte-oriented datastream and handles the :term:" @@ -3330,7 +3394,7 @@ msgstr "" "有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔案、:data:`sys.stdin`、:data:" "`sys.stdout` 以及 :class:`io.StringIO` 的實例。" -#: ../../glossary.rst:1512 +#: ../../glossary.rst:1544 msgid "" "See also :term:`binary file` for a file object able to read and write :term:" "`bytes-like objects `." @@ -3338,32 +3402,32 @@ msgstr "" "另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入\\ :" "term:`類位元組串物件 (bytes-like object) ` 的檔案物件。" -#: ../../glossary.rst:1514 +#: ../../glossary.rst:1546 msgid "thread state" msgstr "" -#: ../../glossary.rst:1517 +#: ../../glossary.rst:1549 msgid "" "The information used by the :term:`CPython` runtime to run in an OS thread. " "For example, this includes the current exception, if any, and the state of " "the bytecode interpreter." msgstr "" -#: ../../glossary.rst:1521 +#: ../../glossary.rst:1553 msgid "" "Each thread state is bound to a single OS thread, but threads may have many " "thread states available. At most, one of them may be :term:`attached " "` at once." msgstr "" -#: ../../glossary.rst:1525 +#: ../../glossary.rst:1557 msgid "" "An :term:`attached thread state` is required to call most of Python's C API, " "unless a function explicitly documents otherwise. The bytecode interpreter " "only runs under an attached thread state." msgstr "" -#: ../../glossary.rst:1529 +#: ../../glossary.rst:1561 msgid "" "Each thread state belongs to a single interpreter, but each interpreter may " "have many thread states, including multiple for the same OS thread. Thread " @@ -3372,17 +3436,17 @@ msgid "" "given moment." msgstr "" -#: ../../glossary.rst:1535 +#: ../../glossary.rst:1567 msgid "" "See :ref:`Thread State and the Global Interpreter Lock ` for more " "information." msgstr "" -#: ../../glossary.rst:1537 +#: ../../glossary.rst:1569 msgid "thread-safe" msgstr "" -#: ../../glossary.rst:1539 +#: ../../glossary.rst:1571 msgid "" "A module, function, or class that behaves correctly when used by multiple " "threads concurrently. Thread-safe code uses appropriate :term:" @@ -3396,11 +3460,11 @@ msgid "" "` when used in multi-threaded programs." msgstr "" -#: ../../glossary.rst:1550 +#: ../../glossary.rst:1582 msgid "token" msgstr "token" -#: ../../glossary.rst:1553 +#: ../../glossary.rst:1585 msgid "" "A small unit of source code, generated by the :ref:`lexical analyzer " "` (also called the *tokenizer*). Names, numbers, strings, " @@ -3409,7 +3473,7 @@ msgstr "" "原始碼的小單位,由 :ref:`詞法分析器 ` (也稱為 *tokenizer*)產生。名" "稱、數字、字串、運算子、換行符號等都以 token 表示。" -#: ../../glossary.rst:1558 +#: ../../glossary.rst:1590 msgid "" "The :mod:`tokenize` module exposes Python's lexical analyzer. The :mod:" "`token` module contains information on the various types of tokens." @@ -3417,11 +3481,11 @@ msgstr "" ":mod:`tokenize` 模組公開了 Python 的詞法分析器。:mod:`token` 模組包含各種 " "token 類型的資訊。" -#: ../../glossary.rst:1561 +#: ../../glossary.rst:1593 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1563 +#: ../../glossary.rst:1595 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -3436,11 +3500,11 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1570 +#: ../../glossary.rst:1602 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1572 +#: ../../glossary.rst:1604 msgid "" "The type of a Python object determines what kind of object it is; every " "object has a type. An object's type is accessible as its :attr:`~object." @@ -3450,22 +3514,22 @@ msgstr "" "件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " "來檢索。" -#: ../../glossary.rst:1576 +#: ../../glossary.rst:1608 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1578 +#: ../../glossary.rst:1610 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1580 +#: ../../glossary.rst:1612 msgid "" "Type aliases are useful for simplifying :term:`type hints `. For " "example::" msgstr "" "型別別名對於簡化\\ :term:`型別提示 (type hint) ` 很有用。例如: ::" -#: ../../glossary.rst:1583 +#: ../../glossary.rst:1615 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -3475,11 +3539,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" -#: ../../glossary.rst:1587 +#: ../../glossary.rst:1619 msgid "could be made more readable like this::" msgstr "可以寫成這樣,更具有可讀性: ::" -#: ../../glossary.rst:1589 +#: ../../glossary.rst:1621 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -3491,15 +3555,15 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" -#: ../../glossary.rst:1594 ../../glossary.rst:1608 +#: ../../glossary.rst:1626 ../../glossary.rst:1640 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`,有此功能的描述。" -#: ../../glossary.rst:1595 +#: ../../glossary.rst:1627 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1597 +#: ../../glossary.rst:1629 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -3507,7 +3571,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1600 +#: ../../glossary.rst:1632 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers `. They can also aid " @@ -3517,7 +3581,7 @@ msgstr "" "(static type checkers) `\\ 很有用,並能協助 IDE 完成程式" "碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1604 +#: ../../glossary.rst:1636 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." @@ -3525,11 +3589,11 @@ msgstr "" "全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使用 :func:" "`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1609 +#: ../../glossary.rst:1641 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1611 +#: ../../glossary.rst:1643 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " @@ -3542,20 +3606,20 @@ msgstr "" "``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用於 :func:`bytes." "splitlines` 的附加用途。" -#: ../../glossary.rst:1616 +#: ../../glossary.rst:1648 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1618 +#: ../../glossary.rst:1650 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1620 +#: ../../glossary.rst:1652 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "註釋變數或 class 屬性時,賦值是選擇性的: ::" -#: ../../glossary.rst:1622 +#: ../../glossary.rst:1654 msgid "" "class C:\n" " field: 'annotation'" @@ -3563,7 +3627,7 @@ msgstr "" "class C:\n" " field: 'annotation'" -#: ../../glossary.rst:1625 +#: ../../glossary.rst:1657 msgid "" "Variable annotations are usually used for :term:`type hints `: " "for example this variable is expected to take :class:`int` values::" @@ -3571,15 +3635,15 @@ msgstr "" "變數註釋通常用於\\ :term:`型別提示 (type hint) `:例如,這個變數預" "期會取得 :class:`int`\\ (整數)值: ::" -#: ../../glossary.rst:1629 +#: ../../glossary.rst:1661 msgid "count: int = 0" msgstr "count: int = 0" -#: ../../glossary.rst:1631 +#: ../../glossary.rst:1663 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1633 +#: ../../glossary.rst:1665 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -3588,11 +3652,11 @@ msgstr "" "請參閱 :term:`function annotation`\\ (函式註釋)、:pep:`484` 和 :pep:`526`," "皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:1637 +#: ../../glossary.rst:1669 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1639 +#: ../../glossary.rst:1671 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -3603,15 +3667,15 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1644 +#: ../../glossary.rst:1676 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`。" -#: ../../glossary.rst:1645 +#: ../../glossary.rst:1677 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1647 +#: ../../glossary.rst:1679 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." @@ -3619,22 +3683,22 @@ msgstr "" "一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行由 :term:" "`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1649 +#: ../../glossary.rst:1681 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../glossary.rst:1651 +#: ../../glossary.rst:1683 msgid "" "A light-hearted way to refer to the :ref:`assignment expression ` operator ``:=`` because it looks a bit like a walrus if you " "turn your head." msgstr "" -#: ../../glossary.rst:1654 +#: ../../glossary.rst:1686 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1656 +#: ../../glossary.rst:1688 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -3659,14 +3723,25 @@ msgstr "C-contiguous(C 連續的)" msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" -#: ../../glossary.rst:955 +#: ../../glossary.rst:978 msgid "magic" msgstr "magic" -#: ../../glossary.rst:1430 +#: ../../glossary.rst:1454 msgid "special" msgstr "special" +#~ msgid "" +#~ "An object usually containing a portion of a :term:`sequence`. A slice is " +#~ "created using the subscript notation, ``[]`` with colons between numbers " +#~ "when several are given, such as in ``variable_name[1:3:5]``. The bracket " +#~ "(subscript) notation uses :class:`slice` objects internally." +#~ msgstr "" +#~ "一個物件,它通常包含一段 :term:`sequence`\\ (序列)的某一部分。建立一段切" +#~ "片的方法是使用下標符號 (subscript notation) ``[]``,若要給出多個數字,則在" +#~ "數字之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內" +#~ "部,會使用 :class:`slice` 物件。" + #~ msgid "" #~ "Mutable objects can change their value but keep their :func:`id`. See " #~ "also :term:`immutable`." diff --git a/howto/annotations.po b/howto/annotations.po index f6a5b8f4ca..bef59517aa 100644 --- a/howto/annotations.po +++ b/howto/annotations.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2023-11-08 23:11+0800\n" "Last-Translator: rockleon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,7 +29,7 @@ msgstr "作者" msgid "Larry Hastings" msgstr "Larry Hastings" -#: ../../howto/annotations.rst:9 +#: ../../howto/annotations.rst:-1 msgid "Abstract" msgstr "摘要" diff --git a/howto/curses.po b/howto/curses.po index 38eb0c2a5e..5809cd8c95 100644 --- a/howto/curses.po +++ b/howto/curses.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,7 +37,7 @@ msgstr "發佈版本" msgid "2.04" msgstr "2.04" -#: ../../howto/curses.rst:13 +#: ../../howto/curses.rst:-1 msgid "Abstract" msgstr "摘要" diff --git a/howto/ipaddress.po b/howto/ipaddress.po index 060f61e22a..08ee8de730 100644 --- a/howto/ipaddress.po +++ b/howto/ipaddress.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2025-12-26 10:42-0500\n" "Last-Translator: Chih-Chao Chang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,7 +35,7 @@ msgstr "Peter Moody" msgid "Nick Coghlan" msgstr "Nick Coghlan" -#: ../../howto/ipaddress.rst:14 +#: ../../howto/ipaddress.rst:-1 msgid "Overview" msgstr "總攬" @@ -200,9 +200,9 @@ msgid "" "commonly used to describe network interfaces of a computer on a given " "network and are described further in the next section." msgstr "" -"網路物件不能設定任何主機位元。這樣做的實際效果是 ``192.0.2.1/24`` 並不描述一個網" -"路。這類定義被稱為介面物件,因為 ip-on-a-network 標記法通常用於描述電腦在給定" -"網路上的網路介面,並將在下一節中進一步說明。" +"網路物件不能設定任何主機位元。這樣做的實際效果是 ``192.0.2.1/24`` 並不描述一" +"個網路。這類定義被稱為介面物件,因為 ip-on-a-network 標記法通常用於描述電腦在" +"給定網路上的網路介面,並將在下一節中進一步說明。" #: ../../howto/ipaddress.rst:107 msgid "" @@ -279,9 +279,9 @@ msgid "" msgstr "" "如上所述,如果你需要描述特定網路上的位址,位址類別和網路類別都不足以滿足需" "求。像 ``192.0.2.1/24`` 這樣的標記法通常被網路工程師以及編寫防火牆和路由器工" -"具的人用作「網路 ``192.0.2.0/24`` 上的主機 ``192.0.2.1``」的簡寫。因" -"此,:mod:`ipaddress` 提供了一組混合類別,將位址與特定網路關聯起來。建立介面的" -"方式與定義網路物件相同,只是位址部分不受限於必須是網路位址。" +"具的人用作「網路 ``192.0.2.0/24`` 上的主機 ``192.0.2.1``」的簡寫。因此,:mod:" +"`ipaddress` 提供了一組混合類別,將位址與特定網路關聯起來。建立介面的方式與定" +"義網路物件相同,只是位址部分不受限於必須是網路位址。" #: ../../howto/ipaddress.rst:152 msgid "" @@ -565,10 +565,10 @@ msgid "" "because it's necessary to know whether the value is *supposed* to be IPv4 or " "IPv6 in order to provide more detail on why it has been rejected." msgstr "" -"當使用版本無關的工廠函式建立位址/網路/介面物件時,任何錯誤都會" -"以 :exc:`ValueError` 回報,並附帶一個通用的錯誤訊息,簡單地說明傳入的值未被識" -"別為該類型的物件。缺乏具體錯誤的原因是,為了提供更多關於為何被拒絕的細節,需" -"要知道該值應該是 IPv4 還是 IPv6。" +"當使用版本無關的工廠函式建立位址/網路/介面物件時,任何錯誤都會以 :exc:" +"`ValueError` 回報,並附帶一個通用的錯誤訊息,簡單地說明傳入的值未被識別為該類" +"型的物件。缺乏具體錯誤的原因是,為了提供更多關於為何被拒絕的細節,需要知道該" +"值應該是 IPv4 還是 IPv6。" #: ../../howto/ipaddress.rst:305 msgid "" @@ -578,9 +578,9 @@ msgid "" "`ipaddress.NetmaskValueError` to indicate exactly which part of the " "definition failed to parse correctly." msgstr "" -"為了支援需要存取這些額外細節的使用情境,個別類別建構子實際上會引" -"發 :exc:`ValueError` 的子類別 :exc:`ipaddress.AddressValueError` " -"和 :exc:`ipaddress.NetmaskValueError`,以明確指出定義的哪個部分無法正確解析。" +"為了支援需要存取這些額外細節的使用情境,個別類別建構子實際上會引發 :exc:" +"`ValueError` 的子類別 :exc:`ipaddress.AddressValueError` 和 :exc:`ipaddress." +"NetmaskValueError`,以明確指出定義的哪個部分無法正確解析。" #: ../../howto/ipaddress.rst:311 msgid "" diff --git a/howto/isolating-extensions.po b/howto/isolating-extensions.po index 2c5f99df61..c4a4f7501f 100644 --- a/howto/isolating-extensions.po +++ b/howto/isolating-extensions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+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-" @@ -21,7 +21,7 @@ msgstr "" msgid "Isolating Extension Modules" msgstr "隔離擴充模組" -#: ../../howto/isolating-extensions.rst:9 +#: ../../howto/isolating-extensions.rst:-1 msgid "Abstract" msgstr "摘要" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index e0640a56fc..286da5aa6f 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2026-02-04 00:17+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -67,8 +67,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" -"(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " +"%(message)s')\n" "fh.setFormatter(formatter)\n" "ch.setFormatter(formatter)\n" "# add the handlers to the logger\n" @@ -99,8 +99,8 @@ msgid "" "\n" "class Auxiliary:\n" " def __init__(self):\n" -" self.logger = " -"logging.getLogger('spam_application.auxiliary.Auxiliary')\n" +" self.logger = logging.getLogger('spam_application.auxiliary." +"Auxiliary')\n" " self.logger.info('creating an instance of Auxiliary')\n" "\n" " def do_something(self):\n" @@ -162,8 +162,8 @@ msgid "" " time.sleep(0.5)\n" "\n" "def main():\n" -" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d %" -"(threadName)s %(message)s')\n" +" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d " +"%(threadName)s %(message)s')\n" " info = {'stop': False}\n" " thread = threading.Thread(target=worker, args=(info,))\n" " thread.start()\n" @@ -240,8 +240,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" -"(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " +"%(message)s')\n" "ch.setFormatter(formatter)\n" "fh.setFormatter(formatter)\n" "# add the handlers to logger\n" @@ -294,8 +294,8 @@ msgid "" "\n" "# set up logging to file - see previous section for more details\n" "logging.basicConfig(level=logging.DEBUG,\n" -" format='%(asctime)s %(name)-12s %(levelname)-8s %" -"(message)s',\n" +" format='%(asctime)s %(name)-12s %(levelname)-8s " +"%(message)s',\n" " datefmt='%m-%d %H:%M',\n" " filename='/tmp/myapp.log',\n" " filemode='w')\n" @@ -307,7 +307,7 @@ msgid "" "# tell the handler to use this format\n" "console.setFormatter(formatter)\n" "# add the handler to the root logger\n" -"logging.getLogger('').addHandler(console)\n" +"logging.getLogger().addHandler(console)\n" "\n" "# Now, we can log to the root logger, or any other logger. First the " "root...\n" @@ -510,9 +510,9 @@ msgid "" "a function which only returns ``True`` if the level of the passed in record " "is at or below the specified level. Note that in this example I have defined " "the ``filter_maker`` in a test script ``main.py`` that I run from the " -"command line, so its module will be ``__main__`` - hence the " -"``__main__.filter_maker`` in the filter configuration. You will need to " -"change that if you define it in a different module." +"command line, so its module will be ``__main__`` - hence the ``__main__." +"filter_maker`` in the filter configuration. You will need to change that if " +"you define it in a different module." msgstr "" #: ../../howto/logging-cookbook.rst:387 @@ -719,13 +719,13 @@ msgstr "" #: ../../howto/logging-cookbook.rst:555 msgid "" -"A common culprit which demonstrates sluggish behaviour is " -"the :class:`SMTPHandler`: sending emails can take a long time, for a number " -"of reasons outside the developer's control (for example, a poorly performing " -"mail or network infrastructure). But almost any network-based handler can " -"block: Even a :class:`SocketHandler` operation may do a DNS query under the " -"hood which is too slow (and this query can be deep in the socket library " -"code, below the Python layer, and outside your control)." +"A common culprit which demonstrates sluggish behaviour is the :class:" +"`SMTPHandler`: sending emails can take a long time, for a number of reasons " +"outside the developer's control (for example, a poorly performing mail or " +"network infrastructure). But almost any network-based handler can block: " +"Even a :class:`SocketHandler` operation may do a DNS query under the hood " +"which is too slow (and this query can be deep in the socket library code, " +"below the Python layer, and outside your control)." msgstr "" #: ../../howto/logging-cookbook.rst:563 @@ -745,12 +745,12 @@ msgstr "" #: ../../howto/logging-cookbook.rst:574 msgid "" "The second part of the solution is :class:`QueueListener`, which has been " -"designed as the counterpart to :class:`QueueHandler`. " -"A :class:`QueueListener` is very simple: it's passed a queue and some " -"handlers, and it fires up an internal thread which listens to its queue for " -"LogRecords sent from ``QueueHandlers`` (or any other source of " -"``LogRecords``, for that matter). The ``LogRecords`` are removed from the " -"queue and passed to the handlers for processing." +"designed as the counterpart to :class:`QueueHandler`. A :class:" +"`QueueListener` is very simple: it's passed a queue and some handlers, and " +"it fires up an internal thread which listens to its queue for LogRecords " +"sent from ``QueueHandlers`` (or any other source of ``LogRecords``, for that " +"matter). The ``LogRecords`` are removed from the queue and passed to the " +"handlers for processing." msgstr "" #: ../../howto/logging-cookbook.rst:582 @@ -798,10 +798,10 @@ msgid "" "Although the earlier discussion wasn't specifically talking about async " "code, but rather about slow logging handlers, it should be noted that when " "logging from async code, network and even file handlers could lead to " -"problems (blocking the event loop) because some logging is done " -"from :mod:`asyncio` internals. It might be best, if any async code is used " -"in an application, to use the above approach for logging, so that any " -"blocking code runs only in the ``QueueListener`` thread." +"problems (blocking the event loop) because some logging is done from :mod:" +"`asyncio` internals. It might be best, if any async code is used in an " +"application, to use the above approach for logging, so that any blocking " +"code runs only in the ``QueueListener`` thread." msgstr "" #: ../../howto/logging-cookbook.rst:619 @@ -818,8 +818,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:629 msgid "" -"The :class:`QueueListener` can be started (and stopped) via " -"the :keyword:`with` statement. For example:" +"The :class:`QueueListener` can be started (and stopped) via the :keyword:" +"`with` statement. For example:" msgstr "" #: ../../howto/logging-cookbook.rst:633 @@ -839,15 +839,15 @@ msgstr "" #: ../../howto/logging-cookbook.rst:647 msgid "" "Let's say you want to send logging events across a network, and handle them " -"at the receiving end. A simple way of doing this is attaching " -"a :class:`SocketHandler` instance to the root logger at the sending end::" +"at the receiving end. A simple way of doing this is attaching a :class:" +"`SocketHandler` instance to the root logger at the sending end::" msgstr "" #: ../../howto/logging-cookbook.rst:651 msgid "" "import logging, logging.handlers\n" "\n" -"rootLogger = logging.getLogger('')\n" +"rootLogger = logging.getLogger()\n" "rootLogger.setLevel(logging.DEBUG)\n" "socketHandler = logging.handlers.SocketHandler('localhost',\n" " logging.handlers.DEFAULT_TCP_LOGGING_PORT)\n" @@ -873,8 +873,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:675 msgid "" -"At the receiving end, you can set up a receiver using " -"the :mod:`socketserver` module. Here is a basic working example::" +"At the receiving end, you can set up a receiver using the :mod:" +"`socketserver` module. Here is a basic working example::" msgstr "" #: ../../howto/logging-cookbook.rst:678 @@ -958,8 +958,8 @@ msgid "" "\n" "def main():\n" " logging.basicConfig(\n" -" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s %" -"(message)s')\n" +" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s " +"%(message)s')\n" " tcpserver = LogRecordSocketReceiver()\n" " print('About to start TCP server...')\n" " tcpserver.serve_until_stopped()\n" @@ -1092,8 +1092,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:824 msgid "" -"Download `the Gist `__ as a ZIP archive using " -"the :guilabel:`Download ZIP` button." +"Download `the Gist `__ as a ZIP archive using the :" +"guilabel:`Download ZIP` button." msgstr "" #: ../../howto/logging-cookbook.rst:827 @@ -1177,8 +1177,8 @@ msgid "" "is not a good idea because these instances are not garbage collected. While " "this is not a problem in practice, when the number of :class:`Logger` " "instances is dependent on the level of granularity you want to use in " -"logging an application, it could be hard to manage if the number " -"of :class:`Logger` instances becomes effectively unbounded." +"logging an application, it could be hard to manage if the number of :class:" +"`Logger` instances becomes effectively unbounded." msgstr "" #: ../../howto/logging-cookbook.rst:886 @@ -1189,22 +1189,22 @@ msgstr "" msgid "" "An easy way in which you can pass contextual information to be output along " "with logging event information is to use the :class:`LoggerAdapter` class. " -"This class is designed to look like a :class:`Logger`, so that you can " -"call :meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:`exception`, :meth:`critical` " -"and :meth:`log`. These methods have the same signatures as their " -"counterparts in :class:`Logger`, so you can use the two types of instances " -"interchangeably." +"This class is designed to look like a :class:`Logger`, so that you can call :" +"meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:" +"`exception`, :meth:`critical` and :meth:`log`. These methods have the same " +"signatures as their counterparts in :class:`Logger`, so you can use the two " +"types of instances interchangeably." msgstr "" #: ../../howto/logging-cookbook.rst:896 msgid "" -"When you create an instance of :class:`LoggerAdapter`, you pass it " -"a :class:`Logger` instance and a dict-like object which contains your " -"contextual information. When you call one of the logging methods on an " -"instance of :class:`LoggerAdapter`, it delegates the call to the underlying " -"instance of :class:`Logger` passed to its constructor, and arranges to pass " -"the contextual information in the delegated call. Here's a snippet from the " -"code of :class:`LoggerAdapter`::" +"When you create an instance of :class:`LoggerAdapter`, you pass it a :class:" +"`Logger` instance and a dict-like object which contains your contextual " +"information. When you call one of the logging methods on an instance of :" +"class:`LoggerAdapter`, it delegates the call to the underlying instance of :" +"class:`Logger` passed to its constructor, and arranges to pass the " +"contextual information in the delegated call. Here's a snippet from the code " +"of :class:`LoggerAdapter`::" msgstr "" #: ../../howto/logging-cookbook.rst:904 @@ -1238,9 +1238,8 @@ msgid "" "use customized strings with your :class:`Formatter` instances which know " "about the keys of the dict-like object. If you need a different method, e.g. " "if you want to prepend or append the contextual information to the message " -"string, you just need to subclass :class:`LoggerAdapter` and " -"override :meth:`~LoggerAdapter.process` to do what you need. Here is a " -"simple example::" +"string, you just need to subclass :class:`LoggerAdapter` and override :meth:" +"`~LoggerAdapter.process` to do what you need. Here is a simple example::" msgstr "" #: ../../howto/logging-cookbook.rst:929 @@ -1289,23 +1288,23 @@ msgstr "" #: ../../howto/logging-cookbook.rst:959 msgid "" -"You can also add contextual information to log output using a user-" -"defined :class:`Filter`. ``Filter`` instances are allowed to modify the " +"You can also add contextual information to log output using a user-defined :" +"class:`Filter`. ``Filter`` instances are allowed to modify the " "``LogRecords`` passed to them, including adding additional attributes which " -"can then be output using a suitable format string, or if needed a " -"custom :class:`Formatter`." +"can then be output using a suitable format string, or if needed a custom :" +"class:`Formatter`." msgstr "" #: ../../howto/logging-cookbook.rst:964 msgid "" "For example in a web application, the request being processed (or at least, " -"the interesting parts of it) can be stored in a threadlocal " -"(:class:`threading.local`) variable, and then accessed from a ``Filter`` to " -"add, say, information from the request - say, the remote IP address and " -"remote user's username - to the ``LogRecord``, using the attribute names " -"'ip' and 'user' as in the ``LoggerAdapter`` example above. In that case, the " -"same format string can be used to get similar output to that shown above. " -"Here's an example script::" +"the interesting parts of it) can be stored in a threadlocal (:class:" +"`threading.local`) variable, and then accessed from a ``Filter`` to add, " +"say, information from the request - say, the remote IP address and remote " +"user's username - to the ``LogRecord``, using the attribute names 'ip' and " +"'user' as in the ``LoggerAdapter`` example above. In that case, the same " +"format string can be used to get similar output to that shown above. Here's " +"an example script::" msgstr "" #: ../../howto/logging-cookbook.rst:973 @@ -1462,8 +1461,8 @@ msgid "" "\n" "# A dummy set of requests which will be used in the simulation - we'll just " "pick\n" -"# from this list randomly. Note that all GET requests are from " -"192.168.2.XXX\n" +"# from this list randomly. Note that all GET requests are from 192.168.2." +"XXX\n" "# addresses, whereas POST requests are from 192.16.3.XXX addresses. Three " "users\n" "# are represented in the sample requests.\n" @@ -1481,8 +1480,8 @@ msgid "" "information\n" "# such as HTTP method, client IP and username\n" "\n" -"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s %" -"(user)-6s %(ip)s %(method)-4s %(message)s')\n" +"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s " +"%(user)-6s %(ip)s %(method)-4s %(message)s')\n" "\n" "# Create our context variables. These will be filled at the start of " "request\n" @@ -1721,19 +1720,18 @@ msgid "" "this is to have all the processes log to a :class:`~handlers.SocketHandler`, " "and have a separate process which implements a socket server which reads " "from the socket and logs to file. (If you prefer, you can dedicate one " -"thread in one of the existing processes to perform this " -"function.) :ref:`This section ` documents this approach in " -"more detail and includes a working socket receiver which can be used as a " -"starting point for you to adapt in your own applications." +"thread in one of the existing processes to perform this function.) :ref:" +"`This section ` documents this approach in more detail and " +"includes a working socket receiver which can be used as a starting point for " +"you to adapt in your own applications." msgstr "" #: ../../howto/logging-cookbook.rst:1294 msgid "" -"You could also write your own handler which uses " -"the :class:`~multiprocessing.Lock` class from the :mod:`multiprocessing` " -"module to serialize access to the file from your processes. The " -"stdlib :class:`FileHandler` and subclasses do not make use " -"of :mod:`multiprocessing`." +"You could also write your own handler which uses the :class:" +"`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to " +"serialize access to the file from your processes. The stdlib :class:" +"`FileHandler` and subclasses do not make use of :mod:`multiprocessing`." msgstr "" #: ../../howto/logging-cookbook.rst:1301 @@ -1784,8 +1782,8 @@ msgid "" "def listener_configurer():\n" " root = logging.getLogger()\n" " h = logging.handlers.RotatingFileHandler('mptest.log', 'a', 300, 10)\n" -" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s %" -"(levelname)-8s %(message)s')\n" +" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s " +"%(levelname)-8s %(message)s')\n" " h.setFormatter(f)\n" " root.addHandler(h)\n" "\n" @@ -1917,8 +1915,8 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" -"(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " +"%(processName)-10s %(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -2132,9 +2130,9 @@ msgstr "" msgid "" "When logging was added to the Python standard library, the only way of " "formatting messages with variable content was to use the %-formatting " -"method. Since then, Python has gained two new formatting " -"approaches: :class:`string.Template` (added in Python 2.4) " -"and :meth:`str.format` (added in Python 2.6)." +"method. Since then, Python has gained two new formatting approaches: :class:" +"`string.Template` (added in Python 2.4) and :meth:`str.format` (added in " +"Python 2.6)." msgstr "" #: ../../howto/logging-cookbook.rst:1635 @@ -2145,9 +2143,9 @@ msgid "" "``'%'``, but other possible values are ``'{'`` and ``'$'``, which correspond " "to the other two formatting styles. Backwards compatibility is maintained by " "default (as you would expect), but by explicitly specifying a style " -"parameter, you get the ability to specify format strings which work " -"with :meth:`str.format` or :class:`string.Template`. Here's an example " -"console session to show the possibilities:" +"parameter, you get the ability to specify format strings which work with :" +"meth:`str.format` or :class:`string.Template`. Here's an example console " +"session to show the possibilities:" msgstr "" #: ../../howto/logging-cookbook.rst:1645 @@ -2221,12 +2219,12 @@ msgid "" "logging call (e.g. the ``exc_info`` keyword parameter to indicate that " "traceback information should be logged, or the ``extra`` keyword parameter " "to indicate additional contextual information to be added to the log). So " -"you cannot directly make logging calls using :meth:`str.format` " -"or :class:`string.Template` syntax, because internally the logging package " -"uses %-formatting to merge the format string and the variable arguments. " -"There would be no changing this while preserving backward compatibility, " -"since all logging calls which are out there in existing code will be using %-" -"format strings." +"you cannot directly make logging calls using :meth:`str.format` or :class:" +"`string.Template` syntax, because internally the logging package uses %-" +"formatting to merge the format string and the variable arguments. There " +"would be no changing this while preserving backward compatibility, since all " +"logging calls which are out there in existing code will be using %-format " +"strings." msgstr "" #: ../../howto/logging-cookbook.rst:1690 @@ -2394,10 +2392,10 @@ msgstr "" #: ../../howto/logging-cookbook.rst:1796 msgid "" "Every logging event is represented by a :class:`LogRecord` instance. When an " -"event is logged and not filtered out by a logger's level, " -"a :class:`LogRecord` is created, populated with information about the event " -"and then passed to the handlers for that logger (and its ancestors, up to " -"and including the logger where further propagation up the hierarchy is " +"event is logged and not filtered out by a logger's level, a :class:" +"`LogRecord` is created, populated with information about the event and then " +"passed to the handlers for that logger (and its ancestors, up to and " +"including the logger where further propagation up the hierarchy is " "disabled). Before Python 3.2, there were only two places where this creation " "was done:" msgstr "" @@ -2413,22 +2411,21 @@ msgid "" ":func:`makeLogRecord`, which is called with a dictionary containing " "attributes to be added to the LogRecord. This is typically invoked when a " "suitable dictionary has been received over the network (e.g. in pickle form " -"via a :class:`~handlers.SocketHandler`, or in JSON form via " -"an :class:`~handlers.HTTPHandler`)." +"via a :class:`~handlers.SocketHandler`, or in JSON form via an :class:" +"`~handlers.HTTPHandler`)." msgstr "" #: ../../howto/logging-cookbook.rst:1812 msgid "" -"This has usually meant that if you need to do anything special with " -"a :class:`LogRecord`, you've had to do one of the following." +"This has usually meant that if you need to do anything special with a :class:" +"`LogRecord`, you've had to do one of the following." msgstr "" #: ../../howto/logging-cookbook.rst:1815 msgid "" -"Create your own :class:`Logger` subclass, which " -"overrides :meth:`Logger.makeRecord`, and set it " -"using :func:`~logging.setLoggerClass` before any loggers that you care about " -"are instantiated." +"Create your own :class:`Logger` subclass, which overrides :meth:`Logger." +"makeRecord`, and set it using :func:`~logging.setLoggerClass` before any " +"loggers that you care about are instantiated." msgstr "" #: ../../howto/logging-cookbook.rst:1818 @@ -2473,10 +2470,10 @@ msgstr "" msgid "" "In Python 3.2 and later, :class:`~logging.LogRecord` creation is done " "through a factory, which you can specify. The factory is just a callable you " -"can set with :func:`~logging.setLogRecordFactory`, and interrogate " -"with :func:`~logging.getLogRecordFactory`. The factory is invoked with the " -"same signature as the :class:`~logging.LogRecord` constructor, " -"as :class:`LogRecord` is the default setting for the factory." +"can set with :func:`~logging.setLogRecordFactory`, and interrogate with :" +"func:`~logging.getLogRecordFactory`. The factory is invoked with the same " +"signature as the :class:`~logging.LogRecord` constructor, as :class:" +"`LogRecord` is the default setting for the factory." msgstr "" #: ../../howto/logging-cookbook.rst:1848 @@ -2596,10 +2593,10 @@ msgstr "" #: ../../howto/logging-cookbook.rst:1937 msgid "" "In a similar way to the above section, we can implement a listener and " -"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The " -"following snippets illustrate -- you can test them in an environment which " -"has ``pynng`` installed. Just for variety, we present the listener first." +"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The following " +"snippets illustrate -- you can test them in an environment which has " +"``pynng`` installed. Just for variety, we present the listener first." msgstr "" #: ../../howto/logging-cookbook.rst:1947 @@ -2697,8 +2694,8 @@ msgid "" "# Make sure the process ID is in the output\n" "logging.basicConfig(level=logging.DEBUG,\n" " handlers=[logging.StreamHandler(), handler],\n" -" format='%(levelname)-8s %(name)10s %(process)6s %" -"(message)s')\n" +" format='%(levelname)-8s %(name)10s %(process)6s " +"%(message)s')\n" "levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" " logging.CRITICAL)\n" "logger_names = ('myapp', 'myapp.lib1', 'myapp.lib2')\n" @@ -2793,8 +2790,8 @@ msgstr "" msgid "" "Below is an example of a logging configuration dictionary - it's taken from " "the `documentation on the Django project `_. This dictionary is passed " -"to :func:`~config.dictConfig` to put the configuration into effect::" +"stable/topics/logging/#configuring-logging>`_. This dictionary is passed to :" +"func:`~config.dictConfig` to put the configuration into effect::" msgstr "" #: ../../howto/logging-cookbook.rst:2127 @@ -3175,13 +3172,13 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" -"(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " +"%(processName)-10s %(message)s'\n" " },\n" " 'simple': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s %" -"(message)s'\n" +" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s " +"%(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -3285,9 +3282,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2478 msgid "" -"Attach a :class:`~logging.Formatter` instance to " -"your :class:`~logging.handlers.SysLogHandler` instance, with a format string " -"such as::" +"Attach a :class:`~logging.Formatter` instance to your :class:`~logging." +"handlers.SysLogHandler` instance, with a format string such as::" msgstr "" #: ../../howto/logging-cookbook.rst:2482 @@ -3455,9 +3451,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2601 msgid "" -"You can then specify, in a logging configuration passed " -"to :func:`dictConfig`, that a logging handler be created by calling this " -"function::" +"You can then specify, in a logging configuration passed to :func:" +"`dictConfig`, that a logging handler be created by calling this function::" msgstr "" #: ../../howto/logging-cookbook.rst:2604 @@ -3561,11 +3556,11 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2691 msgid "" -"Note that this example uses Python 3.3 because that's " -"where :func:`shutil.chown` makes an appearance. This approach should work " -"with any Python version that supports :func:`dictConfig` - namely, Python " -"2.7, 3.2 or later. With pre-3.3 versions, you would need to implement the " -"actual ownership change using e.g. :func:`os.chown`." +"Note that this example uses Python 3.3 because that's where :func:`shutil." +"chown` makes an appearance. This approach should work with any Python " +"version that supports :func:`dictConfig` - namely, Python 2.7, 3.2 or later. " +"With pre-3.3 versions, you would need to implement the actual ownership " +"change using e.g. :func:`os.chown`." msgstr "" #: ../../howto/logging-cookbook.rst:2697 @@ -3631,12 +3626,11 @@ msgid "" "call (e.g. the ``exc_info`` keyword parameter to indicate that traceback " "information should be logged, or the ``extra`` keyword parameter to indicate " "additional contextual information to be added to the log). So you cannot " -"directly make logging calls using :meth:`str.format` " -"or :class:`string.Template` syntax, because internally the logging package " -"uses %-formatting to merge the format string and the variable arguments. " -"There would be no changing this while preserving backward compatibility, " -"since all logging calls which are out there in existing code will be using %-" -"format strings." +"directly make logging calls using :meth:`str.format` or :class:`string." +"Template` syntax, because internally the logging package uses %-formatting " +"to merge the format string and the variable arguments. There would be no " +"changing this while preserving backward compatibility, since all logging " +"calls which are out there in existing code will be using %-format strings." msgstr "" #: ../../howto/logging-cookbook.rst:2746 @@ -3676,8 +3670,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2770 msgid "" -"Refer to the reference documentation on :func:`setLogRecordFactory` " -"and :class:`LogRecord` for more information." +"Refer to the reference documentation on :func:`setLogRecordFactory` and :" +"class:`LogRecord` for more information." msgstr "" #: ../../howto/logging-cookbook.rst:2775 @@ -3687,11 +3681,11 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2777 msgid "" "There is another, perhaps simpler way that you can use {}- and $- formatting " -"to construct your individual log messages. You may recall " -"(from :ref:`arbitrary-object-messages`) that when logging you can use an " -"arbitrary object as a message format string, and that the logging package " -"will call :func:`str` on that object to get the actual format string. " -"Consider the following two classes::" +"to construct your individual log messages. You may recall (from :ref:" +"`arbitrary-object-messages`) that when logging you can use an arbitrary " +"object as a message format string, and that the logging package will call :" +"func:`str` on that object to get the actual format string. Consider the " +"following two classes::" msgstr "" #: ../../howto/logging-cookbook.rst:2802 @@ -3707,8 +3701,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:2810 msgid "" -"Examples of this approach are given below. Firstly, formatting " -"with :meth:`str.format`::" +"Examples of this approach are given below. Firstly, formatting with :meth:" +"`str.format`::" msgstr "" #: ../../howto/logging-cookbook.rst:2813 @@ -3775,13 +3769,13 @@ msgid "" "it might not be obvious at first glance how to do it (hence this recipe). " "Since :class:`~logging.Filter` is the only filter class included in the " "standard library, and it is unlikely to cater to many requirements (it's " -"only there as a base class), you will typically need to define your " -"own :class:`~logging.Filter` subclass with an " -"overridden :meth:`~logging.Filter.filter` method. To do this, specify the " -"``()`` key in the configuration dictionary for the filter, specifying a " -"callable which will be used to create the filter (a class is the most " -"obvious, but you can provide any callable which returns " -"a :class:`~logging.Filter` instance). Here is a complete example::" +"only there as a base class), you will typically need to define your own :" +"class:`~logging.Filter` subclass with an overridden :meth:`~logging.Filter." +"filter` method. To do this, specify the ``()`` key in the configuration " +"dictionary for the filter, specifying a callable which will be used to " +"create the filter (a class is the most obvious, but you can provide any " +"callable which returns a :class:`~logging.Filter` instance). Here is a " +"complete example::" msgstr "" #: ../../howto/logging-cookbook.rst:2858 @@ -3992,14 +3986,14 @@ msgid "" "rendered in an audible rather than a visible format. This is easy to do if " "you have text-to-speech (TTS) functionality available in your system, even " "if it doesn't have a Python binding. Most TTS systems have a command line " -"program you can run, and this can be invoked from a handler " -"using :mod:`subprocess`. It's assumed here that TTS command line programs " -"won't expect to interact with users or take a long time to complete, and " -"that the frequency of logged messages will be not so high as to swamp the " -"user with messages, and that it's acceptable to have the messages spoken one " -"at a time rather than concurrently, The example implementation below waits " -"for one message to be spoken before the next is processed, and this might " -"cause other handlers to be kept waiting. Here is a short example showing the " +"program you can run, and this can be invoked from a handler using :mod:" +"`subprocess`. It's assumed here that TTS command line programs won't expect " +"to interact with users or take a long time to complete, and that the " +"frequency of logged messages will be not so high as to swamp the user with " +"messages, and that it's acceptable to have the messages spoken one at a time " +"rather than concurrently, The example implementation below waits for one " +"message to be spoken before the next is processed, and this might cause " +"other handlers to be kept waiting. Here is a short example showing the " "approach, which assumes that the ``espeak`` TTS package is available::" msgstr "" @@ -4091,9 +4085,9 @@ msgid "" "parameter and attaches a memory handler for the duration of the call to the " "decorated function. The decorator can be additionally parameterised using a " "target handler, a level at which flushing should occur, and a capacity for " -"the buffer (number of records buffered). These default to " -"a :class:`~logging.StreamHandler` which writes to ``sys.stderr``, " -"``logging.ERROR`` and ``100`` respectively." +"the buffer (number of records buffered). These default to a :class:`~logging." +"StreamHandler` which writes to ``sys.stderr``, ``logging.ERROR`` and ``100`` " +"respectively." msgstr "" #: ../../howto/logging-cookbook.rst:3072 @@ -4224,13 +4218,12 @@ msgstr "" #: ../../howto/logging-cookbook.rst:3181 msgid "" "To illustrate how you can send log messages via email, so that a set number " -"of messages are sent per email, you can " -"subclass :class:`~logging.handlers.BufferingHandler`. In the following " -"example, which you can adapt to suit your specific needs, a simple test " -"harness is provided which allows you to run the script with command line " -"arguments specifying what you typically need to send things via SMTP. (Run " -"the downloaded script with the ``-h`` argument to see the required and " -"optional arguments.)" +"of messages are sent per email, you can subclass :class:`~logging.handlers." +"BufferingHandler`. In the following example, which you can adapt to suit " +"your specific needs, a simple test harness is provided which allows you to " +"run the script with command line arguments specifying what you typically " +"need to send things via SMTP. (Run the downloaded script with the ``-h`` " +"argument to see the required and optional arguments.)" msgstr "" #: ../../howto/logging-cookbook.rst:3189 @@ -4253,8 +4246,8 @@ msgid "" " toaddrs = [toaddrs]\n" " self.toaddrs = toaddrs\n" " self.subject = subject\n" -" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s %" -"(message)s\"))\n" +" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s " +"%(message)s\"))\n" "\n" " def flush(self):\n" " if len(self.buffer) > 0:\n" @@ -4335,10 +4328,10 @@ msgstr "" #: ../../howto/logging-cookbook.rst:3272 msgid "" -"and you can then use the ``UTCFormatter`` in your code instead " -"of :class:`~logging.Formatter`. If you want to do that via configuration, " -"you can use the :func:`~logging.config.dictConfig` API with an approach " -"illustrated by the following complete example::" +"and you can then use the ``UTCFormatter`` in your code instead of :class:" +"`~logging.Formatter`. If you want to do that via configuration, you can use " +"the :func:`~logging.config.dictConfig` API with an approach illustrated by " +"the following complete example::" msgstr "" #: ../../howto/logging-cookbook.rst:3277 @@ -4634,8 +4627,8 @@ msgid "" "Suppose we have a command-line application whose job is to stop, start or " "restart some services. This could be organised for the purposes of " "illustration as a file ``app.py`` that is the main script for the " -"application, with individual commands implemented in ``start.py``, " -"``stop.py`` and ``restart.py``. Suppose further that we want to control the " +"application, with individual commands implemented in ``start.py``, ``stop." +"py`` and ``restart.py``. Suppose further that we want to control the " "verbosity of the application via a command-line argument, defaulting to " "``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" @@ -4675,8 +4668,8 @@ msgid "" " mod = importlib.import_module(options.command)\n" " cmd = getattr(mod, 'command')\n" " except (ImportError, AttributeError):\n" -" print('Unable to find the code for command \\'%s\\'' % " -"options.command)\n" +" print('Unable to find the code for command \\'%s\\'' % options." +"command)\n" " return 1\n" " # Could get fancy here and load configuration from file or dictionary\n" " logging.basicConfig(level=options.log_level,\n" @@ -4895,8 +4888,8 @@ msgstr "" msgid "" "A question that comes up from time to time is about how to log to a GUI " "application. The `Qt `_ framework is a popular cross-" -"platform UI framework with Python bindings using :pypi:`PySide2` " -"or :pypi:`PyQt5` libraries." +"platform UI framework with Python bindings using :pypi:`PySide2` or :pypi:" +"`PyQt5` libraries." msgstr "" #: ../../howto/logging-cookbook.rst:3604 @@ -5107,8 +5100,8 @@ msgid "" " self.start_thread()\n" " self.work_button.clicked.connect(self.worker.start)\n" " # Once started, the button should be disabled\n" -" self.work_button.clicked.connect(lambda : " -"self.work_button.setEnabled(False))\n" +" self.work_button.clicked.connect(lambda : self.work_button." +"setEnabled(False))\n" "\n" " def start_thread(self):\n" " self.worker = Worker()\n" @@ -5185,9 +5178,8 @@ msgid "" "default to use the older :rfc:`3164`, which hails from 2001. When " "``logging`` was added to Python in 2003, it supported the earlier (and only " "existing) protocol at the time. Since RFC5424 came out, as there has not " -"been widespread deployment of it in syslog servers, " -"the :class:`~logging.handlers.SysLogHandler` functionality has not been " -"updated." +"been widespread deployment of it in syslog servers, the :class:`~logging." +"handlers.SysLogHandler` functionality has not been updated." msgstr "" #: ../../howto/logging-cookbook.rst:3861 @@ -5217,8 +5209,8 @@ msgid "" "\n" " def format(self, record):\n" " version = 1\n" -" asctime = " -"datetime.datetime.fromtimestamp(record.created).isoformat()\n" +" asctime = datetime.datetime.fromtimestamp(record.created)." +"isoformat()\n" " m = self.tz_offset.match(time.strftime('%z'))\n" " has_offset = False\n" " if m and time.timezone:\n" @@ -5358,8 +5350,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:3990 msgid "" -"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and " -"``sys.stderr`` by doing something like this:" +"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys." +"stderr`` by doing something like this:" msgstr "" #: ../../howto/logging-cookbook.rst:3993 @@ -5377,9 +5369,9 @@ msgstr "" #: ../../howto/logging-cookbook.rst:4000 msgid "" "You should do this *after* configuring logging for your needs. In the above " -"example, the :func:`~logging.basicConfig` call does this (using the " -"``sys.stderr`` value *before* it is overwritten by a ``LoggerWriter`` " -"instance). Then, you'd get this kind of result:" +"example, the :func:`~logging.basicConfig` call does this (using the ``sys." +"stderr`` value *before* it is overwritten by a ``LoggerWriter`` instance). " +"Then, you'd get this kind of result:" msgstr "" #: ../../howto/logging-cookbook.rst:4005 @@ -5398,9 +5390,9 @@ msgstr "" #: ../../howto/logging-cookbook.rst:4013 msgid "" -"Of course, the examples above show output according to the format used " -"by :func:`~logging.basicConfig`, but you can use a different formatter when " -"you configure logging." +"Of course, the examples above show output according to the format used by :" +"func:`~logging.basicConfig`, but you can use a different formatter when you " +"configure logging." msgstr "" #: ../../howto/logging-cookbook.rst:4017 @@ -5578,8 +5570,8 @@ msgid "" " pass\n" "\n" "if __name__ == '__main__':\n" -" logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %" -"(levelname)-9s %(message)s',\n" +" logging.basicConfig(level=logging.DEBUG, format='%(asctime)s " +"%(levelname)-9s %(message)s',\n" " handlers = [StreamHandler()])\n" " logger.debug('Single line')\n" " logger.debug('Multiple lines:\\nfool me once ...')\n" @@ -5597,8 +5589,8 @@ msgstr "" " pass\n" "\n" "if __name__ == '__main__':\n" -" logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %" -"(levelname)-9s %(message)s',\n" +" logging.basicConfig(level=logging.DEBUG, format='%(asctime)s " +"%(levelname)-9s %(message)s',\n" " handlers = [StreamHandler()])\n" " logger.debug('Single line')\n" " logger.debug('Multiple lines:\\nfool me once ...')\n" @@ -5630,9 +5622,9 @@ msgstr "" #: ../../howto/logging-cookbook.rst:4143 msgid "" -"If, on the other hand, you are concerned about `log injection `_, you can use a formatter " -"which escapes newlines, as per the following example:" +"If, on the other hand, you are concerned about `log injection `_, you can use a formatter which " +"escapes newlines, as per the following example:" msgstr "" #: ../../howto/logging-cookbook.rst:4147 @@ -5648,8 +5640,8 @@ msgid "" "\n" "if __name__ == '__main__':\n" " h = logging.StreamHandler()\n" -" h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s %" -"(message)s'))\n" +" h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s " +"%(message)s'))\n" " logging.basicConfig(level=logging.DEBUG, handlers = [h])\n" " logger.debug('Single line')\n" " logger.debug('Multiple lines:\\nfool me once ...')\n" @@ -5668,8 +5660,8 @@ msgstr "" "\n" "if __name__ == '__main__':\n" " h = logging.StreamHandler()\n" -" h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s %" -"(message)s'))\n" +" h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s " +"%(message)s'))\n" " logging.basicConfig(level=logging.DEBUG, handlers = [h])\n" " logger.debug('Single line')\n" " logger.debug('Multiple lines:\\nfool me once ...')\n" diff --git a/howto/regex.po b/howto/regex.po index 02a25aaf4d..4840ea5412 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,7 +31,7 @@ msgstr "作者" msgid "A.M. Kuchling " msgstr "A.M. Kuchling " -#: ../../howto/regex.rst:16 +#: ../../howto/regex.rst:-1 msgid "Abstract" msgstr "摘要" diff --git a/howto/sockets.po b/howto/sockets.po index 11ec58c7e6..c7e63d526f 100644 --- a/howto/sockets.po +++ b/howto/sockets.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2023-08-12 15:16+0800\n" "Last-Translator: Jay \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,7 +30,7 @@ msgstr "作者" msgid "Gordon McMillan" msgstr "Gordon McMillan" -#: ../../howto/sockets.rst:10 +#: ../../howto/sockets.rst:-1 msgid "Abstract" msgstr "摘要" diff --git a/howto/urllib2.po b/howto/urllib2.po index 540848cedb..2838843ae7 100644 --- a/howto/urllib2.po +++ b/howto/urllib2.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2022-06-27 09:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,10 +35,6 @@ msgstr "`Michael Foord `_" msgid "Introduction" msgstr "簡介" -#: ../../howto/urllib2.rst:13 -msgid "Related Articles" -msgstr "" - #: ../../howto/urllib2.rst:15 msgid "" "You may also find useful the following article on fetching web resources " diff --git a/library/asyncio.po b/library/asyncio.po index 79c9d8f5e1..8c267942ad 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2025-07-06 17:13+0800\n" "Last-Translator: Weilin Du\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,7 +37,7 @@ msgstr "指南與教學" msgid ":mod:`!asyncio` --- Asynchronous I/O" msgstr ":mod:`!asyncio` --- 非同步 I/O" -#: ../../library/asyncio.rst:9 +#: ../../library/asyncio.rst:-1 msgid "Hello World!" msgstr "Hello World!" diff --git a/library/base64.po b/library/base64.po index 9af6ca2344..cfc898bb5c 100644 --- a/library/base64.po +++ b/library/base64.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-27 07:36+0000\n" +"POT-Creation-Date: 2026-01-24 22:47+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,8 +34,8 @@ msgid "" "Base32 and Base16) and the non-standard :ref:`Base85 encodings `." msgstr "" -"這個模組提供將二進位資料編碼成可顯示 ASCII 字元以及解碼回原始資料的功能。這包括" -"了 :rfc:`4648` 中\\ :ref:`指定的編碼 `\\ (Base64、Base32 " +"這個模組提供將二進位資料編碼成可顯示 ASCII 字元以及解碼回原始資料的功能。這包" +"括了 :rfc:`4648` 中\\ :ref:`指定的編碼 `\\ (Base64、Base32 " "和 Base16)和非標準的 :ref:`Base85 編碼 `。" #: ../../library/base64.rst:22 @@ -61,10 +61,10 @@ msgid "" "`2045`. Note that if you are looking for :rfc:`2045` support you probably " "want to be looking at the :mod:`email` package instead." msgstr "" -":ref:`舊版介面 `\\ 不支援從字串解碼,但它提供對\\ :term:`檔案物件 `\\ 進行" -"編碼和解碼的函式。它僅支援 Base64 標準字母表,並且按照 :rfc:`2045` 每 76 個字" -"元添加換行字元。請注意,如果你需要 :rfc:`2045` 的支援,你可能會需要 :mod:" -"`email` 函式庫。" +":ref:`舊版介面 `\\ 不支援從字串解碼,但它提供對\\ :term:`檔案" +"物件 `\\ 進行編碼和解碼的函式。它僅支援 Base64 標準字母表,並且" +"按照 :rfc:`2045` 每 76 個字元添加換行字元。請注意,如果你需要 :rfc:`2045` 的" +"支援,你可能會需要 :mod:`email` 函式庫。" #: ../../library/base64.rst:36 msgid "" @@ -408,16 +408,14 @@ msgstr "" #: ../../library/base64.rst:242 msgid "" -"*ignorechars* should be a :term:`bytes-like object` or ASCII string " -"containing characters to ignore from the input. This should only contain " -"whitespace characters, and by default contains all whitespace characters in " -"ASCII." +"*ignorechars* should be a byte string containing characters to ignore from " +"the input. This should only contain whitespace characters, and by default " +"contains all whitespace characters in ASCII." msgstr "" -"*ignorechars* 是一個包含要從輸入中忽略的字元的\\ :term:`類位元組物件 `\\ 或 ASCII 字串。這只包含空格字元,預設情況下包含 ASCII 中的所" -"有空格字元。" +"*ignorechars* 應是一個包含要從輸入中忽略的字元的位元組字串。這只包含空格字元,預設情況下" +"包含 ASCII 中的所有空格字元。" -#: ../../library/base64.rst:252 +#: ../../library/base64.rst:251 msgid "" "Encode the :term:`bytes-like object` *b* using base85 (as used in e.g. git-" "style binary diffs) and return the encoded :class:`bytes`." @@ -425,7 +423,7 @@ msgstr "" "使用 Base85(例如,git 風格的二進位差異 (binary diff))對\\ :term:`類位元組物" "件 ` *b* 進行編碼,並回傳編碼後的 :class:`bytes`。" -#: ../../library/base64.rst:255 +#: ../../library/base64.rst:254 msgid "" "If *pad* is true, the input is padded with ``b'\\0'`` so its length is a " "multiple of 4 bytes before encoding." @@ -433,7 +431,7 @@ msgstr "" "如果 *pad* 為 true,則在編碼之前,輸入將使用 ``b'\\0'`` 進行填充,以使其長度" "為 4 的倍數。" -#: ../../library/base64.rst:263 +#: ../../library/base64.rst:262 msgid "" "Decode the base85-encoded :term:`bytes-like object` or ASCII string *b* and " "return the decoded :class:`bytes`. Padding is implicitly removed, if " @@ -442,29 +440,31 @@ msgstr "" "解碼經過 base85 編碼的\\ :term:`類位元組物件 `\\ 或 ASCII " "字串 *b*,並回傳解碼後的 :class:`bytes`。必要時會隱式移除填充。" -#: ../../library/base64.rst:272 +#: ../../library/base64.rst:271 msgid "" "Encode the :term:`bytes-like object` *s* using Z85 (as used in ZeroMQ) and " "return the encoded :class:`bytes`. See `Z85 specification `_ for more information." msgstr "" -"使用 Z85(如用於 ZeroMQ)對\\ :term:`類位元組物件 ` *s* 進行編碼,並回傳" -"編碼後的 :class:`bytes`。有關更多資訊,請參閱 `Z85 規格 `_。" +"使用 Z85(如用於 ZeroMQ)對\\ :term:`類位元組物件 ` *s* 進" +"行編碼,並回傳編碼後的 :class:`bytes`。有關更多資訊,請參閱 `Z85 規格 " +"`_。" -#: ../../library/base64.rst:281 +#: ../../library/base64.rst:280 msgid "" "Decode the Z85-encoded :term:`bytes-like object` or ASCII string *s* and " "return the decoded :class:`bytes`. See `Z85 specification `_ for more information." msgstr "" -"解碼經 Z85 編碼的\\ :term:`類位元組物件 `\\ 或 ASCII " -"字串 *s*,並回傳解碼後的 :class:`bytes`。有關更多資訊,請參閱 `Z85 規格 `_。" +"解碼經 Z85 編碼的\\ :term:`類位元組物件 `\\ 或 ASCII 字串 " +"*s*,並回傳解碼後的 :class:`bytes`。有關更多資訊,請參閱 `Z85 規格 `_。" -#: ../../library/base64.rst:291 +#: ../../library/base64.rst:290 msgid "Legacy Interface" msgstr "舊版介面" -#: ../../library/base64.rst:295 +#: ../../library/base64.rst:294 msgid "" "Decode the contents of the binary *input* file and write the resulting " "binary data to the *output* file. *input* and *output* must be :term:`file " @@ -475,7 +475,7 @@ msgstr "" "*input* 和 *output* 必須是\\ :term:`檔案物件 `。*input* 將被讀" "取,直到 ``input.readline()`` 回傳一個空的 bytes 物件為止。" -#: ../../library/base64.rst:303 +#: ../../library/base64.rst:302 msgid "" "Decode the :term:`bytes-like object` *s*, which must contain one or more " "lines of base64 encoded data, and return the decoded :class:`bytes`." @@ -483,7 +483,7 @@ msgstr "" "解碼必須包含一行或多行的 base64 編碼資料\\ :term:`類位元組物件 ` *s*,並回傳解碼後的 :class:`bytes`。" -#: ../../library/base64.rst:311 +#: ../../library/base64.rst:310 msgid "" "Encode the contents of the binary *input* file and write the resulting " "base64 encoded data to the *output* file. *input* and *output* must be :term:" @@ -498,7 +498,7 @@ msgstr "" "出的每 76 個位元組之後插入一個換行字元 (``b'\\n'``),並確保輸出始終以換行字元" "結尾,符合 :rfc:`2045` (MIME) 的規定。" -#: ../../library/base64.rst:321 +#: ../../library/base64.rst:320 msgid "" "Encode the :term:`bytes-like object` *s*, which can contain arbitrary binary " "data, and return :class:`bytes` containing the base64-encoded data, with " @@ -509,15 +509,15 @@ msgstr "" "碼,並回傳包含 base64 編碼資料 :class:`bytes`,在每 76 個輸出位元組後插入換行" "字元 (``b'\\n'``) ,並確保有尾隨換行字元,符合 :rfc:`2045` (MIME) 的規定。" -#: ../../library/base64.rst:329 +#: ../../library/base64.rst:328 msgid "An example usage of the module:" msgstr "模組的一個範例用法:" -#: ../../library/base64.rst:342 +#: ../../library/base64.rst:341 msgid "Security Considerations" msgstr "安全性注意事項" -#: ../../library/base64.rst:344 +#: ../../library/base64.rst:343 msgid "" "A new security considerations section was added to :rfc:`4648` (section 12); " "it's recommended to review the security section for any code deployed to " @@ -526,18 +526,18 @@ msgstr "" ":rfc:`4648`\\ (第 12 節)中添加了一個新的安全性考量部分;建議對部署到正式環" "境的任何程式碼進行安全性部分的審查。" -#: ../../library/base64.rst:349 +#: ../../library/base64.rst:348 msgid "Module :mod:`binascii`" msgstr ":mod:`binascii` 模組" -#: ../../library/base64.rst:350 +#: ../../library/base64.rst:349 msgid "" "Support module containing ASCII-to-binary and binary-to-ASCII conversions." msgstr "" "支援模組中包含 ASCII 到二進位 (ASCII-to-binary) 和二進位到 ASCII (binary-to-" "ASCII) 的轉換功能。" -#: ../../library/base64.rst:352 +#: ../../library/base64.rst:351 msgid "" ":rfc:`1521` - MIME (Multipurpose Internet Mail Extensions) Part One: " "Mechanisms for Specifying and Describing the Format of Internet Message " @@ -546,7 +546,7 @@ msgstr "" ":rfc:`1521` - MIME(多用途網際網路郵件擴展)第一部分:指定和描述網際網路主體" "格式的機制。" -#: ../../library/base64.rst:353 +#: ../../library/base64.rst:352 msgid "" "Section 5.2, \"Base64 Content-Transfer-Encoding,\" provides the definition " "of the base64 encoding." diff --git a/library/codecs.po b/library/codecs.po index 4d4aee110f..ab26604c3e 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1328,15 +1328,15 @@ msgid "" "charmap encoded file starts with these byte values (which would e.g. map to" msgstr "" -#: ../../library/codecs.rst:1049 +#: ../../library/codecs.rst:0 msgid "LATIN SMALL LETTER I WITH DIAERESIS" msgstr "" -#: ../../library/codecs.rst:1050 +#: ../../library/codecs.rst:0 msgid "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK" msgstr "" -#: ../../library/codecs.rst:1051 +#: ../../library/codecs.rst:0 msgid "INVERTED QUESTION MARK" msgstr "" diff --git a/library/contextvars.po b/library/contextvars.po index e696043c84..bc72ad080b 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2026-01-28 00:16+0000\n" "PO-Revision-Date: 2025-07-30 22:06+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,15 +28,15 @@ msgid "" "context in asynchronous frameworks." msgstr "" "本模組供 API 來管理、儲存及存取單一情境各自的狀態(context-local state)。 " -"用 :class:`~contextvars.ContextVar` 類別宣告和處理\\ *情境變數" -"*。 :func:`~contextvars.copy_context` 函式和 :class:`~contextvars.Context` 類" -"別應在非同步框架中管理目前的情境。" +"用 :class:`~contextvars.ContextVar` 類別宣告和處理\\ *情境變數*。 :func:" +"`~contextvars.copy_context` 函式和 :class:`~contextvars.Context` 類別應在非同" +"步框架中管理目前的情境。" #: ../../library/contextvars.rst:17 msgid "" -"Context managers that have state should use Context Variables instead " -"of :func:`threading.local` to prevent their state from bleeding to other " -"code unexpectedly, when used in concurrent code." +"Context managers that have state should use Context Variables instead of :" +"func:`threading.local` to prevent their state from bleeding to other code " +"unexpectedly, when used in concurrent code." msgstr "" "帶有狀態的 Context Manager 應該使用情境變數,而不是 :func:`threading.local`," "才能防止它們的狀態在並行(concurrent)程式碼中使用時意外外溢並干擾到其他程式" @@ -65,9 +65,9 @@ msgstr "必要參數 *name* 用於自我檢查(introspection)和除錯。" #: ../../library/contextvars.rst:38 msgid "" -"The optional keyword-only *default* parameter is returned " -"by :meth:`ContextVar.get` when no value for the variable is found in the " -"current context." +"The optional keyword-only *default* parameter is returned by :meth:" +"`ContextVar.get` when no value for the variable is found in the current " +"context." msgstr "" "當在目前的情境中找不到變數的值時,:meth:`ContextVar.get` 會回傳可選的僅限關鍵" "字參數 *default*。" @@ -127,20 +127,72 @@ msgid "" "Returns a :class:`~contextvars.Token` object that can be used to restore the " "variable to its previous value via the :meth:`ContextVar.reset` method." msgstr "" -"回傳一個 :class:`~contextvars.Token` 物件,該物件可透" -"過 :meth:`ContextVar.reset` 方法,用來將變數還原到之前的值。" +"回傳一個 :class:`~contextvars.Token` 物件,該物件可透過 :meth:`ContextVar." +"reset` 方法,用來將變數還原到之前的值。" -#: ../../library/contextvars.rst:82 +#: ../../library/contextvars.rst:80 msgid "" -"Reset the context variable to the value it had before " -"the :meth:`ContextVar.set` that created the *token* was used." +"For convenience, the token object can be used as a context manager to avoid " +"calling :meth:`ContextVar.reset` manually::" +msgstr "為了方便起見,token 物件可以用作情境管理器,以避免手動呼叫 :meth:`ContextVar.reset`: ::" + +#: ../../library/contextvars.rst:83 +msgid "" +"var = ContextVar('var', default='default value')\n" +"\n" +"with var.set('new value'):\n" +" assert var.get() == 'new value'\n" +"\n" +"assert var.get() == 'default value'" +msgstr "" +"var = ContextVar('var', default='default value')\n" +"\n" +"with var.set('new value'):\n" +" assert var.get() == 'new value'\n" +"\n" +"assert var.get() == 'default value'" + +#: ../../library/contextvars.rst:90 +msgid "It is a shorthand for::" +msgstr "它是以下程式碼的簡寫: ::" + +#: ../../library/contextvars.rst:92 +msgid "" +"var = ContextVar('var', default='default value')\n" +"\n" +"token = var.set('new value')\n" +"try:\n" +" assert var.get() == 'new value'\n" +"finally:\n" +" var.reset(token)\n" +"\n" +"assert var.get() == 'default value'" +msgstr "" +"var = ContextVar('var', default='default value')\n" +"\n" +"token = var.set('new value')\n" +"try:\n" +" assert var.get() == 'new value'\n" +"finally:\n" +" var.reset(token)\n" +"\n" +"assert var.get() == 'default value'" + +#: ../../library/contextvars.rst:104 +msgid "Added support for using tokens as context managers." +msgstr "新增對將 token 用作情境管理器的支援。" + +#: ../../library/contextvars.rst:108 +msgid "" +"Reset the context variable to the value it had before the :meth:`ContextVar." +"set` that created the *token* was used." msgstr "將情境變數重設為使用 :meth:`ContextVar.set` 建立 *token* 前的值。" -#: ../../library/contextvars.rst:85 +#: ../../library/contextvars.rst:111 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/contextvars.rst:87 +#: ../../library/contextvars.rst:113 msgid "" "var = ContextVar('var')\n" "\n" @@ -160,78 +212,68 @@ msgstr "" "# 在重設呼叫之後,var 又沒有值了,所以\n" "# var.get() 會引發 LookupError。" -#: ../../library/contextvars.rst:99 +#: ../../library/contextvars.rst:122 +msgid "The same *token* cannot be used twice." +msgstr "同一個 *token* 不能被使用兩次。" + +#: ../../library/contextvars.rst:127 msgid "" "*Token* objects are returned by the :meth:`ContextVar.set` method. They can " "be passed to the :meth:`ContextVar.reset` method to revert the value of the " -"variable to what it was before the corresponding *set*." +"variable to what it was before the corresponding *set*. A single token " +"cannot reset a context variable more than once." msgstr "" -"*Token* 物件由 :meth:`ContextVar.set` 方法回傳,可以傳遞" -"給 :meth:`ContextVar.reset` 方法,用以將變數的值還原為相對應的 *set* 之前的" -"值。" +"*Token* 物件由 :meth:`ContextVar.set` 方法回傳,可以傳遞給 :meth:`ContextVar." +"reset` 方法,用以將變數的值還原為相對應的 *set* 之前的值。單一 token 不能重設" +"情境變數超過一次。" -#: ../../library/contextvars.rst:104 +#: ../../library/contextvars.rst:132 msgid "" -"The token supports :ref:`context manager protocol ` to " -"restore the corresponding context variable value at the exit " -"from :keyword:`with` block::" +"Tokens support the :ref:`context manager protocol ` to " +"automatically reset context variables. See :meth:`ContextVar.set`." msgstr "" +"Token 支援\\ :ref:`情境管理器協定 `,可自動重設情境變數。" +"請參閱 :meth:`ContextVar.set`。" -#: ../../library/contextvars.rst:108 -msgid "" -"var = ContextVar('var', default='default value')\n" -"\n" -"with var.set('new value'):\n" -" assert var.get() == 'new value'\n" -"\n" -"assert var.get() == 'default value'" -msgstr "" -"var = ContextVar('var', default='default value')\n" -"\n" -"with var.set('new value'):\n" -" assert var.get() == 'new value'\n" -"\n" -"assert var.get() == 'default value'" - -#: ../../library/contextvars.rst:117 +#: ../../library/contextvars.rst:137 msgid "Added support for usage as a context manager." msgstr "新增對用作情境管理器的支援。" -#: ../../library/contextvars.rst:121 +#: ../../library/contextvars.rst:141 msgid "" "A read-only property. Points to the :class:`ContextVar` object that created " "the token." msgstr "唯讀屬性。 指向建立 token 的 :class:`ContextVar` 物件。" -#: ../../library/contextvars.rst:126 +#: ../../library/contextvars.rst:146 msgid "" -"A read-only property. Set to the value the variable had before " -"the :meth:`ContextVar.set` method call that created the token. It points " -"to :attr:`Token.MISSING` if the variable was not set before the call." +"A read-only property. Set to the value the variable had before the :meth:" +"`ContextVar.set` method call that created the token. It points to :attr:" +"`Token.MISSING` if the variable was not set before the call." msgstr "" "唯讀屬性。 值為變數在呼叫 :meth:`ContextVar.set` 方法之前的值。如果變數在呼叫" "前沒有設定,則指向 :attr:`Token.MISSING`。" -#: ../../library/contextvars.rst:133 +#: ../../library/contextvars.rst:153 msgid "A marker object used by :attr:`Token.old_value`." msgstr "由 :attr:`Token.old_value` 使用的標記物件。" -#: ../../library/contextvars.rst:137 +#: ../../library/contextvars.rst:157 msgid "Manual Context Management" msgstr "手動情境管理" -#: ../../library/contextvars.rst:141 +#: ../../library/contextvars.rst:161 msgid "Returns a copy of the current :class:`~contextvars.Context` object." msgstr "回傳目前 :class:`~contextvars.Context` 物件的複本(copy)。" -#: ../../library/contextvars.rst:143 +#: ../../library/contextvars.rst:163 msgid "" "The following snippet gets a copy of the current context and prints all " "variables and their values that are set in it::" msgstr "" "以下程式碼片段會取得目前情境的複本,並顯示在其中設定的所有變數及其值:::" -#: ../../library/contextvars.rst:146 +#: ../../library/contextvars.rst:166 msgid "" "ctx: Context = copy_context()\n" "print(list(ctx.items()))" @@ -239,7 +281,7 @@ msgstr "" "ctx: Context = copy_context()\n" "print(list(ctx.items()))" -#: ../../library/contextvars.rst:149 +#: ../../library/contextvars.rst:169 msgid "" "The function has an *O*\\ (1) complexity, i.e. works equally fast for " "contexts with a few context variables and for contexts that have a lot of " @@ -248,30 +290,30 @@ msgstr "" "這個函式具有 *O*\\ (1) 的複雜度,也就是說,對於只有少許情境變數的情境和有大量" "情境變數的情境,速度都一樣快。" -#: ../../library/contextvars.rst:156 +#: ../../library/contextvars.rst:176 msgid "A mapping of :class:`ContextVars ` to their values." msgstr ":class:`ContextVars` 到其值的映射。" -#: ../../library/contextvars.rst:158 +#: ../../library/contextvars.rst:178 msgid "" "``Context()`` creates an empty context with no values in it. To get a copy " "of the current context use the :func:`~contextvars.copy_context` function." msgstr "" -"``Context()`` 會建立一個沒有值的空情境。要取得目前情境的複本,請使" -"用 :func:`~contextvars.copy_context` 函式。" +"``Context()`` 會建立一個沒有值的空情境。要取得目前情境的複本,請使用 :func:" +"`~contextvars.copy_context` 函式。" -#: ../../library/contextvars.rst:162 +#: ../../library/contextvars.rst:182 msgid "" -"Each thread has its own effective stack of :class:`!Context` objects. " -"The :term:`current context` is the :class:`!Context` object at the top of " -"the current thread's stack. All :class:`!Context` objects in the stacks are " +"Each thread has its own effective stack of :class:`!Context` objects. The :" +"term:`current context` is the :class:`!Context` object at the top of the " +"current thread's stack. All :class:`!Context` objects in the stacks are " "considered to be *entered*." msgstr "" -"每個執行緒都有自己的 :class:`!Context` 物件中目前主控中的堆疊" -"(stack)。:term:`current context` 是目前執行緒堆疊頂端的 :class:`!Context` " -"物件。 堆疊中的所有 :class:`!Context` 物件都被視為\\ *已進入*。" +"每個執行緒都有自己的 :class:`!Context` 物件中目前主控中的堆疊(stack)。:" +"term:`current context` 是目前執行緒堆疊頂端的 :class:`!Context` 物件。 堆疊" +"中的所有 :class:`!Context` 物件都被視為\\ *已進入*。" -#: ../../library/contextvars.rst:167 +#: ../../library/contextvars.rst:187 msgid "" "*Entering* a context, which can be done by calling its :meth:`~Context.run` " "method, makes the context the current context by pushing it onto the top of " @@ -280,7 +322,7 @@ msgstr "" "*進入*\\ 一個情境,可以藉由呼叫其 :meth:`~Context.run` 方法來完成,此\\ *進入" "*\\ 的動作會將一情境推到目前執行緒的情境堆疊的頂端,使該情境成為目前的情境。" -#: ../../library/contextvars.rst:171 +#: ../../library/contextvars.rst:191 msgid "" "*Exiting* from the current context, which can be done by returning from the " "callback passed to the :meth:`~Context.run` method, restores the current " @@ -291,28 +333,28 @@ msgstr "" "式回傳之後,就會自動\\ *退出*\\ 目前的情境,這會將目前的情境還原到進入情境之" "前的狀態,方法是將情境從情境堆疊的頂端彈出。" -#: ../../library/contextvars.rst:176 +#: ../../library/contextvars.rst:196 msgid "" "Since each thread has its own context stack, :class:`ContextVar` objects " "behave in a similar fashion to :func:`threading.local` when values are " "assigned in different threads." msgstr "" -"因為每個執行緒都有自己的情境堆疊,當值在不同的執行緒中被指定" -"時, :class:`ContextVar` 物件的行為與 :func:`threading.local` 相似。" +"因為每個執行緒都有自己的情境堆疊,當值在不同的執行緒中被指定時, :class:" +"`ContextVar` 物件的行為與 :func:`threading.local` 相似。" -#: ../../library/contextvars.rst:180 +#: ../../library/contextvars.rst:200 msgid "" "Attempting to enter an already entered context, including contexts entered " "in other threads, raises a :exc:`RuntimeError`." msgstr "" -"嘗試進入已進入的情境,包括在其他執行緒中進入的情境,會引" -"發 :exc:`RuntimeError`。" +"嘗試進入已進入的情境,包括在其他執行緒中進入的情境,會引發 :exc:" +"`RuntimeError`。" -#: ../../library/contextvars.rst:183 +#: ../../library/contextvars.rst:203 msgid "After exiting a context, it can later be re-entered (from any thread)." msgstr "退出情境後,之後可以重新進入(從任何執行緒)。" -#: ../../library/contextvars.rst:185 +#: ../../library/contextvars.rst:205 msgid "" "Any changes to :class:`ContextVar` values via the :meth:`ContextVar.set` " "method are recorded in the current context. The :meth:`ContextVar.get` " @@ -326,11 +368,11 @@ msgstr "" "實際造成的效果會像是將其在進入情境時對情境變數所做的任何變一一彈出並還原(如" "果需要,可以透過重新進入情境來還原值)。" -#: ../../library/contextvars.rst:192 +#: ../../library/contextvars.rst:212 msgid "Context implements the :class:`collections.abc.Mapping` interface." msgstr "情境(Context)實作了 :class:`collections.abc.Mapping` 介面。" -#: ../../library/contextvars.rst:196 +#: ../../library/contextvars.rst:216 msgid "" "Enters the Context, executes ``callable(*args, **kwargs)``, then exits the " "Context. Returns *callable*'s return value, or propagates an exception if " @@ -339,11 +381,11 @@ msgstr "" "進入 Context,執行 ``callable(*args, **kwargs)``,然後退出 Context。 回傳 " "*callable* 的回傳值,如果發生例外(exception),則傳播例外。" -#: ../../library/contextvars.rst:200 +#: ../../library/contextvars.rst:220 msgid "Example:" msgstr "例如:" -#: ../../library/contextvars.rst:202 +#: ../../library/contextvars.rst:222 msgid "" "import contextvars\n" "\n" @@ -407,18 +449,18 @@ msgstr "" "# 但是,在 'ctx' 外, 'var' 的值仍然是 'spam':\n" "print(var.get()) # 'spam'" -#: ../../library/contextvars.rst:248 +#: ../../library/contextvars.rst:268 msgid "Return a shallow copy of the context object." msgstr "回傳情境物件的淺層複本(shallow copy)。" -#: ../../library/contextvars.rst:252 +#: ../../library/contextvars.rst:272 msgid "" "Return ``True`` if the *context* has a value for *var* set; return ``False`` " "otherwise." msgstr "" "如果\\ *情境*\\ 裡面有 *var* 的值,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/contextvars.rst:257 +#: ../../library/contextvars.rst:277 msgid "" "Return the value of the *var* :class:`ContextVar` variable. If the variable " "is not set in the context object, a :exc:`KeyError` is raised." @@ -426,7 +468,7 @@ msgstr "" "回傳 *var* :class:`ContextVar` 變數的值。如果該變數並沒有在情境物件中設定,則" "會引發 :exc:`KeyError` 錯誤。" -#: ../../library/contextvars.rst:263 +#: ../../library/contextvars.rst:283 msgid "" "Return the value for *var* if *var* has the value in the context object. " "Return *default* otherwise. If *default* is not given, return ``None``." @@ -434,33 +476,33 @@ msgstr "" "如果 *var* 的值在情境物件中,則回傳 *var* 的值。否則回傳 *default*。如果沒有 " "*default* 值,則回傳 ``None``。" -#: ../../library/contextvars.rst:269 +#: ../../library/contextvars.rst:289 msgid "Return an iterator over the variables stored in the context object." msgstr "回傳儲存於情境物件中變數的疊代器。" -#: ../../library/contextvars.rst:274 +#: ../../library/contextvars.rst:294 msgid "Return the number of variables set in the context object." msgstr "回傳情境物件中的變數個數。" -#: ../../library/contextvars.rst:278 +#: ../../library/contextvars.rst:298 msgid "Return a list of all variables in the context object." msgstr "回傳情境物件中所有變數的串列。" -#: ../../library/contextvars.rst:282 +#: ../../library/contextvars.rst:302 msgid "Return a list of all variables' values in the context object." msgstr "回傳情境物件中所有變數的值的串列。" -#: ../../library/contextvars.rst:287 +#: ../../library/contextvars.rst:307 msgid "" "Return a list of 2-tuples containing all variables and their values in the " "context object." msgstr "回傳情境物件中所有變數與其值的 2-元組(2-tuples)的串列。" -#: ../../library/contextvars.rst:292 +#: ../../library/contextvars.rst:312 msgid "asyncio support" msgstr "對 asyncio 的支援" -#: ../../library/contextvars.rst:294 +#: ../../library/contextvars.rst:314 msgid "" "Context variables are natively supported in :mod:`asyncio` and are ready to " "be used without any extra configuration. For example, here is a simple echo " @@ -470,7 +512,7 @@ msgstr "" ":mod:`asyncio` 原生支援情境變數,不需任何額外設定。 舉例來說,以下是一個簡單" "的 echo 伺服器,使用情境變數讓遠端用戶端的位址在處理該用戶端的任務中可用:" -#: ../../library/contextvars.rst:300 +#: ../../library/contextvars.rst:320 msgid "" "import asyncio\n" "import contextvars\n" diff --git a/library/ctypes.po b/library/ctypes.po index 85c879ff7b..a6cf4970b2 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-17 00:14+0000\n" +"POT-Creation-Date: 2026-02-03 00:20+0000\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1803,9 +1803,9 @@ msgstr "" #: ../../library/ctypes.rst:899 msgid "" -"From Python 3.13 onward, the :term:`GIL` can be disabled on :term:`free " -"threaded ` builds. In ctypes, reads and writes to a single " -"object concurrently is safe, but not across multiple objects:" +"From Python 3.13 onward, the :term:`GIL` can be disabled on the :term:`free-" +"threaded build`. In ctypes, reads and writes to a single object concurrently " +"is safe, but not across multiple objects:" msgstr "" #: ../../library/ctypes.rst:902 diff --git a/library/datetime.po b/library/datetime.po index ae1b1b16c3..c5707f46d0 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-22 00:16+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" "Last-Translator: Griiid \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1061,11 +1061,11 @@ msgstr "``timedelta = date1 - date2``" msgid "\\(3)" msgstr "\\(3)" -#: ../../library/datetime.rst:663 +#: ../../library/datetime.rst:0 msgid "``date1 == date2``" msgstr "``date1 == date2``" -#: ../../library/datetime.rst:664 +#: ../../library/datetime.rst:0 msgid "``date1 != date2``" msgstr "``date1 != date2``" @@ -1073,19 +1073,19 @@ msgstr "``date1 != date2``" msgid "Equality comparison. (4)" msgstr "" -#: ../../library/datetime.rst:666 +#: ../../library/datetime.rst:0 msgid "``date1 < date2``" msgstr "``date1 < date2``" -#: ../../library/datetime.rst:667 +#: ../../library/datetime.rst:0 msgid "``date1 > date2``" msgstr "``date1 > date2``" -#: ../../library/datetime.rst:668 +#: ../../library/datetime.rst:0 msgid "``date1 <= date2``" msgstr "``date1 <= date2``" -#: ../../library/datetime.rst:669 +#: ../../library/datetime.rst:0 msgid "``date1 >= date2``" msgstr "``date1 >= date2``" @@ -1899,27 +1899,27 @@ msgstr "\\(2)" msgid "``timedelta = datetime1 - datetime2``" msgstr "``timedelta = datetime1 - datetime2``" -#: ../../library/datetime.rst:1259 +#: ../../library/datetime.rst:0 msgid "``datetime1 == datetime2``" msgstr "``datetime1 == datetime2``" -#: ../../library/datetime.rst:1260 +#: ../../library/datetime.rst:0 msgid "``datetime1 != datetime2``" msgstr "``datetime1 != datetime2``" -#: ../../library/datetime.rst:1262 +#: ../../library/datetime.rst:0 msgid "``datetime1 < datetime2``" msgstr "``datetime1 < datetime2``" -#: ../../library/datetime.rst:1263 +#: ../../library/datetime.rst:0 msgid "``datetime1 > datetime2``" msgstr "``datetime1 > datetime2``" -#: ../../library/datetime.rst:1264 +#: ../../library/datetime.rst:0 msgid "``datetime1 <= datetime2``" msgstr "``datetime1 <= datetime2``" -#: ../../library/datetime.rst:1265 +#: ../../library/datetime.rst:0 msgid "``datetime1 >= datetime2``" msgstr "``datetime1 >= datetime2``" @@ -3744,11 +3744,11 @@ msgstr "``%a``" msgid "Weekday as locale's abbreviated name." msgstr "" -#: ../../library/datetime.rst:2490 +#: ../../library/datetime.rst:0 msgid "Sun, Mon, ..., Sat (en_US);" msgstr "" -#: ../../library/datetime.rst:2492 +#: ../../library/datetime.rst:0 msgid "So, Mo, ..., Sa (de_DE)" msgstr "" @@ -3760,11 +3760,11 @@ msgstr "``%A``" msgid "Weekday as locale's full name." msgstr "" -#: ../../library/datetime.rst:2495 +#: ../../library/datetime.rst:0 msgid "Sunday, Monday, ..., Saturday (en_US);" msgstr "" -#: ../../library/datetime.rst:2497 +#: ../../library/datetime.rst:0 msgid "Sonntag, Montag, ..., Samstag (de_DE)" msgstr "" @@ -3807,11 +3807,11 @@ msgstr "``%b``" msgid "Month as locale's abbreviated name." msgstr "" -#: ../../library/datetime.rst:2507 +#: ../../library/datetime.rst:0 msgid "Jan, Feb, ..., Dec (en_US);" msgstr "" -#: ../../library/datetime.rst:2509 +#: ../../library/datetime.rst:0 msgid "Jan, Feb, ..., Dez (de_DE)" msgstr "" @@ -3823,11 +3823,11 @@ msgstr "``%B``" msgid "Month as locale's full name." msgstr "" -#: ../../library/datetime.rst:2512 +#: ../../library/datetime.rst:0 msgid "January, February, ..., December (en_US);" msgstr "" -#: ../../library/datetime.rst:2514 +#: ../../library/datetime.rst:0 msgid "Januar, Februar, ..., Dezember (de_DE)" msgstr "" @@ -3895,11 +3895,11 @@ msgstr "``%p``" msgid "Locale's equivalent of either AM or PM." msgstr "" -#: ../../library/datetime.rst:2532 +#: ../../library/datetime.rst:0 msgid "AM, PM (en_US);" msgstr "AM, PM (en_US);" -#: ../../library/datetime.rst:2533 +#: ../../library/datetime.rst:0 msgid "am, pm (de_DE)" msgstr "am, pm (de_DE)" @@ -4028,11 +4028,11 @@ msgstr "``%c``" msgid "Locale's appropriate date and time representation." msgstr "" -#: ../../library/datetime.rst:2572 +#: ../../library/datetime.rst:0 msgid "Tue Aug 16 21:30:00 1988 (en_US);" msgstr "" -#: ../../library/datetime.rst:2574 +#: ../../library/datetime.rst:0 msgid "Di 16 Aug 21:30:00 1988 (de_DE)" msgstr "" @@ -4044,15 +4044,15 @@ msgstr "``%x``" msgid "Locale's appropriate date representation." msgstr "" -#: ../../library/datetime.rst:2577 +#: ../../library/datetime.rst:0 msgid "08/16/88 (None);" msgstr "" -#: ../../library/datetime.rst:2578 +#: ../../library/datetime.rst:0 msgid "08/16/1988 (en_US);" msgstr "" -#: ../../library/datetime.rst:2579 +#: ../../library/datetime.rst:0 msgid "16.08.1988 (de_DE)" msgstr "" @@ -4064,11 +4064,11 @@ msgstr "``%X``" msgid "Locale's appropriate time representation." msgstr "" -#: ../../library/datetime.rst:2581 +#: ../../library/datetime.rst:0 msgid "21:30:00 (en_US);" msgstr "" -#: ../../library/datetime.rst:2582 +#: ../../library/datetime.rst:0 msgid "21:30:00 (de_DE)" msgstr "" diff --git a/library/dialog.po b/library/dialog.po index 7bc9c50cda..3ab19f244e 100644 --- a/library/dialog.po +++ b/library/dialog.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+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-" @@ -83,32 +83,32 @@ msgid "" "listed below:" msgstr "" -#: ../../library/dialog.rst:64 +#: ../../library/dialog.rst:0 msgid "*parent* - the window to place the dialog on top of" msgstr "" -#: ../../library/dialog.rst:66 +#: ../../library/dialog.rst:0 msgid "*title* - the title of the window" msgstr "" -#: ../../library/dialog.rst:68 +#: ../../library/dialog.rst:0 msgid "*initialdir* - the directory that the dialog starts in" msgstr "" -#: ../../library/dialog.rst:70 +#: ../../library/dialog.rst:0 msgid "*initialfile* - the file selected upon opening of the dialog" msgstr "" -#: ../../library/dialog.rst:72 +#: ../../library/dialog.rst:0 msgid "" "*filetypes* - a sequence of (label, pattern) tuples, '*' wildcard is allowed" msgstr "" -#: ../../library/dialog.rst:74 +#: ../../library/dialog.rst:0 msgid "*defaultextension* - default extension to append to file (save dialogs)" msgstr "" -#: ../../library/dialog.rst:76 +#: ../../library/dialog.rst:0 msgid "*multiple* - when true, selection of multiple items is allowed" msgstr "" diff --git a/library/enum.po b/library/enum.po index 0a45558139..c625a7a3b7 100644 --- a/library/enum.po +++ b/library/enum.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-01-12 12:22+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2024-12-21 13:50+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,10 +25,6 @@ msgstr ":mod:`!enum` --- 對列舉的支援" msgid "**Source code:** :source:`Lib/enum.py`" msgstr "**原始碼:**\\ :source:`Lib/enum.py`" -#: ../../library/enum.rst:16 -msgid "Important" -msgstr "重點資訊" - #: ../../library/enum.rst:18 msgid "" "This page contains the API reference information. For tutorial information " @@ -1908,3 +1904,6 @@ msgstr "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" "... __str__ = Enum.__str__" + +#~ msgid "Important" +#~ msgstr "重點資訊" diff --git a/library/functions.po b/library/functions.po index 5465e746b0..3396abc77c 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-01-12 12:22+0000\n" +"POT-Creation-Date: 2026-02-05 14:10+0000\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,367 +33,367 @@ msgid "" msgstr "" "Python 直譯器有內建多個可隨時使用的函式和型別。以下按照英文字母排序列出。" -#: ../../library/functions.rst:13 +#: ../../library/functions.rst:0 msgid "**A**" msgstr "**A**" -#: ../../library/functions.rst:14 +#: ../../library/functions.rst:0 msgid ":func:`abs`" msgstr ":func:`abs`" -#: ../../library/functions.rst:15 +#: ../../library/functions.rst:0 msgid ":func:`aiter`" msgstr ":func:`aiter`" -#: ../../library/functions.rst:16 +#: ../../library/functions.rst:0 msgid ":func:`all`" msgstr ":func:`all`" -#: ../../library/functions.rst:17 +#: ../../library/functions.rst:0 msgid ":func:`anext`" msgstr ":func:`anext`" -#: ../../library/functions.rst:18 +#: ../../library/functions.rst:0 msgid ":func:`any`" msgstr ":func:`any`" -#: ../../library/functions.rst:19 +#: ../../library/functions.rst:0 msgid ":func:`ascii`" msgstr ":func:`ascii`" -#: ../../library/functions.rst:21 +#: ../../library/functions.rst:0 msgid "**B**" msgstr "**B**" -#: ../../library/functions.rst:22 +#: ../../library/functions.rst:0 msgid ":func:`bin`" msgstr ":func:`bin`" -#: ../../library/functions.rst:23 +#: ../../library/functions.rst:0 msgid ":func:`bool`" msgstr ":func:`bool`" -#: ../../library/functions.rst:24 +#: ../../library/functions.rst:0 msgid ":func:`breakpoint`" msgstr ":func:`breakpoint`" -#: ../../library/functions.rst:25 +#: ../../library/functions.rst:0 msgid "|func-bytearray|_" msgstr "|func-bytearray|_" -#: ../../library/functions.rst:26 +#: ../../library/functions.rst:0 msgid "|func-bytes|_" msgstr "|func-bytes|_" -#: ../../library/functions.rst:28 +#: ../../library/functions.rst:0 msgid "**C**" msgstr "**C**" -#: ../../library/functions.rst:29 +#: ../../library/functions.rst:0 msgid ":func:`callable`" msgstr ":func:`callable`" -#: ../../library/functions.rst:30 +#: ../../library/functions.rst:0 msgid ":func:`chr`" msgstr ":func:`chr`" -#: ../../library/functions.rst:31 +#: ../../library/functions.rst:0 msgid ":func:`classmethod`" msgstr ":func:`classmethod`" -#: ../../library/functions.rst:32 +#: ../../library/functions.rst:0 msgid ":func:`compile`" msgstr ":func:`compile`" -#: ../../library/functions.rst:33 +#: ../../library/functions.rst:0 msgid ":func:`complex`" msgstr ":func:`complex`" -#: ../../library/functions.rst:35 +#: ../../library/functions.rst:0 msgid "**D**" msgstr "**D**" -#: ../../library/functions.rst:36 +#: ../../library/functions.rst:0 msgid ":func:`delattr`" msgstr ":func:`delattr`" -#: ../../library/functions.rst:37 +#: ../../library/functions.rst:0 msgid "|func-dict|_" msgstr "|func-dict|_" -#: ../../library/functions.rst:38 +#: ../../library/functions.rst:0 msgid ":func:`dir`" msgstr ":func:`dir`" -#: ../../library/functions.rst:39 +#: ../../library/functions.rst:0 msgid ":func:`divmod`" msgstr ":func:`divmod`" -#: ../../library/functions.rst:13 +#: ../../library/functions.rst:0 msgid "**E**" msgstr "**E**" -#: ../../library/functions.rst:14 +#: ../../library/functions.rst:0 msgid ":func:`enumerate`" msgstr ":func:`enumerate`" -#: ../../library/functions.rst:15 +#: ../../library/functions.rst:0 msgid ":func:`eval`" msgstr ":func:`eval`" -#: ../../library/functions.rst:16 +#: ../../library/functions.rst:0 msgid ":func:`exec`" msgstr ":func:`exec`" -#: ../../library/functions.rst:18 +#: ../../library/functions.rst:0 msgid "**F**" msgstr "**F**" -#: ../../library/functions.rst:19 +#: ../../library/functions.rst:0 msgid ":func:`filter`" msgstr ":func:`filter`" -#: ../../library/functions.rst:20 +#: ../../library/functions.rst:0 msgid ":func:`float`" msgstr ":func:`float`" -#: ../../library/functions.rst:21 +#: ../../library/functions.rst:0 msgid ":func:`format`" msgstr ":func:`format`" -#: ../../library/functions.rst:22 +#: ../../library/functions.rst:0 msgid "|func-frozenset|_" msgstr "|func-frozenset|_" -#: ../../library/functions.rst:24 +#: ../../library/functions.rst:0 msgid "**G**" msgstr "**G**" -#: ../../library/functions.rst:25 +#: ../../library/functions.rst:0 msgid ":func:`getattr`" msgstr ":func:`getattr`" -#: ../../library/functions.rst:26 +#: ../../library/functions.rst:0 msgid ":func:`globals`" msgstr ":func:`globals`" -#: ../../library/functions.rst:28 +#: ../../library/functions.rst:0 msgid "**H**" msgstr "**H**" -#: ../../library/functions.rst:29 +#: ../../library/functions.rst:0 msgid ":func:`hasattr`" msgstr ":func:`hasattr`" -#: ../../library/functions.rst:30 +#: ../../library/functions.rst:0 msgid ":func:`hash`" msgstr ":func:`hash`" -#: ../../library/functions.rst:31 +#: ../../library/functions.rst:0 msgid ":func:`help`" msgstr ":func:`help`" -#: ../../library/functions.rst:32 +#: ../../library/functions.rst:0 msgid ":func:`hex`" msgstr ":func:`hex`" -#: ../../library/functions.rst:34 +#: ../../library/functions.rst:0 msgid "**I**" msgstr "**I**" -#: ../../library/functions.rst:35 +#: ../../library/functions.rst:0 msgid ":func:`id`" msgstr ":func:`id`" -#: ../../library/functions.rst:36 +#: ../../library/functions.rst:0 msgid ":func:`input`" msgstr ":func:`input`" -#: ../../library/functions.rst:37 +#: ../../library/functions.rst:0 msgid ":func:`int`" msgstr ":func:`int`" -#: ../../library/functions.rst:38 +#: ../../library/functions.rst:0 msgid ":func:`isinstance`" msgstr ":func:`isinstance`" -#: ../../library/functions.rst:39 +#: ../../library/functions.rst:0 msgid ":func:`issubclass`" msgstr ":func:`issubclass`" -#: ../../library/functions.rst:40 +#: ../../library/functions.rst:0 msgid ":func:`iter`" msgstr ":func:`iter`" -#: ../../library/functions.rst:13 +#: ../../library/functions.rst:0 msgid "**L**" msgstr "**L**" -#: ../../library/functions.rst:14 +#: ../../library/functions.rst:0 msgid ":func:`len`" msgstr ":func:`len`" -#: ../../library/functions.rst:15 +#: ../../library/functions.rst:0 msgid "|func-list|_" msgstr "|func-list|_" -#: ../../library/functions.rst:16 +#: ../../library/functions.rst:0 msgid ":func:`locals`" msgstr ":func:`locals`" -#: ../../library/functions.rst:18 +#: ../../library/functions.rst:0 msgid "**M**" msgstr "**M**" -#: ../../library/functions.rst:19 +#: ../../library/functions.rst:0 msgid ":func:`map`" msgstr ":func:`map`" -#: ../../library/functions.rst:20 +#: ../../library/functions.rst:0 msgid ":func:`max`" msgstr ":func:`max`" -#: ../../library/functions.rst:21 +#: ../../library/functions.rst:0 msgid "|func-memoryview|_" msgstr "|func-memoryview|_" -#: ../../library/functions.rst:22 +#: ../../library/functions.rst:0 msgid ":func:`min`" msgstr ":func:`min`" -#: ../../library/functions.rst:24 +#: ../../library/functions.rst:0 msgid "**N**" msgstr "**N**" -#: ../../library/functions.rst:25 +#: ../../library/functions.rst:0 msgid ":func:`next`" msgstr ":func:`next`" -#: ../../library/functions.rst:27 +#: ../../library/functions.rst:0 msgid "**O**" msgstr "**O**" -#: ../../library/functions.rst:28 +#: ../../library/functions.rst:0 msgid ":func:`object`" msgstr ":func:`object`" -#: ../../library/functions.rst:29 +#: ../../library/functions.rst:0 msgid ":func:`oct`" msgstr ":func:`oct`" -#: ../../library/functions.rst:30 +#: ../../library/functions.rst:0 msgid ":func:`open`" msgstr ":func:`open`" -#: ../../library/functions.rst:31 +#: ../../library/functions.rst:0 msgid ":func:`ord`" msgstr ":func:`ord`" -#: ../../library/functions.rst:33 +#: ../../library/functions.rst:0 msgid "**P**" msgstr "**P**" -#: ../../library/functions.rst:34 +#: ../../library/functions.rst:0 msgid ":func:`pow`" msgstr ":func:`pow`" -#: ../../library/functions.rst:35 +#: ../../library/functions.rst:0 msgid ":func:`print`" msgstr ":func:`print`" -#: ../../library/functions.rst:36 +#: ../../library/functions.rst:0 msgid ":func:`property`" msgstr ":func:`property`" -#: ../../library/functions.rst:13 +#: ../../library/functions.rst:0 msgid "**R**" msgstr "**R**" -#: ../../library/functions.rst:14 +#: ../../library/functions.rst:0 msgid "|func-range|_" msgstr "|func-range|_" -#: ../../library/functions.rst:15 +#: ../../library/functions.rst:0 msgid ":func:`repr`" msgstr ":func:`repr`" -#: ../../library/functions.rst:16 +#: ../../library/functions.rst:0 msgid ":func:`reversed`" msgstr ":func:`reversed`" -#: ../../library/functions.rst:17 +#: ../../library/functions.rst:0 msgid ":func:`round`" msgstr ":func:`round`" -#: ../../library/functions.rst:19 +#: ../../library/functions.rst:0 msgid "**S**" msgstr "**S**" -#: ../../library/functions.rst:20 +#: ../../library/functions.rst:0 msgid "|func-set|_" msgstr "|func-set|_" -#: ../../library/functions.rst:21 +#: ../../library/functions.rst:0 msgid ":func:`setattr`" msgstr ":func:`setattr`" -#: ../../library/functions.rst:22 +#: ../../library/functions.rst:0 msgid ":func:`slice`" msgstr ":func:`slice`" -#: ../../library/functions.rst:23 +#: ../../library/functions.rst:0 msgid ":func:`sorted`" msgstr ":func:`sorted`" -#: ../../library/functions.rst:24 +#: ../../library/functions.rst:0 msgid ":func:`staticmethod`" msgstr ":func:`staticmethod`" -#: ../../library/functions.rst:25 +#: ../../library/functions.rst:0 msgid "|func-str|_" msgstr "|func-str|_" -#: ../../library/functions.rst:26 +#: ../../library/functions.rst:0 msgid ":func:`sum`" msgstr ":func:`sum`" -#: ../../library/functions.rst:27 +#: ../../library/functions.rst:0 msgid ":func:`super`" msgstr ":func:`super`" -#: ../../library/functions.rst:29 +#: ../../library/functions.rst:0 msgid "**T**" msgstr "**T**" -#: ../../library/functions.rst:30 +#: ../../library/functions.rst:0 msgid "|func-tuple|_" msgstr "|func-tuple|_" -#: ../../library/functions.rst:31 +#: ../../library/functions.rst:0 msgid ":func:`type`" msgstr ":func:`type`" -#: ../../library/functions.rst:33 +#: ../../library/functions.rst:0 msgid "**V**" msgstr "**V**" -#: ../../library/functions.rst:34 +#: ../../library/functions.rst:0 msgid ":func:`vars`" msgstr ":func:`vars`" -#: ../../library/functions.rst:36 +#: ../../library/functions.rst:0 msgid "**Z**" msgstr "**Z**" -#: ../../library/functions.rst:37 +#: ../../library/functions.rst:0 msgid ":func:`zip`" msgstr ":func:`zip`" -#: ../../library/functions.rst:39 +#: ../../library/functions.rst:0 msgid "**_**" msgstr "**_**" -#: ../../library/functions.rst:40 +#: ../../library/functions.rst:0 msgid ":func:`__import__`" msgstr ":func:`__import__`" @@ -3179,17 +3179,21 @@ msgstr "" #: ../../library/functions.rst:1846 msgid "" -"Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " -"and :attr:`!step` which merely return the argument values (or their " -"default). They have no other explicit functionality; however, they are used " -"by NumPy and other third-party packages." +"Slice objects are also generated when :ref:`slicing syntax ` is " +"used. For example: ``a[start:stop:step]`` or ``a[start:stop, i]``." +msgstr "" + +#: ../../library/functions.rst:1849 +msgid "" +"See :func:`itertools.islice` for an alternate version that returns an :term:" +"`iterator`." msgstr "" -#: ../../library/functions.rst:1855 +#: ../../library/functions.rst:1856 msgid "" -"Slice objects are also generated when extended indexing syntax is used. For " -"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" -"`itertools.islice` for an alternate version that returns an :term:`iterator`." +"These read-only attributes are set to the argument values (or their " +"default). They have no other explicit functionality; however, they are used " +"by NumPy and other third-party packages." msgstr "" #: ../../library/functions.rst:1860 diff --git a/library/http.cookies.po b/library/http.cookies.po index 25cf3a3e44..c5989efd59 100644 --- a/library/http.cookies.po +++ b/library/http.cookies.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2026-01-24 22:47+0000\n" "PO-Revision-Date: 2024-12-24 18:49+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,12 +38,12 @@ msgstr "" #: ../../library/http.cookies.rst:19 msgid "" -"The module formerly strictly applied the parsing rules described in " -"the :rfc:`2109` and :rfc:`2068` specifications. It has since been " -"discovered that MSIE 3.0x didn't follow the character rules outlined in " -"those specs; many current-day browsers and servers have also relaxed parsing " -"rules when it comes to cookie handling. As a result, this module now uses " -"parsing rules that are a bit less strict than they once were." +"The module formerly strictly applied the parsing rules described in the :rfc:" +"`2109` and :rfc:`2068` specifications. It has since been discovered that " +"MSIE 3.0x didn't follow the character rules outlined in those specs; many " +"current-day browsers and servers have also relaxed parsing rules when it " +"comes to cookie handling. As a result, this module now uses parsing rules " +"that are a bit less strict than they once were." msgstr "" "此模組原先嚴格遵循了 :rfc:`2109` 和 :rfc:`2068` 規範所描述的剖析規則。自從發" "現 MSIE 3.0x 並不遵循這些規範所描述的字元規則,許多目前的瀏覽器和伺服器也在處" @@ -55,9 +55,8 @@ msgid "" "``!#$%&'*+-.^_`|~:`` denote the set of valid characters allowed by this " "module in a cookie name (as :attr:`~Morsel.key`)." msgstr "" -"字元集 :data:`string.ascii_letters`、:data:`string.digits` 和 ``!#$" -"%&'*+-.^_`|~`` 表示此模組在 cookie 名稱 (:attr:`~Morsel.key`) 中允許的合法字" -"元集合。" +"字元集 :data:`string.ascii_letters`、:data:`string.digits` 和 ``!#$%&'*+-." +"^_`|~`` 表示此模組在 cookie 名稱 (:attr:`~Morsel.key`) 中允許的合法字元集合。" #: ../../library/http.cookies.rst:30 msgid "Allowed ':' as a valid cookie name character." @@ -96,12 +95,11 @@ msgstr "如果有給定 *input*,它會被傳遞給 :meth:`load` 方法。" #: ../../library/http.cookies.rst:58 msgid "" -"This class derives from :class:`BaseCookie` and " -"overrides :meth:`~BaseCookie.value_decode` " -"and :meth:`~BaseCookie.value_encode`. :class:`!SimpleCookie` supports " -"strings as cookie values. When setting the value, :class:`!SimpleCookie` " -"calls the builtin :func:`str` to convert the value to a string. Values " -"received from HTTP are kept as strings." +"This class derives from :class:`BaseCookie` and overrides :meth:`~BaseCookie." +"value_decode` and :meth:`~BaseCookie.value_encode`. :class:`!SimpleCookie` " +"supports strings as cookie values. When setting the value, :class:`!" +"SimpleCookie` calls the builtin :func:`str` to convert the value to a " +"string. Values received from HTTP are kept as strings." msgstr "" "這個類別繼承自 :class:`BaseCookie` 並覆寫了 :meth:`~BaseCookie.value_decode` " "和 :meth:`~BaseCookie.value_encode`。:class:`!SimpleCookie` 支援字串作為 " @@ -114,11 +112,11 @@ msgstr ":mod:`http.cookiejar` 模組" #: ../../library/http.cookies.rst:67 msgid "" -"HTTP cookie handling for web *clients*. The :mod:`http.cookiejar` " -"and :mod:`http.cookies` modules do not depend on each other." +"HTTP cookie handling for web *clients*. The :mod:`http.cookiejar` and :mod:" +"`http.cookies` modules do not depend on each other." msgstr "" -"用於網路\\ *用戶端*\\ 的 HTTP cookie 處理。:mod:`http.cookiejar` " -"和 :mod:`http.cookies` 模組互不相依。" +"用於網路\\ *用戶端*\\ 的 HTTP cookie 處理。:mod:`http.cookiejar` 和 :mod:" +"`http.cookies` 模組互不相依。" #: ../../library/http.cookies.rst:70 msgid ":rfc:`2109` - HTTP State Management Mechanism" @@ -135,8 +133,8 @@ msgstr "Cookie 物件" #: ../../library/http.cookies.rst:82 msgid "" "Return a tuple ``(real_value, coded_value)`` from a string representation. " -"``real_value`` can be any type. This method does no decoding " -"in :class:`BaseCookie` --- it exists so it can be overridden." +"``real_value`` can be any type. This method does no decoding in :class:" +"`BaseCookie` --- it exists so it can be overridden." msgstr "" "從字串表示回傳 ``(real_value, coded_value)`` 的元組。``real_value`` 可以是任" "何型別。此方法在 :class:`BaseCookie` 中不做解碼 --- 它存在以便可以被覆寫。" @@ -153,8 +151,8 @@ msgstr "" #: ../../library/http.cookies.rst:94 msgid "" -"In general, it should be the case that :meth:`value_encode` " -"and :meth:`value_decode` are inverses on the range of *value_decode*." +"In general, it should be the case that :meth:`value_encode` and :meth:" +"`value_decode` are inverses on the range of *value_decode*." msgstr "" "一般來說,:meth:`value_encode` 和 :meth:`value_decode` 應該在 *value_decode* " "的範圍內是互逆的 (inverse)。" @@ -246,9 +244,9 @@ msgid "" "the cookie was first set in. For this to be accepted by the user agent, you " "**must** also set ``Secure``." msgstr "" -"屬性 :attr:`partitioned` 向 user agent(使用者代理)表明這些跨網站 cookie " -"*應該*\\ 只能在與首次設定 cookie 時相同的頂層情境中使用。要讓 user agent 接受" -"此設定,你\\ **必須**\\ 同時設定 ``Secure``。" +"屬性 :attr:`partitioned` 向 user agent(使用者代理)表明這些跨網站 cookie *應" +"該*\\ 只能在與首次設定 cookie 時相同的頂層情境中使用。要讓 user agent 接受此" +"設定,你\\ **必須**\\ 同時設定 ``Secure``。" #: ../../library/http.cookies.rst:163 msgid "" @@ -258,8 +256,8 @@ msgid "" "State)`_ for full details and examples." msgstr "" "此外,建議在設定 partitioned(分區)cookie 時使用 ``__Host`` 前綴,使其綁定到" -"主機名稱而非可註冊網域。請閱讀 `CHIPS (Cookies Having Independent Partitioned " -"State)`_ 以取得完整細節和範例。" +"主機名稱而非可註冊網域。請閱讀 `CHIPS (Cookies Having Independent " +"Partitioned State)`_ 以取得完整細節和範例。" #: ../../library/http.cookies.rst:171 msgid "The keys are case-insensitive and their default value is ``''``." @@ -274,13 +272,11 @@ msgstr "" #: ../../library/http.cookies.rst:177 msgid "" -"Attributes :attr:`~Morsel.key`, :attr:`~Morsel.value` " -"and :attr:`~Morsel.coded_value` are read-only. Use :meth:`~Morsel.set` for " -"setting them." +"Attributes :attr:`~Morsel.key`, :attr:`~Morsel.value` and :attr:`~Morsel." +"coded_value` are read-only. Use :meth:`~Morsel.set` for setting them." msgstr "" -"屬性 :attr:`~Morsel.key`、:attr:`~Morsel.value` " -"和 :attr:`~Morsel.coded_value` 是唯讀的。請使用 :meth:`~Morsel.set` 來設定它" -"們。" +"屬性 :attr:`~Morsel.key`、:attr:`~Morsel.value` 和 :attr:`~Morsel." +"coded_value` 是唯讀的。請使用 :meth:`~Morsel.set` 來設定它們。" #: ../../library/http.cookies.rst:182 msgid "Added support for the :attr:`samesite` attribute." @@ -361,8 +357,8 @@ msgid "" "Raise an error if key is not a valid :rfc:`2109` attribute, otherwise behave " "the same as :meth:`dict.setdefault`." msgstr "" -"如果鍵不是一個有效的 :rfc:`2109` 屬性會引發錯誤,否則行為" -"與 :meth:`dict.setdefault` 相同。" +"如果鍵不是一個有效的 :rfc:`2109` 屬性會引發錯誤,否則行為與 :meth:`dict." +"setdefault` 相同。" #: ../../library/http.cookies.rst:265 msgid "Example" @@ -399,9 +395,9 @@ msgid "" "Set-Cookie: chips=ahoy\n" "Set-Cookie: vienna=finger\n" ">>> C = cookies.SimpleCookie()\n" -">>> C.load('keebler=\"E=everybody; L=\\\\\"Loves\\\\\"; fudge=\\\\012;\";')\n" +">>> C.load('keebler=\"E=everybody; L=\\\\\"Loves\\\\\"; fudge=;\";')\n" ">>> print(C)\n" -"Set-Cookie: keebler=\"E=everybody; L=\\\"Loves\\\"; fudge=\\012;\"\n" +"Set-Cookie: keebler=\"E=everybody; L=\\\"Loves\\\"; fudge=;\"\n" ">>> C = cookies.SimpleCookie()\n" ">>> C[\"oreo\"] = \"doublestuff\"\n" ">>> C[\"oreo\"][\"path\"] = \"/\"\n" @@ -445,9 +441,9 @@ msgstr "" "Set-Cookie: chips=ahoy\n" "Set-Cookie: vienna=finger\n" ">>> C = cookies.SimpleCookie()\n" -">>> C.load('keebler=\"E=everybody; L=\\\\\"Loves\\\\\"; fudge=\\\\012;\";')\n" +">>> C.load('keebler=\"E=everybody; L=\\\\\"Loves\\\\\"; fudge=;\";')\n" ">>> print(C)\n" -"Set-Cookie: keebler=\"E=everybody; L=\\\"Loves\\\"; fudge=\\012;\"\n" +"Set-Cookie: keebler=\"E=everybody; L=\\\"Loves\\\"; fudge=;\"\n" ">>> C = cookies.SimpleCookie()\n" ">>> C[\"oreo\"] = \"doublestuff\"\n" ">>> C[\"oreo\"][\"path\"] = \"/\"\n" diff --git a/library/importlib.po b/library/importlib.po index 714d1903ff..968b405316 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-17 00:14+0000\n" +"POT-Creation-Date: 2026-01-24 22:47+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -580,7 +580,7 @@ msgid "" "implemented." msgstr "" -#: ../../library/importlib.rst:387 ../../library/importlib.rst:642 +#: ../../library/importlib.rst:387 msgid "*Superseded by TraversableResources*" msgstr "" @@ -738,7 +738,7 @@ msgstr "" msgid "Use :meth:`Loader.exec_module` instead." msgstr "改用 :meth:`Loader.exec_module`。" -#: ../../library/importlib.rst:539 ../../library/importlib.rst:1146 +#: ../../library/importlib.rst:539 ../../library/importlib.rst:980 msgid "Returns :attr:`path`." msgstr "回傳 :attr:`path`。" @@ -864,228 +864,59 @@ msgid "" "``__init__``." msgstr "" -#: ../../library/importlib.rst:644 -msgid "" -"An :term:`abstract base class` to provide the ability to read *resources*." -msgstr "" - -#: ../../library/importlib.rst:647 -msgid "" -"From the perspective of this ABC, a *resource* is a binary artifact that is " -"shipped within a package. Typically this is something like a data file that " -"lives next to the ``__init__.py`` file of the package. The purpose of this " -"class is to help abstract out the accessing of such data files so that it " -"does not matter if the package and its data file(s) are stored e.g. in a zip " -"file versus on the file system." -msgstr "" - -#: ../../library/importlib.rst:655 -msgid "" -"For any of methods of this class, a *resource* argument is expected to be a :" -"term:`path-like object` which represents conceptually just a file name. This " -"means that no subdirectory paths should be included in the *resource* " -"argument. This is because the location of the package the reader is for, " -"acts as the \"directory\". Hence the metaphor for directories and file names " -"is packages and resources, respectively. This is also why instances of this " -"class are expected to directly correlate to a specific package (instead of " -"potentially representing multiple packages or a module)." -msgstr "" - -#: ../../library/importlib.rst:666 -msgid "" -"Loaders that wish to support resource reading are expected to provide a " -"method called ``get_resource_reader(fullname)`` which returns an object " -"implementing this ABC's interface. If the module specified by fullname is " -"not a package, this method should return :const:`None`. An object compatible " -"with this ABC should only be returned when the specified module is a package." -msgstr "" - -#: ../../library/importlib.rst:675 ../../library/importlib.rst:795 -msgid "Use :class:`importlib.resources.abc.TraversableResources` instead." -msgstr "" - -#: ../../library/importlib.rst:681 -msgid "" -"Returns an opened, :term:`file-like object` for binary reading of the " -"*resource*." -msgstr "" - -#: ../../library/importlib.rst:684 -msgid "If the resource cannot be found, :exc:`FileNotFoundError` is raised." -msgstr "" - -#: ../../library/importlib.rst:690 -msgid "Returns the file system path to the *resource*." -msgstr "" - -#: ../../library/importlib.rst:692 -msgid "" -"If the resource does not concretely exist on the file system, raise :exc:" -"`FileNotFoundError`." -msgstr "" - -#: ../../library/importlib.rst:698 -msgid "" -"Returns ``True`` if the named *name* is considered a resource. :exc:" -"`FileNotFoundError` is raised if *name* does not exist." -msgstr "" - -#: ../../library/importlib.rst:704 -msgid "" -"Returns an :term:`iterable` of strings over the contents of the package. Do " -"note that it is not required that all names returned by the iterator be " -"actual resources, e.g. it is acceptable to return names for which :meth:" -"`is_resource` would be false." -msgstr "" - -#: ../../library/importlib.rst:710 -msgid "" -"Allowing non-resource names to be returned is to allow for situations where " -"how a package and its resources are stored are known a priori and the non-" -"resource names would be useful. For instance, returning subdirectory names " -"is allowed so that when it is known that the package and resources are " -"stored on the file system then those subdirectory names can be used directly." -msgstr "" - -#: ../../library/importlib.rst:718 -msgid "The abstract method returns an iterable of no items." -msgstr "" - -#: ../../library/importlib.rst:723 -msgid "" -"An object with a subset of :class:`pathlib.Path` methods suitable for " -"traversing directories and opening files." -msgstr "" - -#: ../../library/importlib.rst:726 -msgid "" -"For a representation of the object on the file-system, use :meth:`importlib." -"resources.as_file`." -msgstr "" - -#: ../../library/importlib.rst:731 -msgid "Use :class:`importlib.resources.abc.Traversable` instead." -msgstr "" - -#: ../../library/importlib.rst:736 -msgid "Abstract. The base name of this object without any parent references." -msgstr "" - -#: ../../library/importlib.rst:741 -msgid "Yield ``Traversable`` objects in ``self``." -msgstr "" - -#: ../../library/importlib.rst:746 -msgid "Return ``True`` if ``self`` is a directory." -msgstr "" - -#: ../../library/importlib.rst:751 -msgid "Return ``True`` if ``self`` is a file." -msgstr "" - -#: ../../library/importlib.rst:756 -msgid "Return Traversable child in ``self``." -msgstr "" - -#: ../../library/importlib.rst:761 -msgid "Return ``Traversable`` child in ``self``." -msgstr "" - -#: ../../library/importlib.rst:766 -msgid "" -"*mode* may be 'r' or 'rb' to open as text or binary. Return a handle " -"suitable for reading (same as :attr:`pathlib.Path.open`)." -msgstr "" - -#: ../../library/importlib.rst:769 -msgid "" -"When opening as text, accepts encoding parameters such as those accepted by :" -"class:`io.TextIOWrapper`." -msgstr "" - -#: ../../library/importlib.rst:774 -msgid "Read contents of ``self`` as bytes." -msgstr "以位元組讀取 ``self`` 的內容。" - -#: ../../library/importlib.rst:778 -msgid "Read contents of ``self`` as text." -msgstr "以文字讀取 ``self`` 的內容。" - -#: ../../library/importlib.rst:783 -msgid "" -"An abstract base class for resource readers capable of serving the :meth:" -"`importlib.resources.files` interface. Subclasses :class:`importlib." -"resources.abc.ResourceReader` and provides concrete implementations of the :" -"class:`importlib.resources.abc.ResourceReader`'s abstract methods. " -"Therefore, any loader supplying :class:`importlib.abc.TraversableResources` " -"also supplies ResourceReader." -msgstr "" - -#: ../../library/importlib.rst:790 -msgid "" -"Loaders that wish to support resource reading are expected to implement this " -"interface." -msgstr "" - -#: ../../library/importlib.rst:801 -msgid "" -"Returns a :class:`importlib.resources.abc.Traversable` object for the loaded " -"package." -msgstr "" - -#: ../../library/importlib.rst:807 +#: ../../library/importlib.rst:641 msgid ":mod:`importlib.machinery` -- Importers and path hooks" msgstr "" -#: ../../library/importlib.rst:812 +#: ../../library/importlib.rst:646 msgid "**Source code:** :source:`Lib/importlib/machinery.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/machinery.py`" -#: ../../library/importlib.rst:816 +#: ../../library/importlib.rst:650 msgid "" "This module contains the various objects that help :keyword:`import` find " "and load modules." msgstr "" -#: ../../library/importlib.rst:821 +#: ../../library/importlib.rst:655 msgid "" "A list of strings representing the recognized file suffixes for source " "modules." msgstr "" -#: ../../library/importlib.rst:828 +#: ../../library/importlib.rst:662 msgid "" "A list of strings representing the file suffixes for non-optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:833 ../../library/importlib.rst:843 +#: ../../library/importlib.rst:667 ../../library/importlib.rst:677 msgid "Use :const:`BYTECODE_SUFFIXES` instead." msgstr "改用 :const:`BYTECODE_SUFFIXES`。" -#: ../../library/importlib.rst:838 +#: ../../library/importlib.rst:672 msgid "" "A list of strings representing the file suffixes for optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:848 +#: ../../library/importlib.rst:682 msgid "" "A list of strings representing the recognized file suffixes for bytecode " "modules (including the leading dot)." msgstr "" -#: ../../library/importlib.rst:853 +#: ../../library/importlib.rst:687 msgid "The value is no longer dependent on ``__debug__``." msgstr "" -#: ../../library/importlib.rst:858 +#: ../../library/importlib.rst:692 msgid "" "A list of strings representing the recognized file suffixes for extension " "modules." msgstr "" -#: ../../library/importlib.rst:865 +#: ../../library/importlib.rst:699 msgid "" "Returns a combined list of strings representing all file suffixes for " "modules recognized by the standard import machinery. This is a helper for " @@ -1094,57 +925,57 @@ msgid "" "`inspect.getmodulename`)." msgstr "" -#: ../../library/importlib.rst:876 +#: ../../library/importlib.rst:710 msgid "" "An :term:`importer` for built-in modules. All known built-in modules are " "listed in :data:`sys.builtin_module_names`. This class implements the :class:" "`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:881 ../../library/importlib.rst:895 -#: ../../library/importlib.rst:908 ../../library/importlib.rst:923 +#: ../../library/importlib.rst:715 ../../library/importlib.rst:729 +#: ../../library/importlib.rst:742 ../../library/importlib.rst:757 msgid "" "Only class methods are defined by this class to alleviate the need for " "instantiation." msgstr "" -#: ../../library/importlib.rst:884 +#: ../../library/importlib.rst:718 msgid "" "As part of :pep:`489`, the builtin importer now implements :meth:`Loader." "create_module` and :meth:`Loader.exec_module`" msgstr "" -#: ../../library/importlib.rst:891 +#: ../../library/importlib.rst:725 msgid "" "An :term:`importer` for frozen modules. This class implements the :class:" "`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:898 +#: ../../library/importlib.rst:732 msgid "" "Gained :meth:`~Loader.create_module` and :meth:`~Loader.exec_module` methods." msgstr "" -#: ../../library/importlib.rst:905 +#: ../../library/importlib.rst:739 msgid "" ":term:`Finder ` for modules declared in the Windows registry. This " "class implements the :class:`importlib.abc.MetaPathFinder` ABC." msgstr "" -#: ../../library/importlib.rst:913 +#: ../../library/importlib.rst:747 msgid "" "Use :mod:`site` configuration instead. Future versions of Python may not " "enable this finder by default." msgstr "" -#: ../../library/importlib.rst:920 +#: ../../library/importlib.rst:754 msgid "" "A :term:`Finder ` for :data:`sys.path` and package ``__path__`` " "attributes. This class implements the :class:`importlib.abc.MetaPathFinder` " "ABC." msgstr "" -#: ../../library/importlib.rst:928 +#: ../../library/importlib.rst:762 msgid "" "Class method that attempts to find a :term:`spec ` for the " "module specified by *fullname* on :data:`sys.path` or, if defined, on " @@ -1158,43 +989,43 @@ msgid "" "cache and returned." msgstr "" -#: ../../library/importlib.rst:942 +#: ../../library/importlib.rst:776 msgid "" "If the current working directory -- represented by an empty string -- is no " "longer valid then ``None`` is returned but no value is cached in :data:`sys." "path_importer_cache`." msgstr "" -#: ../../library/importlib.rst:949 +#: ../../library/importlib.rst:783 msgid "" "Calls :meth:`importlib.abc.PathEntryFinder.invalidate_caches` on all finders " "stored in :data:`sys.path_importer_cache` that define the method. Otherwise " "entries in :data:`sys.path_importer_cache` set to ``None`` are deleted." msgstr "" -#: ../../library/importlib.rst:954 +#: ../../library/importlib.rst:788 msgid "Entries of ``None`` in :data:`sys.path_importer_cache` are deleted." msgstr "" -#: ../../library/importlib.rst:957 +#: ../../library/importlib.rst:791 msgid "" "Calls objects in :data:`sys.path_hooks` with the current working directory " "for ``''`` (i.e. the empty string)." msgstr "" -#: ../../library/importlib.rst:964 +#: ../../library/importlib.rst:798 msgid "" "A concrete implementation of :class:`importlib.abc.PathEntryFinder` which " "caches results from the file system." msgstr "" -#: ../../library/importlib.rst:967 +#: ../../library/importlib.rst:801 msgid "" "The *path* argument is the directory for which the finder is in charge of " "searching." msgstr "" -#: ../../library/importlib.rst:970 +#: ../../library/importlib.rst:804 msgid "" "The *loader_details* argument is a variable number of 2-item tuples each " "containing a loader and a sequence of file suffixes the loader recognizes. " @@ -1202,7 +1033,7 @@ msgid "" "module's name and the path to the file found." msgstr "" -#: ../../library/importlib.rst:975 +#: ../../library/importlib.rst:809 msgid "" "The finder will cache the directory contents as necessary, making stat calls " "for each module search to verify the cache is not outdated. Because cache " @@ -1215,166 +1046,166 @@ msgid "" "to call :func:`importlib.invalidate_caches`." msgstr "" -#: ../../library/importlib.rst:989 +#: ../../library/importlib.rst:823 msgid "The path the finder will search in." msgstr "" -#: ../../library/importlib.rst:993 +#: ../../library/importlib.rst:827 msgid "Attempt to find the spec to handle *fullname* within :attr:`path`." msgstr "" -#: ../../library/importlib.rst:999 +#: ../../library/importlib.rst:833 msgid "Clear out the internal cache." msgstr "" -#: ../../library/importlib.rst:1003 +#: ../../library/importlib.rst:837 msgid "" "A class method which returns a closure for use on :data:`sys.path_hooks`. An " "instance of :class:`FileFinder` is returned by the closure using the path " "argument given to the closure directly and *loader_details* indirectly." msgstr "" -#: ../../library/importlib.rst:1008 +#: ../../library/importlib.rst:842 msgid "" "If the argument to the closure is not an existing directory, :exc:" "`ImportError` is raised." msgstr "" -#: ../../library/importlib.rst:1014 +#: ../../library/importlib.rst:848 msgid "" "A concrete implementation of :class:`importlib.abc.SourceLoader` by " "subclassing :class:`importlib.abc.FileLoader` and providing some concrete " "implementations of other methods." msgstr "" -#: ../../library/importlib.rst:1022 +#: ../../library/importlib.rst:856 msgid "The name of the module that this loader will handle." msgstr "" -#: ../../library/importlib.rst:1026 +#: ../../library/importlib.rst:860 msgid "The path to the source file." msgstr "" -#: ../../library/importlib.rst:1030 +#: ../../library/importlib.rst:864 msgid "Return ``True`` if :attr:`path` appears to be for a package." msgstr "" -#: ../../library/importlib.rst:1034 +#: ../../library/importlib.rst:868 msgid "" "Concrete implementation of :meth:`importlib.abc.SourceLoader.path_stats`." msgstr "" -#: ../../library/importlib.rst:1038 +#: ../../library/importlib.rst:872 msgid "Concrete implementation of :meth:`importlib.abc.SourceLoader.set_data`." msgstr "" -#: ../../library/importlib.rst:1042 ../../library/importlib.rst:1085 +#: ../../library/importlib.rst:876 ../../library/importlib.rst:919 msgid "" "Concrete implementation of :meth:`importlib.abc.Loader.load_module` where " "specifying the name of the module to load is optional." msgstr "" -#: ../../library/importlib.rst:1047 ../../library/importlib.rst:1090 +#: ../../library/importlib.rst:881 ../../library/importlib.rst:924 msgid "Use :meth:`importlib.abc.Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:1052 +#: ../../library/importlib.rst:886 msgid "" "A concrete implementation of :class:`importlib.abc.FileLoader` which can " "import bytecode files (i.e. no source code files exist)." msgstr "" -#: ../../library/importlib.rst:1055 +#: ../../library/importlib.rst:889 msgid "" "Please note that direct use of bytecode files (and thus not source code " "files) inhibits your modules from being usable by all Python implementations " "or new versions of Python which change the bytecode format." msgstr "" -#: ../../library/importlib.rst:1064 +#: ../../library/importlib.rst:898 msgid "The name of the module the loader will handle." msgstr "" -#: ../../library/importlib.rst:1068 +#: ../../library/importlib.rst:902 msgid "The path to the bytecode file." msgstr "" -#: ../../library/importlib.rst:1072 +#: ../../library/importlib.rst:906 msgid "Determines if the module is a package based on :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1076 +#: ../../library/importlib.rst:910 msgid "Returns the code object for :attr:`name` created from :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1080 +#: ../../library/importlib.rst:914 msgid "" "Returns ``None`` as bytecode files have no source when this loader is used." msgstr "" -#: ../../library/importlib.rst:1095 +#: ../../library/importlib.rst:929 msgid "" "A concrete implementation of :class:`importlib.abc.ExecutionLoader` for " "extension modules." msgstr "" -#: ../../library/importlib.rst:1098 +#: ../../library/importlib.rst:932 msgid "" "The *fullname* argument specifies the name of the module the loader is to " "support. The *path* argument is the path to the extension module's file." msgstr "" -#: ../../library/importlib.rst:1101 +#: ../../library/importlib.rst:935 msgid "" "Note that, by default, importing an extension module will fail in " "subinterpreters if it doesn't implement multi-phase init (see :pep:`489`), " "even if it would otherwise import successfully." msgstr "" -#: ../../library/importlib.rst:1107 +#: ../../library/importlib.rst:941 msgid "Multi-phase init is now required for use in subinterpreters." msgstr "" -#: ../../library/importlib.rst:1112 ../../library/importlib.rst:1298 +#: ../../library/importlib.rst:946 ../../library/importlib.rst:1132 msgid "Name of the module the loader supports." msgstr "" -#: ../../library/importlib.rst:1116 +#: ../../library/importlib.rst:950 msgid "Path to the extension module." msgstr "" -#: ../../library/importlib.rst:1120 +#: ../../library/importlib.rst:954 msgid "" "Creates the module object from the given specification in accordance with :" "pep:`489`." msgstr "" -#: ../../library/importlib.rst:1127 +#: ../../library/importlib.rst:961 msgid "Initializes the given module object in accordance with :pep:`489`." msgstr "" -#: ../../library/importlib.rst:1133 +#: ../../library/importlib.rst:967 msgid "" "Returns ``True`` if the file path points to a package's ``__init__`` module " "based on :const:`EXTENSION_SUFFIXES`." msgstr "" -#: ../../library/importlib.rst:1138 +#: ../../library/importlib.rst:972 msgid "Returns ``None`` as extension modules lack a code object." msgstr "" -#: ../../library/importlib.rst:1142 +#: ../../library/importlib.rst:976 msgid "Returns ``None`` as extension modules do not have source code." msgstr "" -#: ../../library/importlib.rst:1153 +#: ../../library/importlib.rst:987 msgid "" "A concrete implementation of :class:`importlib.abc.InspectLoader` for " "namespace packages. This is an alias for a private class and is only made " "public for introspecting the ``__loader__`` attribute on namespace packages::" msgstr "" -#: ../../library/importlib.rst:1158 +#: ../../library/importlib.rst:992 msgid "" ">>> from importlib.machinery import NamespaceLoader\n" ">>> import my_namespace\n" @@ -1392,7 +1223,7 @@ msgstr "" ">>> isinstance(my_namespace.__loader__, importlib.abc.Loader)\n" "True" -#: ../../library/importlib.rst:1171 +#: ../../library/importlib.rst:1005 msgid "" "A specification for a module's import-system-related state. This is " "typically exposed as the module's :attr:`~module.__spec__` attribute. Many " @@ -1405,19 +1236,19 @@ msgid "" "origin>`, and vice versa." msgstr "" -#: ../../library/importlib.rst:1185 +#: ../../library/importlib.rst:1019 msgid "" "The module's fully qualified name (see :attr:`module.__name__`). The :term:" "`finder` should always set this attribute to a non-empty string." msgstr "" -#: ../../library/importlib.rst:1190 +#: ../../library/importlib.rst:1024 msgid "" "The :term:`loader` used to load the module (see :attr:`module.__loader__`). " "The :term:`finder` should always set this attribute." msgstr "" -#: ../../library/importlib.rst:1195 +#: ../../library/importlib.rst:1029 msgid "" "The location the :term:`loader` should use to load the module (see :attr:" "`module.__file__`). For example, for modules loaded from a ``.py`` file this " @@ -1426,14 +1257,14 @@ msgid "" "there is not one (like for namespace packages), it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1204 +#: ../../library/importlib.rst:1038 msgid "" "A (possibly empty) :term:`sequence` of strings enumerating the locations in " "which a package's submodules will be found (see :attr:`module.__path__`). " "Most of the time there will only be a single directory in this list." msgstr "" -#: ../../library/importlib.rst:1209 +#: ../../library/importlib.rst:1043 msgid "" "The :term:`finder` should set this attribute to a sequence, even an empty " "one, to indicate to the import system that the module is a package. It " @@ -1441,41 +1272,41 @@ msgid "" "later to a special object for namespace packages." msgstr "" -#: ../../library/importlib.rst:1217 +#: ../../library/importlib.rst:1051 msgid "" "The :term:`finder` may set this attribute to an object containing " "additional, module-specific data to use when loading the module. Otherwise " "it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1223 +#: ../../library/importlib.rst:1057 msgid "" "The filename of a compiled version of the module's code (see :attr:`module." "__cached__`). The :term:`finder` should always set this attribute but it may " "be ``None`` for modules that do not need compiled code stored." msgstr "" -#: ../../library/importlib.rst:1230 +#: ../../library/importlib.rst:1064 msgid "" "(Read-only) The fully qualified name of the package the module is in (or the " "empty string for a top-level module). See :attr:`module.__package__`. If the " "module is a package then this is the same as :attr:`name`." msgstr "" -#: ../../library/importlib.rst:1237 +#: ../../library/importlib.rst:1071 msgid "" "``True`` if the spec's :attr:`origin` refers to a loadable location, " "``False`` otherwise. This value impacts how :attr:`!origin` is interpreted " "and how the module's :attr:`~module.__file__` is populated." msgstr "" -#: ../../library/importlib.rst:1244 +#: ../../library/importlib.rst:1078 msgid "" "A specialization of :class:`importlib.machinery.ExtensionFileLoader` that is " "able to load extension modules in Framework format." msgstr "" -#: ../../library/importlib.rst:1247 +#: ../../library/importlib.rst:1081 msgid "" "For compatibility with the iOS App Store, *all* binary modules in an iOS app " "must be dynamic libraries, contained in a framework with appropriate " @@ -1484,7 +1315,7 @@ msgid "" "material outside the Frameworks folder." msgstr "" -#: ../../library/importlib.rst:1253 +#: ../../library/importlib.rst:1087 msgid "" "To accommodate this requirement, when running on iOS, extension module " "binaries are *not* packaged as ``.so`` files on ``sys.path``, but as " @@ -1498,7 +1329,7 @@ msgid "" "fwork`` file, relative to the app bundle." msgstr "" -#: ../../library/importlib.rst:1264 +#: ../../library/importlib.rst:1098 msgid "" "For example, consider the case of an import ``from foo.bar import _whiz``, " "where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" @@ -1514,7 +1345,7 @@ msgid "" "_whiz.origin``, containing the path to the ``.fwork`` file." msgstr "" -#: ../../library/importlib.rst:1278 +#: ../../library/importlib.rst:1112 msgid "" "When a module is loaded with this loader, the ``__file__`` for the module " "will report as the location of the ``.fwork`` file. This allows code to use " @@ -1523,7 +1354,7 @@ msgid "" "in the ``.framework`` folder." msgstr "" -#: ../../library/importlib.rst:1284 +#: ../../library/importlib.rst:1118 msgid "" "The Xcode project building the app is responsible for converting any ``.so`` " "files from wherever they exist in the ``PYTHONPATH`` into frameworks in the " @@ -1534,35 +1365,35 @@ msgid "" "details on how to construct this build step." msgstr "" -#: ../../library/importlib.rst:1294 +#: ../../library/importlib.rst:1128 msgid "Availability" msgstr "可用性" -#: ../../library/importlib.rst:1302 +#: ../../library/importlib.rst:1136 msgid "Path to the ``.fwork`` file for the extension module." msgstr "" -#: ../../library/importlib.rst:1306 +#: ../../library/importlib.rst:1140 msgid ":mod:`importlib.util` -- Utility code for importers" msgstr "" -#: ../../library/importlib.rst:1312 +#: ../../library/importlib.rst:1146 msgid "**Source code:** :source:`Lib/importlib/util.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/util.py`" -#: ../../library/importlib.rst:1316 +#: ../../library/importlib.rst:1150 msgid "" "This module contains the various objects that help in the construction of " "an :term:`importer`." msgstr "" -#: ../../library/importlib.rst:1321 +#: ../../library/importlib.rst:1155 msgid "" "The bytes which represent the bytecode version number. If you need help with " "loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`." msgstr "" -#: ../../library/importlib.rst:1328 +#: ../../library/importlib.rst:1162 msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " @@ -1572,7 +1403,7 @@ msgid "" "`NotImplementedError` will be raised)." msgstr "" -#: ../../library/importlib.rst:1335 +#: ../../library/importlib.rst:1169 msgid "" "The *optimization* parameter is used to specify the optimization level of " "the bytecode file. An empty string represents no optimization, so ``/foo/bar/" @@ -1585,7 +1416,7 @@ msgid "" "be alphanumeric, else :exc:`ValueError` is raised." msgstr "" -#: ../../library/importlib.rst:1345 +#: ../../library/importlib.rst:1179 msgid "" "The *debug_override* parameter is deprecated and can be used to override the " "system's value for ``__debug__``. A ``True`` value is the equivalent of " @@ -1594,18 +1425,18 @@ msgid "" "are not ``None`` then :exc:`TypeError` is raised." msgstr "" -#: ../../library/importlib.rst:1353 +#: ../../library/importlib.rst:1187 msgid "" "The *optimization* parameter was added and the *debug_override* parameter " "was deprecated." msgstr "" -#: ../../library/importlib.rst:1357 ../../library/importlib.rst:1373 -#: ../../library/importlib.rst:1462 +#: ../../library/importlib.rst:1191 ../../library/importlib.rst:1207 +#: ../../library/importlib.rst:1296 msgid "Accepts a :term:`path-like object`." msgstr "接受一個 :term:`path-like object`。" -#: ../../library/importlib.rst:1363 +#: ../../library/importlib.rst:1197 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " "code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." @@ -1615,25 +1446,25 @@ msgid "" "cache_tag` is not defined, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/importlib.rst:1378 +#: ../../library/importlib.rst:1212 msgid "" "Decode the given bytes representing source code and return it as a string " "with universal newlines (as required by :meth:`importlib.abc.InspectLoader." "get_source`)." msgstr "" -#: ../../library/importlib.rst:1386 +#: ../../library/importlib.rst:1220 msgid "Resolve a relative module name to an absolute one." msgstr "" -#: ../../library/importlib.rst:1388 +#: ../../library/importlib.rst:1222 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " "allows for usage such as ``importlib.util.resolve_name('sys', __spec__." "parent)`` without doing a check to see if the **package** argument is needed." msgstr "" -#: ../../library/importlib.rst:1393 +#: ../../library/importlib.rst:1227 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " "**package** is a false value (e.g. ``None`` or the empty string). :exc:" @@ -1641,13 +1472,13 @@ msgid "" "package (e.g. requesting ``..bacon`` from within the ``spam`` package)." msgstr "" -#: ../../library/importlib.rst:1401 +#: ../../library/importlib.rst:1235 msgid "" "To improve consistency with import statements, raise :exc:`ImportError` " "instead of :exc:`ValueError` for invalid relative import attempts." msgstr "" -#: ../../library/importlib.rst:1408 +#: ../../library/importlib.rst:1242 msgid "" "Find the :term:`spec ` for a module, optionally relative to the " "specified **package** name. If the module is in :data:`sys.modules`, then " @@ -1657,30 +1488,30 @@ msgid "" "if no spec is found." msgstr "" -#: ../../library/importlib.rst:1415 +#: ../../library/importlib.rst:1249 msgid "" "If **name** is for a submodule (contains a dot), the parent module is " "automatically imported." msgstr "" -#: ../../library/importlib.rst:1418 +#: ../../library/importlib.rst:1252 msgid "**name** and **package** work the same as for :func:`import_module`." msgstr "" -#: ../../library/importlib.rst:1422 +#: ../../library/importlib.rst:1256 msgid "" "Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if " "**package** is in fact not a package (i.e. lacks a :attr:`~module.__path__` " "attribute)." msgstr "" -#: ../../library/importlib.rst:1429 +#: ../../library/importlib.rst:1263 msgid "" "Create a new module based on **spec** and :meth:`spec.loader.create_module " "`." msgstr "" -#: ../../library/importlib.rst:1432 +#: ../../library/importlib.rst:1266 msgid "" "If :meth:`spec.loader.create_module ` " "does not return ``None``, then any pre-existing attributes will not be " @@ -1688,14 +1519,14 @@ msgid "" "accessing **spec** or setting an attribute on the module." msgstr "" -#: ../../library/importlib.rst:1437 +#: ../../library/importlib.rst:1271 msgid "" "This function is preferred over using :class:`types.ModuleType` to create a " "new module as **spec** is used to set as many import-controlled attributes " "on the module as possible." msgstr "" -#: ../../library/importlib.rst:1445 +#: ../../library/importlib.rst:1279 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " @@ -1704,7 +1535,7 @@ msgid "" "spec." msgstr "" -#: ../../library/importlib.rst:1455 +#: ../../library/importlib.rst:1289 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on the path to a file. Missing information will be filled in " @@ -1712,14 +1543,14 @@ msgid "" "module will be file-based." msgstr "" -#: ../../library/importlib.rst:1467 +#: ../../library/importlib.rst:1301 msgid "" "Return the hash of *source_bytes* as bytes. A hash-based ``.pyc`` file " "embeds the :func:`source_hash` of the corresponding source file's contents " "in its header." msgstr "" -#: ../../library/importlib.rst:1475 +#: ../../library/importlib.rst:1309 msgid "" "A context manager that can temporarily skip the compatibility check for " "extension modules. By default the check is enabled and will fail when a " @@ -1728,14 +1559,14 @@ msgid "" "interpreter GIL, when imported in an interpreter with its own GIL." msgstr "" -#: ../../library/importlib.rst:1482 +#: ../../library/importlib.rst:1316 msgid "" "Note that this function is meant to accommodate an unusual case; one which " "is likely to eventually go away. There's is a pretty good chance this is " "not what you were looking for." msgstr "" -#: ../../library/importlib.rst:1486 +#: ../../library/importlib.rst:1320 msgid "" "You can get the same effect as this function by implementing the basic " "interface of multi-phase init (:pep:`489`) and lying about support for " @@ -1744,19 +1575,19 @@ msgstr "" "你可以透過實作多階段初始化的基本介面 (:pep:`489`) 並假稱有多個直譯器(或直譯" "器各別持有的 GIL)的支援,來達到與此函式相同的效果。" -#: ../../library/importlib.rst:1491 +#: ../../library/importlib.rst:1325 msgid "" "Using this function to disable the check can lead to unexpected behavior and " "even crashes. It should only be used during extension module development." msgstr "" -#: ../../library/importlib.rst:1499 +#: ../../library/importlib.rst:1333 msgid "" "A class which postpones the execution of the loader of a module until the " "module has an attribute accessed." msgstr "" -#: ../../library/importlib.rst:1502 +#: ../../library/importlib.rst:1336 msgid "" "This class **only** works with loaders that define :meth:`~importlib.abc." "Loader.exec_module` as control over what module type is used for the module " @@ -1769,7 +1600,7 @@ msgid "" "raised if such a substitution is detected." msgstr "" -#: ../../library/importlib.rst:1513 +#: ../../library/importlib.rst:1347 msgid "" "For projects where startup time is critical, this class allows for " "potentially minimizing the cost of loading a module if it is never used. For " @@ -1778,21 +1609,21 @@ msgid "" "postponed and thus occurring out of context." msgstr "" -#: ../../library/importlib.rst:1521 +#: ../../library/importlib.rst:1355 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " "compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" "class:`importlib.machinery.ExtensionFileLoader`." msgstr "" -#: ../../library/importlib.rst:1528 +#: ../../library/importlib.rst:1362 msgid "" "A class method which returns a callable that creates a lazy loader. This is " "meant to be used in situations where the loader is passed by class instead " "of by instance. ::" msgstr "" -#: ../../library/importlib.rst:1533 +#: ../../library/importlib.rst:1367 msgid "" "suffixes = importlib.machinery.SOURCE_SUFFIXES\n" "loader = importlib.machinery.SourceFileLoader\n" @@ -1804,20 +1635,20 @@ msgstr "" "lazy_loader = importlib.util.LazyLoader.factory(loader)\n" "finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))" -#: ../../library/importlib.rst:1541 +#: ../../library/importlib.rst:1375 msgid "Examples" msgstr "範例" -#: ../../library/importlib.rst:1544 +#: ../../library/importlib.rst:1378 msgid "Importing programmatically" msgstr "" -#: ../../library/importlib.rst:1546 +#: ../../library/importlib.rst:1380 msgid "" "To programmatically import a module, use :func:`importlib.import_module`. ::" msgstr "" -#: ../../library/importlib.rst:1549 +#: ../../library/importlib.rst:1383 msgid "" "import importlib\n" "\n" @@ -1827,23 +1658,23 @@ msgstr "" "\n" "itertools = importlib.import_module('itertools')" -#: ../../library/importlib.rst:1555 +#: ../../library/importlib.rst:1389 msgid "Checking if a module can be imported" msgstr "" -#: ../../library/importlib.rst:1557 +#: ../../library/importlib.rst:1391 msgid "" "If you need to find out if a module can be imported without actually doing " "the import, then you should use :func:`importlib.util.find_spec`." msgstr "" -#: ../../library/importlib.rst:1560 +#: ../../library/importlib.rst:1394 msgid "" "Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." "find_spec` will import the parent module. ::" msgstr "" -#: ../../library/importlib.rst:1564 +#: ../../library/importlib.rst:1398 msgid "" "import importlib.util\n" "import sys\n" @@ -1863,11 +1694,11 @@ msgid "" " print(f\"can't find the {name!r} module\")" msgstr "" -#: ../../library/importlib.rst:1583 +#: ../../library/importlib.rst:1417 msgid "Importing a source file directly" msgstr "" -#: ../../library/importlib.rst:1585 +#: ../../library/importlib.rst:1419 msgid "" "This recipe should be used with caution: it is an approximation of an import " "statement where the file path is specified directly, rather than :data:`sys." @@ -1877,13 +1708,13 @@ msgid "" "file is appropriate." msgstr "" -#: ../../library/importlib.rst:1592 +#: ../../library/importlib.rst:1426 msgid "" "To import a Python source file directly from a path, use the following " "recipe::" msgstr "" -#: ../../library/importlib.rst:1594 +#: ../../library/importlib.rst:1428 msgid "" "import importlib.util\n" "import sys\n" @@ -1906,15 +1737,15 @@ msgid "" "json = import_from_path(module_name, file_path)" msgstr "" -#: ../../library/importlib.rst:1616 +#: ../../library/importlib.rst:1450 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1618 +#: ../../library/importlib.rst:1452 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1620 +#: ../../library/importlib.rst:1454 msgid "" ">>> import importlib.util\n" ">>> import sys\n" @@ -1950,11 +1781,11 @@ msgstr "" ">>> lazy_typing.TYPE_CHECKING\n" "False" -#: ../../library/importlib.rst:1639 +#: ../../library/importlib.rst:1473 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1641 +#: ../../library/importlib.rst:1475 msgid "" "For deep customizations of import, you typically want to implement an :term:" "`importer`. This means managing both the :term:`finder` and :term:`loader` " @@ -1968,7 +1799,7 @@ msgid "" "for the appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1652 +#: ../../library/importlib.rst:1486 msgid "" "import importlib.machinery\n" "import sys\n" @@ -1992,11 +1823,11 @@ msgid "" "sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))" msgstr "" -#: ../../library/importlib.rst:1673 +#: ../../library/importlib.rst:1507 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1675 +#: ../../library/importlib.rst:1509 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " @@ -2004,7 +1835,7 @@ msgid "" "approximate implementation of :func:`importlib.import_module`::" msgstr "" -#: ../../library/importlib.rst:1681 +#: ../../library/importlib.rst:1515 msgid "" "import importlib.util\n" "import sys\n" @@ -2045,6 +1876,12 @@ msgstr "universal newlines" msgid "importlib.abc.InspectLoader.get_source method" msgstr "importlib.abc.InspectLoader.get_source 方法" +#~ msgid "Read contents of ``self`` as bytes." +#~ msgstr "以位元組讀取 ``self`` 的內容。" + +#~ msgid "Read contents of ``self`` as text." +#~ msgstr "以文字讀取 ``self`` 的內容。" + #~ msgid ":attr:`__cached__`" #~ msgstr ":attr:`__cached__`" diff --git a/library/inspect.po b/library/inspect.po index 1a82a11623..9444944dcd 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-29 00:16+0000\n" +"POT-Creation-Date: 2026-01-24 22:47+0000\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -794,7 +794,7 @@ msgid "" "Sync functions marked with :func:`markcoroutinefunction` now return ``True``." msgstr "" -#: ../../library/inspect.rst:455 ../../library/inspect.rst:525 +#: ../../library/inspect.rst:455 msgid "" "Functions wrapped in :func:`functools.partialmethod` now return ``True`` if " "the wrapped function is a :term:`coroutine function`." @@ -886,6 +886,12 @@ msgid "" "wrapped function is an :term:`asynchronous generator` function." msgstr "" +#: ../../library/inspect.rst:525 +msgid "" +"Functions wrapped in :func:`functools.partialmethod` now return ``True`` if " +"the wrapped function is a :term:`asynchronous generator` function." +msgstr "" + #: ../../library/inspect.rst:531 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator iterator` " @@ -2195,6 +2201,7 @@ msgstr "GEN_CREATED:等待開始執行。" #: ../../library/inspect.rst:1601 msgid "GEN_RUNNING: Currently being executed by the interpreter." msgstr "GEN_RUNNING:目前正在被直譯器執行。" + #: ../../library/inspect.rst:1602 msgid "GEN_SUSPENDED: Currently suspended at a yield expression." msgstr "" diff --git a/library/itertools.po b/library/itertools.po index 61ec398f06..c031abe499 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-01-13 00:13+0000\n" +"POT-Creation-Date: 2026-02-05 00:20+0000\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1780,8 +1780,8 @@ msgid "" msgstr "" "應用技巧的次要目的是作為 itertools 的孵化器。``accumulate()``, " "``compress()`` 和 ``pairwise()`` itertools 最初都是作為應用技巧出現的。目前," -"``sliding_window()``、``derangements()`` 和 ``sieve()`` 的應用技巧正在被測試," -"以確定它們是否有價值被收錄到內建的 itertools 中。" +"``sliding_window()``、``derangements()`` 和 ``sieve()`` 的應用技巧正在被測" +"試,以確定它們是否有價值被收錄到內建的 itertools 中。" #: ../../library/itertools.rst:825 msgid "" @@ -1814,6 +1814,7 @@ msgstr "" "term:`產生器 `,則能保持高速度。" #: ../../library/itertools.rst:839 +#, fuzzy msgid "" "from itertools import (accumulate, batched, chain, combinations, compress,\n" " count, cycle, filterfalse, groupby, islice, permutations, product,\n" @@ -1822,7 +1823,8 @@ msgid "" "from contextlib import suppress\n" "from functools import reduce\n" "from math import comb, isqrt, prod, sumprod\n" -"from operator import getitem, is_not, itemgetter, mul, neg\n" +"from operator import getitem, is_not, itemgetter, mul, neg, truediv\n" +"\n" "\n" "# ==== Basic one liners ====\n" "\n" @@ -1835,9 +1837,10 @@ msgid "" " # prepend(1, [2, 3, 4]) → 1 2 3 4\n" " return chain([value], iterable)\n" "\n" -"def tabulate(function, start=0):\n" -" \"Return function(0), function(1), ...\"\n" -" return map(function, count(start))\n" +"def running_mean(iterable):\n" +" \"Yield the average of all values seen so far.\"\n" +" # running_mean([8.5, 9.5, 7.5, 6.5]) -> 8.5 9.0 8.5 8.0\n" +" return map(truediv, accumulate(iterable), count(1))\n" "\n" "def repeatfunc(function, times=None, *args):\n" " \"Repeat calls to a function with specified arguments.\"\n" @@ -1892,6 +1895,7 @@ msgid "" " # all_equal('4٤௪౪໔', key=int) → True\n" " return len(take(2, groupby(iterable, key))) <= 1\n" "\n" +"\n" "# ==== Data pipelines ====\n" "\n" "def unique_justseen(iterable, key=None):\n" @@ -2003,6 +2007,7 @@ msgid "" " while True:\n" " yield function()\n" "\n" +"\n" "# ==== Mathematical operations ====\n" "\n" "def multinomial(*counts):\n" @@ -2022,6 +2027,7 @@ msgid "" " # sum_of_squares([10, 20, 30]) → 1400\n" " return sumprod(*tee(iterable))\n" "\n" +"\n" "# ==== Matrix operations ====\n" "\n" "def reshape(matrix, columns):\n" @@ -2040,6 +2046,7 @@ msgid "" " n = len(m2[0])\n" " return batched(starmap(sumprod, product(m1, transpose(m2))), n)\n" "\n" +"\n" "# ==== Polynomial arithmetic ====\n" "\n" "def convolve(signal, kernel):\n" @@ -2096,6 +2103,7 @@ msgid "" " powers = reversed(range(1, n))\n" " return list(map(mul, coefficients, powers))\n" "\n" +"\n" "# ==== Number theory ====\n" "\n" "def sieve(n):\n" diff --git a/library/logging.config.po b/library/logging.config.po index 534425a49c..d0c5307537 100644 --- a/library/logging.config.po +++ b/library/logging.config.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,10 +25,6 @@ msgstr ":mod:`!logging.config` --- 日誌記錄配置" msgid "**Source code:** :source:`Lib/logging/config.py`" msgstr "**原始碼:**\\ :source:`Lib/logging/config.py`" -#: ../../library/logging.config.rst:12 -msgid "Important" -msgstr "重點資訊" - #: ../../library/logging.config.rst:14 msgid "" "This page contains only reference information. For tutorials, please see" @@ -1513,3 +1509,6 @@ msgstr ":mod:`logging.handlers` 模組" #: ../../library/logging.config.rst:1000 msgid "Useful handlers included with the logging module." msgstr "" + +#~ msgid "Important" +#~ msgstr "重點資訊" diff --git a/library/logging.handlers.po b/library/logging.handlers.po index 6c838f085b..0455bcb787 100644 --- a/library/logging.handlers.po +++ b/library/logging.handlers.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,10 +25,6 @@ msgstr ":mod:`!logging.handlers` --- 日誌紀錄處理器" msgid "**Source code:** :source:`Lib/logging/handlers.py`" msgstr "**原始碼:**\\ :source:`Lib/logging/handlers.py`" -#: ../../library/logging.handlers.rst:12 -msgid "Important" -msgstr "重點資訊" - #: ../../library/logging.handlers.rst:14 msgid "" "This page contains only reference information. For tutorials, please see" @@ -1688,3 +1684,6 @@ msgstr ":mod:`logging.config` 模組" #: ../../library/logging.handlers.rst:1235 msgid "Configuration API for the logging module." msgstr "" + +#~ msgid "Important" +#~ msgstr "重點資訊" diff --git a/library/logging.po b/library/logging.po index b7ad8c2038..f13d09f62c 100644 --- a/library/logging.po +++ b/library/logging.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-26 00:15+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,10 +27,6 @@ msgstr ":mod:`!logging` --- Python 的日誌記錄工具" msgid "**Source code:** :source:`Lib/logging/__init__.py`" msgstr "**原始碼:**\\ :source:`Lib/logging/__init__.py`" -#: ../../library/logging.rst:14 -msgid "Important" -msgstr "重點資訊" - #: ../../library/logging.rst:16 msgid "" "This page contains the API reference information. For tutorial information " @@ -2349,3 +2345,6 @@ msgstr "Errors(錯誤)" #: ../../library/logging.rst:12 msgid "logging" msgstr "logging(日誌)" + +#~ msgid "Important" +#~ msgstr "重點資訊" diff --git a/library/os.path.po b/library/os.path.po index 5ad64854fc..b2c49802ad 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-17 00:14+0000\n" +"POT-Creation-Date: 2026-02-04 00:17+0000\n" "PO-Revision-Date: 2023-07-13 14:06+0800\n" "Last-Translator: Po-Chuan Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -113,18 +113,18 @@ msgid ":func:`os.path.join` and :func:`os.path.normpath`." msgstr ":func:`os.path.join` 和 :func:`os.path.normpath`。" #: ../../library/os.path.rst:64 ../../library/os.path.rst:77 -#: ../../library/os.path.rst:118 ../../library/os.path.rst:127 -#: ../../library/os.path.rst:143 ../../library/os.path.rst:153 -#: ../../library/os.path.rst:179 ../../library/os.path.rst:199 -#: ../../library/os.path.rst:216 ../../library/os.path.rst:228 -#: ../../library/os.path.rst:237 ../../library/os.path.rst:249 -#: ../../library/os.path.rst:263 ../../library/os.path.rst:273 -#: ../../library/os.path.rst:292 ../../library/os.path.rst:312 -#: ../../library/os.path.rst:398 ../../library/os.path.rst:418 -#: ../../library/os.path.rst:458 ../../library/os.path.rst:487 -#: ../../library/os.path.rst:503 ../../library/os.path.rst:514 -#: ../../library/os.path.rst:541 ../../library/os.path.rst:566 -#: ../../library/os.path.rst:630 +#: ../../library/os.path.rst:120 ../../library/os.path.rst:129 +#: ../../library/os.path.rst:145 ../../library/os.path.rst:155 +#: ../../library/os.path.rst:181 ../../library/os.path.rst:201 +#: ../../library/os.path.rst:218 ../../library/os.path.rst:230 +#: ../../library/os.path.rst:239 ../../library/os.path.rst:251 +#: ../../library/os.path.rst:265 ../../library/os.path.rst:275 +#: ../../library/os.path.rst:294 ../../library/os.path.rst:314 +#: ../../library/os.path.rst:400 ../../library/os.path.rst:420 +#: ../../library/os.path.rst:460 ../../library/os.path.rst:489 +#: ../../library/os.path.rst:505 ../../library/os.path.rst:516 +#: ../../library/os.path.rst:543 ../../library/os.path.rst:568 +#: ../../library/os.path.rst:632 msgid "Accepts a :term:`path-like object`." msgstr "接受一個 :term:`path-like object`。" @@ -161,23 +161,27 @@ msgid "Any iterable can now be passed, rather than just sequences." msgstr "" #: ../../library/os.path.rst:100 +#, fuzzy msgid "" -"Return the longest path prefix (taken character-by-character) that is a " -"prefix of all paths in *list*. If *list* is empty, return the empty string " -"(``''``)." +"Return the longest string prefix (taken character-by-character) that is a " +"prefix of all strings in *list*. If *list* is empty, return the empty " +"string (``''``)." msgstr "" "回傳 *list* 中所有路徑的最長路徑前綴(逐字元比較)。如果 *list* 為空,則回傳" "空字串(``''``)。" #: ../../library/os.path.rst:106 +#, fuzzy msgid "" "This function may return invalid paths because it works a character at a " -"time. To obtain a valid path, see :func:`commonpath`." +"time. If you need a **common path prefix**, then the algorithm implemented " +"in this function is not secure. Use :func:`commonpath` for finding a common " +"path prefix." msgstr "" "由於此函式是逐字元比較,因此可能會回傳無效的路徑。若要獲得有效的路徑,請參" "考 :func:`commonpath` 函式。" -#: ../../library/os.path.rst:112 +#: ../../library/os.path.rst:114 msgid "" ">>> os.path.commonprefix(['/usr/lib', '/usr/local/lib'])\n" "'/usr/l'\n" @@ -191,7 +195,7 @@ msgstr "" ">>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])\n" "'/usr'" -#: ../../library/os.path.rst:124 +#: ../../library/os.path.rst:126 msgid "" "Return the directory name of pathname *path*. This is the first element of " "the pair returned by passing *path* to the function :func:`split`." @@ -199,7 +203,7 @@ msgstr "" "回傳路徑名 *path* 的目錄名稱。這是將 *path* 傳遞給函式 :func:`split` 後回傳之" "成對結果中的第一個元素。" -#: ../../library/os.path.rst:133 +#: ../../library/os.path.rst:135 msgid "" "Return ``True`` if *path* refers to an existing path or an open file " "descriptor. Returns ``False`` for broken symbolic links. On some " @@ -211,7 +215,7 @@ msgstr "" "的符號連結則回傳 ``False``。在某些平台上,即使 *path* 實際存在,如果未被授予" "執行 :func:`os.stat` 的權限,此函式仍可能回傳 ``False``。" -#: ../../library/os.path.rst:139 +#: ../../library/os.path.rst:141 msgid "" "*path* can now be an integer: ``True`` is returned if it is an open file " "descriptor, ``False`` otherwise." @@ -219,7 +223,7 @@ msgstr "" "現在 *path* 可以是一個整數:如果它是一個開啟的檔案描述器,則回傳 ``True``;否" "則回傳 ``False``。" -#: ../../library/os.path.rst:149 +#: ../../library/os.path.rst:151 msgid "" "Return ``True`` if *path* refers to an existing path, including broken " "symbolic links. Equivalent to :func:`exists` on platforms lacking :func:" @@ -228,7 +232,7 @@ msgstr "" "如果 *path* 是一個存在的路徑則回傳 ``True``,對已損壞的符號連結也是。在缺乏 :" "func:`os.lstat` 的平台上,與 :func:`exists` 函式等效。" -#: ../../library/os.path.rst:161 +#: ../../library/os.path.rst:163 msgid "" "On Unix and Windows, return the argument with an initial component of ``~`` " "or ``~user`` replaced by that *user*'s home directory." @@ -236,7 +240,7 @@ msgstr "" "在 Unix 和 Windows 上,將引數中以 ``~`` 或 ``~user`` 開頭的部分替換為該 " "*user* 的家目錄。" -#: ../../library/os.path.rst:166 +#: ../../library/os.path.rst:168 msgid "" "On Unix, an initial ``~`` is replaced by the environment variable :envvar:" "`HOME` if it is set; otherwise the current user's home directory is looked " @@ -247,7 +251,7 @@ msgstr "" "數的值;否則將使用內建模組 :mod:`pwd` 在密碼目錄中查找目前使用者的家目錄。對" "於初始的 ``~user``,直接在密碼目錄中查找該使用者的家目錄。" -#: ../../library/os.path.rst:171 +#: ../../library/os.path.rst:173 msgid "" "On Windows, :envvar:`USERPROFILE` will be used if set, otherwise a " "combination of :envvar:`HOMEPATH` and :envvar:`HOMEDRIVE` will be used. An " @@ -260,18 +264,18 @@ msgstr "" "目前使用者的家目錄的最後一個目錄元件是否與 :envvar:`USERNAME` 相符,如果相符" "則替換它。" -#: ../../library/os.path.rst:176 +#: ../../library/os.path.rst:178 msgid "" "If the expansion fails or if the path does not begin with a tilde, the path " "is returned unchanged." msgstr "" "如果展開失敗或路徑不以波浪符號 (tilde) 開頭,則回傳原始路徑,不做任何變更。" -#: ../../library/os.path.rst:182 +#: ../../library/os.path.rst:184 msgid "No longer uses :envvar:`HOME` on Windows." msgstr "在 Windows 上不再使用 :envvar:`HOME` 變數。" -#: ../../library/os.path.rst:191 +#: ../../library/os.path.rst:193 msgid "" "Return the argument with environment variables expanded. Substrings of the " "form ``$name`` or ``${name}`` are replaced by the value of environment " @@ -281,7 +285,7 @@ msgstr "" "回傳已展開環境變數的引數。形如 ``$name`` 或 ``${name}`` 的子字串會被替換為環" "境變數 *name* 的值。無效的變數名稱和對不存在變數的引用保持不變。" -#: ../../library/os.path.rst:196 +#: ../../library/os.path.rst:198 msgid "" "On Windows, ``%name%`` expansions are supported in addition to ``$name`` and " "``${name}``." @@ -289,7 +293,7 @@ msgstr "" "在 Windows 上,除了支援 ``$name`` 和 ``${name}`` 形式的展開外,還支援 " "``%name%`` 形式的展開。" -#: ../../library/os.path.rst:205 +#: ../../library/os.path.rst:207 msgid "" "Return the time of last access of *path*. The return value is a floating-" "point number giving the number of seconds since the epoch (see the :mod:" @@ -299,7 +303,7 @@ msgstr "" "回傳 *path* 的最後存取時間。回傳值是一個浮點數,表示自紀元(參見 :mod:`time` " "模組)以來的秒數。如果檔案不存在或無法存取,則引發 :exc:`OSError`。" -#: ../../library/os.path.rst:212 +#: ../../library/os.path.rst:214 msgid "" "Return the time of last modification of *path*. The return value is a " "floating-point number giving the number of seconds since the epoch (see " @@ -309,7 +313,7 @@ msgstr "" "回傳 *path* 的最後修改時間。回傳值是一個浮點數,表示自紀元(參見 :mod:`time` " "模組)以來的秒數。如果檔案不存在或無法存取,則引發 :exc:`OSError`。" -#: ../../library/os.path.rst:222 +#: ../../library/os.path.rst:224 msgid "" "Return the system's ctime which, on some systems (like Unix) is the time of " "the last metadata change, and, on others (like Windows), is the creation " @@ -322,7 +326,7 @@ msgstr "" "數,表示自紀元(參見 :mod:`time` 模組)以來的秒數。如果檔案不存在或無法存" "取),則引發 :exc:`OSError`。" -#: ../../library/os.path.rst:234 +#: ../../library/os.path.rst:236 msgid "" "Return the size, in bytes, of *path*. Raise :exc:`OSError` if the file does " "not exist or is inaccessible." @@ -330,7 +334,7 @@ msgstr "" "回傳 *path* 的大小(以位元組為單位)。如果檔案不存在或無法存取,則引發 :exc:" "`OSError`。" -#: ../../library/os.path.rst:243 +#: ../../library/os.path.rst:245 msgid "" "Return ``True`` if *path* is an absolute pathname. On Unix, that means it " "begins with a slash, on Windows that it begins with two (back)slashes, or a " @@ -340,17 +344,17 @@ msgstr "" "在 Windows 上,表示這是以兩個(反)斜線開頭或者以一個驅動機字母、冒號和(反)" "斜線開頭。" -#: ../../library/os.path.rst:247 +#: ../../library/os.path.rst:249 msgid ":func:`abspath`" msgstr ":func:`abspath`" -#: ../../library/os.path.rst:252 +#: ../../library/os.path.rst:254 msgid "" "On Windows, returns ``False`` if the given path starts with exactly one " "(back)slash." msgstr "" -#: ../../library/os.path.rst:259 +#: ../../library/os.path.rst:261 msgid "" "Return ``True`` if *path* is an :func:`existing ` regular file. This " "follows symbolic links, so both :func:`islink` and :func:`isfile` can be " @@ -360,7 +364,7 @@ msgstr "" "這將跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` 和 :func:" "`isfile` 的結果為真。" -#: ../../library/os.path.rst:269 +#: ../../library/os.path.rst:271 msgid "" "Return ``True`` if *path* is an :func:`existing ` directory. This " "follows symbolic links, so both :func:`islink` and :func:`isdir` can be true " @@ -370,7 +374,7 @@ msgstr "" "跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` 和 :func:`isdir` 的結" "果為真。" -#: ../../library/os.path.rst:279 +#: ../../library/os.path.rst:281 msgid "" "Return ``True`` if *path* refers to an :func:`existing ` directory " "entry that is a junction. Always return ``False`` if junctions are not " @@ -379,7 +383,7 @@ msgstr "" "如果 *path* 是指向\\ :func:`已存在的 `\\ 目錄條目且為聯接點 " "(junction),則回傳 ``True``。如果目前平台不支援聯接點,則始終返回 ``False``。" -#: ../../library/os.path.rst:288 +#: ../../library/os.path.rst:290 msgid "" "Return ``True`` if *path* refers to an :func:`existing ` directory " "entry that is a symbolic link. Always ``False`` if symbolic links are not " @@ -388,7 +392,7 @@ msgstr "" "如果 *path* 是指向\\ :func:`已存在的 `\\ 目錄項目且為符號連結,則回" "傳 ``True``。如果 Python 執行時不支援符號連結,則始終回傳 ``False``。" -#: ../../library/os.path.rst:298 +#: ../../library/os.path.rst:300 msgid "" "Return ``True`` if pathname *path* is a :dfn:`mount point`: a point in a " "file system where a different file system has been mounted. On POSIX, the " @@ -411,11 +415,11 @@ msgstr "" "在 Windows 上,以驅動機字母開頭的根目錄和 UNC 共享路徑始終是掛載點,對於任何" "其他路徑,會呼叫 ``GetVolumePathName`` 函式來檢查它是否與輸入路徑不同。" -#: ../../library/os.path.rst:309 +#: ../../library/os.path.rst:311 msgid "Added support for detecting non-root mount points on Windows." msgstr "新增在 Windows 上檢測非根目錄掛載點的支援。" -#: ../../library/os.path.rst:318 +#: ../../library/os.path.rst:320 msgid "" "Return ``True`` if pathname *path* is located on a Windows Dev Drive. A Dev " "Drive is optimized for developer scenarios, and offers faster performance " @@ -424,10 +428,10 @@ msgid "" "operations." msgstr "" "如果路徑名 *path* 位於 Windows Dev 驅動機上,則回傳 ``True``。Dev 驅動機針對" -"開發人員場景進行了最佳化,提供更快的讀寫檔案性能。建議將其用於原始程式碼、臨時" -"建置目錄、封包快取和其他 I/O 密集型操作。" +"開發人員場景進行了最佳化,提供更快的讀寫檔案性能。建議將其用於原始程式碼、臨" +"時建置目錄、封包快取和其他 I/O 密集型操作。" -#: ../../library/os.path.rst:324 +#: ../../library/os.path.rst:326 msgid "" "May raise an error for an invalid path, for example, one without a " "recognizable drive, but returns ``False`` on platforms that do not support " @@ -438,17 +442,17 @@ msgstr "" "碟機的平台上回傳 ``False``。請參閱 `Windows 文件 `_\\ 以了解有關啟用和建立 Dev 驅動機的資訊。" -#: ../../library/os.path.rst:331 +#: ../../library/os.path.rst:333 msgid "" "The function is now available on all platforms, and will always return " "``False`` on those that have no support for Dev Drives" msgstr "" -#: ../../library/os.path.rst:337 +#: ../../library/os.path.rst:339 msgid "Return ``True`` if *path* is a reserved pathname on the current system." msgstr "" -#: ../../library/os.path.rst:339 +#: ../../library/os.path.rst:341 msgid "" "On Windows, reserved filenames include those that end with a space or dot; " "those that contain colons (i.e. file streams such as \"name:stream\"), " @@ -457,7 +461,7 @@ msgid "" "\", \"AUX\", \"PRN\", \"COM1\", and \"LPT1\"." msgstr "" -#: ../../library/os.path.rst:347 +#: ../../library/os.path.rst:349 msgid "" "This function approximates rules for reserved paths on most Windows systems. " "These rules change over time in various Windows releases. This function may " @@ -465,11 +469,11 @@ msgid "" "available." msgstr "" -#: ../../library/os.path.rst:352 +#: ../../library/os.path.rst:354 msgid "Availability" msgstr "可用性" -#: ../../library/os.path.rst:359 +#: ../../library/os.path.rst:361 msgid "" "Join one or more path segments intelligently. The return value is the " "concatenation of *path* and all members of *\\*paths*, with exactly one " @@ -481,14 +485,14 @@ msgstr "" "每個非空部分後面都有一個目錄分隔符號,除了最後一個部分。換句話說,如果最後一" "個部分為空或以分隔符號結尾,結果只會以分隔符號結尾。" -#: ../../library/os.path.rst:365 +#: ../../library/os.path.rst:367 msgid "" "If a segment is an absolute path (which on Windows requires both a drive and " "a root), then all previous segments are ignored and joining continues from " "the absolute path segment. On Linux, for example::" msgstr "" -#: ../../library/os.path.rst:369 +#: ../../library/os.path.rst:371 msgid "" ">>> os.path.join('/home/foo', 'bar')\n" "'/home/foo/bar'\n" @@ -496,7 +500,7 @@ msgid "" "'/home/bar'" msgstr "" -#: ../../library/os.path.rst:374 +#: ../../library/os.path.rst:376 msgid "" "On Windows, the drive is not reset when a rooted path segment (e.g., " "``r'\\foo'``) is encountered. If a segment is on a different drive or is an " @@ -507,7 +511,7 @@ msgstr "" "一個段位於不同的驅動機上,或者是絕對路徑,則將忽略所有之前的段並重置驅動機。" "例如: ::" -#: ../../library/os.path.rst:379 +#: ../../library/os.path.rst:381 msgid "" ">>> os.path.join('c:\\\\', 'foo')\n" "'c:\\\\foo'\n" @@ -515,21 +519,21 @@ msgid "" "'d:\\\\bar'" msgstr "" -#: ../../library/os.path.rst:384 +#: ../../library/os.path.rst:386 msgid "" "Note that since there is a current directory for each drive, ``os.path." "join(\"c:\", \"foo\")`` represents a path relative to the current directory " "on drive :file:`C:` (:file:`c:foo`), not :file:`c:\\\\foo`." msgstr "" "請注意,由於每個驅動機都有目前目錄,``os.path.join(\"c:\", \"foo\")`` 表示相" -"對於驅動機 :file:`C:` 的目前目錄的路徑(:file:`c:foo`),而不是 :file:`c:" -"\\\\foo`。" +"對於驅動機 :file:`C:` 的目前目錄的路徑(:file:`c:foo`),而不是 :file:`c:\\" +"\\foo`。" -#: ../../library/os.path.rst:388 +#: ../../library/os.path.rst:390 msgid "Accepts a :term:`path-like object` for *path* and *paths*." msgstr "*path* 和 *paths* 接受 :term:`path-like object` 作為參數。" -#: ../../library/os.path.rst:394 +#: ../../library/os.path.rst:396 msgid "" "Normalize the case of a pathname. On Windows, convert all characters in the " "pathname to lowercase, and also convert forward slashes to backward slashes. " @@ -538,7 +542,7 @@ msgstr "" "將路徑名的大小寫規範化。在 Windows 上,將路徑名中的所有字元轉換為小寫,並將正" "斜線轉換為反斜線。在其他作業系統上,回傳原始路徑。" -#: ../../library/os.path.rst:404 +#: ../../library/os.path.rst:406 msgid "" "Normalize a pathname by collapsing redundant separators and up-level " "references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all " @@ -551,7 +555,7 @@ msgstr "" "結的路徑的含義。在 Windows 上,它將正斜線轉換為反斜線。要標準化大小寫,請使" "用 :func:`normcase`。" -#: ../../library/os.path.rst:411 +#: ../../library/os.path.rst:413 msgid "" "On POSIX systems, in accordance with `IEEE Std 1003.1 2013 Edition; 4.13 " "Pathname Resolution >> splitdrive(\"c:/dir\")\n" "(\"c:\", \"/dir\")" @@ -750,12 +754,12 @@ msgstr "" ">>> splitdrive(\"c:/dir\")\n" "(\"c:\", \"/dir\")" -#: ../../library/os.path.rst:560 +#: ../../library/os.path.rst:562 msgid "" "If the path contains a UNC path, drive will contain the host name and share::" msgstr "如果路徑包含 UNC 路徑,則驅動機將包含主機名和共享名: ::" -#: ../../library/os.path.rst:563 +#: ../../library/os.path.rst:565 msgid "" ">>> splitdrive(\"//host/computer/dir\")\n" "(\"//host/computer\", \"/dir\")" @@ -763,7 +767,7 @@ msgstr "" ">>> splitdrive(\"//host/computer/dir\")\n" "(\"//host/computer\", \"/dir\")" -#: ../../library/os.path.rst:572 +#: ../../library/os.path.rst:574 msgid "" "Split the pathname *path* into a 3-item tuple ``(drive, root, tail)`` where " "*drive* is a device name or mount point, *root* is a string of separators " @@ -776,7 +780,7 @@ msgstr "" "這些項目中的任何一個都可能是空字串。在所有情況下,``drive + root + tail`` 將" "與 *path* 相同。" -#: ../../library/os.path.rst:578 +#: ../../library/os.path.rst:580 msgid "" "On POSIX systems, *drive* is always empty. The *root* may be empty (if " "*path* is relative), a single forward slash (if *path* is absolute), or two " @@ -790,7 +794,7 @@ msgstr "" "onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>`_ 的實作定義)。例" "如: ::" -#: ../../library/os.path.rst:584 +#: ../../library/os.path.rst:586 msgid "" ">>> splitroot('/home/sam')\n" "('', '/', 'home/sam')\n" @@ -806,7 +810,7 @@ msgstr "" ">>> splitroot('///home/sam')\n" "('', '/', '//home/sam')" -#: ../../library/os.path.rst:591 +#: ../../library/os.path.rst:593 msgid "" "On Windows, *drive* may be empty, a drive-letter name, a UNC share, or a " "device name. The *root* may be empty, a forward slash, or a backward slash. " @@ -815,7 +819,7 @@ msgstr "" "在 Windows 上,*drive* 可能為空、驅動機名稱、UNC 共享或設備名稱。*root* 可能" "為空,斜線或反斜線。例如: ::" -#: ../../library/os.path.rst:595 +#: ../../library/os.path.rst:597 msgid "" ">>> splitroot('C:/Users/Sam')\n" "('C:', '/', 'Users/Sam')\n" @@ -827,7 +831,7 @@ msgstr "" ">>> splitroot('//Server/Share/Users/Sam')\n" "('//Server/Share', '/', 'Users/Sam')" -#: ../../library/os.path.rst:605 +#: ../../library/os.path.rst:607 msgid "" "Split the pathname *path* into a pair ``(root, ext)`` such that ``root + " "ext == path``, and the extension, *ext*, is empty or begins with a period " @@ -836,11 +840,11 @@ msgstr "" "將路徑名 *path* 拆分為一對 ``(root, ext)``,使得 ``root + ext == path``,且副" "檔名 *ext* 為空或以點開頭且最多包含一個點 (period)。" -#: ../../library/os.path.rst:609 +#: ../../library/os.path.rst:611 msgid "If the path contains no extension, *ext* will be ``''``::" msgstr "如果路徑不包含副檔名,則 *ext* 將為 ``''``: ::" -#: ../../library/os.path.rst:611 +#: ../../library/os.path.rst:613 msgid "" ">>> splitext('bar')\n" "('bar', '')" @@ -848,7 +852,7 @@ msgstr "" ">>> splitext('bar')\n" "('bar', '')" -#: ../../library/os.path.rst:614 +#: ../../library/os.path.rst:616 msgid "" "If the path contains an extension, then *ext* will be set to this extension, " "including the leading period. Note that previous periods will be ignored::" @@ -856,7 +860,7 @@ msgstr "" "如果路徑包含副檔名,則 *ext* 將設置為該副檔名,包括前導的點。請注意,前面的點" "將被忽略: ::" -#: ../../library/os.path.rst:617 +#: ../../library/os.path.rst:619 msgid "" ">>> splitext('foo.bar.exe')\n" "('foo.bar', '.exe')\n" @@ -868,13 +872,13 @@ msgstr "" ">>> splitext('/foo/bar.exe')\n" "('/foo/bar', '.exe')" -#: ../../library/os.path.rst:622 +#: ../../library/os.path.rst:624 msgid "" "Leading periods of the last component of the path are considered to be part " "of the root::" msgstr "路徑的最後一個部份的前導點被認為是根的一部分: ::" -#: ../../library/os.path.rst:625 +#: ../../library/os.path.rst:627 msgid "" ">>> splitext('.cshrc')\n" "('.cshrc', '')\n" @@ -886,7 +890,7 @@ msgstr "" ">>> splitext('/foo/....jpg')\n" "('/foo/....jpg', '')" -#: ../../library/os.path.rst:636 +#: ../../library/os.path.rst:638 msgid "" "``True`` if arbitrary Unicode strings can be used as file names (within " "limitations imposed by the file system)." @@ -902,34 +906,34 @@ msgstr "path(路徑)" msgid "operations" msgstr "operations(操作)" -#: ../../library/os.path.rst:157 +#: ../../library/os.path.rst:159 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../library/os.path.rst:157 +#: ../../library/os.path.rst:159 msgid "home directory expansion" msgstr "home directory expansion(家目錄展開)" -#: ../../library/os.path.rst:164 +#: ../../library/os.path.rst:166 msgid "module" msgstr "module(模組)" -#: ../../library/os.path.rst:164 +#: ../../library/os.path.rst:166 msgid "pwd" msgstr "pwd" -#: ../../library/os.path.rst:185 +#: ../../library/os.path.rst:187 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/os.path.rst:185 +#: ../../library/os.path.rst:187 msgid "environment variables expansion" msgstr "environment variables expansion(環境變數展開)" -#: ../../library/os.path.rst:185 +#: ../../library/os.path.rst:187 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/os.path.rst:185 +#: ../../library/os.path.rst:187 msgid "environment variables expansion (Windows)" msgstr "environment variables expansion (Windows)(環境變數展開 (Windows))" diff --git a/library/os.po b/library/os.po index f97093cb3c..4cfda9d099 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-01-07 00:14+0000\n" +"POT-Creation-Date: 2026-01-27 00:17+0000\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -4408,7 +4408,7 @@ msgid "" "import os\n" "\n" "# semaphore with start value '1'\n" -"fd = os.eventfd(1, os.EFD_SEMAPHORE | os.EFC_CLOEXEC)\n" +"fd = os.eventfd(1, os.EFD_SEMAPHORE | os.EFD_CLOEXEC)\n" "try:\n" " # acquire semaphore\n" " v = os.eventfd_read(fd)\n" diff --git a/library/pickle.po b/library/pickle.po index 035cdbf6eb..0aeb4c5403 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2026-01-27 00:17+0000\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,9 +39,9 @@ msgid "" "The :mod:`pickle` module implements binary protocols for serializing and de-" "serializing a Python object structure. *\"Pickling\"* is the process " "whereby a Python object hierarchy is converted into a byte stream, and " -"*\"unpickling\"* is the inverse operation, whereby a byte stream (from " -"a :term:`binary file` or :term:`bytes-like object`) is converted back into " -"an object hierarchy. Pickling (and unpickling) is alternatively known as " +"*\"unpickling\"* is the inverse operation, whereby a byte stream (from a :" +"term:`binary file` or :term:`bytes-like object`) is converted back into an " +"object hierarchy. Pickling (and unpickling) is alternatively known as " "\"serialization\", \"marshalling,\" [#]_ or \"flattening\"; however, to " "avoid confusion, the terms used here are \"pickling\" and \"unpickling\"." msgstr "" @@ -92,12 +92,12 @@ msgstr "和 ``marshal`` 的比較" msgid "" "Python has a more primitive serialization module called :mod:`marshal`, but " "in general :mod:`pickle` should always be the preferred way to serialize " -"Python objects. :mod:`marshal` exists primarily to support " -"Python's :file:`.pyc` files." +"Python objects. :mod:`marshal` exists primarily to support Python's :file:`." +"pyc` files." msgstr "" "Python 有另一個比較原始的序列化模組叫 :mod:`marshal`,不過其設計目的是為了支" -"援 Python 的預編譯功能 :file:`.pyc` 的運作。總地來說,請盡可能地使" -"用 :mod:`pickle`,沒事不要用 :mod:`marshal`。" +"援 Python 的預編譯功能 :file:`.pyc` 的運作。總地來說,請盡可能地使用 :mod:" +"`pickle`,沒事不要用 :mod:`marshal`。" #: ../../library/pickle.rst:57 msgid "" @@ -107,33 +107,6 @@ msgstr ":mod:`pickle` 和 :mod:`marshal` 有幾個明顯不同的地方:" #: ../../library/pickle.rst:59 msgid "" -"The :mod:`pickle` module keeps track of the objects it has already " -"serialized, so that later references to the same object won't be serialized " -"again. :mod:`marshal` doesn't do this." -msgstr "" -":mod:`pickle` 會記住哪些物件已經被序列化過了,稍後再次參照到這個物件的時候才" -"不會進行重複的序列化。:mod:`marshal` 沒有這個功能。" - -#: ../../library/pickle.rst:63 -msgid "" -"This has implications both for recursive objects and object sharing. " -"Recursive objects are objects that contain references to themselves. These " -"are not handled by marshal, and in fact, attempting to marshal recursive " -"objects will crash your Python interpreter. Object sharing happens when " -"there are multiple references to the same object in different places in the " -"object hierarchy being serialized. :mod:`pickle` stores such objects only " -"once, and ensures that all other references point to the master copy. " -"Shared objects remain shared, which can be very important for mutable " -"objects." -msgstr "" -"這對遞迴物件和物件共用都有影響。遞迴物件是指包含自我參照的物件。這些情況在 " -"marshal 模組中不會被處理,若嘗試使用 marshal 處理遞迴物件會導致 Python 直譯器" -"崩潰。物件共用發生在序列化的物件階層中、不同位置對同一物件有多個參照" -"時。:mod:`pickle` 只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主" -"要的版本。共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" - -#: ../../library/pickle.rst:72 -msgid "" ":mod:`marshal` cannot be used to serialize user-defined classes and their " "instances. :mod:`pickle` can save and restore class instances " "transparently, however the class definition must be importable and live in " @@ -143,17 +116,17 @@ msgstr "" "者儲存並還原自訂的類別實例,前提是儲存時該類別的定義存在於與要被儲存的物件所" "在的模組中、且可以被引入(import)。" -#: ../../library/pickle.rst:77 +#: ../../library/pickle.rst:64 msgid "" "The :mod:`marshal` serialization format is not guaranteed to be portable " -"across Python versions. Because its primary job in life is to " -"support :file:`.pyc` files, the Python implementers reserve the right to " -"change the serialization format in non-backwards compatible ways should the " -"need arise. The :mod:`pickle` serialization format is guaranteed to be " -"backwards compatible across Python releases provided a compatible pickle " -"protocol is chosen and pickling and unpickling code deals with Python 2 to " -"Python 3 type differences if your data is crossing that unique breaking " -"change language boundary." +"across Python versions. Because its primary job in life is to support :file:" +"`.pyc` files, the Python implementers reserve the right to change the " +"serialization format in non-backwards compatible ways should the need arise. " +"The :mod:`pickle` serialization format is guaranteed to be backwards " +"compatible across Python releases provided a compatible pickle protocol is " +"chosen and pickling and unpickling code deals with Python 2 to Python 3 type " +"differences if your data is crossing that unique breaking change language " +"boundary." msgstr "" ":mod:`marshal` 序列化格式無法保證能在不同版本的 Python 之間移植。因為其主要的" "作用是支援 :file:`.pyc` 檔案的運作,Python 的實作人員會在需要時實作無法前向相" @@ -161,11 +134,11 @@ msgstr "" "3 之間的資料類型差異,:mod:`pickle` 序列化協定能保證在不同 Python 版本間的相" "容性。" -#: ../../library/pickle.rst:90 +#: ../../library/pickle.rst:77 msgid "Comparison with ``json``" msgstr "和 ``json`` 的比較" -#: ../../library/pickle.rst:92 +#: ../../library/pickle.rst:79 msgid "" "There are fundamental differences between the pickle protocols and `JSON " "(JavaScript Object Notation) `_:" @@ -173,7 +146,7 @@ msgstr "" "pickle 協定和 `JSON (JavaScript Object Notation) `_ 有一些" "根本上的不同:" -#: ../../library/pickle.rst:95 +#: ../../library/pickle.rst:82 msgid "" "JSON is a text serialization format (it outputs unicode text, although most " "of the time it is then encoded to ``utf-8``), while pickle is a binary " @@ -182,11 +155,11 @@ msgstr "" "JSON 以文字形式作為序列化的輸出(輸出 unicode 文字,但大多數又會被編碼為 " "``UTF-8``),而 pickle 則是以二進位形式作為序列化的輸出;" -#: ../../library/pickle.rst:99 +#: ../../library/pickle.rst:86 msgid "JSON is human-readable, while pickle is not;" msgstr "JSON 是人類可讀的,而 pickle 則無法;" -#: ../../library/pickle.rst:101 +#: ../../library/pickle.rst:88 msgid "" "JSON is interoperable and widely used outside of the Python ecosystem, while " "pickle is Python-specific;" @@ -200,19 +173,19 @@ msgstr "" # https://zh.wikipedia.org/wiki/%E5%86%85%E7%9C%81_(%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%A7%91%E5%AD%A6) # https://book.pythontips.com/en/latest/object_introspection.html # https://www.geeksforgeeks.org/code-introspection-in-python/ -#: ../../library/pickle.rst:104 +#: ../../library/pickle.rst:91 msgid "" "JSON, by default, can only represent a subset of the Python built-in types, " "and no custom classes; pickle can represent an extremely large number of " "Python types (many of them automatically, by clever usage of Python's " -"introspection facilities; complex cases can be tackled by " -"implementing :ref:`specific object APIs `);" +"introspection facilities; complex cases can be tackled by implementing :ref:" +"`specific object APIs `);" msgstr "" "預設狀態下的 JSON 只能紀錄一小部份的 Python 內建型別,且無法紀錄自訂類別;但" "透過 Python 的自省措施,pickle 可以紀錄絕大多數的 Python 型別(其他比較複雜的" "狀況也可以透過實作 :ref:`specific object APIs ` 來解決);" -#: ../../library/pickle.rst:110 +#: ../../library/pickle.rst:97 msgid "" "Unlike pickle, deserializing untrusted JSON does not in itself create an " "arbitrary code execution vulnerability." @@ -220,7 +193,7 @@ msgstr "" "去序列化不安全的 JSON 不會產生任意程式執行的風險,但去序列化不安全的 pickle " "會。" -#: ../../library/pickle.rst:114 +#: ../../library/pickle.rst:101 msgid "" "The :mod:`json` module: a standard library module allowing JSON " "serialization and deserialization." @@ -228,11 +201,11 @@ msgstr "" ":mod:`json` module: 是標準函式庫的一部分,可讓使用者進行 JSON 的序列化與去序" "列化。" -#: ../../library/pickle.rst:121 +#: ../../library/pickle.rst:108 msgid "Data stream format" msgstr "資料串流格式" -#: ../../library/pickle.rst:126 +#: ../../library/pickle.rst:113 msgid "" "The data format used by :mod:`pickle` is Python-specific. This has the " "advantage that there are no restrictions imposed by external standards such " @@ -243,7 +216,7 @@ msgstr "" "(像是 JSON,無法紀錄指標共用)的限制;不過這也代表其他不是 Python 的程式可能" "無法重建 pickle 封裝的 Python 物件。" -#: ../../library/pickle.rst:131 +#: ../../library/pickle.rst:118 msgid "" "By default, the :mod:`pickle` data format uses a relatively compact binary " "representation. If you need optimal size characteristics, you can " @@ -252,17 +225,16 @@ msgstr "" "以預設設定來說,:mod:`pickle` 使用相對緊湊的二進位形式來儲存資料。如果你需要" "盡可能地縮小檔案大小,你可以\\ :doc:`壓縮 `\\ 封裝的資料。" -#: ../../library/pickle.rst:135 +#: ../../library/pickle.rst:122 msgid "" "The module :mod:`pickletools` contains tools for analyzing data streams " "generated by :mod:`pickle`. :mod:`pickletools` source code has extensive " "comments about opcodes used by pickle protocols." msgstr "" -":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料" -"流。:mod:`pickletools` 的源始碼詳細地記載了所有 pickle 協定的操作碼" -"(opcode)。" +":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料流。:mod:" +"`pickletools` 的源始碼詳細地記載了所有 pickle 協定的操作碼(opcode)。" -#: ../../library/pickle.rst:139 +#: ../../library/pickle.rst:126 msgid "" "There are currently 6 different protocols which can be used for pickling. " "The higher the protocol used, the more recent the version of Python needed " @@ -271,20 +243,20 @@ msgstr "" "截至目前為止,共有六種不同版本的協定可用於封裝 pickle。數字越大版本代表你需要" "使用越新的 Python 版本來拆封相應的 pickle 封裝。" -#: ../../library/pickle.rst:143 +#: ../../library/pickle.rst:130 msgid "" "Protocol version 0 is the original \"human-readable\" protocol and is " "backwards compatible with earlier versions of Python." msgstr "" "版本 0 的協定是最初「人類可讀」的版本,且可以向前支援早期版本的 Python。" -#: ../../library/pickle.rst:146 +#: ../../library/pickle.rst:133 msgid "" "Protocol version 1 is an old binary format which is also compatible with " "earlier versions of Python." msgstr "版本 1 的協定使用舊的二進位格式,一樣能向前支援早期版本的 Python。" -#: ../../library/pickle.rst:149 +#: ../../library/pickle.rst:136 msgid "" "Protocol version 2 was introduced in Python 2.3. It provides much more " "efficient pickling of :term:`new-style classes `. Refer " @@ -294,27 +266,27 @@ msgstr "" "classes ` 封裝過程。請參閱 :pep:`307` 以了解版本 2 帶來的改" "進。" -#: ../../library/pickle.rst:153 +#: ../../library/pickle.rst:140 msgid "" -"Protocol version 3 was added in Python 3.0. It has explicit support " -"for :class:`bytes` objects and cannot be unpickled by Python 2.x. This was " -"the default protocol in Python 3.0--3.7." +"Protocol version 3 was added in Python 3.0. It has explicit support for :" +"class:`bytes` objects and cannot be unpickled by Python 2.x. This was the " +"default protocol in Python 3.0--3.7." msgstr "" "版本 3 的協定在 Python 3.0 被新增。現在能支援封裝 :class:`bytes` 的物件且無法" "被 2.x 版本的 Python 拆封。在 3.0~3.7 的 Python 預設使用 3 版協定。" -#: ../../library/pickle.rst:157 +#: ../../library/pickle.rst:144 msgid "" "Protocol version 4 was added in Python 3.4. It adds support for very large " "objects, pickling more kinds of objects, and some data format " -"optimizations. This was the default protocol in Python 3.8--3.13. Refer " -"to :pep:`3154` for information about improvements brought by protocol 4." +"optimizations. This was the default protocol in Python 3.8--3.13. Refer to :" +"pep:`3154` for information about improvements brought by protocol 4." msgstr "" "版本 4 的協定在 Python 3.4 被新增。現在能支援超大物件的封裝、更多種型別的物件" -"以及針對部份資料格式的儲存進行最佳化。從 Python 3.8 到 3.13,預設使用第 4 版協定。" -"請參閱 :pep:`3154` 以了解第 4 版協定改進的細節。" +"以及針對部份資料格式的儲存進行最佳化。從 Python 3.8 到 3.13,預設使用第 4 版" +"協定。請參閱 :pep:`3154` 以了解第 4 版協定改進的細節。" -#: ../../library/pickle.rst:163 +#: ../../library/pickle.rst:150 msgid "" "Protocol version 5 was added in Python 3.8. It adds support for out-of-band " "data and speedup for in-band data. It is the default protocol starting with " @@ -322,7 +294,8 @@ msgid "" "by protocol 5." msgstr "" "版本 5 的協定在 Python 3.8 被新增。現在能支援帶外資料(Out-of-band data)並加" -"速帶內資料的處理速度。自 3.14 起這是預設使用的協定。請參閱 :pep:`574` 以了解第 5 版協定改進的細節。" +"速帶內資料的處理速度。自 3.14 起這是預設使用的協定。請參閱 :pep:`574` 以了解" +"第 5 版協定改進的細節。" # SkyLull: [T] # persistent -> 持久 @@ -331,11 +304,11 @@ msgstr "" # tw/%E5%8F%AF%E6%8C%81%E4%B9%85%E5%8C%96%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84 # https://1fly2sky.wordpress.com/2016/04/05/%E6%8C%81%E4%B9%85%E5%B1%A4data- # persistence-layer/ -#: ../../library/pickle.rst:169 +#: ../../library/pickle.rst:156 msgid "" -"Serialization is a more primitive notion than persistence; " -"although :mod:`pickle` reads and writes file objects, it does not handle the " -"issue of naming persistent objects, nor the (even more complicated) issue of " +"Serialization is a more primitive notion than persistence; although :mod:" +"`pickle` reads and writes file objects, it does not handle the issue of " +"naming persistent objects, nor the (even more complicated) issue of " "concurrent access to persistent objects. The :mod:`pickle` module can " "transform a complex object into a byte stream and it can transform the byte " "stream into an object with the same internal structure. Perhaps the most " @@ -352,71 +325,70 @@ msgstr "" "提供了一個簡單的介面來讓使用者在 DBM 風格的資料庫檔案中對物件進行封裝和拆封的" "操作。" -#: ../../library/pickle.rst:182 +#: ../../library/pickle.rst:169 msgid "Module Interface" msgstr "模組介面" -#: ../../library/pickle.rst:184 +#: ../../library/pickle.rst:171 msgid "" "To serialize an object hierarchy, you simply call the :func:`dumps` " -"function. Similarly, to de-serialize a data stream, you call " -"the :func:`loads` function. However, if you want more control over " -"serialization and de-serialization, you can create a :class:`Pickler` or " -"an :class:`Unpickler` object, respectively." +"function. Similarly, to de-serialize a data stream, you call the :func:" +"`loads` function. However, if you want more control over serialization and " +"de-serialization, you can create a :class:`Pickler` or an :class:`Unpickler` " +"object, respectively." msgstr "" "想要序列化一個物件,你只需要呼叫 :func:`dumps` 函式。而當你想要去序列化一個資" "料流時,你只需要呼叫 :func:`loads` 即可。不過,若你希望能各自對序列化和去序列" -"化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` " -"或 :class:`Unpickler` 物件。" +"化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` 或 :class:" +"`Unpickler` 物件。" -#: ../../library/pickle.rst:189 +#: ../../library/pickle.rst:176 msgid "The :mod:`pickle` module provides the following constants:" msgstr ":mod:`pickle` 模組提供以下常數:" -#: ../../library/pickle.rst:194 +#: ../../library/pickle.rst:181 msgid "" "An integer, the highest :ref:`protocol version ` " -"available. This value can be passed as a *protocol* value to " -"functions :func:`dump` and :func:`dumps` as well as the :class:`Pickler` " -"constructor." +"available. This value can be passed as a *protocol* value to functions :" +"func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor." msgstr "" "一個整數,表示可使用的最高\\ :ref:`協定版本 `。這個值可作" -"為 *protocol* 的數值傳給 :func:`dump` 和 :func:`dumps` 函式以" -"及 :class:`Pickler` 建構式。" +"為 *protocol* 的數值傳給 :func:`dump` 和 :func:`dumps` 函式以及 :class:" +"`Pickler` 建構式。" -#: ../../library/pickle.rst:201 +#: ../../library/pickle.rst:188 msgid "" "An integer, the default :ref:`protocol version ` used for " "pickling. May be less than :data:`HIGHEST_PROTOCOL`. Currently the default " "protocol is 5, introduced in Python 3.8 and incompatible with previous " -"versions. This version introduces support for out-of-band buffers, " -"where :pep:`3118`-compatible data can be transmitted separately from the " -"main pickle stream." +"versions. This version introduces support for out-of-band buffers, where :" +"pep:`3118`-compatible data can be transmitted separately from the main " +"pickle stream." msgstr "" -"一個整數,用於 pickle 的預設 :ref:`協定版本 `。可能小於 " -":data:`HIGHEST_PROTOCOL`。目前預設協定是 5,在 Python 3.8 中引入,與之前的版本不相容。" -"此版本引入了對 out-of-band buffer 的支援,其中 :pep:`3118` 相容的資料可以與主要 " -"pickle 串流分開傳輸。" +"一個整數,用於 pickle 的預設 :ref:`協定版本 `。可能小於 :" +"data:`HIGHEST_PROTOCOL`。目前預設協定是 5,在 Python 3.8 中引入,與之前的版本" +"不相容。此版本引入了對 out-of-band buffer 的支援,其中 :pep:`3118` 相容的資料" +"可以與主要 pickle 串流分開傳輸。" -#: ../../library/pickle.rst:210 +#: ../../library/pickle.rst:197 msgid "The default protocol is 3." msgstr "預設協定版本為 3。" -#: ../../library/pickle.rst:214 +#: ../../library/pickle.rst:201 msgid "The default protocol is 4." msgstr "預設協定版本為 4。" -#: ../../library/pickle.rst:218 +#: ../../library/pickle.rst:205 msgid "The default protocol is 5." msgstr "預設協定是 5。" -#: ../../library/pickle.rst:220 +#: ../../library/pickle.rst:207 msgid "" "The :mod:`pickle` module provides the following functions to make the " "pickling process more convenient:" msgstr ":mod:`pickle` 模組提供下列函式來簡化封裝的過程:" -#: ../../library/pickle.rst:225 +#: ../../library/pickle.rst:212 msgid "" "Write the pickled representation of the object *obj* to the open :term:`file " "object` *file*. This is equivalent to ``Pickler(file, protocol).dump(obj)``." @@ -424,20 +396,20 @@ msgstr "" "將被封裝成 pickle 形式的物件 *obj* 寫入到已開啟的\\ :term:`file object` " "*file*。這等效於\\ ``Pickler(file, protocol).dump(obj)``。" -#: ../../library/pickle.rst:229 +#: ../../library/pickle.rst:216 msgid "" "Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the " "same meaning as in the :class:`Pickler` constructor." msgstr "" -"引數 *file*、*protocol*、*fix_imports* 和 *buffer_callback* 的意義" -"與 :class:`Pickler` 建構式中的相同。" +"引數 *file*、*protocol*、*fix_imports* 和 *buffer_callback* 的意義與 :class:" +"`Pickler` 建構式中的相同。" -#: ../../library/pickle.rst:232 ../../library/pickle.rst:243 -#: ../../library/pickle.rst:335 +#: ../../library/pickle.rst:219 ../../library/pickle.rst:230 +#: ../../library/pickle.rst:322 msgid "The *buffer_callback* argument was added." msgstr "新增 *buffer_callback* 引數。" -#: ../../library/pickle.rst:237 +#: ../../library/pickle.rst:224 msgid "" "Return the pickled representation of the object *obj* as a :class:`bytes` " "object, instead of writing it to a file." @@ -445,15 +417,15 @@ msgstr "" "將被封裝為 pickle 形式的物件 *obj* 以 :class:`bytes` 類別回傳,而非寫入進檔" "案。" -#: ../../library/pickle.rst:240 +#: ../../library/pickle.rst:227 msgid "" "Arguments *protocol*, *fix_imports* and *buffer_callback* have the same " "meaning as in the :class:`Pickler` constructor." msgstr "" -"引數 *protocol*、*fix_imports* 和 *buffer_callback* 的意義" -"和 :class:`Pickler` 建構式中的相同。" +"引數 *protocol*、*fix_imports* 和 *buffer_callback* 的意義和 :class:" +"`Pickler` 建構式中的相同。" -#: ../../library/pickle.rst:248 +#: ../../library/pickle.rst:235 msgid "" "Read the pickled representation of an object from the open :term:`file " "object` *file* and return the reconstituted object hierarchy specified " @@ -462,7 +434,7 @@ msgstr "" "從已開啟的 :term:`檔案物件 ` *file* 中讀取已序列化的物件,並傳回" "其重建後的物件階層。這相當於呼叫 ``Unpickler(file).load()``。" -#: ../../library/pickle.rst:252 ../../library/pickle.rst:267 +#: ../../library/pickle.rst:239 ../../library/pickle.rst:254 msgid "" "The protocol version of the pickle is detected automatically, so no protocol " "argument is needed. Bytes past the pickled representation of the object are " @@ -471,7 +443,7 @@ msgstr "" "模組會自動偵測 pickle 封包所使用的協定版本,所以無須另外指定。超出 pickle 封" "包表示範圍的位元組將被忽略。" -#: ../../library/pickle.rst:256 +#: ../../library/pickle.rst:243 msgid "" "Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and " "*buffers* have the same meaning as in the :class:`Unpickler` constructor." @@ -479,12 +451,12 @@ msgstr "" "引數 *file*、*fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意" "義和 :class:`Unpickler` 建構式中的相同。" -#: ../../library/pickle.rst:259 ../../library/pickle.rst:274 -#: ../../library/pickle.rst:449 +#: ../../library/pickle.rst:246 ../../library/pickle.rst:261 +#: ../../library/pickle.rst:436 msgid "The *buffers* argument was added." msgstr "新增 *buffer* 引數。" -#: ../../library/pickle.rst:264 +#: ../../library/pickle.rst:251 msgid "" "Return the reconstituted object hierarchy of the pickled representation " "*data* of an object. *data* must be a :term:`bytes-like object`." @@ -492,26 +464,26 @@ msgstr "" "回傳從 *data* 的 pickle 封包重建後的物件階層。*data* 必須是一個 :term:`bytes-" "like object`。" -#: ../../library/pickle.rst:271 +#: ../../library/pickle.rst:258 msgid "" "Arguments *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have " "the same meaning as in the :class:`Unpickler` constructor." msgstr "" -"引數 *fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意義" -"與 :class:`Unpickler` 建構式所用的相同。" +"引數 *fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意義與 :" +"class:`Unpickler` 建構式所用的相同。" -#: ../../library/pickle.rst:278 +#: ../../library/pickle.rst:265 msgid "The :mod:`pickle` module defines three exceptions:" msgstr ":mod:`pickle` 模組定義了以下三種例外:" -#: ../../library/pickle.rst:282 +#: ../../library/pickle.rst:269 msgid "" -"Common base class for the other pickling exceptions. It inherits " -"from :exc:`Exception`." +"Common base class for the other pickling exceptions. It inherits from :exc:" +"`Exception`." msgstr "" "繼承 :exc:`Exception` 類別。一個在封裝或拆封時遭遇其他例外時通用的基底類別。" -#: ../../library/pickle.rst:287 +#: ../../library/pickle.rst:274 msgid "" "Error raised when an unpicklable object is encountered by :class:`Pickler`. " "It inherits from :exc:`PickleError`." @@ -519,21 +491,21 @@ msgstr "" "當 :class:`Pickler` 遭遇無法封裝物件時會引發的例外。繼承 :exc:`PickleError` " "類別。" -#: ../../library/pickle.rst:290 +#: ../../library/pickle.rst:277 msgid "" "Refer to :ref:`pickle-picklable` to learn what kinds of objects can be " "pickled." msgstr "請參閱 :ref:`pickle-picklable` 以了解哪些物件是可以被封裝的。" -#: ../../library/pickle.rst:295 +#: ../../library/pickle.rst:282 msgid "" "Error raised when there is a problem unpickling an object, such as a data " "corruption or a security violation. It inherits from :exc:`PickleError`." msgstr "" -"拆封物件時遇到問題(如資料毀損或違反安全性原則等)所引發的意外。繼承" -"自 :exc:`PickleError` 類別。" +"拆封物件時遇到問題(如資料毀損或違反安全性原則等)所引發的意外。繼承自 :exc:" +"`PickleError` 類別。" -#: ../../library/pickle.rst:298 +#: ../../library/pickle.rst:285 msgid "" "Note that other exceptions may also be raised during unpickling, including " "(but not necessarily limited to) AttributeError, EOFError, ImportError, and " @@ -542,19 +514,19 @@ msgstr "" "拆封的時候還是可能會遭遇其他不在此列的例外(例如:AttributeError、EOFError、" "ImportError、或 IndexError),請注意。" -#: ../../library/pickle.rst:303 +#: ../../library/pickle.rst:290 msgid "" -"The :mod:`pickle` module exports three " -"classes, :class:`Pickler`, :class:`Unpickler` and :class:`PickleBuffer`:" +"The :mod:`pickle` module exports three classes, :class:`Pickler`, :class:" +"`Unpickler` and :class:`PickleBuffer`:" msgstr "" -"引入模組 :mod:`pickle` 時會帶來三個類" -"別::class:`Pickler`、:class:`Unpickler` 和 :class:`PickleBuffer`:" +"引入模組 :mod:`pickle` 時會帶來三個類別::class:`Pickler`、:class:" +"`Unpickler` 和 :class:`PickleBuffer`:" -#: ../../library/pickle.rst:308 +#: ../../library/pickle.rst:295 msgid "This takes a binary file for writing a pickle data stream." msgstr "接受一個用以寫入 pickle 資料流的二進位檔案。" -#: ../../library/pickle.rst:310 +#: ../../library/pickle.rst:297 msgid "" "The optional *protocol* argument, an integer, tells the pickler to use the " "given protocol; supported protocols are 0 to :data:`HIGHEST_PROTOCOL`. If " @@ -562,22 +534,21 @@ msgid "" "number is specified, :data:`HIGHEST_PROTOCOL` is selected." msgstr "" "可選引數 *protocol* 接受整數,用來要求封裝器(pickler)使用指定的協定;支援" -"從 0 版起到 :data:`HIGHEST_PROTOCOL` 版的協定。如未指定,則預設" -"為 :data:`DEFAULT_PROTOCOL`。若指定了負數,則視為選" -"擇 :data:`HIGHEST_PROTOCOL`。" +"從 0 版起到 :data:`HIGHEST_PROTOCOL` 版的協定。如未指定,則預設為 :data:" +"`DEFAULT_PROTOCOL`。若指定了負數,則視為選擇 :data:`HIGHEST_PROTOCOL`。" -#: ../../library/pickle.rst:315 +#: ../../library/pickle.rst:302 msgid "" "The *file* argument must have a write() method that accepts a single bytes " -"argument. It can thus be an on-disk file opened for binary writing, " -"an :class:`io.BytesIO` instance, or any other custom object that meets this " +"argument. It can thus be an on-disk file opened for binary writing, an :" +"class:`io.BytesIO` instance, or any other custom object that meets this " "interface." msgstr "" "引數 *file* 必須支援可寫入單一位元組引數的 write() 方法。只要滿足此條件,傳入" "的物件可以是一個硬碟上二進位檔案、一個 :class:`io.BytesIO` 實例或任何其他滿足" "這個介面要求的物件。" -#: ../../library/pickle.rst:320 +#: ../../library/pickle.rst:307 msgid "" "If *fix_imports* is true and *protocol* is less than 3, pickle will try to " "map the new Python 3 names to the old module names used in Python 2, so that " @@ -591,7 +562,7 @@ msgstr "" # 應作何翻譯? # out-of-band 目前參考 https://kb.synology.com/zh- # tw/DSM/tutorial/Quick_Start_OOB_Management `帶外管理` 譯作 `帶外` -#: ../../library/pickle.rst:324 +#: ../../library/pickle.rst:311 msgid "" "If *buffer_callback* is ``None`` (the default), buffer views are serialized " "into *file* as part of the pickle stream." @@ -599,7 +570,7 @@ msgstr "" "如果 *buffer_callback* 是 ``None``\\ (預設值),緩衝區的視圖會作為 pickle 封" "裝串流的一部分被序列化進 *file* 中。" -#: ../../library/pickle.rst:327 +#: ../../library/pickle.rst:314 msgid "" "If *buffer_callback* is not ``None``, then it can be called any number of " "times with a buffer view. If the callback returns a false value (such as " @@ -611,7 +582,7 @@ msgstr "" "帶外資料 `;否則,該緩衝區將被視為 pickle 串流的帶內資料被序列" "化。" -#: ../../library/pickle.rst:332 +#: ../../library/pickle.rst:319 msgid "" "It is an error if *buffer_callback* is not ``None`` and *protocol* is " "``None`` or smaller than 5." @@ -619,19 +590,19 @@ msgstr "" "如果 *buffer_callback* 不是 ``None`` 且 *protocol* 是 ``None`` 或小於 5 則會" "報錯。" -#: ../../library/pickle.rst:340 +#: ../../library/pickle.rst:327 msgid "" "Write the pickled representation of *obj* to the open file object given in " "the constructor." msgstr "將已封裝(pickled)的 *obj* 寫入已在建構式中開啟的對應檔案。" -#: ../../library/pickle.rst:345 +#: ../../library/pickle.rst:332 msgid "Do nothing by default. This exists so a subclass can override it." msgstr "" "預設不進行任何動作。這是一種抽象方法,用於讓後續繼承這個類別的物件可以覆寫本" "方法函式。" -#: ../../library/pickle.rst:347 +#: ../../library/pickle.rst:334 msgid "" "If :meth:`persistent_id` returns ``None``, *obj* is pickled as usual. Any " "other value causes :class:`Pickler` to emit the returned value as a " @@ -644,14 +615,14 @@ msgstr "" "碼回傳。此永久識別碼的意義應由 :meth:`Unpickler.persistent_load` 定義。請注" "意 :meth:`persistent_id` 回傳的值本身不能擁有自己的永久識別碼。" -#: ../../library/pickle.rst:353 ../../library/pickle.rst:467 +#: ../../library/pickle.rst:340 ../../library/pickle.rst:454 msgid "See :ref:`pickle-persistent` for details and examples of uses." msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" -#: ../../library/pickle.rst:355 +#: ../../library/pickle.rst:342 msgid "" -"Add the default implementation of this method in the C implementation " -"of :class:`!Pickler`." +"Add the default implementation of this method in the C implementation of :" +"class:`!Pickler`." msgstr "在 C 的 :class:`!Pickler` 實作中的增加了這個方法的預設實作。" # SkyLull: [T] @@ -661,7 +632,7 @@ msgstr "在 C 的 :class:`!Pickler` 實作中的增加了這個方法的預設 # reduction function -> 縮減函式 # 這個是指reduce()函式類型的運算,類似sql的aggregation類型運算,故參閱以下內文,譯為縮減 # https://support.google.com/docs/answer/12657238?hl=zh-Hant -#: ../../library/pickle.rst:361 +#: ../../library/pickle.rst:348 msgid "" "A pickler object's dispatch table is a registry of *reduction functions* of " "the kind which can be declared using :func:`copyreg.pickle`. It is a " @@ -674,15 +645,15 @@ msgstr "" "一個以類別為鍵、還原函式為值的映射表。縮減函式應準備接收一個對應類別的引數," "並應遵循與 :meth:`~object.__reduce__` 方法相同的介面。" -#: ../../library/pickle.rst:369 +#: ../../library/pickle.rst:356 msgid "" "By default, a pickler object will not have a :attr:`dispatch_table` " -"attribute, and it will instead use the global dispatch table managed by " -"the :mod:`copyreg` module. However, to customize the pickling for a specific " +"attribute, and it will instead use the global dispatch table managed by the :" +"mod:`copyreg` module. However, to customize the pickling for a specific " "pickler object one can set the :attr:`dispatch_table` attribute to a dict-" -"like object. Alternatively, if a subclass of :class:`Pickler` has " -"a :attr:`dispatch_table` attribute then this will be used as the default " -"dispatch table for instances of that class." +"like object. Alternatively, if a subclass of :class:`Pickler` has a :attr:" +"`dispatch_table` attribute then this will be used as the default dispatch " +"table for instances of that class." msgstr "" "預設情況下,封裝器(pickler)物件不會有 :attr:`dispatch_table` 屬性,而是會使" "用由 :mod:`copyreg` 模組管理的全域調度表。不過,若要自訂某個封裝器(pickler)" @@ -690,29 +661,29 @@ msgstr "" "如果 :class:`Pickler` 的子類別具有 :attr:`dispatch_table` 屬性,那麼這個屬性" "將作為該子類別實例的預設調度表。" -#: ../../library/pickle.rst:378 +#: ../../library/pickle.rst:365 msgid "See :ref:`pickle-dispatch` for usage examples." msgstr "關於用法範例請見 :ref:`pickle-dispatch`。" -#: ../../library/pickle.rst:384 +#: ../../library/pickle.rst:371 msgid "" "Special reducer that can be defined in :class:`Pickler` subclasses. This " "method has priority over any reducer in the :attr:`dispatch_table`. It " "should conform to the same interface as a :meth:`~object.__reduce__` method, " -"and can optionally return :data:`NotImplemented` to fallback " -"on :attr:`dispatch_table`-registered reducers to pickle ``obj``." +"and can optionally return :data:`NotImplemented` to fallback on :attr:" +"`dispatch_table`-registered reducers to pickle ``obj``." msgstr "" "一個可以在 :class:`Pickler` 子類別中被定義的縮減器(reducer)。這個方法的優先" -"度高於任何其他 :attr:`分派表 ` 中的縮減器。他應該要有" -"和 :meth:`~object.__reduce__` 方法相同的函式介面,且可以可選地回" -"傳 :data:`NotImplemented` 以後備(fallback)使用 :attr:`分派表 " -"` 中登錄的縮減方法來封裝 ``obj``。" +"度高於任何其他 :attr:`分派表 ` 中的縮減器。他應該要有和 :" +"meth:`~object.__reduce__` 方法相同的函式介面,且可以可選地回傳 :data:" +"`NotImplemented` 以後備(fallback)使用 :attr:`分派表 ` 中登" +"錄的縮減方法來封裝 ``obj``。" -#: ../../library/pickle.rst:390 +#: ../../library/pickle.rst:377 msgid "For a detailed example, see :ref:`reducer_override`." msgstr "請查閱 :ref:`reducer_override` 來參考其他較詳細的範例。" -#: ../../library/pickle.rst:396 +#: ../../library/pickle.rst:383 msgid "" "Deprecated. Enable fast mode if set to a true value. The fast mode disables " "the usage of memo, therefore speeding the pickling process by not generating " @@ -723,46 +694,46 @@ msgstr "" "過不產生多餘的 PUT 操作碼(OpCode)來加速封裝過程。它不應被用於自我參照物件," "否則將導致 :class:`Pickler` 陷入無限遞迴。" -#: ../../library/pickle.rst:402 +#: ../../library/pickle.rst:389 msgid "Use :func:`pickletools.optimize` if you need more compact pickles." msgstr "使用 :func:`pickletools.optimize` 以獲得更緊湊的 pickle 輸出。" -#: ../../library/pickle.rst:406 +#: ../../library/pickle.rst:393 msgid "Clears the pickler's \"memo\"." msgstr "" -#: ../../library/pickle.rst:408 +#: ../../library/pickle.rst:395 msgid "" "The memo is the data structure that remembers which objects the pickler has " "already seen, so that shared or recursive objects are pickled by reference " "and not by value. This method is useful when re-using picklers." msgstr "" -#: ../../library/pickle.rst:416 +#: ../../library/pickle.rst:403 msgid "This takes a binary file for reading a pickle data stream." msgstr "這個物件接受一個二進位檔案 *file* 來從中讀取 pickle 資料流。" -#: ../../library/pickle.rst:418 +#: ../../library/pickle.rst:405 msgid "" "The protocol version of the pickle is detected automatically, so no protocol " "argument is needed." msgstr "協定版本號會被自動偵測,所以不需要在這邊手動輸入。" -#: ../../library/pickle.rst:421 +#: ../../library/pickle.rst:408 msgid "" "The argument *file* must have three methods, a read() method that takes an " "integer argument, a readinto() method that takes a buffer argument and a " -"readline() method that requires no arguments, as in " -"the :class:`io.BufferedIOBase` interface. Thus *file* can be an on-disk " -"file opened for binary reading, an :class:`io.BytesIO` object, or any other " -"custom object that meets this interface." +"readline() method that requires no arguments, as in the :class:`io." +"BufferedIOBase` interface. Thus *file* can be an on-disk file opened for " +"binary reading, an :class:`io.BytesIO` object, or any other custom object " +"that meets this interface." msgstr "" "參數 *file* 必須擁有三個方法,分別是接受整數作為引數的 read() 方法、接受緩衝" -"區作為引數的 readinto() 方法以及不需要引數的 readline() 方法,如同" -"在 :class:`io.BufferedIOBase` 的介面一樣。因此,*file* 可以是一個以二進位讀取" -"模式開啟的檔案、一個 :class:`io.BytesIO` 物件、或任何符合此介面的自訂物件。" +"區作為引數的 readinto() 方法以及不需要引數的 readline() 方法,如同在 :class:" +"`io.BufferedIOBase` 的介面一樣。因此,*file* 可以是一個以二進位讀取模式開啟的" +"檔案、一個 :class:`io.BytesIO` 物件、或任何符合此介面的自訂物件。" -#: ../../library/pickle.rst:428 +#: ../../library/pickle.rst:415 msgid "" "The optional arguments *fix_imports*, *encoding* and *errors* are used to " "control compatibility support for pickle stream generated by Python 2. If " @@ -771,20 +742,20 @@ msgid "" "decode 8-bit string instances pickled by Python 2; these default to 'ASCII' " "and 'strict', respectively. The *encoding* can be 'bytes' to read these 8-" "bit string instances as bytes objects. Using ``encoding='latin1'`` is " -"required for unpickling NumPy arrays and instances " -"of :class:`~datetime.datetime`, :class:`~datetime.date` " -"and :class:`~datetime.time` pickled by Python 2." +"required for unpickling NumPy arrays and instances of :class:`~datetime." +"datetime`, :class:`~datetime.date` and :class:`~datetime.time` pickled by " +"Python 2." msgstr "" "可選引數 *fix_imports*、*encoding* 和 *errors* 用來控制 Python 2 pickle 資料" "的相容性支援。如果 *fix_imports* 為 true,則 pickle 模組會嘗試將舊的 Python " "2 模組名稱映射到 Python 3 中使用的新名稱。*encoding* 和 *errors* 告訴 pickle " "模組如何解碼由 Python 2 pickle 封裝的 8 位元字串實例;*encoding* 和 *errors* " "預設分別為 'ASCII' 和 'strict'。*encoding* 可以設定為 'bytes' 以將這些 8 位元" -"字串實例讀為位元組物件。而由 Python 2 封裝的 NumPy 陣" -"列、:class:`~datetime.datetime`、:class:`~datetime.date` " -"和 :class:`~datetime.time` 的實例則必須使用 ``encoding='latin1'`` 來拆封。" +"字串實例讀為位元組物件。而由 Python 2 封裝的 NumPy 陣列、:class:`~datetime." +"datetime`、:class:`~datetime.date` 和 :class:`~datetime.time` 的實例則必須使" +"用 ``encoding='latin1'`` 來拆封。" -#: ../../library/pickle.rst:439 +#: ../../library/pickle.rst:426 msgid "" "If *buffers* is ``None`` (the default), then all data necessary for " "deserialization must be contained in the pickle stream. This means that the " @@ -795,7 +766,7 @@ msgstr "" "包含在 pickle 串流中。這意味著當初在建立對應的 :class:`Pickler` 時(或在呼" "叫 :func:`dump` 或 :func:`dumps` 時)*buffer_callback* 引數必須為 ``None``。" -#: ../../library/pickle.rst:444 +#: ../../library/pickle.rst:431 msgid "" "If *buffers* is not ``None``, it should be an iterable of buffer-enabled " "objects that is consumed each time the pickle stream references an :ref:`out-" @@ -807,7 +778,7 @@ msgstr "" "將會被照順序消耗。這些緩衝資料當初建立時應已按照順序給定於 Pickler 物件中的 " "*buffer_callback*。" -#: ../../library/pickle.rst:454 +#: ../../library/pickle.rst:441 msgid "" "Read the pickled representation of an object from the open file object given " "in the constructor, and return the reconstituted object hierarchy specified " @@ -816,26 +787,26 @@ msgstr "" "開啟先前被傳入建構子的檔案,從中讀取一個被 pickle 封裝的物件,並回傳重建完成" "的物件階層。超過 pickle 表示範圍的位元組會被忽略。" -#: ../../library/pickle.rst:461 +#: ../../library/pickle.rst:448 msgid "Raise an :exc:`UnpicklingError` by default." msgstr "預設會引發 :exc:`UnpicklingError` 例外。" -#: ../../library/pickle.rst:463 +#: ../../library/pickle.rst:450 msgid "" "If defined, :meth:`persistent_load` should return the object specified by " -"the persistent ID *pid*. If an invalid persistent ID is encountered, " -"an :exc:`UnpicklingError` should be raised." +"the persistent ID *pid*. If an invalid persistent ID is encountered, an :" +"exc:`UnpicklingError` should be raised." msgstr "" "若有定義,則 :meth:`persistent_load` 將回傳符合持久化識別碼 *pid* 的物件。如" "果遭遇了無效的持久化識別碼,則會引發 :exc:`UnpicklingError`。" -#: ../../library/pickle.rst:469 +#: ../../library/pickle.rst:456 msgid "" -"Add the default implementation of this method in the C implementation " -"of :class:`!Unpickler`." +"Add the default implementation of this method in the C implementation of :" +"class:`!Unpickler`." msgstr "在 C 的 :class:`!Unpickler` 實作中的增加了這個方法的預設實作。" -#: ../../library/pickle.rst:475 +#: ../../library/pickle.rst:462 msgid "" "Import *module* if necessary and return the object called *name* from it, " "where the *module* and *name* arguments are :class:`str` objects. Note, " @@ -843,19 +814,19 @@ msgid "" "functions." msgstr "" "如有需要將引入 *module*,並從中回傳名為 *name* 的物件,這裡的 *module* 和 " -"*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像," -"但 :meth:`find_class` 亦可被用於尋找其他函式。" +"*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像,但 :" +"meth:`find_class` 亦可被用於尋找其他函式。" -#: ../../library/pickle.rst:480 +#: ../../library/pickle.rst:467 msgid "" "Subclasses may override this to gain control over what type of objects and " -"how they can be loaded, potentially reducing security risks. Refer " -"to :ref:`pickle-restrict` for details." +"how they can be loaded, potentially reducing security risks. Refer to :ref:" +"`pickle-restrict` for details." msgstr "" "子類別可以覆寫此方法以控制可以載入哪些類型的物件、以及如何載入它們,從而潛在" "地降低安全性風險。詳情請參考\\ :ref:`pickle-restrict`。" -#: ../../library/pickle.rst:484 +#: ../../library/pickle.rst:471 msgid "" "Raises an :ref:`auditing event ` ``pickle.find_class`` with " "arguments ``module``, ``name``." @@ -866,26 +837,26 @@ msgstr "" # SkyLull: [T] # 參見 #729 # wrapper -> 包裝器 -#: ../../library/pickle.rst:488 +#: ../../library/pickle.rst:475 msgid "" -"A wrapper for a buffer representing picklable data. *buffer* must be " -"a :ref:`buffer-providing ` object, such as a :term:`bytes-" -"like object` or a N-dimensional array." +"A wrapper for a buffer representing picklable data. *buffer* must be a :ref:" +"`buffer-providing ` object, such as a :term:`bytes-like " +"object` or a N-dimensional array." msgstr "" "一個表示了含有可封裝資料緩衝區的包裝函式(wrapper function)。*buffer* 必須是" "一個 :ref:`提供緩衝區 ` 的物件,例如一個 :term:`類位元組物件 " "` 或 N 維陣列。" -#: ../../library/pickle.rst:492 +#: ../../library/pickle.rst:479 msgid "" ":class:`PickleBuffer` is itself a buffer provider, therefore it is possible " -"to pass it to other APIs expecting a buffer-providing object, such " -"as :class:`memoryview`." +"to pass it to other APIs expecting a buffer-providing object, such as :class:" +"`memoryview`." msgstr "" ":class:`PickleBuffer` 本身就是一個提供緩衝區的物件,所以是能夠將其提供給其它" "「預期收到含有緩衝物件的 API」的,比如 :class:`memoryview`。" -#: ../../library/pickle.rst:496 +#: ../../library/pickle.rst:483 msgid "" ":class:`PickleBuffer` objects can only be serialized using pickle protocol 5 " "or higher. They are eligible for :ref:`out-of-band serialization 限定名稱 -#: ../../library/pickle.rst:545 +#: ../../library/pickle.rst:532 msgid "" -"Note that functions (built-in and user-defined) are pickled by " -"fully :term:`qualified name`, not by value. [#]_ This means that only the " -"function name is pickled, along with the name of the containing module and " -"classes. Neither the function's code, nor any of its function attributes " -"are pickled. Thus the defining module must be importable in the unpickling " +"Note that functions (built-in and user-defined) are pickled by fully :term:" +"`qualified name`, not by value. [#]_ This means that only the function name " +"is pickled, along with the name of the containing module and classes. " +"Neither the function's code, nor any of its function attributes are " +"pickled. Thus the defining module must be importable in the unpickling " "environment, and the module must contain the named object, otherwise an " "exception will be raised. [#]_" msgstr "" @@ -997,7 +967,7 @@ msgstr "" "拆封該物件的環境中,定義此函式的模組必須可被引入,且該模組必須包含具此命名之" "物件,否則將引發例外。 [#]_" -#: ../../library/pickle.rst:552 +#: ../../library/pickle.rst:539 msgid "" "Similarly, classes are pickled by fully qualified name, so the same " "restrictions in the unpickling environment apply. Note that none of the " @@ -1008,7 +978,7 @@ msgstr "" "上的限制。類別中的程式碼或資料皆不會被封裝,因此在以下範例中,注意到類別屬性 " "``attr`` 在拆封的環境中不會被還原::" -#: ../../library/pickle.rst:557 +#: ../../library/pickle.rst:544 msgid "" "class Foo:\n" " attr = 'A class attribute'\n" @@ -1020,13 +990,13 @@ msgstr "" "\n" "picklestring = pickle.dumps(Foo)" -#: ../../library/pickle.rst:562 +#: ../../library/pickle.rst:549 msgid "" "These restrictions are why picklable functions and classes must be defined " "at the top level of a module." msgstr "這些限制就是可封裝的函式和類別必須被定義在模組頂層的原因。" -#: ../../library/pickle.rst:565 +#: ../../library/pickle.rst:552 msgid "" "Similarly, when class instances are pickled, their class's code and data are " "not pickled along with them. Only the instance data are pickled. This is " @@ -1034,8 +1004,8 @@ msgid "" "and still load objects that were created with an earlier version of the " "class. If you plan to have long-lived objects that will see many versions " "of a class, it may be worthwhile to put a version number in the objects so " -"that suitable conversions can be made by the " -"class's :meth:`~object.__setstate__` method." +"that suitable conversions can be made by the class's :meth:`~object." +"__setstate__` method." msgstr "" "同樣地,當類別實例被封裝時,它所屬類別具有的程式碼和資料不會被一起封裝。只有" "實例資料本身會被封裝。這是有意而為的,因為如此你才可以在類別中修正錯誤或新增" @@ -1043,11 +1013,11 @@ msgstr "" "計將有長期存在的物件、且該物件將經歷許多版本的更替,你可以在物件中存放一個版" "本號,以便未來能透過 :meth:`~object.__setstate__` 方法來進行適當的版本轉換。" -#: ../../library/pickle.rst:577 +#: ../../library/pickle.rst:564 msgid "Pickling Class Instances" msgstr "Pickling 類別實例" -#: ../../library/pickle.rst:581 +#: ../../library/pickle.rst:568 msgid "" "In this section, we describe the general mechanisms available to you to " "define, customize, and control how class instances are pickled and unpickled." @@ -1055,22 +1025,21 @@ msgstr "" "在這一個章節,我們會講述如何封裝或拆封一個物件實例的相關機制,以方便你進行自" "訂。" -#: ../../library/pickle.rst:584 +#: ../../library/pickle.rst:571 msgid "" "In most cases, no additional code is needed to make instances picklable. By " "default, pickle will retrieve the class and the attributes of an instance " -"via introspection. When a class instance is unpickled, " -"its :meth:`~object.__init__` method is usually *not* invoked. The default " -"behaviour first creates an uninitialized instance and then restores the " -"saved attributes. The following code shows an implementation of this " -"behaviour::" +"via introspection. When a class instance is unpickled, its :meth:`~object." +"__init__` method is usually *not* invoked. The default behaviour first " +"creates an uninitialized instance and then restores the saved attributes. " +"The following code shows an implementation of this behaviour::" msgstr "" "大部分的實例不需要額外的程式碼就已經是可封裝的了。在這樣的預設狀況中,pickle " -"模組透過自省機制來取得類別及其實例的屬性。當類別實例被拆封時," -"其 :meth:`~object.__init__` 方法通常\\ *不會*\\ 被呼叫。預設行為首先會建立一" -"個未初始化的實例,然後還原紀錄中的屬性。以下程式碼的實作展示了前述行為: ::" +"模組透過自省機制來取得類別及其實例的屬性。當類別實例被拆封時,其 :meth:" +"`~object.__init__` 方法通常\\ *不會*\\ 被呼叫。預設行為首先會建立一個未初始化" +"的實例,然後還原紀錄中的屬性。以下程式碼的實作展示了前述行為: ::" -#: ../../library/pickle.rst:591 +#: ../../library/pickle.rst:578 msgid "" "def save(obj):\n" " return (obj.__class__, obj.__dict__)\n" @@ -1088,28 +1057,28 @@ msgstr "" " obj.__dict__.update(attributes)\n" " return obj" -#: ../../library/pickle.rst:599 +#: ../../library/pickle.rst:586 msgid "" "Classes can alter the default behaviour by providing one or several special " "methods:" msgstr "" "被封裝的目標類別可以提供一個或數個下列特殊方法來改變 pickle 的預設行為:" -#: ../../library/pickle.rst:604 +#: ../../library/pickle.rst:591 msgid "" -"In protocols 2 and newer, classes that implements " -"the :meth:`__getnewargs_ex__` method can dictate the values passed to " -"the :meth:`__new__` method upon unpickling. The method must return a pair " -"``(args, kwargs)`` where *args* is a tuple of positional arguments and " -"*kwargs* a dictionary of named arguments for constructing the object. Those " -"will be passed to the :meth:`__new__` method upon unpickling." +"In protocols 2 and newer, classes that implements the :meth:" +"`__getnewargs_ex__` method can dictate the values passed to the :meth:" +"`__new__` method upon unpickling. The method must return a pair ``(args, " +"kwargs)`` where *args* is a tuple of positional arguments and *kwargs* a " +"dictionary of named arguments for constructing the object. Those will be " +"passed to the :meth:`__new__` method upon unpickling." msgstr "" "在第 2 版協定或更新的版本中,有實作 :meth:`__getnewargs_ex__` 方法的類別,可" "以決定在拆封時要傳遞給 :meth:`__new__` 方法的值。該方法必須回傳一個 ``(args, " "kwargs)`` 的組合,其中 *args* 是一個位置引數的元組(tuple),*kwargs* 是一個" "用於建構物件的命名引數字典。這些資訊將在拆封時傳遞給 :meth:`__new__` 方法。" -#: ../../library/pickle.rst:612 +#: ../../library/pickle.rst:599 msgid "" "You should implement this method if the :meth:`__new__` method of your class " "requires keyword-only arguments. Otherwise, it is recommended for " @@ -1118,36 +1087,36 @@ msgstr "" "如果目標類別的方法 :meth:`__new__` 需要僅限關鍵字的參數時,你應該實作此方法。" "否則,為了提高相容性,建議你改為實作 :meth:`__getnewargs__`。" -#: ../../library/pickle.rst:616 +#: ../../library/pickle.rst:603 msgid ":meth:`__getnewargs_ex__` is now used in protocols 2 and 3." msgstr "在第 2、3 版的協定中現在改為使用 :meth:`__getnewargs_ex__`。" -#: ../../library/pickle.rst:622 +#: ../../library/pickle.rst:609 msgid "" "This method serves a similar purpose as :meth:`__getnewargs_ex__`, but " "supports only positional arguments. It must return a tuple of arguments " "``args`` which will be passed to the :meth:`__new__` method upon unpickling." msgstr "" "此方法與 :meth:`__getnewargs_ex__` 的目的一樣,但僅支援位置參數。它必須回傳一" -"個由傳入引數所組成的元組(tuple)\\ ``args``,這些引數會在拆封時傳遞" -"給 :meth:`__new__` 方法。" +"個由傳入引數所組成的元組(tuple)\\ ``args``,這些引數會在拆封時傳遞給 :meth:" +"`__new__` 方法。" -#: ../../library/pickle.rst:626 +#: ../../library/pickle.rst:613 msgid "" ":meth:`__getnewargs__` will not be called if :meth:`__getnewargs_ex__` is " "defined." msgstr "" "當有定義 :meth:`__getnewargs_ex__` 的時候便不會呼叫 :meth:`__getnewargs__`。" -#: ../../library/pickle.rst:629 +#: ../../library/pickle.rst:616 msgid "" -"Before Python 3.6, :meth:`__getnewargs__` was called instead " -"of :meth:`__getnewargs_ex__` in protocols 2 and 3." +"Before Python 3.6, :meth:`__getnewargs__` was called instead of :meth:" +"`__getnewargs_ex__` in protocols 2 and 3." msgstr "" "在 Python 3.6 之前、版本 2 和版本 3 的協定中,會呼叫 :meth:`__getnewargs__` " "而非 :meth:`__getnewargs_ex__`。" -#: ../../library/pickle.rst:636 +#: ../../library/pickle.rst:623 msgid "" "Classes can further influence how their instances are pickled by overriding " "the method :meth:`__getstate__`. It is called and the returned object is " @@ -1158,52 +1127,52 @@ msgstr "" "封裝時,呼叫該方法所回傳的物件將作為該實例的內容被封裝、而非一個預設狀態。以" "下列出幾種預設狀態:" -#: ../../library/pickle.rst:641 +#: ../../library/pickle.rst:628 msgid "" -"For a class that has no instance :attr:`~object.__dict__` and " -"no :attr:`~object.__slots__`, the default state is ``None``." +"For a class that has no instance :attr:`~object.__dict__` and no :attr:" +"`~object.__slots__`, the default state is ``None``." msgstr "" "沒有 :attr:`~object.__dict__` 和 :attr:`~object.__slots__` 實例的類別,其預設" "狀態為 ``None``。" -#: ../../library/pickle.rst:644 +#: ../../library/pickle.rst:631 msgid "" -"For a class that has an instance :attr:`~object.__dict__` and " -"no :attr:`~object.__slots__`, the default state is ``self.__dict__``." +"For a class that has an instance :attr:`~object.__dict__` and no :attr:" +"`~object.__slots__`, the default state is ``self.__dict__``." msgstr "" "有 :attr:`~object.__dict__` 實例、但沒有 :attr:`~object.__slots__` 實例的類" "別,其預設狀態為 ``self.__dict__``。" -#: ../../library/pickle.rst:647 +#: ../../library/pickle.rst:634 msgid "" -"For a class that has an instance :attr:`~object.__dict__` " -"and :attr:`~object.__slots__`, the default state is a tuple consisting of " -"two dictionaries: ``self.__dict__``, and a dictionary mapping slot names to " -"slot values. Only slots that have a value are included in the latter." +"For a class that has an instance :attr:`~object.__dict__` and :attr:`~object." +"__slots__`, the default state is a tuple consisting of two dictionaries: " +"``self.__dict__``, and a dictionary mapping slot names to slot values. Only " +"slots that have a value are included in the latter." msgstr "" "有 :attr:`~object.__dict__` 和 :attr:`~object.__slots__` 實例的類別,其預設狀" "態是一個含有兩個字典的元組(tuple),該二字典分別為 ``self.__dict__`` 本身," "和紀錄欄位(slot)名稱和值對應關係的字典(只有含有值的欄位(slot)會被紀錄其" "中)。" -#: ../../library/pickle.rst:653 +#: ../../library/pickle.rst:640 msgid "" -"For a class that has :attr:`~object.__slots__` and no " -"instance :attr:`~object.__dict__`, the default state is a tuple whose first " -"item is ``None`` and whose second item is a dictionary mapping slot names to " -"slot values described in the previous bullet." +"For a class that has :attr:`~object.__slots__` and no instance :attr:" +"`~object.__dict__`, the default state is a tuple whose first item is " +"``None`` and whose second item is a dictionary mapping slot names to slot " +"values described in the previous bullet." msgstr "" "沒有 :attr:`~object.__dict__` 但有 :attr:`~object.__slots__` 實例的類別,其預" "設狀態是一個二元組(tuple),元組中的第一個值是 ``None``,第二個值則是紀錄欄" "位(slot)名稱和值對應關係的字典(與前一項提到的字典是同一個)。" -#: ../../library/pickle.rst:658 +#: ../../library/pickle.rst:645 msgid "" -"Added the default implementation of the ``__getstate__()`` method in " -"the :class:`object` class." +"Added the default implementation of the ``__getstate__()`` method in the :" +"class:`object` class." msgstr "在 :class:`object` 類別中增加預設的 ``__getstate__()`` 實作。" -#: ../../library/pickle.rst:665 +#: ../../library/pickle.rst:652 msgid "" "Upon unpickling, if the class defines :meth:`__setstate__`, it is called " "with the unpickled state. In that case, there is no requirement for the " @@ -1214,68 +1183,65 @@ msgstr "" "這種情況下,紀錄狀態的物件不需要是字典(dictionary)。否則,封裝時的狀態紀錄" "必須是一個字典,其紀錄的項目將被賦值給新實例的字典。" -#: ../../library/pickle.rst:672 +#: ../../library/pickle.rst:659 msgid "" -"If :meth:`__reduce__` returns a state with value ``None`` at pickling, " -"the :meth:`__setstate__` method will not be called upon unpickling." +"If :meth:`__reduce__` returns a state with value ``None`` at pickling, the :" +"meth:`__setstate__` method will not be called upon unpickling." msgstr "" -"如果 :meth:`__reduce__` 在封裝時回傳了 ``None`` 狀態,則拆封時就不會去呼" -"叫 :meth:`__setstate__`。" +"如果 :meth:`__reduce__` 在封裝時回傳了 ``None`` 狀態,則拆封時就不會去呼叫 :" +"meth:`__setstate__`。" -#: ../../library/pickle.rst:676 +#: ../../library/pickle.rst:663 msgid "" "Refer to the section :ref:`pickle-state` for more information about how to " -"use the methods :meth:`~object.__getstate__` " -"and :meth:`~object.__setstate__`." +"use the methods :meth:`~object.__getstate__` and :meth:`~object." +"__setstate__`." msgstr "" -"參閱 :ref:`pickle-state` 以了解 :meth:`~object.__getstate__` " -"和 :meth:`~object.__setstate__` 的使用方法。" +"參閱 :ref:`pickle-state` 以了解 :meth:`~object.__getstate__` 和 :meth:" +"`~object.__setstate__` 的使用方法。" -#: ../../library/pickle.rst:681 +#: ../../library/pickle.rst:668 msgid "" -"At unpickling time, some methods " -"like :meth:`~object.__getattr__`, :meth:`~object.__getattribute__`, " -"or :meth:`~object.__setattr__` may be called upon the instance. In case " -"those methods rely on some internal invariant being true, the type should " -"implement :meth:`~object.__new__` to establish such an invariant, " -"as :meth:`~object.__init__` is not called when unpickling an instance." +"At unpickling time, some methods like :meth:`~object.__getattr__`, :meth:" +"`~object.__getattribute__`, or :meth:`~object.__setattr__` may be called " +"upon the instance. In case those methods rely on some internal invariant " +"being true, the type should implement :meth:`~object.__new__` to establish " +"such an invariant, as :meth:`~object.__init__` is not called when unpickling " +"an instance." msgstr "" -"在拆封時,某些方法" -"如 :meth:`~object.__getattr__`、:meth:`~object.__getattribute__` " -"或 :meth:`~object.__setattr__` 可能會在建立實例時被呼叫。如果這些方法依賴了某" -"些實例內部的不變性,則應實作 :meth:`~object.__new__` 以建立此不變性,因為在拆" -"封實例時不會呼叫 :meth:`~object.__init__`。" +"在拆封時,某些方法如 :meth:`~object.__getattr__`、:meth:`~object." +"__getattribute__` 或 :meth:`~object.__setattr__` 可能會在建立實例時被呼叫。如" +"果這些方法依賴了某些實例內部的不變性,則應實作 :meth:`~object.__new__` 以建立" +"此不變性,因為在拆封實例時不會呼叫 :meth:`~object.__init__`。" -#: ../../library/pickle.rst:690 +#: ../../library/pickle.rst:677 msgid "" "As we shall see, pickle does not use directly the methods described above. " -"In fact, these methods are part of the copy protocol which implements " -"the :meth:`~object.__reduce__` special method. The copy protocol provides a " +"In fact, these methods are part of the copy protocol which implements the :" +"meth:`~object.__reduce__` special method. The copy protocol provides a " "unified interface for retrieving the data necessary for pickling and copying " "objects. [#]_" msgstr "" -"如稍後所演示,pickle 並不直接使用上述方法。這些方法實際上是實作" -"了 :meth:`~object.__reduce__` 特殊方法的拷貝協定(copy protocol)。拷貝協定提" -"供了統一的介面,以檢索進行封裝及複製物件時所需的資料。 [#]_" +"如稍後所演示,pickle 並不直接使用上述方法。這些方法實際上是實作了 :meth:" +"`~object.__reduce__` 特殊方法的拷貝協定(copy protocol)。拷貝協定提供了統一" +"的介面,以檢索進行封裝及複製物件時所需的資料。 [#]_" -#: ../../library/pickle.rst:696 +#: ../../library/pickle.rst:683 msgid "" "Although powerful, implementing :meth:`~object.__reduce__` directly in your " "classes is error prone. For this reason, class designers should use the " -"high-level interface " -"(i.e., :meth:`~object.__getnewargs_ex__`, :meth:`~object.__getstate__` " -"and :meth:`~object.__setstate__`) whenever possible. We will show, however, " -"cases where using :meth:`!__reduce__` is the only option or leads to more " -"efficient pickling or both." +"high-level interface (i.e., :meth:`~object.__getnewargs_ex__`, :meth:" +"`~object.__getstate__` and :meth:`~object.__setstate__`) whenever possible. " +"We will show, however, cases where using :meth:`!__reduce__` is the only " +"option or leads to more efficient pickling or both." msgstr "" "直接在類別中實作 :meth:`~object.__reduce__` 雖然功能強大但卻容易導致出錯。因" -"此,設計類別者應盡可能使用高階介面(例" -"如,:meth:`~object.__getnewargs_ex__`、:meth:`~object.__getstate__` " -"和 :meth:`~object.__setstate__`)。不過,我們也將展示一些特例狀況,在這些狀況" -"中,使用 :meth:`!__reduce__` 可能是唯一的選擇、是更有效率的封裝方法或二者兼" -"備。" +"此,設計類別者應盡可能使用高階介面(例如,:meth:`~object." +"__getnewargs_ex__`、:meth:`~object.__getstate__` 和 :meth:`~object." +"__setstate__`)。不過,我們也將展示一些特例狀況,在這些狀況中,使用 :meth:`!" +"__reduce__` 可能是唯一的選擇、是更有效率的封裝方法或二者兼備。" -#: ../../library/pickle.rst:705 +#: ../../library/pickle.rst:692 msgid "" "The interface is currently defined as follows. The :meth:`__reduce__` " "method takes no argument and shall return either a string or preferably a " @@ -1284,7 +1250,7 @@ msgstr "" "目前的介面定義如下。 :meth:`__reduce__` 方法不接受引數,且應回傳一個字串或一" "個元組(元組一般而言是較佳的選擇;所回傳的物件通常稱為「縮減值」)。" -#: ../../library/pickle.rst:709 +#: ../../library/pickle.rst:696 msgid "" "If a string is returned, the string should be interpreted as the name of a " "global variable. It should be the object's local name relative to its " @@ -1295,7 +1261,7 @@ msgstr "" "模組的本地名稱;pickle 模組會在模組命名空間中尋找,以確定該物件所在的模組。這" "種行為通常對於單例物件特別有用。" -#: ../../library/pickle.rst:714 +#: ../../library/pickle.rst:701 msgid "" "When a tuple is returned, it must be between two and six items long. " "Optional items can either be omitted, or ``None`` can be provided as their " @@ -1304,13 +1270,13 @@ msgstr "" "當回傳一個元組時,其長度必須介於兩至六項元素之間。可選項可以被省略,或者其值" "可以被設為 ``None``。各項物件的語意依序為:" -#: ../../library/pickle.rst:720 +#: ../../library/pickle.rst:707 msgid "" "A callable object that will be called to create the initial version of the " "object." msgstr "一個將會被呼叫來建立初始版本物件的可呼叫物件。" -#: ../../library/pickle.rst:723 +#: ../../library/pickle.rst:710 msgid "" "A tuple of arguments for the callable object. An empty tuple must be given " "if the callable does not accept any argument." @@ -1318,39 +1284,39 @@ msgstr "" "一個用於傳遞引數給前述物件的元組。如果前述物件不接受引數輸入,則你仍應在這裡" "給定一個空元組。" -#: ../../library/pickle.rst:726 +#: ../../library/pickle.rst:713 msgid "" -"Optionally, the object's state, which will be passed to the " -"object's :meth:`__setstate__` method as previously described. If the object " -"has no such method then, the value must be a dictionary and it will be added " -"to the object's :attr:`~object.__dict__` attribute." +"Optionally, the object's state, which will be passed to the object's :meth:" +"`__setstate__` method as previously described. If the object has no such " +"method then, the value must be a dictionary and it will be added to the " +"object's :attr:`~object.__dict__` attribute." msgstr "" "可選項。物件狀態。如前所述,會被傳遞給該物件的 :meth:`__setstate__` 方法。如" -"果該物件沒有實作此方法,則本值必須是一個字典,且其將會被新增到物件" -"的 :attr:`~object.__dict__` 屬性中。" +"果該物件沒有實作此方法,則本值必須是一個字典,且其將會被新增到物件的 :attr:" +"`~object.__dict__` 屬性中。" # SkyLull: [T] # signature: https://jo-jo.medium.com/c-c-%E5%B9%BC%E5%B9%BC%E7%8F%AD-%E7%B0%BD%E7%AB%A0signature-fa9b04e1a3e2 -#: ../../library/pickle.rst:731 +#: ../../library/pickle.rst:718 msgid "" "Optionally, an iterator (and not a sequence) yielding successive items. " "These items will be appended to the object either using ``obj.append(item)`` " "or, in batch, using ``obj.extend(list_of_items)``. This is primarily used " -"for list subclasses, but may be used by other classes as long as they " -"have :meth:`~sequence.append` and :meth:`~sequence.extend` methods with the " +"for list subclasses, but may be used by other classes as long as they have :" +"meth:`~sequence.append` and :meth:`~sequence.extend` methods with the " "appropriate signature. (Whether :meth:`!append` or :meth:`!extend` is used " "depends on which pickle protocol version is used as well as the number of " "items to append, so both must be supported.)" msgstr "" -"可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 " -"``obj.append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被" -"附加到物件中。主要用於串列(list)子類別,但只要其他類別具有相應" -"的 :meth:`~sequence.append` 和 :meth:`~sequence.extend` 方法以及相同的函式簽章" +"可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 ``obj." +"append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被附加到" +"物件中。主要用於串列(list)子類別,但只要其他類別具有相應的 :meth:" +"`~sequence.append` 和 :meth:`~sequence.extend` 方法以及相同的函式簽章" "(signature)就也可以使用。 (是否會呼叫 :meth:`!append` 或 :meth:`!extend` " "方法將取決於所選用的 pickle 協定版本以及要附加的項目數量,因此必須同時支援這" "兩種方法。)" -#: ../../library/pickle.rst:741 +#: ../../library/pickle.rst:728 msgid "" "Optionally, an iterator (not a sequence) yielding successive key-value " "pairs. These items will be stored to the object using ``obj[key] = " @@ -1361,43 +1327,42 @@ msgstr "" "value`` 方式被儲存到物件中。主要用於字典(dictionary)子類別,但只要有實現" "了 :meth:`__setitem__` 的其他類別也可以使用。" -#: ../../library/pickle.rst:746 +#: ../../library/pickle.rst:733 msgid "" "Optionally, a callable with a ``(obj, state)`` signature. This callable " "allows the user to programmatically control the state-updating behavior of a " "specific object, instead of using ``obj``'s static :meth:`__setstate__` " -"method. If not ``None``, this callable will have priority over " -"``obj``'s :meth:`__setstate__`." +"method. If not ``None``, this callable will have priority over ``obj``'s :" +"meth:`__setstate__`." msgstr "" "可選項。一個具有 ``(obj, state)`` 函式簽章(signature)的可呼叫物件。該物件允" "許使用者以可編寫的邏輯,而不是物件 ``obj`` 預設的 :meth:`__setstate__` 靜態方" "法去控制特定物件的狀態更新方式。如果這個物件不是 ``None``,這個物件的呼叫優先" "權將優於物件 ``obj`` 的 :meth:`__setstate__`。" -#: ../../library/pickle.rst:752 +#: ../../library/pickle.rst:739 msgid "The optional sixth tuple item, ``(obj, state)``, was added." msgstr "加入第六個可選項(一個 ``(obj, state)`` 元組)。" -#: ../../library/pickle.rst:758 +#: ../../library/pickle.rst:745 msgid "" "Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " "difference is this method should take a single integer argument, the " -"protocol version. When defined, pickle will prefer it over " -"the :meth:`__reduce__` method. In addition, :meth:`__reduce__` " -"automatically becomes a synonym for the extended version. The main use for " -"this method is to provide backwards-compatible reduce values for older " -"Python releases." +"protocol version. When defined, pickle will prefer it over the :meth:" +"`__reduce__` method. In addition, :meth:`__reduce__` automatically becomes " +"a synonym for the extended version. The main use for this method is to " +"provide backwards-compatible reduce values for older Python releases." msgstr "" "另外,你也可以定義一個 :meth:`__reduce_ex__` 方法。唯一的不同的地方是此方法只" -"接受協定版本(整數)作為參數。當有定義本方法時,pickle 會優先呼叫它而不" -"是 :meth:`__reduce__` 。此外,呼叫 :meth:`__reduce__` 時也會自動變成呼叫這個" -"變體版本。此方法主要是為了向後相容的舊的 Python 版本而存在。" +"接受協定版本(整數)作為參數。當有定義本方法時,pickle 會優先呼叫它而不是 :" +"meth:`__reduce__` 。此外,呼叫 :meth:`__reduce__` 時也會自動變成呼叫這個變體" +"版本。此方法主要是為了向後相容的舊的 Python 版本而存在。" -#: ../../library/pickle.rst:770 +#: ../../library/pickle.rst:757 msgid "Persistence of External Objects" msgstr "外部物件持久化" -#: ../../library/pickle.rst:776 +#: ../../library/pickle.rst:763 msgid "" "For the benefit of object persistence, the :mod:`pickle` module supports the " "notion of a reference to an object outside the pickled data stream. Such " @@ -1410,18 +1375,18 @@ msgstr "" "(alphanumeric)組成的字串(協定 0) [#]_ 或者是任意的物件(任何較新的協" "定)。" -#: ../../library/pickle.rst:782 +#: ../../library/pickle.rst:769 msgid "" "The resolution of such persistent IDs is not defined by the :mod:`pickle` " "module; it will delegate this resolution to the user-defined methods on the " -"pickler and unpickler, :meth:`~Pickler.persistent_id` " -"and :meth:`~Unpickler.persistent_load` respectively." +"pickler and unpickler, :meth:`~Pickler.persistent_id` and :meth:`~Unpickler." +"persistent_load` respectively." msgstr "" ":mod:`pickle` 沒有定義要如何解決或分派這個持久化 ID 的問題;故其處理方式有賴" "使用者自行定義在封裝器(pickler)以及拆封器(unpickler)中。方法的名稱各自" "為 :meth:`~Pickler.persistent_id` 和 :meth:`~Unpickler.persistent_load`。" -#: ../../library/pickle.rst:787 +#: ../../library/pickle.rst:774 msgid "" "To pickle objects that have an external persistent ID, the pickler must have " "a custom :meth:`~Pickler.persistent_id` method that takes an object as an " @@ -1431,30 +1396,29 @@ msgid "" "object, along with a marker so that the unpickler will recognize it as a " "persistent ID." msgstr "" -"要封裝具有外部持久化 ID 的物件,封裝器(pickler)必須擁有一個自訂的方" -"法 :meth:`~Pickler.persistent_id`,這個方法將接收一個物件作為參數,並回傳 " +"要封裝具有外部持久化 ID 的物件,封裝器(pickler)必須擁有一個自訂的方法 :" +"meth:`~Pickler.persistent_id`,這個方法將接收一個物件作為參數,並回傳 " "``None`` 或該物件的持久化 ID。當回傳 ``None`` 時,封裝器會正常地封裝該物件。" "當回傳一個持久化 ID 字串時,封裝器會封裝該物件並加上一個標記,讓拆封器" "(unpickler)能識別它是一個持久化 ID。" -#: ../../library/pickle.rst:794 +#: ../../library/pickle.rst:781 msgid "" -"To unpickle external objects, the unpickler must have a " -"custom :meth:`~Unpickler.persistent_load` method that takes a persistent ID " -"object and returns the referenced object." +"To unpickle external objects, the unpickler must have a custom :meth:" +"`~Unpickler.persistent_load` method that takes a persistent ID object and " +"returns the referenced object." msgstr "" -"要拆封外部物件,拆封器(unpickler)必須有一個自訂" -"的 :meth:`~Unpickler.persistent_load` 方法,該方法應接受一個持久化 ID 物件," -"並回傳相對應的物件。" +"要拆封外部物件,拆封器(unpickler)必須有一個自訂的 :meth:`~Unpickler." +"persistent_load` 方法,該方法應接受一個持久化 ID 物件,並回傳相對應的物件。" -#: ../../library/pickle.rst:798 +#: ../../library/pickle.rst:785 msgid "" "Here is a comprehensive example presenting how persistent ID can be used to " "pickle external objects by reference." msgstr "" "以下是一個完整的範例,用以說明如何使用持久化 ID 來封裝具外部參照的物件。" -#: ../../library/pickle.rst:801 +#: ../../library/pickle.rst:788 msgid "" "# Simple example presenting how persistent ID can be used to pickle\n" "# external objects by reference.\n" @@ -1517,8 +1481,8 @@ msgid "" " # Initialize and populate our database.\n" " conn = sqlite3.connect(\":memory:\")\n" " cursor = conn.cursor()\n" -" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task TEXT)" -"\")\n" +" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task " +"TEXT)\")\n" " tasks = (\n" " 'give food to fish',\n" " 'prepare group meeting',\n" @@ -1604,8 +1568,8 @@ msgstr "" " # 初始化資料庫。\n" " conn = sqlite3.connect(\":memory:\")\n" " cursor = conn.cursor()\n" -" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task TEXT)" -"\")\n" +" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task " +"TEXT)\")\n" " tasks = (\n" " 'give food to fish',\n" " 'prepare group meeting',\n" @@ -1638,11 +1602,11 @@ msgstr "" "if __name__ == '__main__':\n" " main()\n" -#: ../../library/pickle.rst:806 +#: ../../library/pickle.rst:793 msgid "Dispatch Tables" msgstr "調度表" -#: ../../library/pickle.rst:808 +#: ../../library/pickle.rst:795 msgid "" "If one wants to customize pickling of some classes without disturbing any " "other code which depends on pickling, then one can create a pickler with a " @@ -1651,7 +1615,7 @@ msgstr "" "如果你希望在不干擾其他物件正常封裝的前提下建立一個針對特定物件的封裝器,你可" "建立一個有私密調度表的封裝器。" -#: ../../library/pickle.rst:812 +#: ../../library/pickle.rst:799 msgid "" "The global dispatch table managed by the :mod:`copyreg` module is available " "as :data:`!copyreg.dispatch_table`. Therefore, one may choose to use a " @@ -1661,11 +1625,11 @@ msgstr "" "叫。你可以透過這個方式來基於原始 :data:`!copyreg.dispatch_table` 建立一個修改" "過的版本,作為你的專屬用途的調度表。" -#: ../../library/pickle.rst:817 +#: ../../library/pickle.rst:804 msgid "For example ::" msgstr "舉例來說: ::" -#: ../../library/pickle.rst:819 +#: ../../library/pickle.rst:806 msgid "" "f = io.BytesIO()\n" "p = pickle.Pickler(f)\n" @@ -1677,7 +1641,7 @@ msgstr "" "p.dispatch_table = copyreg.dispatch_table.copy()\n" "p.dispatch_table[SomeClass] = reduce_SomeClass" -#: ../../library/pickle.rst:824 +#: ../../library/pickle.rst:811 msgid "" "creates an instance of :class:`pickle.Pickler` with a private dispatch table " "which handles the ``SomeClass`` class specially. Alternatively, the code ::" @@ -1685,7 +1649,7 @@ msgstr "" "建立了一個 :class:`pickle.Pickler`,其中含有專門處裡 ``SomeClass`` 類別的專屬" "調度表。此外,你也可以寫作:::" -#: ../../library/pickle.rst:828 +#: ../../library/pickle.rst:815 msgid "" "class MyPickler(pickle.Pickler):\n" " dispatch_table = copyreg.dispatch_table.copy()\n" @@ -1699,7 +1663,7 @@ msgstr "" "f = io.BytesIO()\n" "p = MyPickler(f)" -#: ../../library/pickle.rst:834 +#: ../../library/pickle.rst:821 msgid "" "does the same but all instances of ``MyPickler`` will by default share the " "private dispatch table. On the other hand, the code ::" @@ -1707,7 +1671,7 @@ msgstr "" "這樣可產生相似的結果,唯一不同的是往後所有 ``MyPickler`` 預設都會使用這個專屬" "調度表。最後,如果將程式寫為:::" -#: ../../library/pickle.rst:837 +#: ../../library/pickle.rst:824 msgid "" "copyreg.pickle(SomeClass, reduce_SomeClass)\n" "f = io.BytesIO()\n" @@ -1717,17 +1681,17 @@ msgstr "" "f = io.BytesIO()\n" "p = pickle.Pickler(f)" -#: ../../library/pickle.rst:841 +#: ../../library/pickle.rst:828 msgid "" "modifies the global dispatch table shared by all users of the :mod:`copyreg` " "module." msgstr "則會改變 :mod:`copyreg` 模組內建、所有使用者共通的調度表。" -#: ../../library/pickle.rst:846 +#: ../../library/pickle.rst:833 msgid "Handling Stateful Objects" msgstr "處裡紀錄大量狀態的物件" -#: ../../library/pickle.rst:852 +#: ../../library/pickle.rst:839 msgid "" "Here's an example that shows how to modify pickling behavior for a class. " "The :class:`!TextReader` class below opens a text file, and returns the line " @@ -1745,7 +1709,7 @@ msgstr "" "上次的位置繼續讀取。這個行為的達成是透過 :meth:`!__setstate__` 和 :meth:`!" "__getstate__` 方法來實作的。::" -#: ../../library/pickle.rst:860 +#: ../../library/pickle.rst:847 msgid "" "class TextReader:\n" " \"\"\"Print and number lines in a text file.\"\"\"\n" @@ -1820,11 +1784,11 @@ msgstr "" " # 存檔。\n" " self.file = file" -#: ../../library/pickle.rst:898 +#: ../../library/pickle.rst:885 msgid "A sample usage might be something like this::" msgstr "可以這樣實際使用:::" -#: ../../library/pickle.rst:900 +#: ../../library/pickle.rst:887 msgid "" ">>> reader = TextReader(\"hello.txt\")\n" ">>> reader.readline()\n" @@ -1844,11 +1808,11 @@ msgstr "" ">>> new_reader.readline()\n" "'3: Goodbye!'" -#: ../../library/pickle.rst:912 +#: ../../library/pickle.rst:899 msgid "Custom Reduction for Types, Functions, and Other Objects" msgstr "針對型別、函式或特定物件定製縮減函式" -#: ../../library/pickle.rst:916 +#: ../../library/pickle.rst:903 msgid "" "Sometimes, :attr:`~Pickler.dispatch_table` may not be flexible enough. In " "particular we may want to customize pickling based on another criterion than " @@ -1859,7 +1823,7 @@ msgstr "" "用型別以外的方式來判斷如何使用自訂封裝、或者我們想要自訂特定函式和類別的封裝" "方法時。" -#: ../../library/pickle.rst:921 +#: ../../library/pickle.rst:908 msgid "" "For those cases, it is possible to subclass from the :class:`Pickler` class " "and implement a :meth:`~Pickler.reducer_override` method. This method can " @@ -1867,40 +1831,39 @@ msgid "" "alternatively return :data:`NotImplemented` to fallback to the traditional " "behavior." msgstr "" -"如果是這樣的話,可以繼承 :class:`Pickler` 類別並實作一" -"個 :meth:`~Pickler.reducer_override` 方法。此方法可以回傳任意的縮減元組(參" -"閱 :meth:`~object.__reduce__`)、也可以回傳 :data:`NotImplemented` 以使用後備" -"的原始行為方案。" +"如果是這樣的話,可以繼承 :class:`Pickler` 類別並實作一個 :meth:`~Pickler." +"reducer_override` 方法。此方法可以回傳任意的縮減元組(參閱 :meth:`~object." +"__reduce__`)、也可以回傳 :data:`NotImplemented` 以使用後備的原始行為方案。" -#: ../../library/pickle.rst:926 +#: ../../library/pickle.rst:913 msgid "" -"If both the :attr:`~Pickler.dispatch_table` " -"and :meth:`~Pickler.reducer_override` are defined, " -"then :meth:`~Pickler.reducer_override` method takes priority." +"If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler." +"reducer_override` are defined, then :meth:`~Pickler.reducer_override` method " +"takes priority." msgstr "" "如果 :attr:`~Pickler.dispatch_table` 和 :meth:`~Pickler.reducer_override` 都" "被定義了的話,:meth:`~Pickler.reducer_override` 的優先度較高。" -#: ../../library/pickle.rst:931 +#: ../../library/pickle.rst:918 msgid "" "For performance reasons, :meth:`~Pickler.reducer_override` may not be called " "for the following objects: ``None``, ``True``, ``False``, and exact " -"instances " -"of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` " -"and :class:`tuple`." +"instances of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :" +"class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` and :class:" +"`tuple`." msgstr "" "出於效能考量,處裡以下物件可能不會呼叫 :meth:`~Pickler.reducer_override`:" -"``None``、``True``、``False``,以" -"及 :class:`int`、:class:`float`、:class:`bytes`、:class:`str`、:class:`dict`、:class:`set`、:class:`frozenset`、:class:`list` " -"和 :class:`tuple` 的實例。" +"``None``、``True``、``False``,以及 :class:`int`、:class:`float`、:class:" +"`bytes`、:class:`str`、:class:`dict`、:class:`set`、:class:`frozenset`、:" +"class:`list` 和 :class:`tuple` 的實例。" -#: ../../library/pickle.rst:937 +#: ../../library/pickle.rst:924 msgid "" "Here is a simple example where we allow pickling and reconstructing a given " "class::" msgstr "以下是一個簡單的例子,我們示範如何允許封裝和重建給定的類別:::" -#: ../../library/pickle.rst:940 +#: ../../library/pickle.rst:927 msgid "" "import io\n" "import pickle\n" @@ -1958,11 +1921,11 @@ msgstr "" "assert unpickled_class.__name__ == \"MyClass\"\n" "assert unpickled_class.my_attribute == 1\n" -#: ../../library/pickle.rst:972 +#: ../../library/pickle.rst:959 msgid "Out-of-band Buffers" msgstr "帶外(Out-of-band)資料緩衝區" -#: ../../library/pickle.rst:976 +#: ../../library/pickle.rst:963 msgid "" "In some contexts, the :mod:`pickle` module is used to transfer massive " "amounts of data. Therefore, it can be important to minimize the number of " @@ -1976,7 +1939,7 @@ msgstr "" "的圖狀結構(graph-like structure)轉換為連續的位元組串流時,本質上就涉及將資" "料複製到封裝流以及從封裝流複製資料。" -#: ../../library/pickle.rst:983 +#: ../../library/pickle.rst:970 msgid "" "This constraint can be eschewed if both the *provider* (the implementation " "of the object types to be transferred) and the *consumer* (the " @@ -1987,23 +1950,22 @@ msgstr "" "實作)都支援由 pickle 協定 5 或更高版本提供的帶外傳輸功能,則可以避免此一先天" "限制。" -#: ../../library/pickle.rst:989 +#: ../../library/pickle.rst:976 msgid "Provider API" msgstr "供給者 API" -#: ../../library/pickle.rst:991 +#: ../../library/pickle.rst:978 msgid "" -"The large data objects to be pickled must implement " -"a :meth:`~object.__reduce_ex__` method specialized for protocol 5 and " -"higher, which returns a :class:`PickleBuffer` instance (instead of e.g. " -"a :class:`bytes` object) for any large data." +"The large data objects to be pickled must implement a :meth:`~object." +"__reduce_ex__` method specialized for protocol 5 and higher, which returns " +"a :class:`PickleBuffer` instance (instead of e.g. a :class:`bytes` object) " +"for any large data." msgstr "" -"要封裝的大型資料物件,則必須實作一個針對 5 版協定及以上" -"的 :meth:`~object.__reduce_ex__` 方法,該方法應回傳一" -"個 :class:`PickleBuffer` 實例來處理任何大型資料(而非回傳如 :class:`bytes` 物" -"件)。" +"要封裝的大型資料物件,則必須實作一個針對 5 版協定及以上的 :meth:`~object." +"__reduce_ex__` 方法,該方法應回傳一個 :class:`PickleBuffer` 實例來處理任何大" +"型資料(而非回傳如 :class:`bytes` 物件)。" -#: ../../library/pickle.rst:996 +#: ../../library/pickle.rst:983 msgid "" "A :class:`PickleBuffer` object *signals* that the underlying buffer is " "eligible for out-of-band data transfer. Those objects remain compatible " @@ -2015,50 +1977,49 @@ msgstr "" "資料傳輸。這些物件仍然相容 :mod:`pickle` 模組的一般使用方式。消費者程式也可以" "選擇介入,指示 :mod:`pickle` 他們將自行處理這些緩衝區。" -#: ../../library/pickle.rst:1003 +#: ../../library/pickle.rst:990 msgid "Consumer API" msgstr "消費者 API" -#: ../../library/pickle.rst:1005 +#: ../../library/pickle.rst:992 msgid "" -"A communications system can enable custom handling of " -"the :class:`PickleBuffer` objects generated when serializing an object graph." +"A communications system can enable custom handling of the :class:" +"`PickleBuffer` objects generated when serializing an object graph." msgstr "" "一個資訊交換系統可以決定要自行處裡序列化物件圖時產生的 :class:`PickleBuffer` " "物件。" -#: ../../library/pickle.rst:1008 +#: ../../library/pickle.rst:995 msgid "" -"On the sending side, it needs to pass a *buffer_callback* argument " -"to :class:`Pickler` (or to the :func:`dump` or :func:`dumps` function), " -"which will be called with each :class:`PickleBuffer` generated while " -"pickling the object graph. Buffers accumulated by the *buffer_callback* " -"will not see their data copied into the pickle stream, only a cheap marker " -"will be inserted." +"On the sending side, it needs to pass a *buffer_callback* argument to :class:" +"`Pickler` (or to the :func:`dump` or :func:`dumps` function), which will be " +"called with each :class:`PickleBuffer` generated while pickling the object " +"graph. Buffers accumulated by the *buffer_callback* will not see their data " +"copied into the pickle stream, only a cheap marker will be inserted." msgstr "" -"傳送端需要傳遞一個呼叫緩衝區的回呼函式給 :class:`Pickler`\\ " -"(或 :func:`dump` 或 :func:`dumps` 函式)的 *buffer_callback* 引數,使每次生" -"成 :class:`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以" -"外,由 *buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" +"傳送端需要傳遞一個呼叫緩衝區的回呼函式給 :class:`Pickler`\\ (或 :func:" +"`dump` 或 :func:`dumps` 函式)的 *buffer_callback* 引數,使每次生成 :class:" +"`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以外,由 " +"*buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" -#: ../../library/pickle.rst:1015 +#: ../../library/pickle.rst:1002 msgid "" -"On the receiving side, it needs to pass a *buffers* argument " -"to :class:`Unpickler` (or to the :func:`load` or :func:`loads` function), " -"which is an iterable of the buffers which were passed to *buffer_callback*. " -"That iterable should produce buffers in the same order as they were passed " -"to *buffer_callback*. Those buffers will provide the data expected by the " -"reconstructors of the objects whose pickling produced the " -"original :class:`PickleBuffer` objects." +"On the receiving side, it needs to pass a *buffers* argument to :class:" +"`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an " +"iterable of the buffers which were passed to *buffer_callback*. That " +"iterable should produce buffers in the same order as they were passed to " +"*buffer_callback*. Those buffers will provide the data expected by the " +"reconstructors of the objects whose pickling produced the original :class:" +"`PickleBuffer` objects." msgstr "" -"接收端需要傳遞一個緩衝區物件給 :class:`Unpickler`\\ (或 :func:`load` " -"或 :func:`loads` 函式)的 *buffers* 引數。該物件須是一個可疊代的(iterable)" -"緩衝區(buffer)物件,其中包含傳遞給 *buffer_callback* 的緩衝區物件。這個可疊" -"代物件的緩衝區順序應該與它們當初被封裝時傳遞給 *buffer_callback* 的順序相同。" -"這些緩衝區將提供物件重建所需的資料,以使重建器能還原出那個當時產生" -"了 :class:`PickleBuffer` 的物件。" +"接收端需要傳遞一個緩衝區物件給 :class:`Unpickler`\\ (或 :func:`load` 或 :" +"func:`loads` 函式)的 *buffers* 引數。該物件須是一個可疊代的(iterable)緩衝" +"區(buffer)物件,其中包含傳遞給 *buffer_callback* 的緩衝區物件。這個可疊代物" +"件的緩衝區順序應該與它們當初被封裝時傳遞給 *buffer_callback* 的順序相同。這些" +"緩衝區將提供物件重建所需的資料,以使重建器能還原出那個當時產生了 :class:" +"`PickleBuffer` 的物件。" -#: ../../library/pickle.rst:1023 +#: ../../library/pickle.rst:1010 msgid "" "Between the sending side and the receiving side, the communications system " "is free to implement its own transfer mechanism for out-of-band buffers. " @@ -2068,19 +2029,19 @@ msgstr "" "在傳送與接收端之間,通訊系統可以自由實作轉移帶外緩衝區資料的機制。該機制可能" "可以利用共用記憶體機制或根據資料類型特定的壓縮方式來最佳化執行速度。" -#: ../../library/pickle.rst:1029 +#: ../../library/pickle.rst:1016 msgid "Example" msgstr "範例" -#: ../../library/pickle.rst:1031 +#: ../../library/pickle.rst:1018 msgid "" "Here is a trivial example where we implement a :class:`bytearray` subclass " "able to participate in out-of-band buffer pickling::" msgstr "" -"這一個簡單的範例展示了如何實作一個可以參與帶外緩衝區封裝" -"的 :class:`bytearray` 子類別:::" +"這一個簡單的範例展示了如何實作一個可以參與帶外緩衝區封裝的 :class:" +"`bytearray` 子類別:::" -#: ../../library/pickle.rst:1034 +#: ../../library/pickle.rst:1021 msgid "" "class ZeroCopyByteArray(bytearray):\n" "\n" @@ -2123,7 +2084,7 @@ msgstr "" " else:\n" " return cls(obj)" -#: ../../library/pickle.rst:1055 +#: ../../library/pickle.rst:1042 msgid "" "The reconstructor (the ``_reconstruct`` class method) returns the buffer's " "providing object if it has the right type. This is an easy way to simulate " @@ -2132,7 +2093,7 @@ msgstr "" "如果型別正確,重建器(``_reconstruct`` 類別方法)會回傳當時提供緩衝區的物件。" "這個簡易實作可以模擬一個無複製行為的重建器。" -#: ../../library/pickle.rst:1059 +#: ../../library/pickle.rst:1046 msgid "" "On the consumer side, we can pickle those objects the usual way, which when " "unserialized will give us a copy of the original object::" @@ -2140,7 +2101,7 @@ msgstr "" "在使用端,我們可以用一般的方式封裝這些物件,當我們拆封時會得到一個原始物件的" "副本:::" -#: ../../library/pickle.rst:1062 +#: ../../library/pickle.rst:1049 msgid "" "b = ZeroCopyByteArray(b\"abc\")\n" "data = pickle.dumps(b, protocol=5)\n" @@ -2154,7 +2115,7 @@ msgstr "" "print(b == new_b) # True\n" "print(b is new_b) # False: 曾進行過複製運算" -#: ../../library/pickle.rst:1068 +#: ../../library/pickle.rst:1055 msgid "" "But if we pass a *buffer_callback* and then give back the accumulated " "buffers when unserializing, we are able to get back the original object::" @@ -2162,7 +2123,7 @@ msgstr "" "但如果我們傳一個 *buffer_callback* 並在去序列化時正確回傳積累的緩衝資料,我們" "就能拿回原始的物件:::" -#: ../../library/pickle.rst:1071 +#: ../../library/pickle.rst:1058 msgid "" "b = ZeroCopyByteArray(b\"abc\")\n" "buffers = []\n" @@ -2178,7 +2139,7 @@ msgstr "" "print(b == new_b) # True\n" "print(b is new_b) # True: 沒有進行過複製" -#: ../../library/pickle.rst:1078 +#: ../../library/pickle.rst:1065 msgid "" "This example is limited by the fact that :class:`bytearray` allocates its " "own memory: you cannot create a :class:`bytearray` instance that is backed " @@ -2192,15 +2153,15 @@ msgstr "" "則可能沒有這個限制,而允許在不同程序或系統之間傳輸資料時使用零拷貝封裝(或儘" "可能地減少拷貝次數)。" -#: ../../library/pickle.rst:1085 +#: ../../library/pickle.rst:1072 msgid ":pep:`574` -- Pickle protocol 5 with out-of-band data" msgstr ":pep:`574` -- 第 5 版 Pickle 協定的帶外資料(out-of-band data)處裡" -#: ../../library/pickle.rst:1091 +#: ../../library/pickle.rst:1078 msgid "Restricting Globals" msgstr "限制全域物件" -#: ../../library/pickle.rst:1096 +#: ../../library/pickle.rst:1083 msgid "" "By default, unpickling will import any class or function that it finds in " "the pickle data. For many applications, this behaviour is unacceptable as " @@ -2211,7 +2172,7 @@ msgstr "" "用程式來說,這種行為是不可接受的,因為它讓拆封器能夠引入並執行任意程式碼。請" "參見以下 pickle 資料流在載入時的行為:::" -#: ../../library/pickle.rst:1101 +#: ../../library/pickle.rst:1088 msgid "" ">>> import pickle\n" ">>> pickle.loads(b\"cos\\nsystem\\n(S'echo hello world'\\ntR.\")\n" @@ -2223,7 +2184,7 @@ msgstr "" "hello world\n" "0" -#: ../../library/pickle.rst:1106 +#: ../../library/pickle.rst:1093 msgid "" "In this example, the unpickler imports the :func:`os.system` function and " "then apply the string argument \"echo hello world\". Although this example " @@ -2234,28 +2195,28 @@ msgstr "" "world」。雖然這個例子是無害的,但不難想像可以這個方式輕易執行任意可能對系統造" "成損害的命令。" -#: ../../library/pickle.rst:1110 +#: ../../library/pickle.rst:1097 msgid "" -"For this reason, you may want to control what gets unpickled by " -"customizing :meth:`Unpickler.find_class`. Unlike its name " -"suggests, :meth:`Unpickler.find_class` is called whenever a global (i.e., a " -"class or a function) is requested. Thus it is possible to either completely " -"forbid globals or restrict them to a safe subset." +"For this reason, you may want to control what gets unpickled by customizing :" +"meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler." +"find_class` is called whenever a global (i.e., a class or a function) is " +"requested. Thus it is possible to either completely forbid globals or " +"restrict them to a safe subset." msgstr "" "基於以上原因,你可能會希望透過自訂 :meth:`Unpickler.find_class` 來控制哪些是" "能夠被拆封的內容。與其名稱字面意義暗示的不同,實際上每當你請求一個全域物件" "(例如,類別或函式)時,就會呼叫 :meth:`Unpickler.find_class`。因此,可以透過" "這個方法完全禁止全域物件或將其限制在安全的子集合。" -#: ../../library/pickle.rst:1116 +#: ../../library/pickle.rst:1103 msgid "" -"Here is an example of an unpickler allowing only few safe classes from " -"the :mod:`builtins` module to be loaded::" +"Here is an example of an unpickler allowing only few safe classes from the :" +"mod:`builtins` module to be loaded::" msgstr "" "以下是一個僅允許從 :mod:`builtins` 模組中載入少數安全類別的拆封器" "(unpickler)的例子:::" -#: ../../library/pickle.rst:1119 +#: ../../library/pickle.rst:1106 msgid "" "import builtins\n" "import io\n" @@ -2309,11 +2270,11 @@ msgstr "" " \"\"\"一個模擬 pickle.loads() 的輔助函式\"\"\"\n" " return RestrictedUnpickler(io.BytesIO(s)).load()" -#: ../../library/pickle.rst:1145 +#: ../../library/pickle.rst:1132 msgid "A sample usage of our unpickler working as intended::" msgstr "我們剛才實作的的拆封器範例正常運作的樣子:::" -#: ../../library/pickle.rst:1147 +#: ../../library/pickle.rst:1134 msgid "" ">>> restricted_loads(pickle.dumps([1, 2, range(15)]))\n" "[1, 2, range(0, 15)]\n" @@ -2341,7 +2302,7 @@ msgstr "" " ...\n" "pickle.UnpicklingError: global 'builtins.eval' is forbidden" -#: ../../library/pickle.rst:1164 +#: ../../library/pickle.rst:1151 msgid "" "As our examples shows, you have to be careful with what you allow to be " "unpickled. Therefore if security is a concern, you may want to consider " @@ -2352,11 +2313,11 @@ msgstr "" "心安全性,你可能需要考慮其他選擇,例如 :mod:`xmlrpc.client` 中的 marshalling " "API 或其他第三方解決方案。" -#: ../../library/pickle.rst:1171 +#: ../../library/pickle.rst:1158 msgid "Performance" msgstr "效能" -#: ../../library/pickle.rst:1173 +#: ../../library/pickle.rst:1160 msgid "" "Recent versions of the pickle protocol (from protocol 2 and upwards) feature " "efficient binary encodings for several common features and built-in types. " @@ -2366,16 +2327,16 @@ msgstr "" "率的二進位編碼。此外,:mod:`pickle` 模組還具備一個透明化的、以 C 語言編寫的最" "佳化工具。" -#: ../../library/pickle.rst:1181 +#: ../../library/pickle.rst:1168 msgid "Examples" msgstr "範例" -#: ../../library/pickle.rst:1183 +#: ../../library/pickle.rst:1170 msgid "" "For the simplest code, use the :func:`dump` and :func:`load` functions. ::" msgstr "最簡單的使用方式,呼叫 :func:`dump` 和 :func:`load` 函式。::" -#: ../../library/pickle.rst:1185 +#: ../../library/pickle.rst:1172 msgid "" "import pickle\n" "\n" @@ -2403,11 +2364,11 @@ msgstr "" " # 使用可用的最高協定來封裝 'data' 字典。\n" " pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)\n" -#: ../../library/pickle.rst:1199 +#: ../../library/pickle.rst:1186 msgid "The following example reads the resulting pickled data. ::" msgstr "以下範例可以讀取前述程式所封裝的 pickle 資料。::" -#: ../../library/pickle.rst:1201 +#: ../../library/pickle.rst:1188 msgid "" "import pickle\n" "\n" @@ -2422,81 +2383,81 @@ msgstr "" " # 會自動檢測資料使用的協定版本,因此我們不需要手動指定。\n" " data = pickle.load(f)" -#: ../../library/pickle.rst:1216 +#: ../../library/pickle.rst:1203 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/pickle.rst:1218 +#: ../../library/pickle.rst:1205 msgid "" "The :mod:`pickle` module can be invoked as a script from the command line, " "it will display contents of the pickle files. However, when the pickle file " "that you want to examine comes from an untrusted source, ``-m pickletools`` " -"is a safer option because it does not execute pickle bytecode, " -"see :ref:`pickletools CLI usage `." +"is a safer option because it does not execute pickle bytecode, see :ref:" +"`pickletools CLI usage `." msgstr "" -#: ../../library/pickle.rst:1224 +#: ../../library/pickle.rst:1211 msgid "python -m pickle pickle_file [pickle_file ...]" msgstr "python -m pickle pickle_file [pickle_file ...]" -#: ../../library/pickle.rst:1228 +#: ../../library/pickle.rst:1215 msgid "The following option is accepted:" msgstr "接受以下選項:" -#: ../../library/pickle.rst:1234 +#: ../../library/pickle.rst:1221 msgid "" "A pickle file to read, or ``-`` to indicate reading from standard input." msgstr "" -#: ../../library/pickle.rst:1239 +#: ../../library/pickle.rst:1226 msgid "Module :mod:`copyreg`" msgstr ":mod:`copyreg` 模組" -#: ../../library/pickle.rst:1240 +#: ../../library/pickle.rst:1227 msgid "Pickle interface constructor registration for extension types." msgstr "註冊擴充型別的 Pickle 介面建構子。" -#: ../../library/pickle.rst:1242 +#: ../../library/pickle.rst:1229 msgid "Module :mod:`pickletools`" msgstr ":mod:`pickletools` 模組" -#: ../../library/pickle.rst:1243 +#: ../../library/pickle.rst:1230 msgid "Tools for working with and analyzing pickled data." msgstr "用於分析或處裡被封裝資料的工具。" -#: ../../library/pickle.rst:1245 +#: ../../library/pickle.rst:1232 msgid "Module :mod:`shelve`" msgstr ":mod:`shelve` 模組" -#: ../../library/pickle.rst:1246 +#: ../../library/pickle.rst:1233 msgid "Indexed databases of objects; uses :mod:`pickle`." msgstr "索引式資料庫;使用 :mod:`pickle` 實作。" -#: ../../library/pickle.rst:1248 +#: ../../library/pickle.rst:1235 msgid "Module :mod:`copy`" msgstr ":mod:`copy` 模組" -#: ../../library/pickle.rst:1249 +#: ../../library/pickle.rst:1236 msgid "Shallow and deep object copying." msgstr "物件的淺層或深度拷貝。" -#: ../../library/pickle.rst:1251 +#: ../../library/pickle.rst:1238 msgid "Module :mod:`marshal`" msgstr ":mod:`marshal` 模組" -#: ../../library/pickle.rst:1252 +#: ../../library/pickle.rst:1239 msgid "High-performance serialization of built-in types." msgstr "內建型別的高效能序列化。" -#: ../../library/pickle.rst:1256 +#: ../../library/pickle.rst:1243 msgid "Footnotes" msgstr "註解" -#: ../../library/pickle.rst:1257 +#: ../../library/pickle.rst:1244 msgid "Don't confuse this with the :mod:`marshal` module" msgstr "不要將此模組與 :mod:`marshal` 模組混淆" -#: ../../library/pickle.rst:1259 +#: ../../library/pickle.rst:1246 msgid "" "This is why :keyword:`lambda` functions cannot be pickled: all :keyword:`!" "lambda` functions share the same name: ````." @@ -2504,21 +2465,21 @@ msgstr "" "這就是為什麼 :keyword:`lambda` 函式無法被封裝:所有 :keyword:`!lambda` 函式共" "享相同的名稱:````。" -#: ../../library/pickle.rst:1262 +#: ../../library/pickle.rst:1249 msgid "" -"The exception raised will likely be an :exc:`ImportError` or " -"an :exc:`AttributeError` but it could be something else." +"The exception raised will likely be an :exc:`ImportError` or an :exc:" +"`AttributeError` but it could be something else." msgstr "" "引發的例外應該是 :exc:`ImportError` 或 :exc:`AttributeError`,但也可能是其他" "例外。" -#: ../../library/pickle.rst:1265 +#: ../../library/pickle.rst:1252 msgid "" "The :mod:`copy` module uses this protocol for shallow and deep copying " "operations." msgstr ":mod:`copy` 模組使用此協定進行淺層及深層複製操作。" -#: ../../library/pickle.rst:1268 +#: ../../library/pickle.rst:1255 msgid "" "The limitation on alphanumeric characters is due to the fact that persistent " "IDs in protocol 0 are delimited by the newline character. Therefore if any " @@ -2557,34 +2518,59 @@ msgstr "flattening(攤平)" msgid "pickling" msgstr "pickling" -#: ../../library/pickle.rst:123 +#: ../../library/pickle.rst:110 msgid "External Data Representation" msgstr "External Data Representation(外部資料表現)" -#: ../../library/pickle.rst:688 +#: ../../library/pickle.rst:675 msgid "copy" msgstr "copy(複製)" -#: ../../library/pickle.rst:688 +#: ../../library/pickle.rst:675 msgid "protocol" msgstr "protocol(協定)" -#: ../../library/pickle.rst:772 +#: ../../library/pickle.rst:759 msgid "persistent_id (pickle protocol)" msgstr "persistent_id(pickle 協定)" -#: ../../library/pickle.rst:772 +#: ../../library/pickle.rst:759 msgid "persistent_load (pickle protocol)" msgstr "persistent_load(pickle 協定)" -#: ../../library/pickle.rst:848 +#: ../../library/pickle.rst:835 msgid "__getstate__() (copy protocol)" msgstr "__getstate__()(copy 協定)" -#: ../../library/pickle.rst:848 +#: ../../library/pickle.rst:835 msgid "__setstate__() (copy protocol)" msgstr "__setstate__()(copy 協定)" -#: ../../library/pickle.rst:1093 +#: ../../library/pickle.rst:1080 msgid "find_class() (pickle protocol)" msgstr "find_class()(pickle 協定)" + +#~ msgid "" +#~ "The :mod:`pickle` module keeps track of the objects it has already " +#~ "serialized, so that later references to the same object won't be " +#~ "serialized again. :mod:`marshal` doesn't do this." +#~ msgstr "" +#~ ":mod:`pickle` 會記住哪些物件已經被序列化過了,稍後再次參照到這個物件的時候" +#~ "才不會進行重複的序列化。:mod:`marshal` 沒有這個功能。" + +#~ msgid "" +#~ "This has implications both for recursive objects and object sharing. " +#~ "Recursive objects are objects that contain references to themselves. " +#~ "These are not handled by marshal, and in fact, attempting to marshal " +#~ "recursive objects will crash your Python interpreter. Object sharing " +#~ "happens when there are multiple references to the same object in " +#~ "different places in the object hierarchy being serialized. :mod:`pickle` " +#~ "stores such objects only once, and ensures that all other references " +#~ "point to the master copy. Shared objects remain shared, which can be " +#~ "very important for mutable objects." +#~ msgstr "" +#~ "這對遞迴物件和物件共用都有影響。遞迴物件是指包含自我參照的物件。這些情況" +#~ "在 marshal 模組中不會被處理,若嘗試使用 marshal 處理遞迴物件會導致 Python " +#~ "直譯器崩潰。物件共用發生在序列化的物件階層中、不同位置對同一物件有多個參照" +#~ "時。:mod:`pickle` 只會儲存這個被參照的物件一次,並確保所有其他參照指向這個" +#~ "主要的版本。共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" diff --git a/library/site.po b/library/site.po index 4ab35b39ea..d9e0fa07b2 100644 --- a/library/site.po +++ b/library/site.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-18 00:15+0000\n" +"POT-Creation-Date: 2026-02-03 00:20+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -56,7 +56,7 @@ msgid "" "empty heads are skipped. For the tail part, it uses the empty string and " "then :file:`lib/site-packages` (on Windows) or :file:`lib/python{X.Y[t]}/" "site-packages` (on Unix and macOS). (The optional suffix \"t\" indicates " -"the :term:`free threading` build, and is appended if ``\"t\"`` is present in " +"the :term:`free-threaded build`, and is appended if ``\"t\"`` is present in " "the :data:`sys.abiflags` constant.) For each of the distinct head-tail " "combinations, it sees if it refers to an existing directory, and if so, adds " "it to ``sys.path`` and also inspects the newly added path for configuration " diff --git a/library/stdtypes.po b/library/stdtypes.po index 4275be44cc..1fafd07b11 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-01-20 00:15+0000\n" +"POT-Creation-Date: 2026-02-05 00:20+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:284 #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1007 -#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:3135 -#: ../../library/stdtypes.rst:4395 +#: ../../library/stdtypes.rst:1229 ../../library/stdtypes.rst:3164 +#: ../../library/stdtypes.rst:4424 msgid "Notes" msgstr "註解" @@ -154,7 +154,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:90 ../../library/stdtypes.rst:1009 #: ../../library/stdtypes.rst:1012 ../../library/stdtypes.rst:1244 -#: ../../library/stdtypes.rst:3141 ../../library/stdtypes.rst:4401 +#: ../../library/stdtypes.rst:3170 ../../library/stdtypes.rst:4430 msgid "\\(1)" msgstr "\\(1)" @@ -168,8 +168,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:93 ../../library/stdtypes.rst:297 #: ../../library/stdtypes.rst:317 ../../library/stdtypes.rst:1255 -#: ../../library/stdtypes.rst:3145 ../../library/stdtypes.rst:3147 -#: ../../library/stdtypes.rst:4405 ../../library/stdtypes.rst:4407 +#: ../../library/stdtypes.rst:3174 ../../library/stdtypes.rst:3176 +#: ../../library/stdtypes.rst:4434 ../../library/stdtypes.rst:4436 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:3149 -#: ../../library/stdtypes.rst:3151 ../../library/stdtypes.rst:3153 -#: ../../library/stdtypes.rst:3155 ../../library/stdtypes.rst:4409 -#: ../../library/stdtypes.rst:4411 ../../library/stdtypes.rst:4413 -#: ../../library/stdtypes.rst:4415 +#: ../../library/stdtypes.rst:96 ../../library/stdtypes.rst:3178 +#: ../../library/stdtypes.rst:3180 ../../library/stdtypes.rst:3182 +#: ../../library/stdtypes.rst:3184 ../../library/stdtypes.rst:4438 +#: ../../library/stdtypes.rst:4440 ../../library/stdtypes.rst:4442 +#: ../../library/stdtypes.rst:4444 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:105 ../../library/stdtypes.rst:328 #: ../../library/stdtypes.rst:442 ../../library/stdtypes.rst:1051 -#: ../../library/stdtypes.rst:1259 ../../library/stdtypes.rst:3181 -#: ../../library/stdtypes.rst:4445 +#: ../../library/stdtypes.rst:1259 ../../library/stdtypes.rst:3210 +#: ../../library/stdtypes.rst:4474 msgid "Notes:" msgstr "註解:" @@ -239,9 +239,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:146 ../../library/stdtypes.rst:3112 -#: ../../library/stdtypes.rst:3135 ../../library/stdtypes.rst:4372 -#: ../../library/stdtypes.rst:4395 +#: ../../library/stdtypes.rst:146 ../../library/stdtypes.rst:3141 +#: ../../library/stdtypes.rst:3164 ../../library/stdtypes.rst:4401 +#: ../../library/stdtypes.rst:4424 msgid "Meaning" msgstr "含義" @@ -574,8 +574,8 @@ msgid "" "zero." msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" -#: ../../library/stdtypes.rst:310 ../../library/stdtypes.rst:3143 -#: ../../library/stdtypes.rst:4432 +#: ../../library/stdtypes.rst:310 ../../library/stdtypes.rst:3172 +#: ../../library/stdtypes.rst:4461 msgid "\\(6)" msgstr "\\(6)" @@ -612,9 +612,9 @@ msgid "*x* to the power *y*" msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:319 ../../library/stdtypes.rst:321 -#: ../../library/stdtypes.rst:3168 ../../library/stdtypes.rst:3171 -#: ../../library/stdtypes.rst:3174 ../../library/stdtypes.rst:4428 -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:3197 ../../library/stdtypes.rst:3200 +#: ../../library/stdtypes.rst:3203 ../../library/stdtypes.rst:4457 +#: ../../library/stdtypes.rst:4464 msgid "\\(5)" msgstr "\\(5)" @@ -697,8 +697,8 @@ msgstr "" "算:" #: ../../library/stdtypes.rst:376 -msgid ":func:`math.trunc( x) `" -msgstr ":func:`math.trunc( x) `" +msgid ":func:`math.trunc(\\ x) `" +msgstr ":func:`math.trunc(\\ x) `" #: ../../library/stdtypes.rst:376 msgid "*x* truncated to :class:`~numbers.Integral`" @@ -715,8 +715,8 @@ msgid "" msgstr "*x* 進位至小數點後第 *n* 位,使用偶數捨入法。若省略 *n* ,則預設為 0。" #: ../../library/stdtypes.rst:383 -msgid ":func:`math.floor( x) `" -msgstr ":func:`math.floor( x) `" +msgid ":func:`math.floor(\\ x) `" +msgstr ":func:`math.floor(\\ x) `" #: ../../library/stdtypes.rst:383 msgid "the greatest :class:`~numbers.Integral` <= *x*" @@ -772,9 +772,9 @@ msgid "bitwise :dfn:`or` of *x* and *y*" msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:426 ../../library/stdtypes.rst:429 -#: ../../library/stdtypes.rst:432 ../../library/stdtypes.rst:3157 -#: ../../library/stdtypes.rst:3161 ../../library/stdtypes.rst:4417 -#: ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:432 ../../library/stdtypes.rst:3186 +#: ../../library/stdtypes.rst:3190 ../../library/stdtypes.rst:4446 +#: ../../library/stdtypes.rst:4450 msgid "\\(4)" msgstr "\\(4)" @@ -3266,7 +3266,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:2007 ../../library/stdtypes.rst:3571 +#: ../../library/stdtypes.rst:2007 ../../library/stdtypes.rst:3600 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -3302,11 +3302,11 @@ msgstr "" ">>> encoded_str_to_bytes\n" "b'Python'" -#: ../../library/stdtypes.rst:2030 ../../library/stdtypes.rst:3590 +#: ../../library/stdtypes.rst:2030 ../../library/stdtypes.rst:3619 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:2033 ../../library/stdtypes.rst:3593 +#: ../../library/stdtypes.rst:2033 ../../library/stdtypes.rst:3622 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." @@ -3475,7 +3475,10 @@ msgid "" msgstr "" #: ../../library/stdtypes.rst:2164 +#, fuzzy msgid "" +">>> 'spam, spam, spam'.index('spam')\n" +"0\n" ">>> 'spam, spam, spam'.index('eggs')\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" @@ -3490,11 +3493,11 @@ msgstr "" " ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^\n" "ValueError: substring not found" -#: ../../library/stdtypes.rst:2173 +#: ../../library/stdtypes.rst:2175 msgid "See also :meth:`rindex`." msgstr "另請參閱 :meth:`rindex`。" -#: ../../library/stdtypes.rst:2178 +#: ../../library/stdtypes.rst:2180 msgid "" "Return ``True`` if all characters in the string are alphanumeric and there " "is at least one character, ``False`` otherwise. A character ``c`` is " @@ -3502,7 +3505,7 @@ msgid "" "isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." msgstr "" -#: ../../library/stdtypes.rst:2186 +#: ../../library/stdtypes.rst:2188 msgid "" "Return ``True`` if all characters in the string are alphabetic and there is " "at least one character, ``False`` otherwise. Alphabetic characters are " @@ -3514,7 +3517,7 @@ msgid "" "spec/chapter-4/#G91002>`_. For example:" msgstr "" -#: ../../library/stdtypes.rst:2195 +#: ../../library/stdtypes.rst:2197 msgid "" ">>> 'Letters and spaces'.isalpha()\n" "False\n" @@ -3531,18 +3534,18 @@ msgstr "" ">>> 'µ'.isalpha() # 非 ASCII 字元也可以被視為字母\n" "True" -#: ../../library/stdtypes.rst:2204 +#: ../../library/stdtypes.rst:2206 msgid "See :ref:`unicode-properties`." msgstr "請參閱 :ref:`unicode-properties`。" -#: ../../library/stdtypes.rst:2209 +#: ../../library/stdtypes.rst:2211 msgid "" "Return ``True`` if the string is empty or all characters in the string are " "ASCII, ``False`` otherwise. ASCII characters have code points in the range " "U+0000-U+007F. For example:" msgstr "" -#: ../../library/stdtypes.rst:2213 +#: ../../library/stdtypes.rst:2215 msgid "" ">>> 'ASCII characters'.isascii()\n" "True\n" @@ -3554,7 +3557,7 @@ msgstr "" ">>> 'µ'.isascii()\n" "False" -#: ../../library/stdtypes.rst:2225 +#: ../../library/stdtypes.rst:2227 msgid "" "Return ``True`` if all characters in the string are decimal characters and " "there is at least one character, ``False`` otherwise. Decimal characters are " @@ -3563,7 +3566,7 @@ msgid "" "Unicode General Category \"Nd\". For example:" msgstr "" -#: ../../library/stdtypes.rst:2232 +#: ../../library/stdtypes.rst:2234 msgid "" ">>> '0123456789'.isdecimal()\n" "True\n" @@ -3579,7 +3582,7 @@ msgstr "" ">>> 'alphabetic'.isdecimal()\n" "False" -#: ../../library/stdtypes.rst:2244 +#: ../../library/stdtypes.rst:2246 msgid "" "Return ``True`` if all characters in the string are digits and there is at " "least one character, ``False`` otherwise. Digits include decimal characters " @@ -3589,23 +3592,23 @@ msgid "" "property value Numeric_Type=Digit or Numeric_Type=Decimal." msgstr "" -#: ../../library/stdtypes.rst:2254 +#: ../../library/stdtypes.rst:2256 msgid "" "Return ``True`` if the string is a valid identifier according to the " "language definition, section :ref:`identifiers`." msgstr "" -#: ../../library/stdtypes.rst:2257 +#: ../../library/stdtypes.rst:2259 msgid "" ":func:`keyword.iskeyword` can be used to test whether string ``s`` is a " "reserved identifier, such as :keyword:`def` and :keyword:`class`." msgstr "" -#: ../../library/stdtypes.rst:2260 +#: ../../library/stdtypes.rst:2262 msgid "Example: ::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:2263 +#: ../../library/stdtypes.rst:2265 msgid "" ">>> from keyword import iskeyword\n" "\n" @@ -3621,13 +3624,13 @@ msgstr "" ">>> 'def'.isidentifier(), iskeyword('def')\n" "(True, True)" -#: ../../library/stdtypes.rst:2273 +#: ../../library/stdtypes.rst:2275 msgid "" "Return ``True`` if all cased characters [4]_ in the string are lowercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:2279 +#: ../../library/stdtypes.rst:2281 msgid "" "Return ``True`` if all characters in the string are numeric characters, and " "there is at least one character, ``False`` otherwise. Numeric characters " @@ -3637,7 +3640,7 @@ msgid "" "Numeric_Type=Decimal or Numeric_Type=Numeric. For example:" msgstr "" -#: ../../library/stdtypes.rst:2287 +#: ../../library/stdtypes.rst:2289 msgid "" ">>> '0123456789'.isnumeric()\n" "True\n" @@ -3657,20 +3660,20 @@ msgstr "" ">>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric()\n" "(False, True, True)" -#: ../../library/stdtypes.rst:2298 +#: ../../library/stdtypes.rst:2300 msgid "" "See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters are a " "superset of decimal numbers." msgstr "" "也請參閱 :meth:`isdecimal` 和 :meth:`isdigit`。數字字元是十進位數字的超集。" -#: ../../library/stdtypes.rst:2304 +#: ../../library/stdtypes.rst:2306 msgid "" "Return ``True`` if all characters in the string are printable, ``False`` if " "it contains at least one non-printable character." msgstr "" -#: ../../library/stdtypes.rst:2307 +#: ../../library/stdtypes.rst:2309 msgid "" "Here \"printable\" means the character is suitable for :func:`repr` to use " "in its output; \"non-printable\" means that :func:`repr` on built-in types " @@ -3678,7 +3681,7 @@ msgid "" "written to :data:`sys.stdout` or :data:`sys.stderr`." msgstr "" -#: ../../library/stdtypes.rst:2312 +#: ../../library/stdtypes.rst:2314 msgid "" "The printable characters are those which in the Unicode character database " "(see :mod:`unicodedata`) have a general category in group Letter, Mark, " @@ -3687,12 +3690,13 @@ msgid "" "C), except the ASCII space." msgstr "" -#: ../../library/stdtypes.rst:2318 ../../library/stdtypes.rst:2345 -#: ../../library/stdtypes.rst:2400 ../../library/stdtypes.rst:2565 +#: ../../library/stdtypes.rst:2320 ../../library/stdtypes.rst:2347 +#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:2581 +#: ../../library/stdtypes.rst:2754 msgid "For example:" msgstr "舉例來說:" -#: ../../library/stdtypes.rst:2320 +#: ../../library/stdtypes.rst:2322 msgid "" ">>> ''.isprintable(), ' '.isprintable()\n" "(True, True)\n" @@ -3704,20 +3708,20 @@ msgstr "" ">>> '\\t'.isprintable(), '\\n'.isprintable()\n" "(False, False)" -#: ../../library/stdtypes.rst:2330 +#: ../../library/stdtypes.rst:2332 msgid "" "Return ``True`` if there are only whitespace characters in the string and " "there is at least one character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:2333 +#: ../../library/stdtypes.rst:2335 msgid "" "A character is *whitespace* if in the Unicode character database (see :mod:" "`unicodedata`), either its general category is ``Zs`` (\"Separator, " "space\"), or its bidirectional class is one of ``WS``, ``B``, or ``S``." msgstr "" -#: ../../library/stdtypes.rst:2341 +#: ../../library/stdtypes.rst:2343 msgid "" "Return ``True`` if the string is a titlecased string and there is at least " "one character, for example uppercase characters may only follow uncased " @@ -3725,7 +3729,7 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:2347 +#: ../../library/stdtypes.rst:2349 msgid "" ">>> 'Spam, Spam, Spam'.istitle()\n" "True\n" @@ -3741,17 +3745,17 @@ msgstr "" ">>> 'SPAM, SPAM, SPAM'.istitle()\n" "False" -#: ../../library/stdtypes.rst:2356 +#: ../../library/stdtypes.rst:2358 msgid "See also :meth:`title`." msgstr "另請參閱 :meth:`title`。" -#: ../../library/stdtypes.rst:2361 +#: ../../library/stdtypes.rst:2363 msgid "" "Return ``True`` if all cased characters [4]_ in the string are uppercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:2379 +#: ../../library/stdtypes.rst:2381 msgid "" "Return a string which is the concatenation of the strings in *iterable*. A :" "exc:`TypeError` will be raised if there are any non-string values in " @@ -3759,7 +3763,7 @@ msgid "" "elements is the string providing this method. For example:" msgstr "" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2386 msgid "" ">>> ', '.join(['spam', 'spam', 'spam'])\n" "'spam, spam, spam'\n" @@ -3771,18 +3775,18 @@ msgstr "" ">>> '-'.join('Python')\n" "'P-y-t-h-o-n'" -#: ../../library/stdtypes.rst:2391 +#: ../../library/stdtypes.rst:2393 msgid "See also :meth:`split`." msgstr "另請參閱 :meth:`split`。" -#: ../../library/stdtypes.rst:2396 +#: ../../library/stdtypes.rst:2398 msgid "" "Return the string left justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2402 +#: ../../library/stdtypes.rst:2404 msgid "" ">>> 'Python'.ljust(10)\n" "'Python '\n" @@ -3798,17 +3802,17 @@ msgstr "" ">>> 'Monty Python'.ljust(10, '.')\n" "'Monty Python'" -#: ../../library/stdtypes.rst:2411 +#: ../../library/stdtypes.rst:2413 msgid "See also :meth:`rjust`." msgstr "另請參閱 :meth:`rjust`。" -#: ../../library/stdtypes.rst:2416 +#: ../../library/stdtypes.rst:2418 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase. For example:" msgstr "" -#: ../../library/stdtypes.rst:2419 +#: ../../library/stdtypes.rst:2421 msgid "" ">>> 'Lower Method Example'.lower()\n" "'lower method example'" @@ -3816,14 +3820,14 @@ msgstr "" ">>> 'Lower Method Example'.lower()\n" "'lower method example'" -#: ../../library/stdtypes.rst:2424 +#: ../../library/stdtypes.rst:2426 msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2431 +#: ../../library/stdtypes.rst:2433 msgid "" "Return a copy of the string with leading characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3832,7 +3836,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2436 +#: ../../library/stdtypes.rst:2438 msgid "" ">>> ' spacious '.lstrip()\n" "'spacious '\n" @@ -3844,13 +3848,13 @@ msgstr "" ">>> 'www.example.com'.lstrip('cmowz.')\n" "'example.com'" -#: ../../library/stdtypes.rst:2441 +#: ../../library/stdtypes.rst:2443 msgid "" "See :meth:`str.removeprefix` for a method that will remove a single prefix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2444 +#: ../../library/stdtypes.rst:2446 msgid "" ">>> 'Arthur: three!'.lstrip('Arthur: ')\n" "'ee!'\n" @@ -3862,13 +3866,13 @@ msgstr "" ">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" "'three!'" -#: ../../library/stdtypes.rst:2453 +#: ../../library/stdtypes.rst:2455 msgid "" "This static method returns a translation table usable for :meth:`str." "translate`." msgstr "" -#: ../../library/stdtypes.rst:2455 +#: ../../library/stdtypes.rst:2457 msgid "" "If there is only one argument, it must be a dictionary mapping Unicode " "ordinals (integers) or characters (strings of length 1) to Unicode ordinals, " @@ -3876,7 +3880,7 @@ msgid "" "converted to ordinals." msgstr "" -#: ../../library/stdtypes.rst:2460 +#: ../../library/stdtypes.rst:2462 msgid "" "If there are two arguments, they must be strings of equal length, and in the " "resulting dictionary, each character in *from* will be mapped to the " @@ -3884,7 +3888,7 @@ msgid "" "must be a string, whose characters will be mapped to ``None`` in the result." msgstr "" -#: ../../library/stdtypes.rst:2468 +#: ../../library/stdtypes.rst:2470 msgid "" "Split the string at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3892,13 +3896,13 @@ msgid "" "containing the string itself, followed by two empty strings." msgstr "" -#: ../../library/stdtypes.rst:2476 +#: ../../library/stdtypes.rst:2478 msgid "" "If the string starts with the *prefix* string, return " "``string[len(prefix):]``. Otherwise, return a copy of the original string:" msgstr "" -#: ../../library/stdtypes.rst:2480 +#: ../../library/stdtypes.rst:2482 msgid "" ">>> 'TestHook'.removeprefix('Test')\n" "'Hook'\n" @@ -3910,18 +3914,18 @@ msgstr "" ">>> 'BaseTestCase'.removeprefix('Test')\n" "'BaseTestCase'" -#: ../../library/stdtypes.rst:2489 +#: ../../library/stdtypes.rst:2491 msgid "See also :meth:`removesuffix` and :meth:`startswith`." msgstr "另請參閱 :meth:`removesuffix` 和 :meth:`startswith`。" -#: ../../library/stdtypes.rst:2494 +#: ../../library/stdtypes.rst:2496 msgid "" "If the string ends with the *suffix* string and that *suffix* is not empty, " "return ``string[:-len(suffix)]``. Otherwise, return a copy of the original " "string:" msgstr "" -#: ../../library/stdtypes.rst:2498 +#: ../../library/stdtypes.rst:2500 msgid "" ">>> 'MiscTests'.removesuffix('Tests')\n" "'Misc'\n" @@ -3933,11 +3937,11 @@ msgstr "" ">>> 'TmpDirMixin'.removesuffix('Tests')\n" "'TmpDirMixin'" -#: ../../library/stdtypes.rst:2507 +#: ../../library/stdtypes.rst:2509 msgid "See also :meth:`removeprefix` and :meth:`endswith`." msgstr "另請參閱 :meth:`removeprefix` 和 :meth:`endswith`。" -#: ../../library/stdtypes.rst:2512 +#: ../../library/stdtypes.rst:2514 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " "by *new*. If *count* is given, only the first *count* occurrences are " @@ -3945,7 +3949,7 @@ msgid "" "replaced. For example:" msgstr "" -#: ../../library/stdtypes.rst:2517 +#: ../../library/stdtypes.rst:2519 msgid "" ">>> 'spam, spam, spam'.replace('spam', 'eggs')\n" "'eggs, eggs, eggs'\n" @@ -3957,11 +3961,11 @@ msgstr "" ">>> 'spam, spam, spam'.replace('spam', 'eggs', 1)\n" "'eggs, spam, spam'" -#: ../../library/stdtypes.rst:2524 +#: ../../library/stdtypes.rst:2526 msgid "*count* is now supported as a keyword argument." msgstr "*count* 現在作為關鍵字引數被支援。" -#: ../../library/stdtypes.rst:2530 +#: ../../library/stdtypes.rst:2532 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " @@ -3969,7 +3973,7 @@ msgid "" "For example:" msgstr "" -#: ../../library/stdtypes.rst:2535 +#: ../../library/stdtypes.rst:2537 msgid "" ">>> 'spam, spam, spam'.rfind('sp')\n" "12\n" @@ -3981,24 +3985,48 @@ msgstr "" ">>> 'spam, spam, spam'.rfind('sp', 0, 10)\n" "6" -#: ../../library/stdtypes.rst:2542 +#: ../../library/stdtypes.rst:2544 msgid "See also :meth:`find` and :meth:`rindex`." msgstr "另請參閱 :meth:`find` 和 :meth:`rindex`。" -#: ../../library/stdtypes.rst:2547 +#: ../../library/stdtypes.rst:2549 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " -"not found." +"not found. For example:" msgstr "" #: ../../library/stdtypes.rst:2553 +#, fuzzy +msgid "" +">>> 'spam, spam, spam'.rindex('spam')\n" +"12\n" +">>> 'spam, spam, spam'.rindex('eggs')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" 'spam, spam, spam'.rindex('eggs')\n" +" ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^\n" +"ValueError: substring not found" +msgstr "" +">>> 'spam, spam, spam'.index('eggs')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" 'spam, spam, spam'.index('eggs')\n" +" ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^\n" +"ValueError: substring not found" + +#: ../../library/stdtypes.rst:2564 +#, fuzzy +msgid "See also :meth:`index` and :meth:`find`." +msgstr "另請參閱 :meth:`rfind` 和 :meth:`index`。" + +#: ../../library/stdtypes.rst:2569 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2560 +#: ../../library/stdtypes.rst:2576 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 " @@ -4006,7 +4034,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2567 +#: ../../library/stdtypes.rst:2583 msgid "" ">>> 'Monty Python'.rpartition(' ')\n" "('Monty', ' ', 'Python')\n" @@ -4022,11 +4050,11 @@ msgstr "" ">>> 'Monty Python'.rpartition('-')\n" "('', '', 'Monty Python')" -#: ../../library/stdtypes.rst:2576 +#: ../../library/stdtypes.rst:2592 msgid "See also :meth:`partition`." msgstr "另請參閱 :meth:`partition`。" -#: ../../library/stdtypes.rst:2581 +#: ../../library/stdtypes.rst:2597 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 " @@ -4035,7 +4063,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2590 +#: ../../library/stdtypes.rst:2606 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 " @@ -4044,7 +4072,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2595 +#: ../../library/stdtypes.rst:2611 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -4056,13 +4084,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2600 +#: ../../library/stdtypes.rst:2616 msgid "" "See :meth:`str.removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2603 +#: ../../library/stdtypes.rst:2619 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -4074,7 +4102,7 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2610 +#: ../../library/stdtypes.rst:2626 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, " @@ -4083,7 +4111,7 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2616 +#: ../../library/stdtypes.rst:2632 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " @@ -4093,21 +4121,21 @@ msgid "" "``['']``." msgstr "" -#: ../../library/stdtypes.rst:2623 ../../library/stdtypes.rst:2641 -#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:2707 -#: ../../library/stdtypes.rst:2775 ../../library/stdtypes.rst:2845 -#: ../../library/stdtypes.rst:2940 ../../library/stdtypes.rst:3906 -#: ../../library/stdtypes.rst:3924 ../../library/stdtypes.rst:4014 -#: ../../library/stdtypes.rst:4030 ../../library/stdtypes.rst:4055 -#: ../../library/stdtypes.rst:4069 ../../library/stdtypes.rst:4097 -#: ../../library/stdtypes.rst:4111 ../../library/stdtypes.rst:4129 -#: ../../library/stdtypes.rst:4156 ../../library/stdtypes.rst:4179 -#: ../../library/stdtypes.rst:4206 ../../library/stdtypes.rst:4248 -#: ../../library/stdtypes.rst:4272 +#: ../../library/stdtypes.rst:2639 ../../library/stdtypes.rst:2657 +#: ../../library/stdtypes.rst:2669 ../../library/stdtypes.rst:2723 +#: ../../library/stdtypes.rst:2804 ../../library/stdtypes.rst:2874 +#: ../../library/stdtypes.rst:2969 ../../library/stdtypes.rst:3935 +#: ../../library/stdtypes.rst:3953 ../../library/stdtypes.rst:4043 +#: ../../library/stdtypes.rst:4059 ../../library/stdtypes.rst:4084 +#: ../../library/stdtypes.rst:4098 ../../library/stdtypes.rst:4126 +#: ../../library/stdtypes.rst:4140 ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:4185 ../../library/stdtypes.rst:4208 +#: ../../library/stdtypes.rst:4235 ../../library/stdtypes.rst:4277 +#: ../../library/stdtypes.rst:4301 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2625 +#: ../../library/stdtypes.rst:2641 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -4127,7 +4155,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2634 +#: ../../library/stdtypes.rst:2650 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, " @@ -4137,7 +4165,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2643 +#: ../../library/stdtypes.rst:2659 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -4153,13 +4181,13 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2650 +#: ../../library/stdtypes.rst:2666 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:2655 +#: ../../library/stdtypes.rst:2671 msgid "" ">>> \"\".split(None, 0)\n" "[]\n" @@ -4175,124 +4203,124 @@ msgstr "" ">>> \" foo \".split(maxsplit=0)\n" "['foo ']" -#: ../../library/stdtypes.rst:2662 +#: ../../library/stdtypes.rst:2678 msgid "See also :meth:`join`." msgstr "另請參閱 :meth:`join`。" -#: ../../library/stdtypes.rst:2670 +#: ../../library/stdtypes.rst:2686 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:2674 +#: ../../library/stdtypes.rst:2690 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2678 +#: ../../library/stdtypes.rst:2694 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2678 +#: ../../library/stdtypes.rst:2694 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2680 +#: ../../library/stdtypes.rst:2696 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2680 +#: ../../library/stdtypes.rst:2696 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2682 +#: ../../library/stdtypes.rst:2698 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2682 +#: ../../library/stdtypes.rst:2698 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2684 +#: ../../library/stdtypes.rst:2700 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2684 +#: ../../library/stdtypes.rst:2700 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2686 +#: ../../library/stdtypes.rst:2702 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2686 +#: ../../library/stdtypes.rst:2702 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2688 +#: ../../library/stdtypes.rst:2704 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2688 +#: ../../library/stdtypes.rst:2704 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2690 +#: ../../library/stdtypes.rst:2706 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2690 +#: ../../library/stdtypes.rst:2706 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2692 +#: ../../library/stdtypes.rst:2708 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2692 +#: ../../library/stdtypes.rst:2708 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2694 +#: ../../library/stdtypes.rst:2710 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2694 +#: ../../library/stdtypes.rst:2710 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2696 +#: ../../library/stdtypes.rst:2712 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2696 +#: ../../library/stdtypes.rst:2712 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2698 +#: ../../library/stdtypes.rst:2714 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2698 +#: ../../library/stdtypes.rst:2714 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2700 +#: ../../library/stdtypes.rst:2716 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2700 +#: ../../library/stdtypes.rst:2716 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2705 +#: ../../library/stdtypes.rst:2721 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2709 +#: ../../library/stdtypes.rst:2725 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -4304,14 +4332,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:2714 +#: ../../library/stdtypes.rst:2730 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:2718 +#: ../../library/stdtypes.rst:2734 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -4323,11 +4351,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2723 +#: ../../library/stdtypes.rst:2739 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2725 +#: ../../library/stdtypes.rst:2741 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -4339,7 +4367,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2733 +#: ../../library/stdtypes.rst:2749 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -4347,7 +4375,31 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2741 +#: ../../library/stdtypes.rst:2756 +#, fuzzy +msgid "" +">>> 'Python'.startswith('Py')\n" +"True\n" +">>> 'a tuple of prefixes'.startswith(('at', 'a'))\n" +"True\n" +">>> 'Python is amazing'.startswith('is', 7)\n" +"True" +msgstr "" +">>> 'Python'.endswith('on')\n" +"True\n" +">>> 'a tuple of suffixes'.endswith(('at', 'in'))\n" +"False\n" +">>> 'a tuple of suffixes'.endswith(('at', 'es'))\n" +"True\n" +">>> 'Python is amazing'.endswith('is', 0, 9)\n" +"True" + +#: ../../library/stdtypes.rst:2765 +#, fuzzy +msgid "See also :meth:`endswith` and :meth:`removeprefix`." +msgstr "另請參閱 :meth:`startswith` 和 :meth:`removesuffix`。" + +#: ../../library/stdtypes.rst:2770 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 " @@ -4356,7 +4408,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2747 +#: ../../library/stdtypes.rst:2776 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -4368,7 +4420,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2781 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -4376,7 +4428,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2758 +#: ../../library/stdtypes.rst:2787 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -4386,20 +4438,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2765 +#: ../../library/stdtypes.rst:2794 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:2772 +#: ../../library/stdtypes.rst:2801 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:2777 +#: ../../library/stdtypes.rst:2806 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -4407,7 +4459,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2780 ../../library/stdtypes.rst:4216 +#: ../../library/stdtypes.rst:2809 ../../library/stdtypes.rst:4245 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 " @@ -4415,7 +4467,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2785 +#: ../../library/stdtypes.rst:2814 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -4423,19 +4475,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2788 +#: ../../library/stdtypes.rst:2817 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2820 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2794 +#: ../../library/stdtypes.rst:2823 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -4455,11 +4507,11 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2803 +#: ../../library/stdtypes.rst:2832 msgid "See also :meth:`istitle`." msgstr "另請參閱 :meth:`istitle`。" -#: ../../library/stdtypes.rst:2808 +#: ../../library/stdtypes.rst:2837 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 " @@ -4471,19 +4523,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2817 +#: ../../library/stdtypes.rst:2846 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2820 +#: ../../library/stdtypes.rst:2849 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2826 +#: ../../library/stdtypes.rst:2855 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`` " @@ -4492,14 +4544,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2832 +#: ../../library/stdtypes.rst:2861 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2839 +#: ../../library/stdtypes.rst:2868 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 " @@ -4507,7 +4559,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2847 +#: ../../library/stdtypes.rst:2876 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -4519,27 +4571,27 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2870 +#: ../../library/stdtypes.rst:2899 msgid "Formatted String Literals (f-strings)" msgstr "" -#: ../../library/stdtypes.rst:2873 +#: ../../library/stdtypes.rst:2902 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" -#: ../../library/stdtypes.rst:2876 +#: ../../library/stdtypes.rst:2905 msgid "Added the debug specifier (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2878 +#: ../../library/stdtypes.rst:2907 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../library/stdtypes.rst:2882 +#: ../../library/stdtypes.rst:2911 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 " @@ -4548,29 +4600,29 @@ msgid "" "replacement field must contain an expression, optionally followed by:" msgstr "" -#: ../../library/stdtypes.rst:2889 +#: ../../library/stdtypes.rst:2918 msgid "a *debug specifier* -- an equal sign (``=``);" msgstr "" -#: ../../library/stdtypes.rst:2890 +#: ../../library/stdtypes.rst:2919 msgid "a *conversion specifier* -- ``!s``, ``!r`` or ``!a``; and/or" msgstr "" -#: ../../library/stdtypes.rst:2891 +#: ../../library/stdtypes.rst:2920 msgid "a *format specifier* prefixed with a colon (``:``)." msgstr "" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2922 msgid "" "See the :ref:`Lexical Analysis section on f-strings ` for details " "on the syntax of these fields." msgstr "" -#: ../../library/stdtypes.rst:2897 +#: ../../library/stdtypes.rst:2926 msgid "Debug specifier" msgstr "" -#: ../../library/stdtypes.rst:2901 +#: ../../library/stdtypes.rst:2930 msgid "" "If a debug specifier -- an equal sign (``=``) -- appears after the " "replacement field expression, the resulting f-string will contain the " @@ -4578,7 +4630,7 @@ msgid "" "is often useful for debugging::" msgstr "" -#: ../../library/stdtypes.rst:2906 +#: ../../library/stdtypes.rst:2935 msgid "" ">>> number = 14.3\n" ">>> f'{number=}'\n" @@ -4588,13 +4640,13 @@ msgstr "" ">>> f'{number=}'\n" "'number=14.3'" -#: ../../library/stdtypes.rst:2910 +#: ../../library/stdtypes.rst:2939 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:2913 +#: ../../library/stdtypes.rst:2942 msgid "" ">>> f'{ number - 4 = }'\n" "' number - 4 = 10.3'" @@ -4602,17 +4654,17 @@ msgstr "" ">>> f'{ number - 4 = }'\n" "' number - 4 = 10.3'" -#: ../../library/stdtypes.rst:2918 +#: ../../library/stdtypes.rst:2947 msgid "Conversion specifier" msgstr "" -#: ../../library/stdtypes.rst:2920 +#: ../../library/stdtypes.rst:2949 msgid "" "By default, the value of a replacement field expression is converted to a " "string using :func:`str`::" msgstr "" -#: ../../library/stdtypes.rst:2923 +#: ../../library/stdtypes.rst:2952 msgid "" ">>> from fractions import Fraction\n" ">>> one_third = Fraction(1, 3)\n" @@ -4624,13 +4676,13 @@ msgstr "" ">>> f'{one_third}'\n" "'1/3'" -#: ../../library/stdtypes.rst:2928 +#: ../../library/stdtypes.rst:2957 msgid "" "When a debug specifier but no format specifier is used, the default " "conversion instead uses :func:`repr`::" msgstr "" -#: ../../library/stdtypes.rst:2931 +#: ../../library/stdtypes.rst:2960 msgid "" ">>> f'{one_third = }'\n" "'one_third = Fraction(1, 3)'" @@ -4638,24 +4690,24 @@ msgstr "" ">>> f'{one_third = }'\n" "'one_third = Fraction(1, 3)'" -#: ../../library/stdtypes.rst:2934 +#: ../../library/stdtypes.rst:2963 msgid "" "The conversion can be specified explicitly using one of these specifiers:" msgstr "" -#: ../../library/stdtypes.rst:2936 +#: ../../library/stdtypes.rst:2965 msgid "``!s`` for :func:`str`" msgstr "``!s`` 用於 :func:`str`" -#: ../../library/stdtypes.rst:2937 +#: ../../library/stdtypes.rst:2966 msgid "``!r`` for :func:`repr`" msgstr "``!r`` 用於 :func:`repr`" -#: ../../library/stdtypes.rst:2938 +#: ../../library/stdtypes.rst:2967 msgid "``!a`` for :func:`ascii`" msgstr "``!a`` 用於 :func:`ascii`" -#: ../../library/stdtypes.rst:2942 +#: ../../library/stdtypes.rst:2971 msgid "" ">>> str(one_third)\n" "'1/3'\n" @@ -4687,11 +4739,11 @@ msgstr "" ">>> f'{string = !a}'\n" "\"string = '\\\\xa1ko\\\\u010dka \\\\U0001f638!'\"" -#: ../../library/stdtypes.rst:2959 +#: ../../library/stdtypes.rst:2988 msgid "Format specifier" msgstr "" -#: ../../library/stdtypes.rst:2961 +#: ../../library/stdtypes.rst:2990 msgid "" "After the expression has been evaluated, and possibly converted using an " "explicit conversion specifier, it is formatted using the :func:`format` " @@ -4701,7 +4753,7 @@ msgid "" "the replacement field. For example::" msgstr "" -#: ../../library/stdtypes.rst:2968 +#: ../../library/stdtypes.rst:2997 msgid "" ">>> from fractions import Fraction\n" ">>> one_third = Fraction(1, 3)\n" @@ -4725,29 +4777,29 @@ msgstr "" ">>> f'{one_third = :~>10}~'\n" "'one_third = ~~~~~~~1/3~'" -#: ../../library/stdtypes.rst:2982 +#: ../../library/stdtypes.rst:3011 msgid "Template String Literals (t-strings)" msgstr "模板字串字面值 (t-strings)" -#: ../../library/stdtypes.rst:2984 +#: ../../library/stdtypes.rst:3013 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:2987 +#: ../../library/stdtypes.rst:3016 msgid "" "These strings follow the same syntax and evaluation rules as :ref:`formatted " "string literals `, with for the following differences:" msgstr "" -#: ../../library/stdtypes.rst:2991 +#: ../../library/stdtypes.rst:3020 msgid "" "Rather than evaluating to a ``str`` object, template string literals " "evaluate to a :class:`string.templatelib.Template` object." msgstr "" -#: ../../library/stdtypes.rst:2994 +#: ../../library/stdtypes.rst:3023 msgid "" "The :func:`format` protocol is not used. Instead, the format specifier and " "conversions (if any) are passed to a new :class:`~string.templatelib." @@ -4756,7 +4808,7 @@ msgid "" "Template` object to decide how to handle format specifiers and conversions." msgstr "" -#: ../../library/stdtypes.rst:3001 +#: ../../library/stdtypes.rst:3030 msgid "" "Format specifiers containing nested replacement fields are evaluated " "eagerly, prior to being passed to the :class:`~string.templatelib." @@ -4766,7 +4818,7 @@ msgid "" "to be ``2``, the resulting format specifier would be ``'.2f'``." msgstr "" -#: ../../library/stdtypes.rst:3009 +#: ../../library/stdtypes.rst:3038 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 " @@ -4778,18 +4830,18 @@ msgid "" "behaviour." msgstr "" -#: ../../library/stdtypes.rst:3023 +#: ../../library/stdtypes.rst:3052 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:3036 +#: ../../library/stdtypes.rst:3065 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:3040 +#: ../../library/stdtypes.rst:3069 msgid "" "Using :ref:`formatted string literals `, the :meth:`str.format` " "interface, or :class:`string.Template` may help avoid these errors. Each of " @@ -4797,7 +4849,7 @@ msgid "" "flexibility, and/or extensibility." msgstr "" -#: ../../library/stdtypes.rst:3045 +#: ../../library/stdtypes.rst:3074 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -4807,7 +4859,7 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:3052 +#: ../../library/stdtypes.rst:3081 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." @@ -4815,7 +4867,7 @@ msgstr "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." -#: ../../library/stdtypes.rst:3057 +#: ../../library/stdtypes.rst:3086 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 " @@ -4823,36 +4875,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3067 ../../library/stdtypes.rst:4327 +#: ../../library/stdtypes.rst:3096 ../../library/stdtypes.rst:4356 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:3070 ../../library/stdtypes.rst:4330 +#: ../../library/stdtypes.rst:3099 ../../library/stdtypes.rst:4359 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:3072 ../../library/stdtypes.rst:4332 +#: ../../library/stdtypes.rst:3101 ../../library/stdtypes.rst:4361 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:3075 ../../library/stdtypes.rst:4335 +#: ../../library/stdtypes.rst:3104 ../../library/stdtypes.rst:4364 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:3078 ../../library/stdtypes.rst:4338 +#: ../../library/stdtypes.rst:3107 ../../library/stdtypes.rst:4367 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:3082 ../../library/stdtypes.rst:4342 +#: ../../library/stdtypes.rst:3111 ../../library/stdtypes.rst:4371 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -4860,15 +4912,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:3087 ../../library/stdtypes.rst:4347 +#: ../../library/stdtypes.rst:3116 ../../library/stdtypes.rst:4376 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:3089 ../../library/stdtypes.rst:4349 +#: ../../library/stdtypes.rst:3118 ../../library/stdtypes.rst:4378 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:3091 +#: ../../library/stdtypes.rst:3120 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 " @@ -4876,279 +4928,279 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3100 ../../library/stdtypes.rst:4360 +#: ../../library/stdtypes.rst:3129 ../../library/stdtypes.rst:4389 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:3103 ../../library/stdtypes.rst:4363 +#: ../../library/stdtypes.rst:3132 ../../library/stdtypes.rst:4392 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:3112 ../../library/stdtypes.rst:4372 +#: ../../library/stdtypes.rst:3141 ../../library/stdtypes.rst:4401 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:3114 ../../library/stdtypes.rst:4374 +#: ../../library/stdtypes.rst:3143 ../../library/stdtypes.rst:4403 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:3114 ../../library/stdtypes.rst:4374 +#: ../../library/stdtypes.rst:3143 ../../library/stdtypes.rst:4403 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:3117 ../../library/stdtypes.rst:4377 +#: ../../library/stdtypes.rst:3146 ../../library/stdtypes.rst:4406 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:3117 ../../library/stdtypes.rst:4377 +#: ../../library/stdtypes.rst:3146 ../../library/stdtypes.rst:4406 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:3119 ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:3148 ../../library/stdtypes.rst:4408 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:3119 ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:3148 ../../library/stdtypes.rst:4408 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:3122 ../../library/stdtypes.rst:4382 +#: ../../library/stdtypes.rst:3151 ../../library/stdtypes.rst:4411 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:3122 ../../library/stdtypes.rst:4382 +#: ../../library/stdtypes.rst:3151 ../../library/stdtypes.rst:4411 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:3125 ../../library/stdtypes.rst:4385 +#: ../../library/stdtypes.rst:3154 ../../library/stdtypes.rst:4414 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:3125 ../../library/stdtypes.rst:4385 +#: ../../library/stdtypes.rst:3154 ../../library/stdtypes.rst:4414 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:3129 ../../library/stdtypes.rst:4389 +#: ../../library/stdtypes.rst:3158 ../../library/stdtypes.rst:4418 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:3132 ../../library/stdtypes.rst:4392 +#: ../../library/stdtypes.rst:3161 ../../library/stdtypes.rst:4421 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:3135 ../../library/stdtypes.rst:4395 +#: ../../library/stdtypes.rst:3164 ../../library/stdtypes.rst:4424 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:3137 ../../library/stdtypes.rst:4397 +#: ../../library/stdtypes.rst:3166 ../../library/stdtypes.rst:4426 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:3137 ../../library/stdtypes.rst:3139 -#: ../../library/stdtypes.rst:4397 ../../library/stdtypes.rst:4399 +#: ../../library/stdtypes.rst:3166 ../../library/stdtypes.rst:3168 +#: ../../library/stdtypes.rst:4426 ../../library/stdtypes.rst:4428 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:3139 ../../library/stdtypes.rst:4399 +#: ../../library/stdtypes.rst:3168 ../../library/stdtypes.rst:4428 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:3141 ../../library/stdtypes.rst:4401 +#: ../../library/stdtypes.rst:3170 ../../library/stdtypes.rst:4430 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:3141 ../../library/stdtypes.rst:4401 +#: ../../library/stdtypes.rst:3170 ../../library/stdtypes.rst:4430 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:3143 ../../library/stdtypes.rst:4403 +#: ../../library/stdtypes.rst:3172 ../../library/stdtypes.rst:4432 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:3143 ../../library/stdtypes.rst:4403 +#: ../../library/stdtypes.rst:3172 ../../library/stdtypes.rst:4432 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:3145 ../../library/stdtypes.rst:4405 +#: ../../library/stdtypes.rst:3174 ../../library/stdtypes.rst:4434 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:3145 ../../library/stdtypes.rst:4405 +#: ../../library/stdtypes.rst:3174 ../../library/stdtypes.rst:4434 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:3147 ../../library/stdtypes.rst:4407 +#: ../../library/stdtypes.rst:3176 ../../library/stdtypes.rst:4436 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:3147 ../../library/stdtypes.rst:4407 +#: ../../library/stdtypes.rst:3176 ../../library/stdtypes.rst:4436 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:3149 ../../library/stdtypes.rst:4409 +#: ../../library/stdtypes.rst:3178 ../../library/stdtypes.rst:4438 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:3149 ../../library/stdtypes.rst:4409 +#: ../../library/stdtypes.rst:3178 ../../library/stdtypes.rst:4438 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:3151 ../../library/stdtypes.rst:4411 +#: ../../library/stdtypes.rst:3180 ../../library/stdtypes.rst:4440 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:3151 ../../library/stdtypes.rst:4411 +#: ../../library/stdtypes.rst:3180 ../../library/stdtypes.rst:4440 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:3153 ../../library/stdtypes.rst:4413 +#: ../../library/stdtypes.rst:3182 ../../library/stdtypes.rst:4442 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:3153 ../../library/stdtypes.rst:3155 -#: ../../library/stdtypes.rst:4413 ../../library/stdtypes.rst:4415 +#: ../../library/stdtypes.rst:3182 ../../library/stdtypes.rst:3184 +#: ../../library/stdtypes.rst:4442 ../../library/stdtypes.rst:4444 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:3155 ../../library/stdtypes.rst:4415 +#: ../../library/stdtypes.rst:3184 ../../library/stdtypes.rst:4444 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:3157 ../../library/stdtypes.rst:4417 +#: ../../library/stdtypes.rst:3186 ../../library/stdtypes.rst:4446 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:3157 ../../library/stdtypes.rst:4417 +#: ../../library/stdtypes.rst:3186 ../../library/stdtypes.rst:4446 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:3161 ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:3190 ../../library/stdtypes.rst:4450 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:3161 ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:3190 ../../library/stdtypes.rst:4450 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:3165 ../../library/stdtypes.rst:4425 +#: ../../library/stdtypes.rst:3194 ../../library/stdtypes.rst:4454 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:3165 +#: ../../library/stdtypes.rst:3194 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:3168 ../../library/stdtypes.rst:4438 +#: ../../library/stdtypes.rst:3197 ../../library/stdtypes.rst:4467 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:3168 +#: ../../library/stdtypes.rst:3197 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:3171 ../../library/stdtypes.rst:4432 +#: ../../library/stdtypes.rst:3200 ../../library/stdtypes.rst:4461 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:3171 +#: ../../library/stdtypes.rst:3200 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:3174 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:3203 ../../library/stdtypes.rst:4464 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:3174 +#: ../../library/stdtypes.rst:3203 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:3177 ../../library/stdtypes.rst:4441 +#: ../../library/stdtypes.rst:3206 ../../library/stdtypes.rst:4470 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:3177 ../../library/stdtypes.rst:4441 +#: ../../library/stdtypes.rst:3206 ../../library/stdtypes.rst:4470 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:3184 ../../library/stdtypes.rst:4448 +#: ../../library/stdtypes.rst:3213 ../../library/stdtypes.rst:4477 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:3188 ../../library/stdtypes.rst:4452 +#: ../../library/stdtypes.rst:3217 ../../library/stdtypes.rst:4481 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:3192 ../../library/stdtypes.rst:4456 +#: ../../library/stdtypes.rst:3221 ../../library/stdtypes.rst:4485 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:3195 ../../library/stdtypes.rst:4459 +#: ../../library/stdtypes.rst:3224 ../../library/stdtypes.rst:4488 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:3199 ../../library/stdtypes.rst:4463 +#: ../../library/stdtypes.rst:3228 ../../library/stdtypes.rst:4492 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:3202 ../../library/stdtypes.rst:4466 +#: ../../library/stdtypes.rst:3231 ../../library/stdtypes.rst:4495 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:3206 ../../library/stdtypes.rst:4470 +#: ../../library/stdtypes.rst:3235 ../../library/stdtypes.rst:4499 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:3209 ../../library/stdtypes.rst:4479 +#: ../../library/stdtypes.rst:3238 ../../library/stdtypes.rst:4508 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:3211 +#: ../../library/stdtypes.rst:3240 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:3216 +#: ../../library/stdtypes.rst:3245 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:3227 +#: ../../library/stdtypes.rst:3256 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:3235 +#: ../../library/stdtypes.rst:3264 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 :" @@ -5156,17 +5208,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:3240 +#: ../../library/stdtypes.rst:3269 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:3246 +#: ../../library/stdtypes.rst:3275 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:3250 +#: ../../library/stdtypes.rst:3279 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -5174,40 +5226,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:3258 +#: ../../library/stdtypes.rst:3287 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:3261 +#: ../../library/stdtypes.rst:3290 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:3262 +#: ../../library/stdtypes.rst:3291 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:3263 +#: ../../library/stdtypes.rst:3292 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:3265 +#: ../../library/stdtypes.rst:3294 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:3269 +#: ../../library/stdtypes.rst:3298 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:3273 +#: ../../library/stdtypes.rst:3302 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -5220,29 +5272,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:3283 +#: ../../library/stdtypes.rst:3312 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:3286 +#: ../../library/stdtypes.rst:3315 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:3287 +#: ../../library/stdtypes.rst:3316 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:3288 +#: ../../library/stdtypes.rst:3317 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:3290 +#: ../../library/stdtypes.rst:3319 msgid "Also see the :ref:`bytes ` built-in." msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:3292 +#: ../../library/stdtypes.rst:3321 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -5250,38 +5302,38 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:3298 +#: ../../library/stdtypes.rst:3327 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:3305 +#: ../../library/stdtypes.rst:3334 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:3309 +#: ../../library/stdtypes.rst:3338 msgid "" ":meth:`bytes.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-like " "objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3313 +#: ../../library/stdtypes.rst:3342 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3319 ../../library/stdtypes.rst:3410 +#: ../../library/stdtypes.rst:3348 ../../library/stdtypes.rst:3439 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:3325 +#: ../../library/stdtypes.rst:3354 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, " @@ -5290,13 +5342,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:3342 +#: ../../library/stdtypes.rst:3371 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:3346 +#: ../../library/stdtypes.rst:3375 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 " @@ -5304,58 +5356,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3351 +#: ../../library/stdtypes.rst:3380 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:3359 +#: ../../library/stdtypes.rst:3388 msgid "Bytearray Objects" msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:3363 +#: ../../library/stdtypes.rst:3392 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:3369 +#: ../../library/stdtypes.rst:3398 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:3372 +#: ../../library/stdtypes.rst:3401 msgid "Creating an empty instance: ``bytearray()``" msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:3373 +#: ../../library/stdtypes.rst:3402 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:3374 +#: ../../library/stdtypes.rst:3403 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:3375 +#: ../../library/stdtypes.rst:3404 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:3377 +#: ../../library/stdtypes.rst:3406 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:3381 +#: ../../library/stdtypes.rst:3410 msgid "Also see the :ref:`bytearray ` built-in." msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:3383 +#: ../../library/stdtypes.rst:3412 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -5363,64 +5415,64 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:3389 +#: ../../library/stdtypes.rst:3418 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:3396 +#: ../../library/stdtypes.rst:3425 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:3400 +#: ../../library/stdtypes.rst:3429 msgid "" ":meth:`bytearray.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-" "like objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3404 +#: ../../library/stdtypes.rst:3433 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3418 +#: ../../library/stdtypes.rst:3447 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:3425 +#: ../../library/stdtypes.rst:3454 msgid "" "Resize the :class:`bytearray` to contain *size* bytes. *size* must be " "greater than or equal to 0." msgstr "" -#: ../../library/stdtypes.rst:3428 +#: ../../library/stdtypes.rst:3457 msgid "" "If the :class:`bytearray` needs to shrink, bytes beyond *size* are truncated." msgstr "" -#: ../../library/stdtypes.rst:3430 +#: ../../library/stdtypes.rst:3459 msgid "" "If the :class:`bytearray` needs to grow, all new bytes, those beyond *size*, " "will be set to null bytes." msgstr "" -#: ../../library/stdtypes.rst:3434 +#: ../../library/stdtypes.rst:3463 msgid "This is equivalent to:" msgstr "等同於:" -#: ../../library/stdtypes.rst:3442 +#: ../../library/stdtypes.rst:3471 msgid "Examples:" msgstr "範例:" -#: ../../library/stdtypes.rst:3455 +#: ../../library/stdtypes.rst:3484 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 " @@ -5428,7 +5480,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3460 +#: ../../library/stdtypes.rst:3489 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -5436,11 +5488,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:3469 +#: ../../library/stdtypes.rst:3498 msgid "Bytes and Bytearray Operations" msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:3474 +#: ../../library/stdtypes.rst:3503 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -5449,14 +5501,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:3482 +#: ../../library/stdtypes.rst:3511 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:3486 +#: ../../library/stdtypes.rst:3515 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -5464,11 +5516,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:3489 +#: ../../library/stdtypes.rst:3518 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:3491 +#: ../../library/stdtypes.rst:3520 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -5476,60 +5528,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:3494 +#: ../../library/stdtypes.rst:3523 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:3499 +#: ../../library/stdtypes.rst:3528 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:3502 +#: ../../library/stdtypes.rst:3531 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:3508 +#: ../../library/stdtypes.rst:3537 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:3512 ../../library/stdtypes.rst:3617 -#: ../../library/stdtypes.rst:3639 ../../library/stdtypes.rst:3705 -#: ../../library/stdtypes.rst:3718 +#: ../../library/stdtypes.rst:3541 ../../library/stdtypes.rst:3646 +#: ../../library/stdtypes.rst:3668 ../../library/stdtypes.rst:3734 +#: ../../library/stdtypes.rst:3747 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:3515 +#: ../../library/stdtypes.rst:3544 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:3518 ../../library/stdtypes.rst:3629 -#: ../../library/stdtypes.rst:3642 ../../library/stdtypes.rst:3708 -#: ../../library/stdtypes.rst:3721 +#: ../../library/stdtypes.rst:3547 ../../library/stdtypes.rst:3658 +#: ../../library/stdtypes.rst:3671 ../../library/stdtypes.rst:3737 +#: ../../library/stdtypes.rst:3750 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:3525 +#: ../../library/stdtypes.rst:3554 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:3529 +#: ../../library/stdtypes.rst:3558 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -5541,32 +5593,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:3534 +#: ../../library/stdtypes.rst:3563 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" -#: ../../library/stdtypes.rst:3538 ../../library/stdtypes.rst:3560 -#: ../../library/stdtypes.rst:3693 ../../library/stdtypes.rst:3786 -#: ../../library/stdtypes.rst:3800 ../../library/stdtypes.rst:3830 -#: ../../library/stdtypes.rst:3844 ../../library/stdtypes.rst:3885 -#: ../../library/stdtypes.rst:3955 ../../library/stdtypes.rst:3973 -#: ../../library/stdtypes.rst:4001 ../../library/stdtypes.rst:4140 -#: ../../library/stdtypes.rst:4195 ../../library/stdtypes.rst:4238 -#: ../../library/stdtypes.rst:4259 ../../library/stdtypes.rst:4281 -#: ../../library/stdtypes.rst:4483 +#: ../../library/stdtypes.rst:3567 ../../library/stdtypes.rst:3589 +#: ../../library/stdtypes.rst:3722 ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:3829 ../../library/stdtypes.rst:3859 +#: ../../library/stdtypes.rst:3873 ../../library/stdtypes.rst:3914 +#: ../../library/stdtypes.rst:3984 ../../library/stdtypes.rst:4002 +#: ../../library/stdtypes.rst:4030 ../../library/stdtypes.rst:4169 +#: ../../library/stdtypes.rst:4224 ../../library/stdtypes.rst:4267 +#: ../../library/stdtypes.rst:4288 ../../library/stdtypes.rst:4310 +#: ../../library/stdtypes.rst:4512 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:3547 +#: ../../library/stdtypes.rst:3576 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:3551 +#: ../../library/stdtypes.rst:3580 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -5578,15 +5630,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:3556 +#: ../../library/stdtypes.rst:3585 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3569 +#: ../../library/stdtypes.rst:3598 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:3574 +#: ../../library/stdtypes.rst:3603 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -5594,21 +5646,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:3580 +#: ../../library/stdtypes.rst:3609 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:3586 +#: ../../library/stdtypes.rst:3615 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:3601 +#: ../../library/stdtypes.rst:3630 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -5616,11 +5668,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3606 +#: ../../library/stdtypes.rst:3635 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:3641 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 " @@ -5628,14 +5680,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3622 +#: ../../library/stdtypes.rst:3651 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:3626 +#: ../../library/stdtypes.rst:3655 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -5643,13 +5695,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:3636 +#: ../../library/stdtypes.rst:3665 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:3649 +#: ../../library/stdtypes.rst:3678 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 " @@ -5659,7 +5711,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:3660 +#: ../../library/stdtypes.rst:3689 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 " @@ -5667,7 +5719,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:3700 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 " @@ -5676,24 +5728,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:3678 ../../library/stdtypes.rst:3735 +#: ../../library/stdtypes.rst:3707 ../../library/stdtypes.rst:3764 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3684 +#: ../../library/stdtypes.rst:3713 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:3688 +#: ../../library/stdtypes.rst:3717 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3700 +#: ../../library/stdtypes.rst:3729 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -5701,13 +5753,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:3715 +#: ../../library/stdtypes.rst:3744 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3728 +#: ../../library/stdtypes.rst:3757 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 " @@ -5716,7 +5768,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:3741 +#: ../../library/stdtypes.rst:3770 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -5724,11 +5776,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3746 +#: ../../library/stdtypes.rst:3775 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3752 +#: ../../library/stdtypes.rst:3781 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 " @@ -5736,18 +5788,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3757 +#: ../../library/stdtypes.rst:3786 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3760 +#: ../../library/stdtypes.rst:3789 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3763 +#: ../../library/stdtypes.rst:3792 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -5755,11 +5807,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3766 +#: ../../library/stdtypes.rst:3795 msgid "*delete* is now supported as a keyword argument." msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3770 +#: ../../library/stdtypes.rst:3799 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 " @@ -5768,7 +5820,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3779 +#: ../../library/stdtypes.rst:3808 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). " @@ -5776,7 +5828,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3793 +#: ../../library/stdtypes.rst:3822 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). " @@ -5784,7 +5836,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3807 +#: ../../library/stdtypes.rst:3836 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 " @@ -5793,7 +5845,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3813 +#: ../../library/stdtypes.rst:3842 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -5805,14 +5857,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3818 +#: ../../library/stdtypes.rst:3847 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:3823 +#: ../../library/stdtypes.rst:3852 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -5824,7 +5876,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:3866 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). " @@ -5832,7 +5884,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3851 +#: ../../library/stdtypes.rst:3880 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 " @@ -5842,7 +5894,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3862 +#: ../../library/stdtypes.rst:3891 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 " @@ -5851,7 +5903,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3868 +#: ../../library/stdtypes.rst:3897 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -5863,14 +5915,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3873 +#: ../../library/stdtypes.rst:3902 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:3878 +#: ../../library/stdtypes.rst:3907 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -5882,7 +5934,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3892 +#: ../../library/stdtypes.rst:3921 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 " @@ -5891,7 +5943,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3898 +#: ../../library/stdtypes.rst:3927 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',')`` " @@ -5902,7 +5954,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3908 +#: ../../library/stdtypes.rst:3937 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -5922,7 +5974,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3917 +#: ../../library/stdtypes.rst:3946 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 " @@ -5932,7 +5984,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3927 +#: ../../library/stdtypes.rst:3956 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -5948,7 +6000,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3938 +#: ../../library/stdtypes.rst:3967 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 " @@ -5957,7 +6009,7 @@ msgid "" "or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3945 +#: ../../library/stdtypes.rst:3974 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -5969,13 +6021,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3950 +#: ../../library/stdtypes.rst:3979 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3959 +#: ../../library/stdtypes.rst:3988 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 " @@ -5983,14 +6035,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3967 +#: ../../library/stdtypes.rst:3996 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:3980 +#: ../../library/stdtypes.rst:4009 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 " @@ -6006,7 +6058,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3994 +#: ../../library/stdtypes.rst:4023 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -6018,7 +6070,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:4008 +#: ../../library/stdtypes.rst:4037 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -6027,7 +6079,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:4016 +#: ../../library/stdtypes.rst:4045 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -6039,7 +6091,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:4025 +#: ../../library/stdtypes.rst:4054 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -6047,7 +6099,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:4032 +#: ../../library/stdtypes.rst:4061 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -6059,20 +6111,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:4041 +#: ../../library/stdtypes.rst:4070 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:4051 +#: ../../library/stdtypes.rst:4080 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:4057 +#: ../../library/stdtypes.rst:4086 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -6084,13 +6136,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:4066 +#: ../../library/stdtypes.rst:4095 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:4071 +#: ../../library/stdtypes.rst:4100 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -6102,16 +6154,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:4076 ../../library/stdtypes.rst:4118 -#: ../../library/stdtypes.rst:4134 ../../library/stdtypes.rst:4184 -#: ../../library/stdtypes.rst:4253 +#: ../../library/stdtypes.rst:4105 ../../library/stdtypes.rst:4147 +#: ../../library/stdtypes.rst:4163 ../../library/stdtypes.rst:4213 +#: ../../library/stdtypes.rst:4282 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:4084 +#: ../../library/stdtypes.rst:4113 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -6119,14 +6171,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:4093 +#: ../../library/stdtypes.rst:4122 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:4099 +#: ../../library/stdtypes.rst:4128 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -6138,14 +6190,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:4108 +#: ../../library/stdtypes.rst:4137 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:4113 +#: ../../library/stdtypes.rst:4142 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -6157,13 +6209,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:4126 +#: ../../library/stdtypes.rst:4155 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:4160 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -6171,7 +6223,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:4151 +#: ../../library/stdtypes.rst:4180 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 " @@ -6179,7 +6231,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:4187 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -6191,14 +6243,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:4163 +#: ../../library/stdtypes.rst:4192 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:4167 +#: ../../library/stdtypes.rst:4196 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -6210,13 +6262,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:4176 +#: ../../library/stdtypes.rst:4205 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:4181 +#: ../../library/stdtypes.rst:4210 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -6224,7 +6276,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:4188 +#: ../../library/stdtypes.rst:4217 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -6232,14 +6284,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:4202 +#: ../../library/stdtypes.rst:4231 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:4208 +#: ../../library/stdtypes.rst:4237 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -6247,7 +6299,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:4211 +#: ../../library/stdtypes.rst:4240 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -6255,7 +6307,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:4221 +#: ../../library/stdtypes.rst:4250 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -6263,12 +6315,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:4224 +#: ../../library/stdtypes.rst:4253 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:4226 +#: ../../library/stdtypes.rst:4255 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -6290,13 +6342,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:4245 +#: ../../library/stdtypes.rst:4274 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:4250 +#: ../../library/stdtypes.rst:4279 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -6304,7 +6356,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:4266 +#: ../../library/stdtypes.rst:4295 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 " @@ -6313,7 +6365,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:4274 +#: ../../library/stdtypes.rst:4303 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -6325,11 +6377,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:4288 +#: ../../library/stdtypes.rst:4317 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:4305 +#: ../../library/stdtypes.rst:4334 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 " @@ -6337,7 +6389,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:4310 +#: ../../library/stdtypes.rst:4339 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -6347,7 +6399,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:4317 +#: ../../library/stdtypes.rst:4346 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 " @@ -6355,7 +6407,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:4351 +#: ../../library/stdtypes.rst:4380 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 " @@ -6363,77 +6415,77 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:4403 +#: ../../library/stdtypes.rst:4432 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/stdtypes.rst:4425 +#: ../../library/stdtypes.rst:4454 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:4428 +#: ../../library/stdtypes.rst:4457 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:4428 +#: ../../library/stdtypes.rst:4457 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:4432 +#: ../../library/stdtypes.rst:4461 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4464 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:4438 +#: ../../library/stdtypes.rst:4467 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4438 +#: ../../library/stdtypes.rst:4467 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:4473 +#: ../../library/stdtypes.rst:4502 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4476 +#: ../../library/stdtypes.rst:4505 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4488 +#: ../../library/stdtypes.rst:4517 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:4495 +#: ../../library/stdtypes.rst:4524 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:4497 +#: ../../library/stdtypes.rst:4526 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:4503 +#: ../../library/stdtypes.rst:4532 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:4507 +#: ../../library/stdtypes.rst:4536 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 " @@ -6441,32 +6493,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:4512 +#: ../../library/stdtypes.rst:4541 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:4516 +#: ../../library/stdtypes.rst:4545 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:4519 +#: ../../library/stdtypes.rst:4548 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:4522 +#: ../../library/stdtypes.rst:4551 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:4525 +#: ../../library/stdtypes.rst:4554 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -6488,7 +6540,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:4535 +#: ../../library/stdtypes.rst:4564 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 " @@ -6499,11 +6551,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:4544 +#: ../../library/stdtypes.rst:4573 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:4546 +#: ../../library/stdtypes.rst:4575 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -6525,13 +6577,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:4556 +#: ../../library/stdtypes.rst:4585 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:4559 +#: ../../library/stdtypes.rst:4588 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -6571,14 +6623,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:4577 +#: ../../library/stdtypes.rst:4606 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:4581 +#: ../../library/stdtypes.rst:4610 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -6596,44 +6648,44 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:4589 +#: ../../library/stdtypes.rst:4618 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:4593 +#: ../../library/stdtypes.rst:4622 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:4597 +#: ../../library/stdtypes.rst:4626 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:4600 +#: ../../library/stdtypes.rst:4629 msgid "memoryview is now a :term:`generic type`." msgstr "" -#: ../../library/stdtypes.rst:4603 +#: ../../library/stdtypes.rst:4632 msgid ":class:`memoryview` has several methods:" msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:4607 +#: ../../library/stdtypes.rst:4636 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:4611 +#: ../../library/stdtypes.rst:4640 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:4614 +#: ../../library/stdtypes.rst:4643 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -6667,14 +6719,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:4630 +#: ../../library/stdtypes.rst:4659 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:4634 +#: ../../library/stdtypes.rst:4663 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -6700,25 +6752,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:4646 +#: ../../library/stdtypes.rst:4675 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:4649 +#: ../../library/stdtypes.rst:4678 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:4655 +#: ../../library/stdtypes.rst:4684 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:4658 +#: ../../library/stdtypes.rst:4687 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -6732,7 +6784,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:4664 +#: ../../library/stdtypes.rst:4693 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -6740,7 +6792,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:4669 +#: ../../library/stdtypes.rst:4698 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' " @@ -6749,13 +6801,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:4679 +#: ../../library/stdtypes.rst:4708 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:4682 +#: ../../library/stdtypes.rst:4711 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -6765,18 +6817,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:4688 +#: ../../library/stdtypes.rst:4717 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:4695 +#: ../../library/stdtypes.rst:4724 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:4697 +#: ../../library/stdtypes.rst:4726 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -6794,19 +6846,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:4705 +#: ../../library/stdtypes.rst:4734 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:4712 +#: ../../library/stdtypes.rst:4741 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:4715 +#: ../../library/stdtypes.rst:4744 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -6832,7 +6884,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:4731 +#: ../../library/stdtypes.rst:4760 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 :" @@ -6841,14 +6893,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:4737 +#: ../../library/stdtypes.rst:4766 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:4741 +#: ../../library/stdtypes.rst:4770 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -6864,13 +6916,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4748 +#: ../../library/stdtypes.rst:4777 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4751 +#: ../../library/stdtypes.rst:4780 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -6890,7 +6942,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4765 +#: ../../library/stdtypes.rst:4794 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 " @@ -6899,7 +6951,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4771 +#: ../../library/stdtypes.rst:4800 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 " @@ -6907,11 +6959,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4777 +#: ../../library/stdtypes.rst:4806 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4779 +#: ../../library/stdtypes.rst:4808 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -6955,11 +7007,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4800 +#: ../../library/stdtypes.rst:4829 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4802 +#: ../../library/stdtypes.rst:4831 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -6983,11 +7035,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4813 +#: ../../library/stdtypes.rst:4842 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4815 +#: ../../library/stdtypes.rst:4844 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -7037,11 +7089,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4839 +#: ../../library/stdtypes.rst:4868 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4841 +#: ../../library/stdtypes.rst:4870 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -7063,33 +7115,33 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4853 +#: ../../library/stdtypes.rst:4882 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4858 +#: ../../library/stdtypes.rst:4887 msgid "Count the number of occurrences of *value*." msgstr "計算 *value* 的出現次數" -#: ../../library/stdtypes.rst:4864 +#: ../../library/stdtypes.rst:4893 msgid "" "Return the index of the first occurrence of *value* (at or after index " "*start* and before index *stop*)." msgstr "" -#: ../../library/stdtypes.rst:4867 +#: ../../library/stdtypes.rst:4896 msgid "Raises a :exc:`ValueError` if *value* cannot be found." msgstr "在找不到 *value* 時引發 :exc:`ValueError`。" -#: ../../library/stdtypes.rst:4871 +#: ../../library/stdtypes.rst:4900 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4875 +#: ../../library/stdtypes.rst:4904 msgid "The underlying object of the memoryview::" msgstr "memoryview 的底層物件: ::" -#: ../../library/stdtypes.rst:4877 +#: ../../library/stdtypes.rst:4906 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -7101,14 +7153,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4886 +#: ../../library/stdtypes.rst:4915 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:4890 +#: ../../library/stdtypes.rst:4919 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -7140,11 +7192,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:4934 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4907 +#: ../../library/stdtypes.rst:4936 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -7168,11 +7220,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4922 +#: ../../library/stdtypes.rst:4951 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4926 +#: ../../library/stdtypes.rst:4955 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 " @@ -7180,17 +7232,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4931 +#: ../../library/stdtypes.rst:4960 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:4937 +#: ../../library/stdtypes.rst:4966 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4939 +#: ../../library/stdtypes.rst:4968 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -7210,49 +7262,49 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4950 +#: ../../library/stdtypes.rst:4979 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4955 +#: ../../library/stdtypes.rst:4984 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:4958 ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:4987 ../../library/stdtypes.rst:4995 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4963 +#: ../../library/stdtypes.rst:4992 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:4971 +#: ../../library/stdtypes.rst:5000 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4975 +#: ../../library/stdtypes.rst:5004 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4981 +#: ../../library/stdtypes.rst:5010 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4987 +#: ../../library/stdtypes.rst:5016 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4995 +#: ../../library/stdtypes.rst:5024 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4999 +#: ../../library/stdtypes.rst:5028 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -7262,7 +7314,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:5006 +#: ../../library/stdtypes.rst:5035 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 " @@ -7270,7 +7322,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:5011 +#: ../../library/stdtypes.rst:5040 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -7282,18 +7334,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:5020 +#: ../../library/stdtypes.rst:5049 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:5024 +#: ../../library/stdtypes.rst:5053 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:5029 +#: ../../library/stdtypes.rst:5058 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 " @@ -7301,92 +7353,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:5035 +#: ../../library/stdtypes.rst:5064 msgid "Sets can be created by several means:" msgstr "集合可以以多種方式建立:" -#: ../../library/stdtypes.rst:5037 +#: ../../library/stdtypes.rst:5066 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:5038 +#: ../../library/stdtypes.rst:5067 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:5039 +#: ../../library/stdtypes.rst:5068 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:5041 +#: ../../library/stdtypes.rst:5070 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:5046 +#: ../../library/stdtypes.rst:5075 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:5050 +#: ../../library/stdtypes.rst:5079 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:5054 +#: ../../library/stdtypes.rst:5083 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:5059 +#: ../../library/stdtypes.rst:5088 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:5066 +#: ../../library/stdtypes.rst:5095 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:5070 +#: ../../library/stdtypes.rst:5099 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:5077 +#: ../../library/stdtypes.rst:5106 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:5081 +#: ../../library/stdtypes.rst:5110 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:5088 +#: ../../library/stdtypes.rst:5117 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:5094 +#: ../../library/stdtypes.rst:5123 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:5100 +#: ../../library/stdtypes.rst:5129 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:5106 +#: ../../library/stdtypes.rst:5135 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:5111 +#: ../../library/stdtypes.rst:5140 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:5114 +#: ../../library/stdtypes.rst:5143 msgid "" "Note, the non-operator versions of :meth:`~frozenset.union`, :meth:" "`~frozenset.intersection`, :meth:`~frozenset.difference`, :meth:`~frozenset." @@ -7397,7 +7449,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:5121 +#: ../../library/stdtypes.rst:5150 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 " @@ -7407,14 +7459,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:5128 +#: ../../library/stdtypes.rst:5157 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:5132 +#: ../../library/stdtypes.rst:5161 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 " @@ -7422,78 +7474,78 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:5137 +#: ../../library/stdtypes.rst:5166 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:5140 +#: ../../library/stdtypes.rst:5169 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:5142 +#: ../../library/stdtypes.rst:5171 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:5146 +#: ../../library/stdtypes.rst:5175 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:5152 +#: ../../library/stdtypes.rst:5181 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:5157 +#: ../../library/stdtypes.rst:5186 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:5162 +#: ../../library/stdtypes.rst:5191 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:5167 +#: ../../library/stdtypes.rst:5196 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:5171 +#: ../../library/stdtypes.rst:5200 msgid "Add element *elem* to the set." msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:5175 +#: ../../library/stdtypes.rst:5204 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:5180 +#: ../../library/stdtypes.rst:5209 msgid "Remove element *elem* from the set if it is present." msgstr "如果 *elem* 存在於集合中則將其移除。" -#: ../../library/stdtypes.rst:5184 +#: ../../library/stdtypes.rst:5213 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:5189 +#: ../../library/stdtypes.rst:5218 msgid "Remove all elements from the set." msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:5192 +#: ../../library/stdtypes.rst:5221 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:5197 +#: ../../library/stdtypes.rst:5226 msgid "" "Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:`~set." "remove`, and :meth:`~set.discard` methods may be a set. To support " @@ -7501,11 +7553,11 @@ msgid "" "*elem*." msgstr "" -#: ../../library/stdtypes.rst:5206 +#: ../../library/stdtypes.rst:5235 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:5216 +#: ../../library/stdtypes.rst:5245 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -7514,7 +7566,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:5222 +#: ../../library/stdtypes.rst:5251 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -7523,33 +7575,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:5233 +#: ../../library/stdtypes.rst:5262 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:5236 +#: ../../library/stdtypes.rst:5265 msgid "Dictionaries can be created by several means:" msgstr "字典可以用數種方式建立:" -#: ../../library/stdtypes.rst:5238 +#: ../../library/stdtypes.rst:5267 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:5240 +#: ../../library/stdtypes.rst:5269 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:5241 +#: ../../library/stdtypes.rst:5270 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:5244 +#: ../../library/stdtypes.rst:5273 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 " @@ -7562,7 +7614,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:5254 +#: ../../library/stdtypes.rst:5283 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 " @@ -7570,7 +7622,7 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:5259 +#: ../../library/stdtypes.rst:5288 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -7579,7 +7631,7 @@ msgid "" "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:5265 +#: ../../library/stdtypes.rst:5294 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -7599,19 +7651,19 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:5274 +#: ../../library/stdtypes.rst:5303 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:5277 +#: ../../library/stdtypes.rst:5306 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:5280 +#: ../../library/stdtypes.rst:5309 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7643,33 +7695,33 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:5295 +#: ../../library/stdtypes.rst:5324 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:5299 +#: ../../library/stdtypes.rst:5328 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:5333 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5308 +#: ../../library/stdtypes.rst:5337 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5312 +#: ../../library/stdtypes.rst:5341 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:5317 +#: ../../library/stdtypes.rst:5346 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 " @@ -7680,7 +7732,7 @@ msgid "" "__missing__` must be a method; it cannot be an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:5325 +#: ../../library/stdtypes.rst:5354 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -7704,51 +7756,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:5336 +#: ../../library/stdtypes.rst:5365 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:5343 +#: ../../library/stdtypes.rst:5372 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:5347 +#: ../../library/stdtypes.rst:5376 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:5352 +#: ../../library/stdtypes.rst:5381 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:5356 +#: ../../library/stdtypes.rst:5385 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:5360 +#: ../../library/stdtypes.rst:5389 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5394 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:5369 +#: ../../library/stdtypes.rst:5398 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5373 +#: ../../library/stdtypes.rst:5402 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:5375 +#: ../../library/stdtypes.rst:5404 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 " @@ -7757,70 +7809,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:5412 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:5389 +#: ../../library/stdtypes.rst:5418 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5394 +#: ../../library/stdtypes.rst:5423 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:5400 +#: ../../library/stdtypes.rst:5429 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:5406 +#: ../../library/stdtypes.rst:5435 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:5409 +#: ../../library/stdtypes.rst:5438 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:5413 +#: ../../library/stdtypes.rst:5442 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:5448 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5426 +#: ../../library/stdtypes.rst:5455 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:5434 +#: ../../library/stdtypes.rst:5463 msgid "" "Update the dictionary with the key/value pairs from *mapping* or *iterable* " "and *kwargs*, overwriting existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:5437 +#: ../../library/stdtypes.rst:5466 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -7829,20 +7881,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:5445 +#: ../../library/stdtypes.rst:5474 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5448 +#: ../../library/stdtypes.rst:5477 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:5452 +#: ../../library/stdtypes.rst:5481 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -7852,25 +7904,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:5458 +#: ../../library/stdtypes.rst:5487 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:5466 +#: ../../library/stdtypes.rst:5495 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:5472 +#: ../../library/stdtypes.rst:5501 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:5474 +#: ../../library/stdtypes.rst:5503 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7892,21 +7944,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:5484 +#: ../../library/stdtypes.rst:5513 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5489 +#: ../../library/stdtypes.rst:5518 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:5496 +#: ../../library/stdtypes.rst:5525 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:5498 +#: ../../library/stdtypes.rst:5527 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 " @@ -7914,23 +7966,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:5503 +#: ../../library/stdtypes.rst:5532 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:5508 +#: ../../library/stdtypes.rst:5537 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5512 +#: ../../library/stdtypes.rst:5541 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5515 +#: ../../library/stdtypes.rst:5544 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -7938,39 +7990,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:5520 +#: ../../library/stdtypes.rst:5549 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:5523 +#: ../../library/stdtypes.rst:5552 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:5528 +#: ../../library/stdtypes.rst:5557 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:5533 +#: ../../library/stdtypes.rst:5562 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:5536 +#: ../../library/stdtypes.rst:5565 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5541 +#: ../../library/stdtypes.rst:5570 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5575 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 " @@ -7984,11 +8036,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:5558 +#: ../../library/stdtypes.rst:5587 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:5560 +#: ../../library/stdtypes.rst:5589 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -8029,11 +8081,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:5602 +#: ../../library/stdtypes.rst:5631 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:5609 +#: ../../library/stdtypes.rst:5638 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 " @@ -8044,7 +8096,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:5617 +#: ../../library/stdtypes.rst:5646 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 " @@ -8055,7 +8107,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:5622 +#: ../../library/stdtypes.rst:5651 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -8064,7 +8116,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:5655 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 " @@ -8078,7 +8130,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5636 +#: ../../library/stdtypes.rst:5665 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -8090,7 +8142,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5641 +#: ../../library/stdtypes.rst:5670 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -8101,14 +8153,14 @@ msgstr "" "keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續傳播 " "(propagate)。" -#: ../../library/stdtypes.rst:5646 +#: ../../library/stdtypes.rst:5675 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:5650 +#: ../../library/stdtypes.rst:5679 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -8120,7 +8172,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" "`~object.__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5656 +#: ../../library/stdtypes.rst:5685 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -8132,7 +8184,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5662 +#: ../../library/stdtypes.rst:5691 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -8147,7 +8199,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5669 +#: ../../library/stdtypes.rst:5698 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 " @@ -8159,7 +8211,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5677 +#: ../../library/stdtypes.rst:5706 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -8167,7 +8219,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5682 +#: ../../library/stdtypes.rst:5711 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -8175,11 +8227,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5689 +#: ../../library/stdtypes.rst:5718 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5695 +#: ../../library/stdtypes.rst:5724 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -8195,7 +8247,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5705 +#: ../../library/stdtypes.rst:5734 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -8203,7 +8255,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5708 +#: ../../library/stdtypes.rst:5737 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -8211,7 +8263,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5711 +#: ../../library/stdtypes.rst:5740 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 " @@ -8223,7 +8275,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5717 +#: ../../library/stdtypes.rst:5746 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 " @@ -8235,7 +8287,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5723 +#: ../../library/stdtypes.rst:5752 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 " @@ -8247,7 +8299,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5729 +#: ../../library/stdtypes.rst:5758 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." @@ -8260,7 +8312,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5735 +#: ../../library/stdtypes.rst:5764 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -8269,7 +8321,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:5741 +#: ../../library/stdtypes.rst:5770 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -8279,7 +8331,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:5746 +#: ../../library/stdtypes.rst:5775 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -8287,7 +8339,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5749 +#: ../../library/stdtypes.rst:5778 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 " @@ -8298,7 +8350,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5754 +#: ../../library/stdtypes.rst:5783 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -8306,7 +8358,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5757 +#: ../../library/stdtypes.rst:5786 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -8314,7 +8366,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5760 +#: ../../library/stdtypes.rst:5789 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -8326,7 +8378,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5765 +#: ../../library/stdtypes.rst:5794 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -8338,7 +8390,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5771 +#: ../../library/stdtypes.rst:5800 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -8348,13 +8400,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5775 +#: ../../library/stdtypes.rst:5804 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5778 +#: ../../library/stdtypes.rst:5807 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -8372,13 +8424,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5786 +#: ../../library/stdtypes.rst:5815 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5788 +#: ../../library/stdtypes.rst:5817 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -8392,7 +8444,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5794 +#: ../../library/stdtypes.rst:5823 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -8400,7 +8452,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5797 +#: ../../library/stdtypes.rst:5826 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -8412,7 +8464,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5802 +#: ../../library/stdtypes.rst:5831 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -8422,7 +8474,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5806 +#: ../../library/stdtypes.rst:5835 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -8434,253 +8486,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5813 +#: ../../library/stdtypes.rst:5842 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5815 +#: ../../library/stdtypes.rst:5844 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5818 +#: ../../library/stdtypes.rst:5847 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5819 +#: ../../library/stdtypes.rst:5848 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5820 +#: ../../library/stdtypes.rst:5849 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5821 +#: ../../library/stdtypes.rst:5850 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5822 +#: ../../library/stdtypes.rst:5851 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5823 +#: ../../library/stdtypes.rst:5852 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5824 +#: ../../library/stdtypes.rst:5853 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5825 +#: ../../library/stdtypes.rst:5854 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5826 +#: ../../library/stdtypes.rst:5855 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5827 +#: ../../library/stdtypes.rst:5856 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5828 +#: ../../library/stdtypes.rst:5857 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5829 +#: ../../library/stdtypes.rst:5858 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5830 +#: ../../library/stdtypes.rst:5859 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5831 +#: ../../library/stdtypes.rst:5860 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5832 +#: ../../library/stdtypes.rst:5861 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5833 +#: ../../library/stdtypes.rst:5862 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5834 +#: ../../library/stdtypes.rst:5863 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5835 +#: ../../library/stdtypes.rst:5864 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5836 +#: ../../library/stdtypes.rst:5865 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5837 +#: ../../library/stdtypes.rst:5866 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5838 +#: ../../library/stdtypes.rst:5867 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5839 +#: ../../library/stdtypes.rst:5868 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5840 +#: ../../library/stdtypes.rst:5869 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5841 +#: ../../library/stdtypes.rst:5870 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5842 +#: ../../library/stdtypes.rst:5871 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5843 +#: ../../library/stdtypes.rst:5872 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5844 +#: ../../library/stdtypes.rst:5873 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5845 +#: ../../library/stdtypes.rst:5874 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5846 +#: ../../library/stdtypes.rst:5875 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5847 +#: ../../library/stdtypes.rst:5876 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5848 +#: ../../library/stdtypes.rst:5877 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5849 +#: ../../library/stdtypes.rst:5878 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5850 +#: ../../library/stdtypes.rst:5879 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5851 +#: ../../library/stdtypes.rst:5880 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5852 +#: ../../library/stdtypes.rst:5881 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5853 +#: ../../library/stdtypes.rst:5882 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5854 +#: ../../library/stdtypes.rst:5883 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5855 +#: ../../library/stdtypes.rst:5884 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5856 +#: ../../library/stdtypes.rst:5885 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5857 +#: ../../library/stdtypes.rst:5886 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5858 +#: ../../library/stdtypes.rst:5887 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5859 +#: ../../library/stdtypes.rst:5888 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5860 +#: ../../library/stdtypes.rst:5889 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5861 +#: ../../library/stdtypes.rst:5890 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5862 +#: ../../library/stdtypes.rst:5891 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5863 +#: ../../library/stdtypes.rst:5892 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5864 +#: ../../library/stdtypes.rst:5893 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5865 +#: ../../library/stdtypes.rst:5894 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5866 +#: ../../library/stdtypes.rst:5895 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5867 +#: ../../library/stdtypes.rst:5896 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5868 +#: ../../library/stdtypes.rst:5897 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5869 +#: ../../library/stdtypes.rst:5898 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5870 +#: ../../library/stdtypes.rst:5899 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5871 +#: ../../library/stdtypes.rst:5900 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5872 +#: ../../library/stdtypes.rst:5901 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5873 +#: ../../library/stdtypes.rst:5902 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5878 +#: ../../library/stdtypes.rst:5907 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5880 +#: ../../library/stdtypes.rst:5909 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5884 +#: ../../library/stdtypes.rst:5913 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5886 +#: ../../library/stdtypes.rst:5915 msgid "" ">>> list[int].__origin__\n" "" @@ -8688,7 +8740,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5892 +#: ../../library/stdtypes.rst:5921 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 " @@ -8697,7 +8749,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5896 +#: ../../library/stdtypes.rst:5925 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -8705,7 +8757,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:5931 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -8713,7 +8765,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5905 +#: ../../library/stdtypes.rst:5934 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -8727,7 +8779,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5913 +#: ../../library/stdtypes.rst:5942 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -8737,7 +8789,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5920 +#: ../../library/stdtypes.rst:5949 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -8745,19 +8797,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5928 +#: ../../library/stdtypes.rst:5957 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5929 +#: ../../library/stdtypes.rst:5958 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5931 +#: ../../library/stdtypes.rst:5960 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5932 +#: ../../library/stdtypes.rst:5961 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -8766,7 +8818,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5936 +#: ../../library/stdtypes.rst:5965 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -8774,18 +8826,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5937 +#: ../../library/stdtypes.rst:5966 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:5946 +#: ../../library/stdtypes.rst:5975 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5952 +#: ../../library/stdtypes.rst:5981 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -8798,7 +8850,7 @@ msgstr "" "釋 (type annotation) `。與下標 :data:`typing.Union` 相比,聯合型" "別運算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5959 +#: ../../library/stdtypes.rst:5988 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 " @@ -8809,7 +8861,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5964 +#: ../../library/stdtypes.rst:5993 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -8817,7 +8869,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5969 +#: ../../library/stdtypes.rst:5998 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 " @@ -8830,40 +8882,40 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5977 +#: ../../library/stdtypes.rst:6006 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5979 +#: ../../library/stdtypes.rst:6008 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5981 +#: ../../library/stdtypes.rst:6010 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5983 +#: ../../library/stdtypes.rst:6012 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5985 +#: ../../library/stdtypes.rst:6014 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5987 +#: ../../library/stdtypes.rst:6016 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5989 +#: ../../library/stdtypes.rst:6018 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5991 +#: ../../library/stdtypes.rst:6020 msgid "It creates instances of :class:`typing.Union`::" msgstr "它會建立 :class:`typing.Union` 的實例: ::" -#: ../../library/stdtypes.rst:5993 +#: ../../library/stdtypes.rst:6022 msgid "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" @@ -8871,21 +8923,21 @@ msgstr "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" -#: ../../library/stdtypes.rst:5996 +#: ../../library/stdtypes.rst:6025 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5998 +#: ../../library/stdtypes.rst:6027 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:6003 +#: ../../library/stdtypes.rst:6032 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:6006 +#: ../../library/stdtypes.rst:6035 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -8893,14 +8945,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:6009 +#: ../../library/stdtypes.rst:6038 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:6012 +#: ../../library/stdtypes.rst:6041 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -8910,7 +8962,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:6019 +#: ../../library/stdtypes.rst:6048 msgid "" "The user-exposed type for the union object can be accessed from :class:" "`typing.Union` and used for :func:`isinstance` checks::" @@ -8918,7 +8970,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`typing." "Union` 存取並用於 :func:`isinstance` 檢查: ::" -#: ../../library/stdtypes.rst:6022 +#: ../../library/stdtypes.rst:6051 msgid "" ">>> import typing\n" ">>> isinstance(int | str, typing.Union)\n" @@ -8936,7 +8988,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'typing.Union' instances" -#: ../../library/stdtypes.rst:6031 +#: ../../library/stdtypes.rst:6060 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 " @@ -8945,7 +8997,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:6035 +#: ../../library/stdtypes.rst:6064 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -8971,32 +9023,32 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:6051 +#: ../../library/stdtypes.rst:6080 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:6057 +#: ../../library/stdtypes.rst:6086 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:6064 +#: ../../library/stdtypes.rst:6093 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:6066 +#: ../../library/stdtypes.rst:6095 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:6073 +#: ../../library/stdtypes.rst:6102 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:6075 +#: ../../library/stdtypes.rst:6104 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 " @@ -9007,7 +9059,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:6082 +#: ../../library/stdtypes.rst:6111 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -9018,32 +9070,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:6090 +#: ../../library/stdtypes.rst:6119 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:6098 +#: ../../library/stdtypes.rst:6127 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:6100 +#: ../../library/stdtypes.rst:6129 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:6106 +#: ../../library/stdtypes.rst:6135 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:6108 +#: ../../library/stdtypes.rst:6137 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:6111 +#: ../../library/stdtypes.rst:6140 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -9051,15 +9103,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:6115 +#: ../../library/stdtypes.rst:6144 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:6121 +#: ../../library/stdtypes.rst:6150 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:6125 +#: ../../library/stdtypes.rst:6154 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -9067,7 +9119,7 @@ msgid "" "methods>`. Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:6131 +#: ../../library/stdtypes.rst:6160 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:" @@ -9080,7 +9132,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:6142 +#: ../../library/stdtypes.rst:6171 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -9091,7 +9143,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:6150 +#: ../../library/stdtypes.rst:6179 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -9119,15 +9171,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:6165 +#: ../../library/stdtypes.rst:6194 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:6173 +#: ../../library/stdtypes.rst:6202 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:6179 +#: ../../library/stdtypes.rst:6208 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -9137,7 +9189,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:6186 +#: ../../library/stdtypes.rst:6215 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -9146,21 +9198,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:6193 +#: ../../library/stdtypes.rst:6222 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:6196 +#: ../../library/stdtypes.rst:6225 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:6202 +#: ../../library/stdtypes.rst:6231 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:6208 +#: ../../library/stdtypes.rst:6237 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 " @@ -9168,30 +9220,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:6213 +#: ../../library/stdtypes.rst:6242 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:6219 +#: ../../library/stdtypes.rst:6248 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:6221 +#: ../../library/stdtypes.rst:6250 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:6225 +#: ../../library/stdtypes.rst:6254 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:6232 +#: ../../library/stdtypes.rst:6261 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:6234 +#: ../../library/stdtypes.rst:6263 msgid "" "This object is commonly used to indicate that something is omitted. It " "supports no special operations. There is exactly one ellipsis object, " @@ -9199,63 +9251,63 @@ msgid "" "the :const:`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:6239 +#: ../../library/stdtypes.rst:6268 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:6241 +#: ../../library/stdtypes.rst:6270 msgid "" "In typical use, ``...`` as the ``Ellipsis`` object appears in a few " "different places, for instance:" msgstr "" -#: ../../library/stdtypes.rst:6244 +#: ../../library/stdtypes.rst:6273 msgid "" "In type annotations, such as :ref:`callable arguments ` or :ref:`tuple elements `." msgstr "" -#: ../../library/stdtypes.rst:6247 +#: ../../library/stdtypes.rst:6276 msgid "" "As the body of a function instead of a :ref:`pass statement `." msgstr "" -#: ../../library/stdtypes.rst:6249 +#: ../../library/stdtypes.rst:6278 msgid "" "In third-party libraries, such as `Numpy's slicing and striding `_." msgstr "" -#: ../../library/stdtypes.rst:6252 +#: ../../library/stdtypes.rst:6281 msgid "" "Python also uses three dots in ways that are not ``Ellipsis`` objects, for " "instance:" msgstr "" -#: ../../library/stdtypes.rst:6254 +#: ../../library/stdtypes.rst:6283 msgid "" "Doctest's :const:`ELLIPSIS `, as a pattern for missing " "content." msgstr "" -#: ../../library/stdtypes.rst:6256 +#: ../../library/stdtypes.rst:6285 msgid "" "The default Python prompt of the :term:`interactive` shell when partial " "input is incomplete." msgstr "" -#: ../../library/stdtypes.rst:6258 +#: ../../library/stdtypes.rst:6287 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:6266 +#: ../../library/stdtypes.rst:6295 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:6268 +#: ../../library/stdtypes.rst:6297 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 " @@ -9263,64 +9315,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:6273 +#: ../../library/stdtypes.rst:6302 msgid "It is written as :code:`NotImplemented`." msgstr "它被寫為 :code:`NotImplemented`。" -#: ../../library/stdtypes.rst:6279 +#: ../../library/stdtypes.rst:6308 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:6281 +#: ../../library/stdtypes.rst:6310 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:6289 +#: ../../library/stdtypes.rst:6318 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:6291 +#: ../../library/stdtypes.rst:6320 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:6298 +#: ../../library/stdtypes.rst:6327 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:6304 +#: ../../library/stdtypes.rst:6333 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:6312 +#: ../../library/stdtypes.rst:6341 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:6317 +#: ../../library/stdtypes.rst:6346 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:6322 +#: ../../library/stdtypes.rst:6351 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:6332 +#: ../../library/stdtypes.rst:6361 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:6334 +#: ../../library/stdtypes.rst:6363 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 " @@ -9328,7 +9380,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:6339 +#: ../../library/stdtypes.rst:6368 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 " @@ -9338,24 +9390,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:6346 +#: ../../library/stdtypes.rst:6375 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:6348 +#: ../../library/stdtypes.rst:6377 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:6352 +#: ../../library/stdtypes.rst:6381 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:6354 +#: ../../library/stdtypes.rst:6383 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -9379,7 +9431,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:6374 +#: ../../library/stdtypes.rst:6403 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -9387,11 +9439,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:6379 +#: ../../library/stdtypes.rst:6408 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:6381 +#: ../../library/stdtypes.rst:6410 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -9409,85 +9461,86 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:6394 +#: ../../library/stdtypes.rst:6423 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:6396 +#: ../../library/stdtypes.rst:6425 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -"此限制僅適用於 :class:`int` 與 :class:`str` 或 :class:`bytes` 之間可能較慢的轉換:" +"此限制僅適用於 :class:`int` 與 :class:`str` 或 :class:`bytes` 之間可能較慢的" +"轉換:" -#: ../../library/stdtypes.rst:6399 +#: ../../library/stdtypes.rst:6428 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:6400 +#: ../../library/stdtypes.rst:6429 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "``int(string, base)`` 用於所有非 2 冪次方的底。" -#: ../../library/stdtypes.rst:6401 +#: ../../library/stdtypes.rst:6430 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:6402 +#: ../../library/stdtypes.rst:6431 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:6403 +#: ../../library/stdtypes.rst:6432 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:6406 +#: ../../library/stdtypes.rst:6435 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:6408 +#: ../../library/stdtypes.rst:6437 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "``int(string, base)`` 以 2、4、8、16 或 32 為底。" -#: ../../library/stdtypes.rst:6409 +#: ../../library/stdtypes.rst:6438 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:6410 +#: ../../library/stdtypes.rst:6439 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:6411 +#: ../../library/stdtypes.rst:6440 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr ":ref:`formatspec` 用於十六進位、八進位和二進位數字。" -#: ../../library/stdtypes.rst:6412 +#: ../../library/stdtypes.rst:6441 msgid ":class:`str` to :class:`float`." msgstr ":class:`str` 轉換為 :class:`float`。" -#: ../../library/stdtypes.rst:6413 +#: ../../library/stdtypes.rst:6442 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr ":class:`str` 轉換為 :class:`decimal.Decimal`。" -#: ../../library/stdtypes.rst:6416 +#: ../../library/stdtypes.rst:6445 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:6418 +#: ../../library/stdtypes.rst:6447 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:6421 +#: ../../library/stdtypes.rst:6450 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:6424 +#: ../../library/stdtypes.rst:6453 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -9495,7 +9548,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:6426 +#: ../../library/stdtypes.rst:6455 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 " @@ -9504,38 +9557,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:6432 +#: ../../library/stdtypes.rst:6461 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:6435 +#: ../../library/stdtypes.rst:6464 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:6439 +#: ../../library/stdtypes.rst:6468 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:6441 +#: ../../library/stdtypes.rst:6470 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:6443 +#: ../../library/stdtypes.rst:6472 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:6450 +#: ../../library/stdtypes.rst:6479 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 " @@ -9547,7 +9600,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:6459 +#: ../../library/stdtypes.rst:6488 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 " @@ -9555,11 +9608,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:6465 +#: ../../library/stdtypes.rst:6494 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:6467 +#: ../../library/stdtypes.rst:6496 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 " @@ -9567,11 +9620,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:6472 +#: ../../library/stdtypes.rst:6501 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:6474 +#: ../../library/stdtypes.rst:6503 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -9593,38 +9646,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:6484 +#: ../../library/stdtypes.rst:6513 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:6488 +#: ../../library/stdtypes.rst:6517 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:6489 +#: ../../library/stdtypes.rst:6518 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:6492 +#: ../../library/stdtypes.rst:6521 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:6495 +#: ../../library/stdtypes.rst:6524 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:6497 +#: ../../library/stdtypes.rst:6526 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:6500 +#: ../../library/stdtypes.rst:6529 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -9637,13 +9690,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:324 #: ../../library/stdtypes.rst:401 ../../library/stdtypes.rst:994 #: ../../library/stdtypes.rst:1184 ../../library/stdtypes.rst:1206 -#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:5208 -#: ../../library/stdtypes.rst:6204 +#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:5237 +#: ../../library/stdtypes.rst:6233 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1221 -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5237 msgid "statement" msgstr "statement(陳述式)" @@ -9765,11 +9818,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1206 ../../library/stdtypes.rst:1371 #: ../../library/stdtypes.rst:1553 ../../library/stdtypes.rst:1597 #: ../../library/stdtypes.rst:1718 ../../library/stdtypes.rst:1848 -#: ../../library/stdtypes.rst:3229 ../../library/stdtypes.rst:3248 -#: ../../library/stdtypes.rst:3361 ../../library/stdtypes.rst:4997 -#: ../../library/stdtypes.rst:5208 ../../library/stdtypes.rst:5691 -#: ../../library/stdtypes.rst:5948 ../../library/stdtypes.rst:6123 -#: ../../library/stdtypes.rst:6168 +#: ../../library/stdtypes.rst:3258 ../../library/stdtypes.rst:3277 +#: ../../library/stdtypes.rst:3390 ../../library/stdtypes.rst:5026 +#: ../../library/stdtypes.rst:5237 ../../library/stdtypes.rst:5720 +#: ../../library/stdtypes.rst:5977 ../../library/stdtypes.rst:6152 +#: ../../library/stdtypes.rst:6197 msgid "object" msgstr "object(物件)" @@ -9861,9 +9914,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:994 -#: ../../library/stdtypes.rst:1184 ../../library/stdtypes.rst:5208 -#: ../../library/stdtypes.rst:6175 ../../library/stdtypes.rst:6189 -#: ../../library/stdtypes.rst:6204 +#: ../../library/stdtypes.rst:1184 ../../library/stdtypes.rst:5237 +#: ../../library/stdtypes.rst:6204 ../../library/stdtypes.rst:6218 +#: ../../library/stdtypes.rst:6233 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -9879,8 +9932,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3105 -#: ../../library/stdtypes.rst:4365 +#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3134 +#: ../../library/stdtypes.rst:4394 msgid "+ (plus)" msgstr "+ (加號)" @@ -9892,13 +9945,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3105 -#: ../../library/stdtypes.rst:4365 +#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3134 +#: ../../library/stdtypes.rst:4394 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3062 -#: ../../library/stdtypes.rst:4322 +#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3091 +#: ../../library/stdtypes.rst:4351 msgid "* (asterisk)" msgstr "* (星號)" @@ -9910,8 +9963,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3025 -#: ../../library/stdtypes.rst:4290 +#: ../../library/stdtypes.rst:251 ../../library/stdtypes.rst:3054 +#: ../../library/stdtypes.rst:4319 msgid "% (percent)" msgstr "% (百分號)" @@ -9921,7 +9974,7 @@ msgstr "**" #: ../../library/stdtypes.rst:324 ../../library/stdtypes.rst:401 #: ../../library/stdtypes.rst:994 ../../library/stdtypes.rst:1221 -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5237 msgid "operations on" msgstr "operations on(操作於)" @@ -9930,7 +9983,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:343 ../../library/stdtypes.rst:1916 -#: ../../library/stdtypes.rst:3229 ../../library/stdtypes.rst:6204 +#: ../../library/stdtypes.rst:3258 ../../library/stdtypes.rst:6233 msgid "module" msgstr "模組" @@ -9998,7 +10051,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:891 ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:891 ../../library/stdtypes.rst:5633 msgid "protocol" msgstr "protocol(協定)" @@ -10024,7 +10077,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:994 ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:994 ../../library/stdtypes.rst:5237 msgid "len" msgstr "len" @@ -10093,14 +10146,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1206 ../../library/stdtypes.rst:3229 -#: ../../library/stdtypes.rst:3361 ../../library/stdtypes.rst:3471 -#: ../../library/stdtypes.rst:4290 +#: ../../library/stdtypes.rst:1206 ../../library/stdtypes.rst:3258 +#: ../../library/stdtypes.rst:3390 ../../library/stdtypes.rst:3500 +#: ../../library/stdtypes.rst:4319 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:5208 -#: ../../library/stdtypes.rst:5948 ../../library/stdtypes.rst:6204 +#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:5237 +#: ../../library/stdtypes.rst:5977 ../../library/stdtypes.rst:6233 msgid "type" msgstr "type(型別)" @@ -10108,7 +10161,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:5237 msgid "del" msgstr "del" @@ -10117,8 +10170,8 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1718 ../../library/stdtypes.rst:1861 -#: ../../library/stdtypes.rst:1908 ../../library/stdtypes.rst:2853 -#: ../../library/stdtypes.rst:3025 +#: ../../library/stdtypes.rst:1908 ../../library/stdtypes.rst:2882 +#: ../../library/stdtypes.rst:3054 msgid "string" msgstr "string(字串)" @@ -10139,17 +10192,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1881 ../../library/stdtypes.rst:3221 +#: ../../library/stdtypes.rst:1881 ../../library/stdtypes.rst:3250 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1881 ../../library/stdtypes.rst:3229 -#: ../../library/stdtypes.rst:3248 ../../library/stdtypes.rst:3471 -#: ../../library/stdtypes.rst:4290 +#: ../../library/stdtypes.rst:1881 ../../library/stdtypes.rst:3258 +#: ../../library/stdtypes.rst:3277 ../../library/stdtypes.rst:3500 +#: ../../library/stdtypes.rst:4319 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1908 ../../library/stdtypes.rst:3471 +#: ../../library/stdtypes.rst:1908 ../../library/stdtypes.rst:3500 msgid "methods" msgstr "methods(方法)" @@ -10157,239 +10210,239 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2665 ../../library/stdtypes.rst:4144 +#: ../../library/stdtypes.rst:2681 ../../library/stdtypes.rst:4173 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2665 +#: ../../library/stdtypes.rst:2681 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "! formatted string literal" msgstr "! formatted string literals(! 格式化字串常數)" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "formatted string literals" msgstr "formatted string literals(格式化字串常數)" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "! f-string" msgstr "! f-string(! f 字串)" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "! (exclamation mark)" msgstr "! (驚嘆號)" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "= (equals)" msgstr "= (等號)" -#: ../../library/stdtypes.rst:2853 +#: ../../library/stdtypes.rst:2882 msgid "for help in debugging using string literals" msgstr "" -#: ../../library/stdtypes.rst:3025 +#: ../../library/stdtypes.rst:3054 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:3025 +#: ../../library/stdtypes.rst:3054 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:3025 +#: ../../library/stdtypes.rst:3054 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:3025 +#: ../../library/stdtypes.rst:3054 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:3025 ../../library/stdtypes.rst:4290 +#: ../../library/stdtypes.rst:3054 ../../library/stdtypes.rst:4319 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:3025 ../../library/stdtypes.rst:4290 +#: ../../library/stdtypes.rst:3054 ../../library/stdtypes.rst:4319 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:3062 ../../library/stdtypes.rst:4322 +#: ../../library/stdtypes.rst:3091 ../../library/stdtypes.rst:4351 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:3062 ../../library/stdtypes.rst:3105 -#: ../../library/stdtypes.rst:4322 ../../library/stdtypes.rst:4365 +#: ../../library/stdtypes.rst:3091 ../../library/stdtypes.rst:3134 +#: ../../library/stdtypes.rst:4351 ../../library/stdtypes.rst:4394 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:3062 ../../library/stdtypes.rst:4322 +#: ../../library/stdtypes.rst:3091 ../../library/stdtypes.rst:4351 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:3105 ../../library/stdtypes.rst:4365 +#: ../../library/stdtypes.rst:3134 ../../library/stdtypes.rst:4394 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:3105 ../../library/stdtypes.rst:4365 +#: ../../library/stdtypes.rst:3134 ../../library/stdtypes.rst:4394 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:3221 +#: ../../library/stdtypes.rst:3250 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:3229 +#: ../../library/stdtypes.rst:3258 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:3229 +#: ../../library/stdtypes.rst:3258 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:4144 +#: ../../library/stdtypes.rst:4173 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:4144 +#: ../../library/stdtypes.rst:4173 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:4290 +#: ../../library/stdtypes.rst:4319 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:4290 +#: ../../library/stdtypes.rst:4319 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:4290 +#: ../../library/stdtypes.rst:4319 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:4290 +#: ../../library/stdtypes.rst:4319 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4997 +#: ../../library/stdtypes.rst:5026 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5237 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5237 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:5315 +#: ../../library/stdtypes.rst:5344 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5633 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5633 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5633 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5679 +#: ../../library/stdtypes.rst:5708 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5679 +#: ../../library/stdtypes.rst:5708 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5720 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5720 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5720 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5948 +#: ../../library/stdtypes.rst:5977 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5948 +#: ../../library/stdtypes.rst:5977 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:6123 +#: ../../library/stdtypes.rst:6152 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:6168 +#: ../../library/stdtypes.rst:6197 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:6168 +#: ../../library/stdtypes.rst:6197 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:6175 +#: ../../library/stdtypes.rst:6204 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:6175 +#: ../../library/stdtypes.rst:6204 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:6189 +#: ../../library/stdtypes.rst:6218 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:6189 +#: ../../library/stdtypes.rst:6218 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:6228 +#: ../../library/stdtypes.rst:6257 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:6228 +#: ../../library/stdtypes.rst:6257 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號字面值)" diff --git a/library/tkinter.font.po b/library/tkinter.font.po index b2b3a10acc..7179e207b4 100644 --- a/library/tkinter.font.po +++ b/library/tkinter.font.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2024-02-15 23:09+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -52,15 +52,15 @@ msgstr "" msgid "arguments:" msgstr "引數:" -#: ../../library/tkinter.font.rst:32 +#: ../../library/tkinter.font.rst:0 msgid "*font* - font specifier tuple (family, size, options)" msgstr "*font* - 字型指定符號元組 (family, size, options)" -#: ../../library/tkinter.font.rst:33 +#: ../../library/tkinter.font.rst:0 msgid "*name* - unique font name" msgstr "*name* - 獨特字型名稱" -#: ../../library/tkinter.font.rst:34 +#: ../../library/tkinter.font.rst:0 msgid "*exists* - self points to existing named font if true" msgstr "*exists* - 如果存在的話,指向現有的已命名字型" @@ -68,39 +68,39 @@ msgstr "*exists* - 如果存在的話,指向現有的已命名字型" msgid "additional keyword options (ignored if *font* is specified):" msgstr "額外的關鍵字選項(若已指定 *font* 則會忽略):" -#: ../../library/tkinter.font.rst:38 +#: ../../library/tkinter.font.rst:0 msgid "*family* - font family i.e. Courier, Times" msgstr "*family* - 字型家族,例如:Courier、Times" -#: ../../library/tkinter.font.rst:39 +#: ../../library/tkinter.font.rst:0 msgid "*size* - font size" msgstr "*size* - 字級" -#: ../../library/tkinter.font.rst:40 +#: ../../library/tkinter.font.rst:0 msgid "If *size* is positive it is interpreted as size in points." msgstr "如果 *size* 是正數則會直譯成以點 (point) 為單位的字級。" -#: ../../library/tkinter.font.rst:41 +#: ../../library/tkinter.font.rst:0 msgid "If *size* is a negative number its absolute value is treated" msgstr "如果 *size* 是負數則會變成絕對值" -#: ../../library/tkinter.font.rst:42 +#: ../../library/tkinter.font.rst:0 msgid "as size in pixels." msgstr "以像素 (pixel) 為單位的字級。" -#: ../../library/tkinter.font.rst:43 +#: ../../library/tkinter.font.rst:0 msgid "*weight* - font emphasis (NORMAL, BOLD)" msgstr "*weight* - 強調字型,例如:NORMAL(標準體)、BOLD(粗體)" -#: ../../library/tkinter.font.rst:44 +#: ../../library/tkinter.font.rst:0 msgid "*slant* - ROMAN, ITALIC" msgstr "*slant* - 例如:ROMAN(正體)、ITALIC(斜體)" -#: ../../library/tkinter.font.rst:45 +#: ../../library/tkinter.font.rst:0 msgid "*underline* - font underlining (0 - none, 1 - underline)" msgstr "*underline* - 字型加上底線(0 - 無底線、 1 - 加上底線)" -#: ../../library/tkinter.font.rst:46 +#: ../../library/tkinter.font.rst:0 msgid "*overstrike* - font strikeout (0 - none, 1 - strikeout)" msgstr "*overstrike* - 字型加上刪除線(0 - 無刪除線、 1 - 加上刪除線)" diff --git a/library/turtle.po b/library/turtle.po index 4a251a317e..50b78f9895 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -61,10 +61,6 @@ msgid "" "degrees clockwise." msgstr "" -#: ../../library/turtle.rst:43 -msgid "Turtle star" -msgstr "" - #: ../../library/turtle.rst:45 msgid "" "Turtle can draw intricate shapes using programs that repeat simple moves." @@ -551,71 +547,71 @@ msgstr "" msgid "Move and draw" msgstr "" -#: ../../library/turtle.rst:336 +#: ../../library/turtle.rst:0 msgid ":func:`forward` | :func:`fd`" msgstr ":func:`forward` | :func:`fd`" -#: ../../library/turtle.rst:337 +#: ../../library/turtle.rst:0 msgid ":func:`backward` | :func:`bk` | :func:`back`" msgstr ":func:`backward` | :func:`bk` | :func:`back`" -#: ../../library/turtle.rst:338 +#: ../../library/turtle.rst:0 msgid ":func:`right` | :func:`rt`" msgstr ":func:`right` | :func:`rt`" -#: ../../library/turtle.rst:339 +#: ../../library/turtle.rst:0 msgid ":func:`left` | :func:`lt`" msgstr ":func:`left` | :func:`lt`" -#: ../../library/turtle.rst:340 +#: ../../library/turtle.rst:0 msgid ":func:`goto` | :func:`setpos` | :func:`setposition`" msgstr ":func:`goto` | :func:`setpos` | :func:`setposition`" -#: ../../library/turtle.rst:341 +#: ../../library/turtle.rst:0 msgid ":func:`teleport`" msgstr ":func:`teleport`" -#: ../../library/turtle.rst:342 +#: ../../library/turtle.rst:0 msgid ":func:`setx`" msgstr ":func:`setx`" -#: ../../library/turtle.rst:343 +#: ../../library/turtle.rst:0 msgid ":func:`sety`" msgstr ":func:`sety`" -#: ../../library/turtle.rst:344 +#: ../../library/turtle.rst:0 msgid ":func:`setheading` | :func:`seth`" msgstr ":func:`setheading` | :func:`seth`" -#: ../../library/turtle.rst:345 +#: ../../library/turtle.rst:0 msgid ":func:`home`" msgstr ":func:`home`" -#: ../../library/turtle.rst:346 ../../library/turtle.rst:2864 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2864 msgid ":func:`circle`" msgstr ":func:`circle`" -#: ../../library/turtle.rst:347 +#: ../../library/turtle.rst:0 msgid ":func:`dot`" msgstr ":func:`dot`" -#: ../../library/turtle.rst:348 ../../library/turtle.rst:2842 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2842 msgid ":func:`stamp`" msgstr ":func:`stamp`" -#: ../../library/turtle.rst:349 +#: ../../library/turtle.rst:0 msgid ":func:`clearstamp`" msgstr ":func:`clearstamp`" -#: ../../library/turtle.rst:350 +#: ../../library/turtle.rst:0 msgid ":func:`clearstamps`" msgstr ":func:`clearstamps`" -#: ../../library/turtle.rst:351 +#: ../../library/turtle.rst:0 msgid ":func:`undo`" msgstr ":func:`undo`" -#: ../../library/turtle.rst:352 +#: ../../library/turtle.rst:0 msgid ":func:`speed`" msgstr ":func:`speed`" @@ -623,27 +619,27 @@ msgstr ":func:`speed`" msgid "Tell Turtle's state" msgstr "" -#: ../../library/turtle.rst:355 +#: ../../library/turtle.rst:0 msgid ":func:`position` | :func:`pos`" msgstr ":func:`position` | :func:`pos`" -#: ../../library/turtle.rst:356 +#: ../../library/turtle.rst:0 msgid ":func:`towards`" msgstr ":func:`towards`" -#: ../../library/turtle.rst:357 +#: ../../library/turtle.rst:0 msgid ":func:`xcor`" msgstr ":func:`xcor`" -#: ../../library/turtle.rst:358 +#: ../../library/turtle.rst:0 msgid ":func:`ycor`" msgstr ":func:`ycor`" -#: ../../library/turtle.rst:359 +#: ../../library/turtle.rst:0 msgid ":func:`heading`" msgstr ":func:`heading`" -#: ../../library/turtle.rst:360 +#: ../../library/turtle.rst:0 msgid ":func:`distance`" msgstr ":func:`distance`" @@ -651,11 +647,11 @@ msgstr ":func:`distance`" msgid "Setting and measurement" msgstr "" -#: ../../library/turtle.rst:363 +#: ../../library/turtle.rst:0 msgid ":func:`degrees`" msgstr ":func:`degrees`" -#: ../../library/turtle.rst:364 +#: ../../library/turtle.rst:0 msgid ":func:`radians`" msgstr ":func:`radians`" @@ -663,23 +659,23 @@ msgstr ":func:`radians`" msgid "Drawing state" msgstr "" -#: ../../library/turtle.rst:368 +#: ../../library/turtle.rst:0 msgid ":func:`pendown` | :func:`pd` | :func:`down`" msgstr ":func:`pendown` | :func:`pd` | :func:`down`" -#: ../../library/turtle.rst:369 +#: ../../library/turtle.rst:0 msgid ":func:`penup` | :func:`pu` | :func:`up`" msgstr ":func:`penup` | :func:`pu` | :func:`up`" -#: ../../library/turtle.rst:370 +#: ../../library/turtle.rst:0 msgid ":func:`pensize` | :func:`width`" msgstr ":func:`pensize` | :func:`width`" -#: ../../library/turtle.rst:371 +#: ../../library/turtle.rst:0 msgid ":func:`pen`" msgstr ":func:`pen`" -#: ../../library/turtle.rst:372 +#: ../../library/turtle.rst:0 msgid ":func:`isdown`" msgstr ":func:`isdown`" @@ -687,15 +683,15 @@ msgstr ":func:`isdown`" msgid "Color control" msgstr "" -#: ../../library/turtle.rst:375 +#: ../../library/turtle.rst:0 msgid ":func:`color`" msgstr ":func:`color`" -#: ../../library/turtle.rst:376 +#: ../../library/turtle.rst:0 msgid ":func:`pencolor`" msgstr ":func:`pencolor`" -#: ../../library/turtle.rst:377 +#: ../../library/turtle.rst:0 msgid ":func:`fillcolor`" msgstr ":func:`fillcolor`" @@ -703,19 +699,19 @@ msgstr ":func:`fillcolor`" msgid "Filling" msgstr "" -#: ../../library/turtle.rst:380 +#: ../../library/turtle.rst:0 msgid ":func:`filling`" msgstr ":func:`filling`" -#: ../../library/turtle.rst:381 +#: ../../library/turtle.rst:0 msgid ":func:`fill`" msgstr ":func:`fill`" -#: ../../library/turtle.rst:382 +#: ../../library/turtle.rst:0 msgid ":func:`begin_fill`" msgstr ":func:`begin_fill`" -#: ../../library/turtle.rst:383 +#: ../../library/turtle.rst:0 msgid ":func:`end_fill`" msgstr ":func:`end_fill`" @@ -723,15 +719,15 @@ msgstr ":func:`end_fill`" msgid "More drawing control" msgstr "" -#: ../../library/turtle.rst:386 +#: ../../library/turtle.rst:0 msgid ":func:`reset`" msgstr ":func:`reset`" -#: ../../library/turtle.rst:387 +#: ../../library/turtle.rst:0 msgid ":func:`clear`" msgstr ":func:`clear`" -#: ../../library/turtle.rst:388 +#: ../../library/turtle.rst:0 msgid ":func:`write`" msgstr ":func:`write`" @@ -743,15 +739,15 @@ msgstr "" msgid "Visibility" msgstr "" -#: ../../library/turtle.rst:392 +#: ../../library/turtle.rst:0 msgid ":func:`showturtle` | :func:`st`" msgstr ":func:`showturtle` | :func:`st`" -#: ../../library/turtle.rst:393 +#: ../../library/turtle.rst:0 msgid ":func:`hideturtle` | :func:`ht`" msgstr ":func:`hideturtle` | :func:`ht`" -#: ../../library/turtle.rst:394 +#: ../../library/turtle.rst:0 msgid ":func:`isvisible`" msgstr ":func:`isvisible`" @@ -759,35 +755,35 @@ msgstr ":func:`isvisible`" msgid "Appearance" msgstr "" -#: ../../library/turtle.rst:397 +#: ../../library/turtle.rst:0 msgid ":func:`shape`" msgstr ":func:`shape`" -#: ../../library/turtle.rst:398 +#: ../../library/turtle.rst:0 msgid ":func:`resizemode`" msgstr ":func:`resizemode`" -#: ../../library/turtle.rst:399 +#: ../../library/turtle.rst:0 msgid ":func:`shapesize` | :func:`turtlesize`" msgstr ":func:`shapesize` | :func:`turtlesize`" -#: ../../library/turtle.rst:400 +#: ../../library/turtle.rst:0 msgid ":func:`shearfactor`" msgstr ":func:`shearfactor`" -#: ../../library/turtle.rst:401 +#: ../../library/turtle.rst:0 msgid ":func:`tiltangle`" msgstr ":func:`tiltangle`" -#: ../../library/turtle.rst:402 +#: ../../library/turtle.rst:0 msgid ":func:`tilt`" msgstr ":func:`tilt`" -#: ../../library/turtle.rst:403 +#: ../../library/turtle.rst:0 msgid ":func:`shapetransform`" msgstr ":func:`shapetransform`" -#: ../../library/turtle.rst:404 +#: ../../library/turtle.rst:0 msgid ":func:`get_shapepoly`" msgstr ":func:`get_shapepoly`" @@ -795,15 +791,15 @@ msgstr ":func:`get_shapepoly`" msgid "Using events" msgstr "" -#: ../../library/turtle.rst:407 ../../library/turtle.rst:2836 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2836 msgid ":func:`onclick`" msgstr ":func:`onclick`" -#: ../../library/turtle.rst:408 +#: ../../library/turtle.rst:0 msgid ":func:`onrelease`" msgstr ":func:`onrelease`" -#: ../../library/turtle.rst:409 ../../library/turtle.rst:2819 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2819 msgid ":func:`ondrag`" msgstr ":func:`ondrag`" @@ -811,39 +807,39 @@ msgstr ":func:`ondrag`" msgid "Special Turtle methods" msgstr "" -#: ../../library/turtle.rst:412 +#: ../../library/turtle.rst:0 msgid ":func:`poly`" msgstr ":func:`poly`" -#: ../../library/turtle.rst:413 +#: ../../library/turtle.rst:0 msgid ":func:`begin_poly`" msgstr ":func:`begin_poly`" -#: ../../library/turtle.rst:414 +#: ../../library/turtle.rst:0 msgid ":func:`end_poly`" msgstr ":func:`end_poly`" -#: ../../library/turtle.rst:415 +#: ../../library/turtle.rst:0 msgid ":func:`get_poly`" msgstr ":func:`get_poly`" -#: ../../library/turtle.rst:416 ../../library/turtle.rst:2858 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2858 msgid ":func:`clone`" msgstr ":func:`clone`" -#: ../../library/turtle.rst:417 +#: ../../library/turtle.rst:0 msgid ":func:`getturtle` | :func:`getpen`" msgstr ":func:`getturtle` | :func:`getpen`" -#: ../../library/turtle.rst:418 +#: ../../library/turtle.rst:0 msgid ":func:`getscreen`" msgstr ":func:`getscreen`" -#: ../../library/turtle.rst:419 +#: ../../library/turtle.rst:0 msgid ":func:`setundobuffer`" msgstr ":func:`setundobuffer`" -#: ../../library/turtle.rst:420 +#: ../../library/turtle.rst:0 msgid ":func:`undobufferentries`" msgstr ":func:`undobufferentries`" @@ -855,27 +851,27 @@ msgstr "" msgid "Window control" msgstr "" -#: ../../library/turtle.rst:427 +#: ../../library/turtle.rst:0 msgid ":func:`bgcolor`" msgstr ":func:`bgcolor`" -#: ../../library/turtle.rst:428 +#: ../../library/turtle.rst:0 msgid ":func:`bgpic`" msgstr ":func:`bgpic`" -#: ../../library/turtle.rst:429 +#: ../../library/turtle.rst:0 msgid ":func:`clearscreen`" msgstr ":func:`clearscreen`" -#: ../../library/turtle.rst:430 +#: ../../library/turtle.rst:0 msgid ":func:`resetscreen`" msgstr ":func:`resetscreen`" -#: ../../library/turtle.rst:431 +#: ../../library/turtle.rst:0 msgid ":func:`screensize`" msgstr ":func:`screensize`" -#: ../../library/turtle.rst:432 +#: ../../library/turtle.rst:0 msgid ":func:`setworldcoordinates`" msgstr ":func:`setworldcoordinates`" @@ -883,19 +879,19 @@ msgstr ":func:`setworldcoordinates`" msgid "Animation control" msgstr "" -#: ../../library/turtle.rst:435 +#: ../../library/turtle.rst:0 msgid ":func:`no_animation`" msgstr ":func:`no_animation`" -#: ../../library/turtle.rst:436 +#: ../../library/turtle.rst:0 msgid ":func:`delay`" msgstr ":func:`delay`" -#: ../../library/turtle.rst:437 +#: ../../library/turtle.rst:0 msgid ":func:`tracer`" msgstr ":func:`tracer`" -#: ../../library/turtle.rst:438 +#: ../../library/turtle.rst:0 msgid ":func:`update`" msgstr ":func:`update`" @@ -903,27 +899,27 @@ msgstr ":func:`update`" msgid "Using screen events" msgstr "" -#: ../../library/turtle.rst:441 +#: ../../library/turtle.rst:0 msgid ":func:`listen`" msgstr ":func:`listen`" -#: ../../library/turtle.rst:442 +#: ../../library/turtle.rst:0 msgid ":func:`onkey` | :func:`onkeyrelease`" msgstr ":func:`onkey` | :func:`onkeyrelease`" -#: ../../library/turtle.rst:443 +#: ../../library/turtle.rst:0 msgid ":func:`onkeypress`" msgstr ":func:`onkeypress`" -#: ../../library/turtle.rst:444 +#: ../../library/turtle.rst:0 msgid ":func:`onclick` | :func:`onscreenclick`" msgstr ":func:`onclick` | :func:`onscreenclick`" -#: ../../library/turtle.rst:445 +#: ../../library/turtle.rst:0 msgid ":func:`ontimer`" msgstr ":func:`ontimer`" -#: ../../library/turtle.rst:446 +#: ../../library/turtle.rst:0 msgid ":func:`mainloop` | :func:`done`" msgstr ":func:`mainloop` | :func:`done`" @@ -931,35 +927,35 @@ msgstr ":func:`mainloop` | :func:`done`" msgid "Settings and special methods" msgstr "" -#: ../../library/turtle.rst:449 +#: ../../library/turtle.rst:0 msgid ":func:`mode`" msgstr ":func:`mode`" -#: ../../library/turtle.rst:450 +#: ../../library/turtle.rst:0 msgid ":func:`colormode`" msgstr ":func:`colormode`" -#: ../../library/turtle.rst:451 +#: ../../library/turtle.rst:0 msgid ":func:`getcanvas`" msgstr ":func:`getcanvas`" -#: ../../library/turtle.rst:452 +#: ../../library/turtle.rst:0 msgid ":func:`getshapes`" msgstr ":func:`getshapes`" -#: ../../library/turtle.rst:453 +#: ../../library/turtle.rst:0 msgid ":func:`register_shape` | :func:`addshape`" msgstr ":func:`register_shape` | :func:`addshape`" -#: ../../library/turtle.rst:454 +#: ../../library/turtle.rst:0 msgid ":func:`turtles`" msgstr ":func:`turtles`" -#: ../../library/turtle.rst:455 +#: ../../library/turtle.rst:0 msgid ":func:`window_height`" msgstr ":func:`window_height`" -#: ../../library/turtle.rst:456 +#: ../../library/turtle.rst:0 msgid ":func:`window_width`" msgstr ":func:`window_width`" @@ -967,11 +963,11 @@ msgstr ":func:`window_width`" msgid "Input methods" msgstr "" -#: ../../library/turtle.rst:459 +#: ../../library/turtle.rst:0 msgid ":func:`textinput`" msgstr ":func:`textinput`" -#: ../../library/turtle.rst:460 +#: ../../library/turtle.rst:0 msgid ":func:`numinput`" msgstr ":func:`numinput`" @@ -979,23 +975,23 @@ msgstr ":func:`numinput`" msgid "Methods specific to Screen" msgstr "" -#: ../../library/turtle.rst:463 +#: ../../library/turtle.rst:0 msgid ":func:`bye`" msgstr ":func:`bye`" -#: ../../library/turtle.rst:464 +#: ../../library/turtle.rst:0 msgid ":func:`exitonclick`" msgstr ":func:`exitonclick`" -#: ../../library/turtle.rst:465 +#: ../../library/turtle.rst:0 msgid ":func:`save`" msgstr ":func:`save`" -#: ../../library/turtle.rst:466 +#: ../../library/turtle.rst:0 msgid ":func:`setup`" msgstr ":func:`setup`" -#: ../../library/turtle.rst:467 +#: ../../library/turtle.rst:0 msgid ":func:`title`" msgstr ":func:`title`" diff --git a/library/urllib.parse.po b/library/urllib.parse.po index a40a8c363b..0cab1b4fdc 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2026-02-06 00:18+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -79,27 +79,28 @@ msgstr "" #: ../../library/urllib.parse.rst:55 msgid "" -"Parse a URL into six components, returning a 6-item :term:`named tuple`. " -"This corresponds to the general structure of a URL: ``scheme://netloc/" -"path;parameters?query#fragment``. Each tuple item is a string, possibly " -"empty. The components are not broken up into smaller parts (for example, the " -"network location is a single string), and % escapes are not expanded. The " -"delimiters as shown above are not part of the result, except for a leading " -"slash in the *path* component, which is retained if present. For example:" +"Parse a URL into five components, returning a 5-item :term:`named tuple` :" +"class:`SplitResult` or :class:`SplitResultBytes`. This corresponds to the " +"general structure of a URL: ``scheme://netloc/path?query#fragment``. Each " +"tuple item is a string, possibly empty. The components are not broken up " +"into smaller parts (for example, the network location is a single string), " +"and % escapes are not expanded. The delimiters as shown above are not part " +"of the result, except for a leading slash in the *path* component, which is " +"retained if present. For example:" msgstr "" -#: ../../library/urllib.parse.rst:64 +#: ../../library/urllib.parse.rst:65 +#, fuzzy msgid "" -">>> from urllib.parse import urlparse\n" -">>> urlparse(\"scheme://netloc/path;parameters?query#fragment\")\n" -"ParseResult(scheme='scheme', netloc='netloc', path='/path;parameters', " -"params='',\n" +">>> from urllib.parse import urlsplit\n" +">>> urlsplit(\"scheme://netloc/path?query#fragment\")\n" +"SplitResult(scheme='scheme', netloc='netloc', path='/path',\n" " query='query', fragment='fragment')\n" -">>> o = urlparse(\"http://docs.python.org:80/3/library/urllib.parse.html?\"\n" +">>> o = urlsplit(\"http://docs.python.org:80/3/library/urllib.parse.html?\"\n" "... \"highlight=params#url-parsing\")\n" ">>> o\n" -"ParseResult(scheme='http', netloc='docs.python.org:80',\n" -" path='/3/library/urllib.parse.html', params='',\n" +"SplitResult(scheme='http', netloc='docs.python.org:80',\n" +" path='/3/library/urllib.parse.html',\n" " query='highlight=params', fragment='url-parsing')\n" ">>> o.scheme\n" "'http'\n" @@ -134,31 +135,33 @@ msgstr "" ">>> o._replace(fragment=\"\").geturl()\n" "'http://docs.python.org:80/3/library/urllib.parse.html?highlight=params'" -#: ../../library/urllib.parse.rst:88 +#: ../../library/urllib.parse.rst:89 msgid "" -"Following the syntax specifications in :rfc:`1808`, urlparse recognizes a " -"netloc only if it is properly introduced by '//'. Otherwise the input is " -"presumed to be a relative URL and thus to start with a path component." +"Following the syntax specifications in :rfc:`1808`, :func:`!urlsplit` " +"recognizes a netloc only if it is properly introduced by '//'. Otherwise " +"the input is presumed to be a relative URL and thus to start with a path " +"component." msgstr "" -#: ../../library/urllib.parse.rst:93 +#: ../../library/urllib.parse.rst:94 +#, fuzzy msgid "" -">>> from urllib.parse import urlparse\n" -">>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" -"Python.html',\n" -" params='', query='', fragment='')\n" -">>> urlparse('www.cwi.nl/%7Eguido/Python.html')\n" -"ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',\n" -" params='', query='', fragment='')\n" -">>> urlparse('help/Python.html')\n" -"ParseResult(scheme='', netloc='', path='help/Python.html', params='',\n" +">>> from urllib.parse import urlsplit\n" +">>> urlsplit('//www.cwi.nl:80/%7Eguido/Python.html')\n" +"SplitResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." +"html',\n" +" query='', fragment='')\n" +">>> urlsplit('www.cwi.nl/%7Eguido/Python.html')\n" +"SplitResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',\n" +" query='', fragment='')\n" +">>> urlsplit('help/Python.html')\n" +"SplitResult(scheme='', netloc='', path='help/Python.html',\n" " query='', fragment='')" msgstr "" ">>> from urllib.parse import urlparse\n" ">>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" -"Python.html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." +"html',\n" " params='', query='', fragment='')\n" ">>> urlparse('www.cwi.nl/%7Eguido/Python.html')\n" "ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',\n" @@ -167,7 +170,7 @@ msgstr "" "ParseResult(scheme='', netloc='', path='help/Python.html', params='',\n" " query='', fragment='')" -#: ../../library/urllib.parse.rst:107 +#: ../../library/urllib.parse.rst:108 msgid "" "The *scheme* argument gives the default addressing scheme, to be used only " "if the URL does not specify one. It should be the same type (text or bytes) " @@ -175,7 +178,7 @@ msgid "" "is automatically converted to ``b''`` if appropriate." msgstr "" -#: ../../library/urllib.parse.rst:112 +#: ../../library/urllib.parse.rst:113 msgid "" "If the *allow_fragments* argument is false, fragment identifiers are not " "recognized. Instead, they are parsed as part of the path, parameters or " @@ -183,174 +186,149 @@ msgid "" "return value." msgstr "" -#: ../../library/urllib.parse.rst:117 +#: ../../library/urllib.parse.rst:118 msgid "" "The return value is a :term:`named tuple`, which means that its items can be " "accessed by index or as named attributes, which are:" msgstr "" -#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:314 -#: ../../library/urllib.parse.rst:436 +#: ../../library/urllib.parse.rst:122 ../../library/urllib.parse.rst:388 msgid "Attribute" msgstr "屬性" -#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:314 -#: ../../library/urllib.parse.rst:436 +#: ../../library/urllib.parse.rst:122 ../../library/urllib.parse.rst:388 msgid "Index" msgstr "" -#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:314 -#: ../../library/urllib.parse.rst:436 +#: ../../library/urllib.parse.rst:122 ../../library/urllib.parse.rst:388 msgid "Value" msgstr "" -#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:314 -#: ../../library/urllib.parse.rst:436 +#: ../../library/urllib.parse.rst:122 ../../library/urllib.parse.rst:388 msgid "Value if not present" msgstr "" -#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:316 +#: ../../library/urllib.parse.rst:124 msgid ":attr:`scheme`" msgstr ":attr:`scheme`" -#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:316 -#: ../../library/urllib.parse.rst:438 +#: ../../library/urllib.parse.rst:124 ../../library/urllib.parse.rst:390 msgid "0" msgstr "0" -#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:316 +#: ../../library/urllib.parse.rst:124 msgid "URL scheme specifier" msgstr "" -#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:316 +#: ../../library/urllib.parse.rst:124 msgid "*scheme* parameter" msgstr "" -#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:126 msgid ":attr:`netloc`" msgstr ":attr:`netloc`" -#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:318 -#: ../../library/urllib.parse.rst:440 +#: ../../library/urllib.parse.rst:126 ../../library/urllib.parse.rst:392 msgid "1" msgstr "1" -#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:126 msgid "Network location part" msgstr "" -#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:127 -#: ../../library/urllib.parse.rst:129 ../../library/urllib.parse.rst:132 -#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:318 -#: ../../library/urllib.parse.rst:320 ../../library/urllib.parse.rst:322 -#: ../../library/urllib.parse.rst:324 ../../library/urllib.parse.rst:438 -#: ../../library/urllib.parse.rst:440 +#: ../../library/urllib.parse.rst:126 ../../library/urllib.parse.rst:128 +#: ../../library/urllib.parse.rst:130 ../../library/urllib.parse.rst:132 +#: ../../library/urllib.parse.rst:390 ../../library/urllib.parse.rst:392 msgid "empty string" msgstr "" -#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:128 msgid ":attr:`path`" msgstr ":attr:`path`" -#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:128 msgid "2" msgstr "2" -#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:128 msgid "Hierarchical path" msgstr "" -#: ../../library/urllib.parse.rst:129 -msgid ":attr:`params`" -msgstr ":attr:`params`" - -#: ../../library/urllib.parse.rst:129 ../../library/urllib.parse.rst:322 -msgid "3" -msgstr "3" - -#: ../../library/urllib.parse.rst:129 -msgid "Parameters for last path element" -msgstr "" - -#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:322 +#: ../../library/urllib.parse.rst:130 msgid ":attr:`query`" msgstr ":attr:`query`" -#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:324 -msgid "4" -msgstr "4" +#: ../../library/urllib.parse.rst:130 +msgid "3" +msgstr "3" -#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:322 +#: ../../library/urllib.parse.rst:130 msgid "Query component" msgstr "" -#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:324 -#: ../../library/urllib.parse.rst:440 +#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:392 msgid ":attr:`fragment`" msgstr ":attr:`fragment`" -#: ../../library/urllib.parse.rst:134 -msgid "5" -msgstr "5" +#: ../../library/urllib.parse.rst:132 +msgid "4" +msgstr "4" -#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:324 -#: ../../library/urllib.parse.rst:440 +#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:392 msgid "Fragment identifier" msgstr "" -#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:326 +#: ../../library/urllib.parse.rst:134 msgid ":attr:`username`" msgstr ":attr:`username`" -#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:326 +#: ../../library/urllib.parse.rst:134 msgid "User name" msgstr "" -#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:138 -#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:142 -#: ../../library/urllib.parse.rst:326 ../../library/urllib.parse.rst:328 -#: ../../library/urllib.parse.rst:330 ../../library/urllib.parse.rst:332 +#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:136 +#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:140 msgid ":const:`None`" msgstr ":const:`None`" -#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:328 +#: ../../library/urllib.parse.rst:136 msgid ":attr:`password`" msgstr ":attr:`password`" -#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:328 +#: ../../library/urllib.parse.rst:136 msgid "Password" msgstr "" -#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:330 +#: ../../library/urllib.parse.rst:138 msgid ":attr:`hostname`" msgstr ":attr:`hostname`" -#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:330 +#: ../../library/urllib.parse.rst:138 msgid "Host name (lower case)" msgstr "" -#: ../../library/urllib.parse.rst:142 ../../library/urllib.parse.rst:332 +#: ../../library/urllib.parse.rst:140 msgid ":attr:`port`" msgstr ":attr:`port`" -#: ../../library/urllib.parse.rst:142 ../../library/urllib.parse.rst:332 +#: ../../library/urllib.parse.rst:140 msgid "Port number as integer, if present" msgstr "" -#: ../../library/urllib.parse.rst:146 ../../library/urllib.parse.rst:336 +#: ../../library/urllib.parse.rst:144 msgid "" "Reading the :attr:`port` attribute will raise a :exc:`ValueError` if an " "invalid port is specified in the URL. See section :ref:`urlparse-result-" "object` for more information on the result object." msgstr "" -#: ../../library/urllib.parse.rst:150 ../../library/urllib.parse.rst:340 +#: ../../library/urllib.parse.rst:148 msgid "" -"Unmatched square brackets in the :attr:`netloc` attribute will raise " -"a :exc:`ValueError`." +"Unmatched square brackets in the :attr:`netloc` attribute will raise a :exc:" +"`ValueError`." msgstr "" -#: ../../library/urllib.parse.rst:153 ../../library/urllib.parse.rst:343 +#: ../../library/urllib.parse.rst:151 msgid "" "Characters in the :attr:`netloc` attribute that decompose under NFKC " "normalization (as used by the IDNA encoding) into any of ``/``, ``?``, " @@ -358,76 +336,93 @@ msgid "" "decomposed before parsing, no error will be raised." msgstr "" -#: ../../library/urllib.parse.rst:158 +#: ../../library/urllib.parse.rst:156 +msgid "" +"Following some of the `WHATWG spec`_ that updates :rfc:`3986`, leading C0 " +"control and space characters are stripped from the URL. ``\\n``, ``\\r`` and " +"tab ``\\t`` characters are removed from the URL at any position." +msgstr "" + +#: ../../library/urllib.parse.rst:160 msgid "" "As is the case with all named tuples, the subclass has a few additional " -"methods and attributes that are particularly useful. One such method " -"is :meth:`_replace`. The :meth:`_replace` method will return a new " -"ParseResult object replacing specified fields with new values." +"methods and attributes that are particularly useful. One such method is :" +"meth:`_replace`. The :meth:`_replace` method will return a new :class:" +"`SplitResult` object replacing specified fields with new values." msgstr "" -#: ../../library/urllib.parse.rst:163 +#: ../../library/urllib.parse.rst:165 +#, fuzzy msgid "" -">>> from urllib.parse import urlparse\n" -">>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" +">>> from urllib.parse import urlsplit\n" +">>> u = urlsplit('//www.cwi.nl:80/%7Eguido/Python.html')\n" ">>> u\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" -"Python.html',\n" -" params='', query='', fragment='')\n" +"SplitResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." +"html',\n" +" query='', fragment='')\n" ">>> u._replace(scheme='http')\n" -"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/" -"Python.html',\n" -" params='', query='', fragment='')" +"SplitResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python." +"html',\n" +" query='', fragment='')" msgstr "" ">>> from urllib.parse import urlparse\n" ">>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" ">>> u\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" -"Python.html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." +"html',\n" " params='', query='', fragment='')\n" ">>> u._replace(scheme='http')\n" -"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/" -"Python.html',\n" +"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python." +"html',\n" " params='', query='', fragment='')" -#: ../../library/urllib.parse.rst:177 +#: ../../library/urllib.parse.rst:179 msgid "" -":func:`urlparse` does not perform validation. See :ref:`URL parsing " +":func:`urlsplit` does not perform validation. See :ref:`URL parsing " "security ` for details." msgstr "" -#: ../../library/urllib.parse.rst:180 +#: ../../library/urllib.parse.rst:182 msgid "Added IPv6 URL parsing capabilities." msgstr "新增剖析 IPv6 URL 的能力。" -#: ../../library/urllib.parse.rst:183 +#: ../../library/urllib.parse.rst:185 msgid "" "The fragment is now parsed for all URL schemes (unless *allow_fragments* is " "false), in accordance with :rfc:`3986`. Previously, an allowlist of schemes " "that support fragments existed." msgstr "" -#: ../../library/urllib.parse.rst:188 ../../library/urllib.parse.rst:357 +#: ../../library/urllib.parse.rst:190 msgid "" -"Out-of-range port numbers now raise :exc:`ValueError`, instead of " -"returning :const:`None`." +"Out-of-range port numbers now raise :exc:`ValueError`, instead of returning :" +"const:`None`." msgstr "" -#: ../../library/urllib.parse.rst:192 ../../library/urllib.parse.rst:361 +#: ../../library/urllib.parse.rst:194 msgid "" "Characters that affect netloc parsing under NFKC normalization will now " "raise :exc:`ValueError`." msgstr "" -#: ../../library/urllib.parse.rst:199 +#: ../../library/urllib.parse.rst:198 +msgid "ASCII newline and tab characters are stripped from the URL." +msgstr "" + +#: ../../library/urllib.parse.rst:201 +msgid "" +"Leading WHATWG C0 control and space characters are stripped from the URL." +msgstr "" + +#: ../../library/urllib.parse.rst:209 msgid "" -"Parse a query string given as a string argument (data of " -"type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a " -"dictionary. The dictionary keys are the unique query variable names and the " -"values are lists of values for each name." +"Parse a query string given as a string argument (data of type :mimetype:" +"`application/x-www-form-urlencoded`). Data are returned as a dictionary. " +"The dictionary keys are the unique query variable names and the values are " +"lists of values for each name." msgstr "" -#: ../../library/urllib.parse.rst:204 ../../library/urllib.parse.rst:253 +#: ../../library/urllib.parse.rst:214 ../../library/urllib.parse.rst:263 msgid "" "The optional argument *keep_blank_values* is a flag indicating whether blank " "values in percent-encoded queries should be treated as blank strings. A true " @@ -436,48 +431,48 @@ msgid "" "treated as if they were not included." msgstr "" -#: ../../library/urllib.parse.rst:210 ../../library/urllib.parse.rst:259 +#: ../../library/urllib.parse.rst:220 ../../library/urllib.parse.rst:269 msgid "" "The optional argument *strict_parsing* is a flag indicating what to do with " "parsing errors. If false (the default), errors are silently ignored. If " "true, errors raise a :exc:`ValueError` exception." msgstr "" -#: ../../library/urllib.parse.rst:214 ../../library/urllib.parse.rst:263 +#: ../../library/urllib.parse.rst:224 ../../library/urllib.parse.rst:273 msgid "" "The optional *encoding* and *errors* parameters specify how to decode " -"percent-encoded sequences into Unicode characters, as accepted by " -"the :meth:`bytes.decode` method." +"percent-encoded sequences into Unicode characters, as accepted by the :meth:" +"`bytes.decode` method." msgstr "" -#: ../../library/urllib.parse.rst:218 ../../library/urllib.parse.rst:267 +#: ../../library/urllib.parse.rst:228 ../../library/urllib.parse.rst:277 msgid "" "The optional argument *max_num_fields* is the maximum number of fields to " "read. If set, then throws a :exc:`ValueError` if there are more than " "*max_num_fields* fields read." msgstr "" -#: ../../library/urllib.parse.rst:222 ../../library/urllib.parse.rst:271 +#: ../../library/urllib.parse.rst:232 ../../library/urllib.parse.rst:281 msgid "" "The optional argument *separator* is the symbol to use for separating the " "query arguments. It defaults to ``&``." msgstr "" -#: ../../library/urllib.parse.rst:225 +#: ../../library/urllib.parse.rst:235 msgid "" "Use the :func:`urllib.parse.urlencode` function (with the ``doseq`` " "parameter set to ``True``) to convert such dictionaries into query strings." msgstr "" -#: ../../library/urllib.parse.rst:230 ../../library/urllib.parse.rst:277 +#: ../../library/urllib.parse.rst:240 ../../library/urllib.parse.rst:287 msgid "Add *encoding* and *errors* parameters." msgstr "新增 *encoding* 和 *errors* 參數。" -#: ../../library/urllib.parse.rst:233 ../../library/urllib.parse.rst:280 +#: ../../library/urllib.parse.rst:243 ../../library/urllib.parse.rst:290 msgid "Added *max_num_fields* parameter." msgstr "新增 *max_num_fields* 參數。" -#: ../../library/urllib.parse.rst:236 ../../library/urllib.parse.rst:283 +#: ../../library/urllib.parse.rst:246 ../../library/urllib.parse.rst:293 msgid "" "Added *separator* parameter with the default value of ``&``. Python versions " "earlier than Python 3.10 allowed using both ``;`` and ``&`` as query " @@ -485,88 +480,63 @@ msgid "" "key, with ``&`` as the default separator." msgstr "" -#: ../../library/urllib.parse.rst:242 ../../library/urllib.parse.rst:761 +#: ../../library/urllib.parse.rst:252 ../../library/urllib.parse.rst:713 msgid "" "Accepting objects with false values (like ``0`` and ``[]``) except empty " "strings and byte-like objects and ``None`` is now deprecated." msgstr "" -#: ../../library/urllib.parse.rst:249 +#: ../../library/urllib.parse.rst:259 msgid "" -"Parse a query string given as a string argument (data of " -"type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a " -"list of name, value pairs." +"Parse a query string given as a string argument (data of type :mimetype:" +"`application/x-www-form-urlencoded`). Data are returned as a list of name, " +"value pairs." msgstr "" -#: ../../library/urllib.parse.rst:274 +#: ../../library/urllib.parse.rst:284 msgid "" "Use the :func:`urllib.parse.urlencode` function to convert such lists of " "pairs into query strings." msgstr "" -#: ../../library/urllib.parse.rst:292 +#: ../../library/urllib.parse.rst:302 msgid "" -"Construct a URL from a tuple as returned by ``urlparse()``. The *parts* " -"argument can be any six-item iterable. This may result in a slightly " +"Construct a URL from a tuple as returned by ``urlsplit()``. The *parts* " +"argument can be any five-item iterable. This may result in a slightly " "different, but equivalent URL, if the URL that was parsed originally had " "unnecessary delimiters (for example, a ``?`` with an empty query; the RFC " "states that these are equivalent)." msgstr "" -#: ../../library/urllib.parse.rst:301 +#: ../../library/urllib.parse.rst:311 msgid "" -"This is similar to :func:`urlparse`, but does not split the params from the " -"URL. This should generally be used instead of :func:`urlparse` if the more " -"recent URL syntax allowing parameters to be applied to each segment of the " -"*path* portion of the URL (see :rfc:`2396`) is wanted. A separate function " -"is needed to separate the path segments and parameters. This function " -"returns a 5-item :term:`named tuple`::" +"This is similar to :func:`urlsplit`, but additionally splits the *path* " +"component on *path* and *params*. This function returns a 6-item :term:" +"`named tuple` :class:`ParseResult` or :class:`ParseResultBytes`. Its items " +"are the same as for the :func:`!urlsplit` result, except that *params* is " +"inserted at index 3, between *path* and *query*." msgstr "" -#: ../../library/urllib.parse.rst:308 +#: ../../library/urllib.parse.rst:318 msgid "" -"(addressing scheme, network location, path, query, fragment identifier)." +"This function is based on obsoleted :rfc:`1738` and :rfc:`1808`, which " +"listed *params* as the main URL component. The more recent URL syntax allows " +"parameters to be applied to each segment of the *path* portion of the URL " +"(see :rfc:`3986`). :func:`urlsplit` should generally be used instead of :" +"func:`urlparse`. A separate function is needed to separate the path segments " +"and parameters." msgstr "" -"(addressing scheme, network location, path, query, fragment identifier)." -#: ../../library/urllib.parse.rst:310 ../../library/urllib.parse.rst:432 +#: ../../library/urllib.parse.rst:327 msgid "" -"The return value is a :term:`named tuple`, its items can be accessed by " -"index or as named attributes:" +"Combine the elements of a tuple as returned by :func:`urlparse` into a " +"complete URL as a string. The *parts* argument can be any six-item iterable. " +"This may result in a slightly different, but equivalent URL, if the URL that " +"was parsed originally had unnecessary delimiters (for example, a ? with an " +"empty query; the RFC states that these are equivalent)." msgstr "" -#: ../../library/urllib.parse.rst:348 -msgid "" -"Following some of the `WHATWG spec`_ that updates RFC 3986, leading C0 " -"control and space characters are stripped from the URL. ``\\n``, ``\\r`` and " -"tab ``\\t`` characters are removed from the URL at any position." -msgstr "" - -#: ../../library/urllib.parse.rst:354 -msgid "" -":func:`urlsplit` does not perform validation. See :ref:`URL parsing " -"security ` for details." -msgstr "" - -#: ../../library/urllib.parse.rst:365 -msgid "ASCII newline and tab characters are stripped from the URL." -msgstr "" - -#: ../../library/urllib.parse.rst:368 -msgid "" -"Leading WHATWG C0 control and space characters are stripped from the URL." -msgstr "" - -#: ../../library/urllib.parse.rst:375 -msgid "" -"Combine the elements of a tuple as returned by :func:`urlsplit` into a " -"complete URL as a string. The *parts* argument can be any five-item " -"iterable. This may result in a slightly different, but equivalent URL, if " -"the URL that was parsed originally had unnecessary delimiters (for example, " -"a ? with an empty query; the RFC states that these are equivalent)." -msgstr "" - -#: ../../library/urllib.parse.rst:384 +#: ../../library/urllib.parse.rst:336 msgid "" "Construct a full (\"absolute\") URL by combining a \"base URL\" (*base*) " "with another URL (*url*). Informally, this uses components of the base URL, " @@ -574,20 +544,20 @@ msgid "" "path, to provide missing components in the relative URL. For example:" msgstr "" -#: ../../library/urllib.parse.rst:393 +#: ../../library/urllib.parse.rst:345 msgid "" -"The *allow_fragments* argument has the same meaning and default as " -"for :func:`urlparse`." +"The *allow_fragments* argument has the same meaning and default as for :func:" +"`urlsplit`." msgstr "" -#: ../../library/urllib.parse.rst:398 +#: ../../library/urllib.parse.rst:350 msgid "" "If *url* is an absolute URL (that is, it starts with ``//`` or ``scheme://" "``), the *url*'s hostname and/or scheme will be present in the result. For " "example:" msgstr "" -#: ../../library/urllib.parse.rst:401 +#: ../../library/urllib.parse.rst:353 msgid "" ">>> urljoin('http://www.cwi.nl/%7Eguido/Python.html',\n" "... '//www.python.org/%7Eguido')\n" @@ -597,13 +567,13 @@ msgstr "" "... '//www.python.org/%7Eguido')\n" "'http://www.python.org/%7Eguido'" -#: ../../library/urllib.parse.rst:407 +#: ../../library/urllib.parse.rst:359 msgid "" "If you do not want that behavior, preprocess the *url* with :func:`urlsplit` " "and :func:`urlunsplit`, removing possible *scheme* and *netloc* parts." msgstr "" -#: ../../library/urllib.parse.rst:412 +#: ../../library/urllib.parse.rst:364 msgid "" "Because an absolute URL may be passed as the ``url`` parameter, it is " "generally **not secure** to use ``urljoin`` with an attacker-controlled " @@ -612,11 +582,11 @@ msgid "" "``urljoin`` will be the absolute URL." msgstr "" -#: ../../library/urllib.parse.rst:422 +#: ../../library/urllib.parse.rst:374 msgid "Behavior updated to match the semantics defined in :rfc:`3986`." msgstr "" -#: ../../library/urllib.parse.rst:427 +#: ../../library/urllib.parse.rst:379 msgid "" "If *url* contains a fragment identifier, return a modified version of *url* " "with no fragment identifier, and the fragment identifier as a separate " @@ -624,37 +594,43 @@ msgid "" "unmodified and an empty string." msgstr "" -#: ../../library/urllib.parse.rst:438 +#: ../../library/urllib.parse.rst:384 +msgid "" +"The return value is a :term:`named tuple`, its items can be accessed by " +"index or as named attributes:" +msgstr "" + +#: ../../library/urllib.parse.rst:390 msgid ":attr:`url`" msgstr ":attr:`url`" -#: ../../library/urllib.parse.rst:438 +#: ../../library/urllib.parse.rst:390 msgid "URL with no fragment" msgstr "" -#: ../../library/urllib.parse.rst:443 +#: ../../library/urllib.parse.rst:395 msgid "" "See section :ref:`urlparse-result-object` for more information on the result " "object." msgstr "" -#: ../../library/urllib.parse.rst:446 +#: ../../library/urllib.parse.rst:398 msgid "Result is a structured object rather than a simple 2-tuple." msgstr "" -#: ../../library/urllib.parse.rst:451 +#: ../../library/urllib.parse.rst:403 msgid "" -"Extract the url from a wrapped URL (that is, a string formatted as " -"````, ````, ``URL:scheme://host/" -"path`` or ``scheme://host/path``). If *url* is not a wrapped URL, it is " -"returned without changes." +"Extract the url from a wrapped URL (that is, a string formatted as ````, ````, ``URL:scheme://host/path`` " +"or ``scheme://host/path``). If *url* is not a wrapped URL, it is returned " +"without changes." msgstr "" -#: ../../library/urllib.parse.rst:459 +#: ../../library/urllib.parse.rst:411 msgid "URL parsing security" msgstr "" -#: ../../library/urllib.parse.rst:461 +#: ../../library/urllib.parse.rst:413 msgid "" "The :func:`urlsplit` and :func:`urlparse` APIs do not perform **validation** " "of inputs. They may not raise errors on inputs that other applications " @@ -663,14 +639,14 @@ msgid "" "rather than purity." msgstr "" -#: ../../library/urllib.parse.rst:467 +#: ../../library/urllib.parse.rst:419 msgid "" "Instead of raising an exception on unusual input, they may instead return " "some component parts as empty strings. Or components may contain more than " "perhaps they should." msgstr "" -#: ../../library/urllib.parse.rst:471 +#: ../../library/urllib.parse.rst:423 msgid "" "We recommend that users of these APIs where the values may be used anywhere " "with security implications code defensively. Do some verification within " @@ -679,7 +655,7 @@ msgid "" "that ``hostname``? etc." msgstr "" -#: ../../library/urllib.parse.rst:477 +#: ../../library/urllib.parse.rst:429 msgid "" "What constitutes a URL is not universally well defined. Different " "applications have different needs and desired constraints. For instance the " @@ -691,56 +667,55 @@ msgid "" "API behavior changes." msgstr "" -#: ../../library/urllib.parse.rst:488 +#: ../../library/urllib.parse.rst:440 msgid "Parsing ASCII Encoded Bytes" msgstr "" -#: ../../library/urllib.parse.rst:490 +#: ../../library/urllib.parse.rst:442 msgid "" "The URL parsing functions were originally designed to operate on character " "strings only. In practice, it is useful to be able to manipulate properly " "quoted and encoded URLs as sequences of ASCII bytes. Accordingly, the URL " -"parsing functions in this module all operate on :class:`bytes` " -"and :class:`bytearray` objects in addition to :class:`str` objects." +"parsing functions in this module all operate on :class:`bytes` and :class:" +"`bytearray` objects in addition to :class:`str` objects." msgstr "" -#: ../../library/urllib.parse.rst:496 +#: ../../library/urllib.parse.rst:448 msgid "" -"If :class:`str` data is passed in, the result will also contain " -"only :class:`str` data. If :class:`bytes` or :class:`bytearray` data is " -"passed in, the result will contain only :class:`bytes` data." +"If :class:`str` data is passed in, the result will also contain only :class:" +"`str` data. If :class:`bytes` or :class:`bytearray` data is passed in, the " +"result will contain only :class:`bytes` data." msgstr "" -#: ../../library/urllib.parse.rst:500 +#: ../../library/urllib.parse.rst:452 msgid "" -"Attempting to mix :class:`str` data with :class:`bytes` " -"or :class:`bytearray` in a single function call will result in " -"a :exc:`TypeError` being raised, while attempting to pass in non-ASCII byte " -"values will trigger :exc:`UnicodeDecodeError`." +"Attempting to mix :class:`str` data with :class:`bytes` or :class:" +"`bytearray` in a single function call will result in a :exc:`TypeError` " +"being raised, while attempting to pass in non-ASCII byte values will " +"trigger :exc:`UnicodeDecodeError`." msgstr "" -#: ../../library/urllib.parse.rst:505 +#: ../../library/urllib.parse.rst:457 msgid "" -"To support easier conversion of result objects between :class:`str` " -"and :class:`bytes`, all return values from URL parsing functions provide " -"either an :meth:`encode` method (when the result contains :class:`str` data) " -"or a :meth:`decode` method (when the result contains :class:`bytes` data). " -"The signatures of these methods match those of the " -"corresponding :class:`str` and :class:`bytes` methods (except that the " -"default encoding is ``'ascii'`` rather than ``'utf-8'``). Each produces a " -"value of a corresponding type that contains either :class:`bytes` data " -"(for :meth:`encode` methods) or :class:`str` data (for :meth:`decode` " -"methods)." +"To support easier conversion of result objects between :class:`str` and :" +"class:`bytes`, all return values from URL parsing functions provide either " +"an :meth:`encode` method (when the result contains :class:`str` data) or a :" +"meth:`decode` method (when the result contains :class:`bytes` data). The " +"signatures of these methods match those of the corresponding :class:`str` " +"and :class:`bytes` methods (except that the default encoding is ``'ascii'`` " +"rather than ``'utf-8'``). Each produces a value of a corresponding type that " +"contains either :class:`bytes` data (for :meth:`encode` methods) or :class:" +"`str` data (for :meth:`decode` methods)." msgstr "" -#: ../../library/urllib.parse.rst:516 +#: ../../library/urllib.parse.rst:468 msgid "" "Applications that need to operate on potentially improperly quoted URLs that " "may contain non-ASCII data will need to do their own decoding from bytes to " "characters before invoking the URL parsing methods." msgstr "" -#: ../../library/urllib.parse.rst:520 +#: ../../library/urllib.parse.rst:472 msgid "" "The behaviour described in this section applies only to the URL parsing " "functions. The URL quoting functions use their own rules when producing or " @@ -748,24 +723,24 @@ msgid "" "URL quoting functions." msgstr "" -#: ../../library/urllib.parse.rst:525 +#: ../../library/urllib.parse.rst:477 msgid "URL parsing functions now accept ASCII encoded byte sequences" msgstr "" -#: ../../library/urllib.parse.rst:532 +#: ../../library/urllib.parse.rst:484 msgid "Structured Parse Results" msgstr "" -#: ../../library/urllib.parse.rst:534 +#: ../../library/urllib.parse.rst:486 msgid "" -"The result objects from the :func:`urlparse`, :func:`urlsplit` " -"and :func:`urldefrag` functions are subclasses of the :class:`tuple` type. " -"These subclasses add the attributes listed in the documentation for those " +"The result objects from the :func:`urlsplit`, :func:`urlparse` and :func:" +"`urldefrag` functions are subclasses of the :class:`tuple` type. These " +"subclasses add the attributes listed in the documentation for those " "functions, the encoding and decoding support described in the previous " "section, as well as an additional method:" msgstr "" -#: ../../library/urllib.parse.rst:542 +#: ../../library/urllib.parse.rst:494 msgid "" "Return the re-combined version of the original URL as a string. This may " "differ from the original URL in that the scheme may be normalized to lower " @@ -773,72 +748,72 @@ msgid "" "queries, and fragment identifiers will be removed." msgstr "" -#: ../../library/urllib.parse.rst:547 +#: ../../library/urllib.parse.rst:499 msgid "" "For :func:`urldefrag` results, only empty fragment identifiers will be " "removed. For :func:`urlsplit` and :func:`urlparse` results, all noted " "changes will be made to the URL returned by this method." msgstr "" -#: ../../library/urllib.parse.rst:551 +#: ../../library/urllib.parse.rst:503 msgid "" "The result of this method remains unchanged if passed back through the " "original parsing function:" msgstr "" -#: ../../library/urllib.parse.rst:564 +#: ../../library/urllib.parse.rst:516 msgid "" "The following classes provide the implementations of the structured parse " "results when operating on :class:`str` objects:" msgstr "" -#: ../../library/urllib.parse.rst:569 +#: ../../library/urllib.parse.rst:521 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`DefragResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:577 +#: ../../library/urllib.parse.rst:529 msgid "" "Concrete class for :func:`urlparse` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`ParseResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:583 +#: ../../library/urllib.parse.rst:535 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`SplitResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:588 +#: ../../library/urllib.parse.rst:540 msgid "" "The following classes provide the implementations of the parse results when " "operating on :class:`bytes` or :class:`bytearray` objects:" msgstr "" -#: ../../library/urllib.parse.rst:593 +#: ../../library/urllib.parse.rst:545 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`DefragResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:601 +#: ../../library/urllib.parse.rst:553 msgid "" "Concrete class for :func:`urlparse` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`ParseResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:609 +#: ../../library/urllib.parse.rst:561 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`SplitResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:617 +#: ../../library/urllib.parse.rst:569 msgid "URL Quoting" msgstr "" -#: ../../library/urllib.parse.rst:619 +#: ../../library/urllib.parse.rst:571 msgid "" "The URL quoting functions focus on taking program data and making it safe " "for use as URL components by quoting special characters and appropriately " @@ -847,7 +822,7 @@ msgid "" "isn't already covered by the URL parsing functions above." msgstr "" -#: ../../library/urllib.parse.rst:627 +#: ../../library/urllib.parse.rst:579 msgid "" "Replace special characters in *string* using the :samp:`%{xx}` escape. " "Letters, digits, and the characters ``'_.-~'`` are never quoted. By default, " @@ -856,38 +831,38 @@ msgid "" "not be quoted --- its default value is ``'/'``." msgstr "" -#: ../../library/urllib.parse.rst:633 ../../library/urllib.parse.rst:679 -#: ../../library/urllib.parse.rst:708 +#: ../../library/urllib.parse.rst:585 ../../library/urllib.parse.rst:631 +#: ../../library/urllib.parse.rst:660 msgid "*string* may be either a :class:`str` or a :class:`bytes` object." msgstr "" -#: ../../library/urllib.parse.rst:635 +#: ../../library/urllib.parse.rst:587 msgid "" "Moved from :rfc:`2396` to :rfc:`3986` for quoting URL strings. \"~\" is now " "included in the set of unreserved characters." msgstr "" -#: ../../library/urllib.parse.rst:639 +#: ../../library/urllib.parse.rst:591 msgid "" "The optional *encoding* and *errors* parameters specify how to deal with non-" "ASCII characters, as accepted by the :meth:`str.encode` method. *encoding* " "defaults to ``'utf-8'``. *errors* defaults to ``'strict'``, meaning " "unsupported characters raise a :class:`UnicodeEncodeError`. *encoding* and " -"*errors* must not be supplied if *string* is a :class:`bytes`, or " -"a :class:`TypeError` is raised." +"*errors* must not be supplied if *string* is a :class:`bytes`, or a :class:" +"`TypeError` is raised." msgstr "" -#: ../../library/urllib.parse.rst:647 +#: ../../library/urllib.parse.rst:599 msgid "" "Note that ``quote(string, safe, encoding, errors)`` is equivalent to " "``quote_from_bytes(string.encode(encoding, errors), safe)``." msgstr "" -#: ../../library/urllib.parse.rst:650 +#: ../../library/urllib.parse.rst:602 msgid "Example: ``quote('/El Niño/')`` yields ``'/El%20Ni%C3%B1o/'``." msgstr "" -#: ../../library/urllib.parse.rst:655 +#: ../../library/urllib.parse.rst:607 msgid "" "Like :func:`quote`, but also replace spaces with plus signs, as required for " "quoting HTML form values when building up a query string to go into a URL. " @@ -895,74 +870,74 @@ msgid "" "*safe*. It also does not have *safe* default to ``'/'``." msgstr "" -#: ../../library/urllib.parse.rst:660 +#: ../../library/urllib.parse.rst:612 msgid "Example: ``quote_plus('/El Niño/')`` yields ``'%2FEl+Ni%C3%B1o%2F'``." msgstr "" -#: ../../library/urllib.parse.rst:665 +#: ../../library/urllib.parse.rst:617 msgid "" -"Like :func:`quote`, but accepts a :class:`bytes` object rather than " -"a :class:`str`, and does not perform string-to-bytes encoding." +"Like :func:`quote`, but accepts a :class:`bytes` object rather than a :class:" +"`str`, and does not perform string-to-bytes encoding." msgstr "" -#: ../../library/urllib.parse.rst:668 +#: ../../library/urllib.parse.rst:620 msgid "Example: ``quote_from_bytes(b'a&\\xef')`` yields ``'a%26%EF'``." msgstr "" -#: ../../library/urllib.parse.rst:674 +#: ../../library/urllib.parse.rst:626 msgid "" "Replace :samp:`%{xx}` escapes with their single-character equivalent. The " "optional *encoding* and *errors* parameters specify how to decode percent-" -"encoded sequences into Unicode characters, as accepted by " -"the :meth:`bytes.decode` method." +"encoded sequences into Unicode characters, as accepted by the :meth:`bytes." +"decode` method." msgstr "" -#: ../../library/urllib.parse.rst:681 +#: ../../library/urllib.parse.rst:633 msgid "" "*encoding* defaults to ``'utf-8'``. *errors* defaults to ``'replace'``, " "meaning invalid sequences are replaced by a placeholder character." msgstr "" -#: ../../library/urllib.parse.rst:685 +#: ../../library/urllib.parse.rst:637 msgid "Example: ``unquote('/El%20Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "" -#: ../../library/urllib.parse.rst:687 +#: ../../library/urllib.parse.rst:639 msgid "" "*string* parameter supports bytes and str objects (previously only str)." msgstr "" -#: ../../library/urllib.parse.rst:695 +#: ../../library/urllib.parse.rst:647 msgid "" "Like :func:`unquote`, but also replace plus signs with spaces, as required " "for unquoting HTML form values." msgstr "" -#: ../../library/urllib.parse.rst:698 +#: ../../library/urllib.parse.rst:650 msgid "*string* must be a :class:`str`." msgstr "" -#: ../../library/urllib.parse.rst:700 +#: ../../library/urllib.parse.rst:652 msgid "Example: ``unquote_plus('/El+Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "" -#: ../../library/urllib.parse.rst:705 +#: ../../library/urllib.parse.rst:657 msgid "" "Replace :samp:`%{xx}` escapes with their single-octet equivalent, and return " "a :class:`bytes` object." msgstr "" -#: ../../library/urllib.parse.rst:710 +#: ../../library/urllib.parse.rst:662 msgid "" "If it is a :class:`str`, unescaped non-ASCII characters in *string* are " "encoded into UTF-8 bytes." msgstr "" -#: ../../library/urllib.parse.rst:713 +#: ../../library/urllib.parse.rst:665 msgid "Example: ``unquote_to_bytes('a%26%EF')`` yields ``b'a&\\xef'``." msgstr "" -#: ../../library/urllib.parse.rst:719 +#: ../../library/urllib.parse.rst:671 msgid "" "Convert a mapping object or a sequence of two-element tuples, which may " "contain :class:`str` or :class:`bytes` objects, to a percent-encoded ASCII " @@ -971,7 +946,7 @@ msgid "" "be encoded to bytes, otherwise it would result in a :exc:`TypeError`." msgstr "" -#: ../../library/urllib.parse.rst:726 +#: ../../library/urllib.parse.rst:678 msgid "" "The resulting string is a series of ``key=value`` pairs separated by ``'&'`` " "characters, where both *key* and *value* are quoted using the *quote_via* " @@ -984,7 +959,7 @@ msgid "" "``quote`` and specify a value for *safe*." msgstr "" -#: ../../library/urllib.parse.rst:736 +#: ../../library/urllib.parse.rst:688 msgid "" "When a sequence of two-element tuples is used as the *query* argument, the " "first element of each tuple is a key and the second is a value. The value " @@ -995,49 +970,49 @@ msgid "" "order of parameter tuples in the sequence." msgstr "" -#: ../../library/urllib.parse.rst:744 +#: ../../library/urllib.parse.rst:696 msgid "" "The *safe*, *encoding*, and *errors* parameters are passed down to " "*quote_via* (the *encoding* and *errors* parameters are only passed when a " "query element is a :class:`str`)." msgstr "" -#: ../../library/urllib.parse.rst:748 +#: ../../library/urllib.parse.rst:700 msgid "" "To reverse this encoding process, :func:`parse_qs` and :func:`parse_qsl` are " "provided in this module to parse query strings into Python data structures." msgstr "" -#: ../../library/urllib.parse.rst:751 +#: ../../library/urllib.parse.rst:703 msgid "" -"Refer to :ref:`urllib examples ` to find out how " -"the :func:`urllib.parse.urlencode` method can be used for generating the " -"query string of a URL or data for a POST request." +"Refer to :ref:`urllib examples ` to find out how the :func:" +"`urllib.parse.urlencode` method can be used for generating the query string " +"of a URL or data for a POST request." msgstr "" -#: ../../library/urllib.parse.rst:755 +#: ../../library/urllib.parse.rst:707 msgid "*query* supports bytes and string objects." msgstr "" -#: ../../library/urllib.parse.rst:758 +#: ../../library/urllib.parse.rst:710 msgid "Added the *quote_via* parameter." msgstr "新增 *quote_via* 參數。" -#: ../../library/urllib.parse.rst:768 +#: ../../library/urllib.parse.rst:720 msgid "`WHATWG`_ - URL Living standard" msgstr "" -#: ../../library/urllib.parse.rst:769 +#: ../../library/urllib.parse.rst:721 msgid "" "Working Group for the URL Standard that defines URLs, domains, IP addresses, " "the application/x-www-form-urlencoded format, and their API." msgstr "" -#: ../../library/urllib.parse.rst:772 +#: ../../library/urllib.parse.rst:724 msgid ":rfc:`3986` - Uniform Resource Identifiers" msgstr ":rfc:`3986` - 統一資源識別碼" -#: ../../library/urllib.parse.rst:773 +#: ../../library/urllib.parse.rst:725 msgid "" "This is the current standard (STD66). Any changes to urllib.parse module " "should conform to this. Certain deviations could be observed, which are " @@ -1045,49 +1020,49 @@ msgid "" "requirements as commonly observed in major browsers." msgstr "" -#: ../../library/urllib.parse.rst:778 +#: ../../library/urllib.parse.rst:730 msgid ":rfc:`2732` - Format for Literal IPv6 Addresses in URL's." msgstr "" -#: ../../library/urllib.parse.rst:779 +#: ../../library/urllib.parse.rst:731 msgid "This specifies the parsing requirements of IPv6 URLs." msgstr "" -#: ../../library/urllib.parse.rst:781 +#: ../../library/urllib.parse.rst:733 msgid ":rfc:`2396` - Uniform Resource Identifiers (URI): Generic Syntax" msgstr ":rfc:`2396` - 統一資源識別碼 (URI):通用語法" -#: ../../library/urllib.parse.rst:782 +#: ../../library/urllib.parse.rst:734 msgid "" "Document describing the generic syntactic requirements for both Uniform " "Resource Names (URNs) and Uniform Resource Locators (URLs)." msgstr "" -#: ../../library/urllib.parse.rst:785 +#: ../../library/urllib.parse.rst:737 msgid ":rfc:`2368` - The mailto URL scheme." msgstr "" -#: ../../library/urllib.parse.rst:786 +#: ../../library/urllib.parse.rst:738 msgid "Parsing requirements for mailto URL schemes." msgstr "" -#: ../../library/urllib.parse.rst:788 +#: ../../library/urllib.parse.rst:740 msgid ":rfc:`1808` - Relative Uniform Resource Locators" msgstr "" ":rfc:`1808` - 相對的統一資源定位器 (Relative Uniform Resource Locators)" -#: ../../library/urllib.parse.rst:789 +#: ../../library/urllib.parse.rst:741 msgid "" "This Request For Comments includes the rules for joining an absolute and a " "relative URL, including a fair number of \"Abnormal Examples\" which govern " "the treatment of border cases." msgstr "" -#: ../../library/urllib.parse.rst:793 +#: ../../library/urllib.parse.rst:745 msgid ":rfc:`1738` - Uniform Resource Locators (URL)" msgstr ":rfc:`1738` - 統一資源定位器 (URL, Uniform Resource Locators)" -#: ../../library/urllib.parse.rst:794 +#: ../../library/urllib.parse.rst:746 msgid "This specifies the formal syntax and semantics of absolute URLs." msgstr "" @@ -1110,3 +1085,14 @@ msgstr "parsing(剖析)" #: ../../library/urllib.parse.rst:9 msgid "relative" msgstr "relative(相對)" + +#~ msgid ":attr:`params`" +#~ msgstr ":attr:`params`" + +#~ msgid "5" +#~ msgstr "5" + +#~ msgid "" +#~ "(addressing scheme, network location, path, query, fragment identifier)." +#~ msgstr "" +#~ "(addressing scheme, network location, path, query, fragment identifier)." diff --git a/library/urllib.robotparser.po b/library/urllib.robotparser.po index 7fdc274c41..962d370154 100644 --- a/library/urllib.robotparser.po +++ b/library/urllib.robotparser.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-05 00:16+0000\n" +"POT-Creation-Date: 2026-02-05 00:20+0000\n" "PO-Revision-Date: 2022-01-27 13:40+0800\n" "Last-Translator: Phil Lin \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -122,23 +122,23 @@ msgid "" msgstr "下面的範例展示了 :class:`RobotFileParser` 類別的基本用法: ::" #: ../../library/urllib.robotparser.rst:92 +#, fuzzy msgid "" ">>> import urllib.robotparser\n" ">>> rp = urllib.robotparser.RobotFileParser()\n" -">>> rp.set_url(\"http://www.musi-cal.com/robots.txt\")\n" +">>> rp.set_url(\"http://www.pythontest.net/robots.txt\")\n" ">>> rp.read()\n" ">>> rrate = rp.request_rate(\"*\")\n" ">>> rrate.requests\n" -"3\n" +"1\n" ">>> rrate.seconds\n" -"20\n" +"1\n" ">>> rp.crawl_delay(\"*\")\n" "6\n" -">>> rp.can_fetch(\"*\", \"http://www.musi-cal.com/cgi-bin/search?" -"city=San+Francisco\")\n" -"False\n" -">>> rp.can_fetch(\"*\", \"http://www.musi-cal.com/\")\n" -"True" +">>> rp.can_fetch(\"*\", \"http://www.pythontest.net/\")\n" +"True\n" +">>> rp.can_fetch(\"*\", \"http://www.pythontest.net/no-robots-here/\")\n" +"False" msgstr "" ">>> import urllib.robotparser\n" ">>> rp = urllib.robotparser.RobotFileParser()\n" diff --git a/library/venv.po b/library/venv.po index 9b5d3e1f91..9168cb77fc 100644 --- a/library/venv.po +++ b/library/venv.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2026-02-06 00:18+0000\n" "PO-Revision-Date: 2025-05-23 10:20+0800\n" "Last-Translator: Dr-XYZ \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -121,8 +121,8 @@ msgid "" "This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" -"此模組在\\ :ref:`行動平台 `\\ 或 :ref:`WebAssembly 平" -"台 `\\ 上不支援。" +"此模組在\\ :ref:`行動平台 `\\ 或 :ref:`WebAssembly 平台 " +"`\\ 上不支援。" #: ../../library/venv.rst:65 msgid "Creating virtual environments" @@ -154,8 +154,8 @@ msgstr "" "徑的 ``home`` 鍵。它同時會建立一個 :file:`bin` (在 Windows 上為 :file:" "`Scripts`)子目錄,其中包含一個 Python 二進位檔案的副本/符號連結(根據建立環" "境時使用的平台或引數而定)。此外,它還會建立一個 :file:`lib/pythonX.Y/site-" -"packages` 子目錄(在 Windows 上為 :file:`Lib\\\\site-packages`)。如果指定的目" -"錄已存在,則將重新使用該目錄。" +"packages` 子目錄(在 Windows 上為 :file:`Lib\\\\site-packages`)。如果指定的" +"目錄已存在,則將重新使用該目錄。" #: ../../library/venv.rst:84 msgid "" @@ -969,13 +969,14 @@ msgstr "" "環境中安裝 setuptools 與 pip: ::" #: ../../library/venv.rst:543 +#, fuzzy msgid "" "import os\n" "import os.path\n" "from subprocess import Popen, PIPE\n" "import sys\n" "from threading import Thread\n" -"from urllib.parse import urlparse\n" +"from urllib.parse import urlsplit\n" "from urllib.request import urlretrieve\n" "import venv\n" "\n" @@ -1050,7 +1051,7 @@ msgid "" " stream.close()\n" "\n" " def install_script(self, context, name, url):\n" -" _, _, path, _, _, _ = urlparse(url)\n" +" _, _, path, _, _ = urlsplit(url)\n" " fn = os.path.split(path)[-1]\n" " binpath = context.bin_path\n" " distpath = os.path.join(binpath, fn)\n" diff --git a/library/wsgiref.po b/library/wsgiref.po index a8da940263..e10942f56a 100644 --- a/library/wsgiref.po +++ b/library/wsgiref.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-25 00:14+0000\n" +"POT-Creation-Date: 2026-02-06 00:18+0000\n" "PO-Revision-Date: 2023-12-09 21:29+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,7 +26,13 @@ msgstr ":mod:`!wsgiref` --- WSGI 工具與參考實作" msgid "**Source code:** :source:`Lib/wsgiref`" msgstr "**原始碼:**\\ :source:`Lib/wsgiref`" -#: ../../library/wsgiref.rst:14 +#: ../../library/wsgiref.rst:16 +msgid "" +":mod:`wsgiref` is a reference implementation and is not recommended for " +"production. The module only implements basic security checks." +msgstr "" + +#: ../../library/wsgiref.rst:19 msgid "" "The Web Server Gateway Interface (WSGI) is a standard interface between web " "server software and web applications written in Python. Having a standard " @@ -37,7 +43,7 @@ msgstr "" "Python 撰寫的網頁應用程式,擁有一個標準介面使得支援 WSGI 的應用程式可以與多個" "不同的網頁伺服器運行。" -#: ../../library/wsgiref.rst:19 +#: ../../library/wsgiref.rst:24 msgid "" "Only authors of web servers and programming frameworks need to know every " "detail and corner case of the WSGI design. You don't need to understand " @@ -48,7 +54,7 @@ msgstr "" "需要為了安裝 WSGI 應用程式或是使用現有框架撰寫網頁應用程式而必須理解每個細" "節。" -#: ../../library/wsgiref.rst:24 +#: ../../library/wsgiref.rst:29 msgid "" ":mod:`wsgiref` is a reference implementation of the WSGI specification that " "can be used to add WSGI support to a web server or framework. It provides " @@ -63,7 +69,7 @@ msgstr "" "別,提供用於示範 HTTP 伺服器的 WSGI 應用程式、靜態型別檢查、以及驗證 WSGI 伺" "服器與應用程式是否符合 WSGI 規格的驗證工具 (:pep:`3333`)。" -#: ../../library/wsgiref.rst:32 +#: ../../library/wsgiref.rst:37 msgid "" "See `wsgi.readthedocs.io `_ for more " "information about WSGI, and links to tutorials and other resources." @@ -71,26 +77,25 @@ msgstr "" "參閱 `wsgi.readthedocs.io `_ 更多 WSGI 相關資" "訊,以及教學連結與其他資源。" -#: ../../library/wsgiref.rst:39 +#: ../../library/wsgiref.rst:44 msgid ":mod:`wsgiref.util` -- WSGI environment utilities" msgstr ":mod:`wsgiref.util` -- WSGI 環境工具" -#: ../../library/wsgiref.rst:45 +#: ../../library/wsgiref.rst:50 msgid "" "This module provides a variety of utility functions for working with WSGI " "environments. A WSGI environment is a dictionary containing HTTP request " "variables as described in :pep:`3333`. All of the functions taking an " "*environ* parameter expect a WSGI-compliant dictionary to be supplied; " -"please see :pep:`3333` for a detailed specification " -"and :data:`~wsgiref.types.WSGIEnvironment` for a type alias that can be used " -"in type annotations." +"please see :pep:`3333` for a detailed specification and :data:`~wsgiref." +"types.WSGIEnvironment` for a type alias that can be used in type annotations." msgstr "" "這個模組提供許多用於處理 WSGI 環境運作的功能。WSGI 環境是一個包含 HTTP 請求變" "數的字典,如 :pep:`3333` 所述。所有接受 *environ* 的參數的函式都需要提供符合 " -"WSGI 標準的字典;請參閱 :pep:`3333` 取得詳細規格,以" -"及 :data:`~wsgiref.types.WSGIEnvironment` 取得可用於使用型別註釋的型別別名。" +"WSGI 標準的字典;請參閱 :pep:`3333` 取得詳細規格,以及 :data:`~wsgiref.types." +"WSGIEnvironment` 取得可用於使用型別註釋的型別別名。" -#: ../../library/wsgiref.rst:56 +#: ../../library/wsgiref.rst:61 msgid "" "Return a guess for whether ``wsgi.url_scheme`` should be \"http\" or " "\"https\", by checking for a ``HTTPS`` environment variable in the *environ* " @@ -99,7 +104,7 @@ msgstr "" "透過檢查 *environ* 字典中的 ``HTTPS`` 環境變數,回傳 ``wsgi.url_scheme`` 應該" "是 \"http\" 或 \"https\" 的猜測。回傳值為一個字串。" -#: ../../library/wsgiref.rst:60 +#: ../../library/wsgiref.rst:65 msgid "" "This function is useful when creating a gateway that wraps CGI or a CGI-like " "protocol such as FastCGI. Typically, servers providing such protocols will " @@ -108,11 +113,11 @@ msgid "" "a value is found, and \"http\" otherwise." msgstr "" "當建立一個包裝 CGI 或類似 FastCGI 的 CGI-like 協定閘道時,此函式非常有用。例" -"如 FastCGI,通常提供這類協定的伺服器在透過 SSL 接收到請求時會包含 \"1\"," -"\"yes\",或 \"on\" 的 ``HTTPS`` 變數,因此,如果找到這樣的值,此函式回傳 " -"\"https\",否則回傳 \"http\"。" +"如 FastCGI,通常提供這類協定的伺服器在透過 SSL 接收到請求時會包含 " +"\"1\",\"yes\",或 \"on\" 的 ``HTTPS`` 變數,因此,如果找到這樣的值,此函式回" +"傳 \"https\",否則回傳 \"http\"。" -#: ../../library/wsgiref.rst:69 +#: ../../library/wsgiref.rst:74 msgid "" "Return the full request URI, optionally including the query string, using " "the algorithm found in the \"URL Reconstruction\" section of :pep:`3333`. " @@ -123,7 +128,7 @@ msgstr "" "求 URI,可選擇性的包含查詢字串,如果 *include_query* 設為 false,查詢字串不會" "被包含在結果的 URI 中。" -#: ../../library/wsgiref.rst:76 +#: ../../library/wsgiref.rst:81 msgid "" "Similar to :func:`request_uri`, except that the ``PATH_INFO`` and " "``QUERY_STRING`` variables are ignored. The result is the base URI of the " @@ -132,7 +137,7 @@ msgstr "" "類似於 :func:`request_uri`,但忽略 ``PATH_INFO`` 和 ``QUERY_STRING`` 變數。結" "果是請求地址的應用程式物件的的基本 URI。" -#: ../../library/wsgiref.rst:83 +#: ../../library/wsgiref.rst:88 msgid "" "Shift a single name from ``PATH_INFO`` to ``SCRIPT_NAME`` and return the " "name. The *environ* dictionary is *modified* in-place; use a copy if you " @@ -142,24 +147,24 @@ msgstr "" "會在適當時機被 *modified*;如果你需要保留原始完好無損的 ``PATH_INFO`` 或 " "``SCRIPT_NAME`` 請使用副本。" -#: ../../library/wsgiref.rst:87 +#: ../../library/wsgiref.rst:92 msgid "" "If there are no remaining path segments in ``PATH_INFO``, ``None`` is " "returned." msgstr "如果在 ``PATH_INFO`` 中沒有剩餘的路徑片段,則回傳 ``None``。" -#: ../../library/wsgiref.rst:89 +#: ../../library/wsgiref.rst:94 msgid "" "Typically, this routine is used to process each portion of a request URI " "path, for example to treat the path as a series of dictionary keys. This " "routine modifies the passed-in environment to make it suitable for invoking " "another WSGI application that is located at the target URI. For example, if " "there is a WSGI application at ``/foo``, and the request URI path is ``/foo/" -"bar/baz``, and the WSGI application at ``/foo`` " -"calls :func:`shift_path_info`, it will receive the string \"bar\", and the " -"environment will be updated to be suitable for passing to a WSGI application " -"at ``/foo/bar``. That is, ``SCRIPT_NAME`` will change from ``/foo`` to ``/" -"foo/bar``, and ``PATH_INFO`` will change from ``/bar/baz`` to ``/baz``." +"bar/baz``, and the WSGI application at ``/foo`` calls :func:" +"`shift_path_info`, it will receive the string \"bar\", and the environment " +"will be updated to be suitable for passing to a WSGI application at ``/foo/" +"bar``. That is, ``SCRIPT_NAME`` will change from ``/foo`` to ``/foo/bar``, " +"and ``PATH_INFO`` will change from ``/bar/baz`` to ``/baz``." msgstr "" "通常,此程式用於處理請求 URI 的每一部分路徑,例如將路徑視為一系列的字典鍵此程" "式會修改傳入的環境,使其適用於呼叫位於目標 URI 的 WSGI 應用程式。例如,如果" @@ -169,7 +174,7 @@ msgstr "" "話說,``SCRIPT_NAME`` 將從 ``/foo`` 變更為 ``/foo/bar``,而 ``PATH_INFO`` 將" "從 ``/bar/baz`` 變更為 ``/baz``。" -#: ../../library/wsgiref.rst:100 +#: ../../library/wsgiref.rst:105 msgid "" "When ``PATH_INFO`` is just a \"/\", this routine returns an empty string and " "appends a trailing slash to ``SCRIPT_NAME``, even though empty path segments " @@ -183,24 +188,24 @@ msgstr "" "``SCRIPT_NAME`` 通常不會以斜號結尾。這是刻意行為,以確保應用程式在使用這個程" "式進行物件遍歷時可以區分結尾為 ``/x`` 和結尾為 ``/x/`` 的 URIs。" -#: ../../library/wsgiref.rst:110 +#: ../../library/wsgiref.rst:115 msgid "Update *environ* with trivial defaults for testing purposes." msgstr "為測試目的,以簡單的預設值更新 *environ* 。" -#: ../../library/wsgiref.rst:112 +#: ../../library/wsgiref.rst:117 msgid "" "This routine adds various parameters required for WSGI, including " "``HTTP_HOST``, ``SERVER_NAME``, ``SERVER_PORT``, ``REQUEST_METHOD``, " -"``SCRIPT_NAME``, ``PATH_INFO``, and all of the :pep:`3333`\\ -defined " -"``wsgi.*`` variables. It only supplies default values, and does not replace " -"any existing settings for these variables." +"``SCRIPT_NAME``, ``PATH_INFO``, and all of the :pep:`3333`\\ -defined ``wsgi." +"*`` variables. It only supplies default values, and does not replace any " +"existing settings for these variables." msgstr "" "這個程式新增 WSGI 所需的各種參數,包括 ``HTTP_HOST``、``SERVER_NAME``、" "``SERVER_PORT``、``REQUEST_METHOD``、``SCRIPT_NAME``、``PATH_INFO``,以及所" "有 :pep:`3333` 定義的 ``wsgi.*`` 變數,它只提供預設值,並且不會取代現有的這些" "變數設定。" -#: ../../library/wsgiref.rst:118 +#: ../../library/wsgiref.rst:123 msgid "" "This routine is intended to make it easier for unit tests of WSGI servers " "and applications to set up dummy environments. It should NOT be used by " @@ -209,13 +214,13 @@ msgstr "" "這個程式目的為了讓 WSGI 伺服器和應用程式的單元測試更容易建置虛擬環境。實際的 " "WSGI 伺服器或應用程式不應該使用它,因為所產生的數據是假的!" -#: ../../library/wsgiref.rst:122 +#: ../../library/wsgiref.rst:127 msgid "" "Example usage (see also :func:`~wsgiref.simple_server.demo_app` for another " "example)::" msgstr "" -#: ../../library/wsgiref.rst:125 +#: ../../library/wsgiref.rst:130 msgid "" "from wsgiref.util import setup_testing_defaults\n" "from wsgiref.simple_server import make_server\n" @@ -239,13 +244,13 @@ msgid "" " httpd.serve_forever()" msgstr "" -#: ../../library/wsgiref.rst:147 +#: ../../library/wsgiref.rst:152 msgid "" "In addition to the environment functions above, the :mod:`wsgiref.util` " "module also provides these miscellaneous utilities:" msgstr "除了上述的環境功能外,:mod:`wsgiref.util` 模組還提供以下各類工具:" -#: ../../library/wsgiref.rst:153 +#: ../../library/wsgiref.rst:158 msgid "" "Return ``True`` if 'header_name' is an HTTP/1.1 \"Hop-by-Hop\" header, as " "defined by :rfc:`2616`." @@ -253,37 +258,36 @@ msgstr "" "如果 'header_name' 是根據 :rfc:`2616` 所定義的 HTTP/1.1 \"Hop-by-Hop\" 標頭," "則回傳 ``True``。" -#: ../../library/wsgiref.rst:159 +#: ../../library/wsgiref.rst:164 msgid "" "A concrete implementation of the :class:`wsgiref.types.FileWrapper` protocol " "used to convert a file-like object to an :term:`iterator`. The resulting " "objects are :term:`iterable`\\ s. As the object is iterated over, the " "optional *blksize* parameter will be repeatedly passed to the *filelike* " -"object's :meth:`read` method to obtain bytestrings to yield. " -"When :meth:`read` returns an empty bytestring, iteration is ended and is not " -"resumable." +"object's :meth:`read` method to obtain bytestrings to yield. When :meth:" +"`read` returns an empty bytestring, iteration is ended and is not resumable." msgstr "" -":class:`wsgiref.types.FileWrapper` 協定的具體實作,用於將類檔案物件轉換" -"為 :term:`iterator`。產生的物件是 :term:`iterable`。當物件進行疊代時,將可選" -"的 *blksize* 引數重複傳遞給 *filelike* 物件的 :meth:`read` 方法來獲得將產生" +":class:`wsgiref.types.FileWrapper` 協定的具體實作,用於將類檔案物件轉換為 :" +"term:`iterator`。產生的物件是 :term:`iterable`。當物件進行疊代時,將可選的 " +"*blksize* 引數重複傳遞給 *filelike* 物件的 :meth:`read` 方法來獲得將產生" "(yield)的位元組字串。當 :meth:`read` 回傳一個空位元組字串,代表疊代已結束且" "無法回復。" -#: ../../library/wsgiref.rst:167 +#: ../../library/wsgiref.rst:172 msgid "" "If *filelike* has a :meth:`close` method, the returned object will also have " -"a :meth:`close` method, and it will invoke the *filelike* " -"object's :meth:`close` method when called." +"a :meth:`close` method, and it will invoke the *filelike* object's :meth:" +"`close` method when called." msgstr "" "如果 *filelike* 有 :meth:`close` 方法,則回傳的物件也會具有 :meth:`close` 方" "法,並在呼叫時叫用 *filelike* 物件的 :meth:`close` 方法。" -#: ../../library/wsgiref.rst:171 ../../library/wsgiref.rst:294 -#: ../../library/wsgiref.rst:429 +#: ../../library/wsgiref.rst:176 ../../library/wsgiref.rst:299 +#: ../../library/wsgiref.rst:434 msgid "Example usage::" msgstr "用法範例: ::" -#: ../../library/wsgiref.rst:173 +#: ../../library/wsgiref.rst:178 msgid "" "from io import StringIO\n" "from wsgiref.util import FileWrapper\n" @@ -296,15 +300,15 @@ msgid "" " print(chunk)" msgstr "" -#: ../../library/wsgiref.rst:183 +#: ../../library/wsgiref.rst:188 msgid "Support for :meth:`~object.__getitem__` method has been removed." msgstr "已移除對 :meth:`~object.__getitem__` 方法的支援。" -#: ../../library/wsgiref.rst:188 +#: ../../library/wsgiref.rst:193 msgid ":mod:`wsgiref.headers` -- WSGI response header tools" msgstr ":mod:`wsgiref.headers` -- WSGI 回應標頭工具" -#: ../../library/wsgiref.rst:194 +#: ../../library/wsgiref.rst:199 msgid "" "This module provides a single class, :class:`Headers`, for convenient " "manipulation of WSGI response headers using a mapping-like interface." @@ -312,7 +316,7 @@ msgstr "" "這個模組提供單一類別 :class:`Headers`,用於使用類似對映的介面方便地操作 WSGI " "回應標頭。" -#: ../../library/wsgiref.rst:200 +#: ../../library/wsgiref.rst:205 msgid "" "Create a mapping-like object wrapping *headers*, which must be a list of " "header name/value tuples as described in :pep:`3333`. The default value of " @@ -321,25 +325,26 @@ msgstr "" "建立一個類似對映物件並包裝 *headers*,並且必須是符合 :pep:`3333` 描述的 name/" "value 元組的標頭串列。*headers* 的預設值是一個空串列。" -#: ../../library/wsgiref.rst:204 -msgid "" -":class:`Headers` objects support typical mapping operations " -"including :meth:`~object.__getitem__`, :meth:`~dict.get`, :meth:`~object.__setitem__`, :meth:`~dict.setdefault`, :meth:`~object.__delitem__` " -"and :meth:`~object.__contains__`. For each of these methods, the key is the " -"header name (treated case-insensitively), and the value is the first value " -"associated with that header name. Setting a header deletes any existing " -"values for that header, then adds a new value at the end of the wrapped " -"header list. Headers' existing order is generally maintained, with new " -"headers added to the end of the wrapped list." -msgstr "" -":class:`Headers` 物件支援典型對映操作包" -"括 :meth:`~object.__getitem__`、:meth:`~dict.get`、:meth:`~object.__setitem__`、:meth:`~dict.setdefault`、:meth:`~object.__delitem__` " -"以及 :meth:`~object.__contains__`。對於這些方法中的每一個,鍵是標頭名稱(以不" -"區分大小寫方式處理),而值則是與該標頭名稱關聯的第一個值。設定標頭會刪除該標" -"頭的所有現有值,然後將新值添加到包裝的標頭串列末尾。標頭的現有順序通常保持不" -"變,新標頭會添加到包裝串列的末尾。" +#: ../../library/wsgiref.rst:209 +msgid "" +":class:`Headers` objects support typical mapping operations including :meth:" +"`~object.__getitem__`, :meth:`~dict.get`, :meth:`~object.__setitem__`, :meth:" +"`~dict.setdefault`, :meth:`~object.__delitem__` and :meth:`~object." +"__contains__`. For each of these methods, the key is the header name " +"(treated case-insensitively), and the value is the first value associated " +"with that header name. Setting a header deletes any existing values for " +"that header, then adds a new value at the end of the wrapped header list. " +"Headers' existing order is generally maintained, with new headers added to " +"the end of the wrapped list." +msgstr "" +":class:`Headers` 物件支援典型對映操作包括 :meth:`~object.__getitem__`、:meth:" +"`~dict.get`、:meth:`~object.__setitem__`、:meth:`~dict.setdefault`、:meth:" +"`~object.__delitem__` 以及 :meth:`~object.__contains__`。對於這些方法中的每一" +"個,鍵是標頭名稱(以不區分大小寫方式處理),而值則是與該標頭名稱關聯的第一個" +"值。設定標頭會刪除該標頭的所有現有值,然後將新值添加到包裝的標頭串列末尾。標" +"頭的現有順序通常保持不變,新標頭會添加到包裝串列的末尾。" -#: ../../library/wsgiref.rst:214 +#: ../../library/wsgiref.rst:219 msgid "" "Unlike a dictionary, :class:`Headers` objects do not raise an error when you " "try to get or delete a key that isn't in the wrapped header list. Getting a " @@ -350,22 +355,22 @@ msgstr "" "不會引發例外錯誤。取得不存在的標頭只會回傳 ``None``,而刪除不存在的標頭則不會" "有任何效果。" -#: ../../library/wsgiref.rst:219 +#: ../../library/wsgiref.rst:224 msgid "" -":class:`Headers` objects also support :meth:`keys`, :meth:`values`, " -"and :meth:`items` methods. The lists returned by :meth:`keys` " -"and :meth:`items` can include the same key more than once if there is a " -"multi-valued header. The ``len()`` of a :class:`Headers` object is the same " -"as the length of its :meth:`items`, which is the same as the length of the " -"wrapped header list. In fact, the :meth:`items` method just returns a copy " -"of the wrapped header list." +":class:`Headers` objects also support :meth:`keys`, :meth:`values`, and :" +"meth:`items` methods. The lists returned by :meth:`keys` and :meth:`items` " +"can include the same key more than once if there is a multi-valued header. " +"The ``len()`` of a :class:`Headers` object is the same as the length of its :" +"meth:`items`, which is the same as the length of the wrapped header list. " +"In fact, the :meth:`items` method just returns a copy of the wrapped header " +"list." msgstr "" ":class:`Headers` 物件還支援 :meth:`keys`、:meth:`values`、和 :meth:`items` 方" "法。由 :meth:`keys` 和 :meth:`items` 回傳的串列在存在多值標頭時可能會包含相同" "的鍵。:class:`Headers` 物件的 ``len()`` 與 :meth:`items` 的長度相同,也與包裝" "標頭串列的長度相同。實際上,:meth:`items` 方法只是回傳包裝的標頭串列的副本。" -#: ../../library/wsgiref.rst:226 +#: ../../library/wsgiref.rst:231 msgid "" "Calling ``bytes()`` on a :class:`Headers` object returns a formatted " "bytestring suitable for transmission as HTTP response headers. Each header " @@ -377,21 +382,20 @@ msgstr "" "式化的位元組字串。每個標頭都與其值一起置於一行上,由冒號與空格分隔。每行以回" "車(carriage return)和換行(line feed)結束,而該位元組字串則以空行結束。" -#: ../../library/wsgiref.rst:232 +#: ../../library/wsgiref.rst:237 msgid "" -"In addition to their mapping interface and formatting " -"features, :class:`Headers` objects also have the following methods for " -"querying and adding multi-valued headers, and for adding headers with MIME " -"parameters:" +"In addition to their mapping interface and formatting features, :class:" +"`Headers` objects also have the following methods for querying and adding " +"multi-valued headers, and for adding headers with MIME parameters:" msgstr "" "除了對映介面和格式化功能外,:class:`Headers` 物件還具有以下查詢及附加多值標頭" "的以及附加 MIME 參數標頭的方法:" -#: ../../library/wsgiref.rst:239 +#: ../../library/wsgiref.rst:244 msgid "Return a list of all the values for the named header." msgstr "回傳指定標頭的所有值的串列。" -#: ../../library/wsgiref.rst:241 +#: ../../library/wsgiref.rst:246 msgid "" "The returned list will be sorted in the order they appeared in the original " "header list or were added to this instance, and may contain duplicates. Any " @@ -402,14 +406,14 @@ msgstr "" "序,並且可能包含重複的內容。任何被刪除並重新插入的欄位都會被添加到標頭串列的" "末尾。如果不存在指定名稱的欄位,則回傳空串列。" -#: ../../library/wsgiref.rst:249 +#: ../../library/wsgiref.rst:254 msgid "" "Add a (possibly multi-valued) header, with optional MIME parameters " "specified via keyword arguments." msgstr "" "添加一個(可能是多值的)標頭,可透過關鍵字引數來指定選擇性的 MIME 參數。" -#: ../../library/wsgiref.rst:252 +#: ../../library/wsgiref.rst:257 msgid "" "*name* is the header field to add. Keyword arguments can be used to set " "MIME parameters for the header field. Each parameter must be a string or " @@ -426,55 +430,55 @@ msgstr "" "則以 ``name=\"value\"`` 的形式添加到標頭值參數中。如果它是 ``None``,則僅添加" "參數名稱。(這使用於沒有值的 MIME 參數)使用範例: ::" -#: ../../library/wsgiref.rst:260 +#: ../../library/wsgiref.rst:265 msgid "h.add_header('content-disposition', 'attachment', filename='bud.gif')" msgstr "h.add_header('content-disposition', 'attachment', filename='bud.gif')" -#: ../../library/wsgiref.rst:262 +#: ../../library/wsgiref.rst:267 msgid "The above will add a header that looks like this::" msgstr "上述操作將添加看起來像這樣的標頭: ::" -#: ../../library/wsgiref.rst:264 +#: ../../library/wsgiref.rst:269 msgid "Content-Disposition: attachment; filename=\"bud.gif\"" msgstr "Content-Disposition: attachment; filename=\"bud.gif\"" -#: ../../library/wsgiref.rst:267 +#: ../../library/wsgiref.rst:272 msgid "*headers* parameter is optional." msgstr "*headers* 參數是可選的。" -#: ../../library/wsgiref.rst:272 +#: ../../library/wsgiref.rst:277 msgid ":mod:`wsgiref.simple_server` -- a simple WSGI HTTP server" msgstr ":mod:`wsgiref.simple_server` -- 一個簡單的 WSGI HTTP 伺服器" -#: ../../library/wsgiref.rst:278 +#: ../../library/wsgiref.rst:283 msgid "" "This module implements a simple HTTP server (based on :mod:`http.server`) " "that serves WSGI applications. Each server instance serves a single WSGI " "application on a given host and port. If you want to serve multiple " "applications on a single host and port, you should create a WSGI application " "that parses ``PATH_INFO`` to select which application to invoke for each " -"request. (E.g., using the :func:`shift_path_info` function " -"from :mod:`wsgiref.util`.)" +"request. (E.g., using the :func:`shift_path_info` function from :mod:" +"`wsgiref.util`.)" msgstr "" "這個模組實作一個簡單的的 HTTP 伺服器(基於 :mod:`http.server`)用於提供 WSGI " "應用程式。每個伺服器執行個體在特定的主機與埠提供單一的 WSGI 應用程式。如果你" "想要在單一主機與埠上提供多個應用程式,你應該建立一個 WSGI 應用程式以剖析 " -"``PATH_INFO`` 去選擇為每個請求叫用哪個應用程式。(例如,使用來" -"自 :mod:`wsgiref.util` 的 :func:`shift_path_info` 函式。)" +"``PATH_INFO`` 去選擇為每個請求叫用哪個應用程式。(例如,使用來自 :mod:" +"`wsgiref.util` 的 :func:`shift_path_info` 函式。)" -#: ../../library/wsgiref.rst:289 +#: ../../library/wsgiref.rst:294 msgid "" "Create a new WSGI server listening on *host* and *port*, accepting " "connections for *app*. The return value is an instance of the supplied " "*server_class*, and will process requests using the specified " -"*handler_class*. *app* must be a WSGI application object, as defined " -"by :pep:`3333`." +"*handler_class*. *app* must be a WSGI application object, as defined by :" +"pep:`3333`." msgstr "" "建立一個新的 WSGI 伺服器監聽 *host* 和 *port*,接受 *app* 的連線。回傳值是提" "供 *server_class* 的實例,並將使用指定的 *handler_class* 處理請求。*app* 必須" "是一個 WSGI 應用程式物件,如 :pep:`3333` 所定義。" -#: ../../library/wsgiref.rst:296 +#: ../../library/wsgiref.rst:301 msgid "" "from wsgiref.simple_server import make_server, demo_app\n" "\n" @@ -488,7 +492,7 @@ msgid "" " httpd.handle_request()" msgstr "" -#: ../../library/wsgiref.rst:310 +#: ../../library/wsgiref.rst:315 msgid "" "This function is a small but complete WSGI application that returns a text " "page containing the message \"Hello world!\" and a list of the key/value " @@ -501,85 +505,83 @@ msgstr "" "(例如 :mod:`wsgiref.simple_server`)是否能正確執行簡單的 WSGI 應用程式非常有" "用。" -#: ../../library/wsgiref.rst:316 +#: ../../library/wsgiref.rst:321 msgid "" "The *start_response* callable should follow the :class:`.StartResponse` " "protocol." msgstr "" -#: ../../library/wsgiref.rst:321 +#: ../../library/wsgiref.rst:326 msgid "" -"Create a :class:`WSGIServer` instance. *server_address* should be a " -"``(host,port)`` tuple, and *RequestHandlerClass* should be the subclass " -"of :class:`http.server.BaseHTTPRequestHandler` that will be used to process " -"requests." +"Create a :class:`WSGIServer` instance. *server_address* should be a ``(host," +"port)`` tuple, and *RequestHandlerClass* should be the subclass of :class:" +"`http.server.BaseHTTPRequestHandler` that will be used to process requests." msgstr "" "建立一個 :class:`WSGIServer` 實例。*server_address* 應該是一個 ``(host, " -"port)`` 元組,而 *RequestHandlerClass* 應該" -"是 :class:`http.server.BaseHTTPRequestHandler` 的子類別,將用於處理請求。" +"port)`` 元組,而 *RequestHandlerClass* 應該是 :class:`http.server." +"BaseHTTPRequestHandler` 的子類別,將用於處理請求。" -#: ../../library/wsgiref.rst:326 +#: ../../library/wsgiref.rst:331 msgid "" -"You do not normally need to call this constructor, as " -"the :func:`make_server` function can handle all the details for you." +"You do not normally need to call this constructor, as the :func:" +"`make_server` function can handle all the details for you." msgstr "" "通常你不需要呼叫這個建構函式(constructor),因為 :func:`make_server` 函式可" "以為你處理所有細節。" -#: ../../library/wsgiref.rst:329 +#: ../../library/wsgiref.rst:334 msgid "" ":class:`WSGIServer` is a subclass of :class:`http.server.HTTPServer`, so all " "of its methods (such as :meth:`serve_forever` and :meth:`handle_request`) " "are available. :class:`WSGIServer` also provides these WSGI-specific methods:" msgstr "" ":class:`WSGIServer` 是 :class:`http.server.HTTPServer` 的子類別,因此它的所有" -"方法(例如 :meth:`serve_forever` 和 :meth:`handle_request`)都可" -"用。:class:`WSGIServer` 也提供這些特定於 WSGI 的方法:" +"方法(例如 :meth:`serve_forever` 和 :meth:`handle_request`)都可用。:class:" +"`WSGIServer` 也提供這些特定於 WSGI 的方法:" -#: ../../library/wsgiref.rst:336 +#: ../../library/wsgiref.rst:341 msgid "" "Sets the callable *application* as the WSGI application that will receive " "requests." msgstr "將可呼叫的 *application* 設定為接收請求的 WSGI 應用程式。" -#: ../../library/wsgiref.rst:342 +#: ../../library/wsgiref.rst:347 msgid "Returns the currently set application callable." msgstr "回傳目前設定應用程式的可呼叫物件。" -#: ../../library/wsgiref.rst:344 +#: ../../library/wsgiref.rst:349 msgid "" -"Normally, however, you do not need to use these additional methods, " -"as :meth:`set_app` is normally called by :func:`make_server`, and " -"the :meth:`get_app` exists mainly for the benefit of request handler " -"instances." +"Normally, however, you do not need to use these additional methods, as :meth:" +"`set_app` is normally called by :func:`make_server`, and the :meth:`get_app` " +"exists mainly for the benefit of request handler instances." msgstr "" -"然而,通常情況下你不需要去使用這些額外方法,因為 :meth:`set_app` 通常會" -"被 :func:`make_server` 呼叫而 :meth:`get_app` 主要存在於請求處理程式" -"(handler)實例的好處上。" +"然而,通常情況下你不需要去使用這些額外方法,因為 :meth:`set_app` 通常會被 :" +"func:`make_server` 呼叫而 :meth:`get_app` 主要存在於請求處理程式(handler)實" +"例的好處上。" -#: ../../library/wsgiref.rst:351 +#: ../../library/wsgiref.rst:356 msgid "" "Create an HTTP handler for the given *request* (i.e. a socket), " -"*client_address* (a ``(host,port)`` tuple), and *server* " -"(:class:`WSGIServer` instance)." +"*client_address* (a ``(host,port)`` tuple), and *server* (:class:" +"`WSGIServer` instance)." msgstr "" -"為給定的 *request*\\ (即一個 socket)、*client_address*\\ (一個 ``(host,port)`` " -"位元組)、*server* (:class:`WSGIServer` 實例) 建立一個 HTTP 處理程式" +"為給定的 *request*\\ (即一個 socket)、*client_address*\\ (一個 ``(host," +"port)`` 位元組)、*server* (:class:`WSGIServer` 實例) 建立一個 HTTP 處理程式" "(handler)。" -#: ../../library/wsgiref.rst:354 +#: ../../library/wsgiref.rst:359 msgid "" "You do not need to create instances of this class directly; they are " "automatically created as needed by :class:`WSGIServer` objects. You can, " -"however, subclass this class and supply it as a *handler_class* to " -"the :func:`make_server` function. Some possibly relevant methods for " -"overriding in subclasses:" +"however, subclass this class and supply it as a *handler_class* to the :func:" +"`make_server` function. Some possibly relevant methods for overriding in " +"subclasses:" msgstr "" "你不需要直接建立這個類別的實例;它們會在需要時由 :class:`WSGIServer` 物件自動" -"建立。不過,你可以建立這個類別的子類別並將其作為 *handler_class* 提供" -"給 :func:`make_server` 函式。一些可能相關的方法可以在子類別中進行覆寫:" +"建立。不過,你可以建立這個類別的子類別並將其作為 *handler_class* 提供給 :" +"func:`make_server` 函式。一些可能相關的方法可以在子類別中進行覆寫:" -#: ../../library/wsgiref.rst:363 +#: ../../library/wsgiref.rst:368 msgid "" "Return a :data:`~wsgiref.types.WSGIEnvironment` dictionary for a request. " "The default implementation copies the contents of the :class:`WSGIServer` " @@ -590,17 +592,17 @@ msgid "" msgstr "" "唯一個請求回傳一個 :data:`~wsgiref.types.WSGIEnvironment` 字典。預設的實作會" "複製 :class:`WSGIServer` 物件的 :attr:`base_environ` 字典屬性的內容以及添加" -"從 HTTP 請求中衍生的各種標頭。每次呼叫這個方法都應該回傳一個包含所有" -"如 :pep:`3333` 所指定的相關 CGI 環境變數的新字典。" +"從 HTTP 請求中衍生的各種標頭。每次呼叫這個方法都應該回傳一個包含所有如 :pep:" +"`3333` 所指定的相關 CGI 環境變數的新字典。" -#: ../../library/wsgiref.rst:374 +#: ../../library/wsgiref.rst:379 msgid "" "Return the object that should be used as the ``wsgi.errors`` stream. The " "default implementation just returns ``sys.stderr``." msgstr "" "回傳的物件應該被用作 ``wsgi.errors`` 串流。預設實作只會回傳 ``sys.stderr``。" -#: ../../library/wsgiref.rst:380 +#: ../../library/wsgiref.rst:385 msgid "" "Process the HTTP request. The default implementation creates a handler " "instance using a :mod:`wsgiref.handlers` class to implement the actual WSGI " @@ -609,17 +611,17 @@ msgstr "" "處理 HTTP 請求。預設實作會使用 :mod:`wsgiref.handlers` 類別來建立處置程式" "(handler)實例來實作實際 WSGI 應用程式介面。" -#: ../../library/wsgiref.rst:386 +#: ../../library/wsgiref.rst:391 msgid ":mod:`wsgiref.validate` --- WSGI conformance checker" msgstr ":mod:`wsgiref.validate` --- WSGI 符合性檢查" -#: ../../library/wsgiref.rst:392 +#: ../../library/wsgiref.rst:397 msgid "" "When creating new WSGI application objects, frameworks, servers, or " -"middleware, it can be useful to validate the new code's conformance " -"using :mod:`wsgiref.validate`. This module provides a function that creates " -"WSGI application objects that validate communications between a WSGI server " -"or gateway and a WSGI application object, to check both sides for protocol " +"middleware, it can be useful to validate the new code's conformance using :" +"mod:`wsgiref.validate`. This module provides a function that creates WSGI " +"application objects that validate communications between a WSGI server or " +"gateway and a WSGI application object, to check both sides for protocol " "conformance." msgstr "" "當建立新的 WSGI 應用程式物件、框架、伺服器、或是中介軟體(middleware)時,使" @@ -627,7 +629,7 @@ msgstr "" "個函式用於建立 WSGI 應用程式物件,並用於驗證 WSGI 伺服器或是閘道與 WSGI 應用" "程式物件之間的通訊,以檢查雙方協定的符合性。" -#: ../../library/wsgiref.rst:399 +#: ../../library/wsgiref.rst:404 msgid "" "Note that this utility does not guarantee complete :pep:`3333` compliance; " "an absence of errors from this module does not necessarily mean that errors " @@ -639,7 +641,7 @@ msgstr "" "錯誤。但是,如果如果這個模組產生錯誤,那麼幾乎可以確定伺服器或應用程式不是 " "100% 符合標準。" -#: ../../library/wsgiref.rst:404 +#: ../../library/wsgiref.rst:409 msgid "" "This module is based on the :mod:`paste.lint` module from Ian Bicking's " "\"Python Paste\" library." @@ -647,7 +649,7 @@ msgstr "" "這個模組基於 Ian Bicking 的 \"Python Paste\" 函式庫的 :mod:`paste.lint` 模" "組。" -#: ../../library/wsgiref.rst:410 +#: ../../library/wsgiref.rst:415 msgid "" "Wrap *application* and return a new WSGI application object. The returned " "application will forward all requests to the original *application*, and " @@ -658,7 +660,7 @@ msgstr "" "請求給原始的 *application*,並檢查 *application* 和呼叫它的伺服器是否符合 " "WSGI 規範和 :rfc:`2616`。" -#: ../../library/wsgiref.rst:415 +#: ../../library/wsgiref.rst:420 msgid "" "Any detected nonconformance results in an :exc:`AssertionError` being " "raised; note, however, that how these errors are handled is server-" @@ -669,12 +671,12 @@ msgid "" "stream." msgstr "" "任何在 :exc:`AssertionError` 中偵測不符合結果都會發起例外;但請注意,如何處理" -"這些錯誤取決於伺服器。例如,基於 :mod:`wsgiref.handlers` " -"的 :mod:`wsgiref.simple_server` 以及其他伺服器(未覆蓋錯誤處理方法以執行其他" -"操作的伺服器)將僅輸出一條錯誤訊息,指示發生錯誤,並將回溯訊息輸出到 " -"``sys.stderr`` 或是其他錯誤串流。" +"這些錯誤取決於伺服器。例如,基於 :mod:`wsgiref.handlers` 的 :mod:`wsgiref." +"simple_server` 以及其他伺服器(未覆蓋錯誤處理方法以執行其他操作的伺服器)將僅" +"輸出一條錯誤訊息,指示發生錯誤,並將回溯訊息輸出到 ``sys.stderr`` 或是其他錯" +"誤串流。" -#: ../../library/wsgiref.rst:422 +#: ../../library/wsgiref.rst:427 msgid "" "This wrapper may also generate output using the :mod:`warnings` module to " "indicate behaviors that are questionable but which may not actually be " @@ -684,11 +686,11 @@ msgid "" "object)." msgstr "" "這個包裝器也可以使用 :mod:`warnings` 模組生成輸出去指示一些可能有疑慮但實際上" -"可能不會被 :pep:`3333` 禁止的行為。除非使用 Python 命令列選項" -"或 :mod:`warnings` API,抑制了這些警告,否則這類警告將被寫入到 " -"``sys.stderr``\\ (*not* ``wsgi.errors``,除非它們碰巧是相同的物件)。" +"可能不會被 :pep:`3333` 禁止的行為。除非使用 Python 命令列選項或 :mod:" +"`warnings` API,抑制了這些警告,否則這類警告將被寫入到 ``sys.stderr``\\ " +"(*not* ``wsgi.errors``,除非它們碰巧是相同的物件)。" -#: ../../library/wsgiref.rst:431 +#: ../../library/wsgiref.rst:436 msgid "" "from wsgiref.validate import validator\n" "from wsgiref.simple_server import make_server\n" @@ -712,11 +714,11 @@ msgid "" " httpd.serve_forever()" msgstr "" -#: ../../library/wsgiref.rst:454 +#: ../../library/wsgiref.rst:459 msgid ":mod:`wsgiref.handlers` -- server/gateway base classes" msgstr ":mod:`wsgiref.handlers` -- 伺服器 / 閘道基本類別" -#: ../../library/wsgiref.rst:460 +#: ../../library/wsgiref.rst:465 msgid "" "This module provides base handler classes for implementing WSGI servers and " "gateways. These base classes handle most of the work of communicating with " @@ -727,7 +729,7 @@ msgstr "" "處理程式大部分與 WSGI 應用程式通訊的工作,只要它們被提供 CGI-like 環境,以及" "輸入、輸出和錯誤串流。" -#: ../../library/wsgiref.rst:468 +#: ../../library/wsgiref.rst:473 msgid "" "CGI-based invocation via ``sys.stdin``, ``sys.stdout``, ``sys.stderr`` and " "``os.environ``. This is useful when you have a WSGI application and want to " @@ -739,18 +741,18 @@ msgstr "" "很有用的。只需叫用 ``CGIHandler().run(app)``,其中 ``app`` 是你希望叫用的 " "WSGI 應用程式物件。" -#: ../../library/wsgiref.rst:473 +#: ../../library/wsgiref.rst:478 msgid "" -"This class is a subclass of :class:`BaseCGIHandler` that sets " -"``wsgi.run_once`` to true, ``wsgi.multithread`` to false, and " -"``wsgi.multiprocess`` to true, and always uses :mod:`sys` and :mod:`os` to " -"obtain the necessary CGI streams and environment." +"This class is a subclass of :class:`BaseCGIHandler` that sets ``wsgi." +"run_once`` to true, ``wsgi.multithread`` to false, and ``wsgi.multiprocess`` " +"to true, and always uses :mod:`sys` and :mod:`os` to obtain the necessary " +"CGI streams and environment." msgstr "" "這個類別是 :class:`BaseCGIHandler` 的子類別將 ``wsgi.run_once`` 設置為 true," "``wsgi.multithread`` 設置為 false,並將 ``wsgi.multiprocess`` 設置為 true,並" "且始終使用 :mod:`sys` 和 :mod:`os` 來取得所需的 CGI 串流以及環境。" -#: ../../library/wsgiref.rst:481 +#: ../../library/wsgiref.rst:486 msgid "" "A specialized alternative to :class:`CGIHandler`, for use when deploying on " "Microsoft's IIS web server, without having set the config allowPathInfo " @@ -760,7 +762,7 @@ msgstr "" "個專門替代選擇,無需設置 config 的 allowPathInfo 選項(IIS>=7),或 metabase " "的 allowPathInfoForScriptMappings 選項(IIS<7)。" -#: ../../library/wsgiref.rst:485 +#: ../../library/wsgiref.rst:490 msgid "" "By default, IIS gives a ``PATH_INFO`` that duplicates the ``SCRIPT_NAME`` at " "the front, causing problems for WSGI applications that wish to implement " @@ -770,7 +772,7 @@ msgstr "" "作路由的 WSGI 應用程式造成問題。這個處理程式(handler)會移除任何這樣的重複路" "徑。" -#: ../../library/wsgiref.rst:489 +#: ../../library/wsgiref.rst:494 msgid "" "IIS can be configured to pass the correct ``PATH_INFO``, but this causes " "another bug where ``PATH_TRANSLATED`` is wrong. Luckily this variable is " @@ -786,31 +788,30 @@ msgstr "" "``PATH_TRANSLATED`` 問題時會中斷。由於這個原因幾乎從不會使用修復的 IIS<7(即" "使是 IIS7 也很少使用它,因為它仍然沒有相應的 UI)。" -#: ../../library/wsgiref.rst:497 +#: ../../library/wsgiref.rst:502 msgid "" "There is no way for CGI code to tell whether the option was set, so a " -"separate handler class is provided. It is used in the same way " -"as :class:`CGIHandler`, i.e., by calling ``IISCGIHandler().run(app)``, where " -"``app`` is the WSGI application object you wish to invoke." +"separate handler class is provided. It is used in the same way as :class:" +"`CGIHandler`, i.e., by calling ``IISCGIHandler().run(app)``, where ``app`` " +"is the WSGI application object you wish to invoke." msgstr "" "CGI 程式碼無法知道是否已設置該選項,因此提供了一個獨立的處理程式(handler)類" -"別。它的使用方式與 :class:`CGIHandler` 相同,即透過呼叫 " -"``IISCGIHandler().run(app)`` 來使用,其中 ``app`` 是你希望叫用的 WSGI 應用程" -"式物件。" +"別。它的使用方式與 :class:`CGIHandler` 相同,即透過呼叫 ``IISCGIHandler()." +"run(app)`` 來使用,其中 ``app`` 是你希望叫用的 WSGI 應用程式物件。" -#: ../../library/wsgiref.rst:507 +#: ../../library/wsgiref.rst:512 msgid "" -"Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` " -"and :mod:`os` modules, the CGI environment and I/O streams are specified " -"explicitly. The *multithread* and *multiprocess* values are used to set the " -"``wsgi.multithread`` and ``wsgi.multiprocess`` flags for any applications " -"run by the handler instance." +"Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` and :mod:" +"`os` modules, the CGI environment and I/O streams are specified explicitly. " +"The *multithread* and *multiprocess* values are used to set the ``wsgi." +"multithread`` and ``wsgi.multiprocess`` flags for any applications run by " +"the handler instance." msgstr "" "類似於 :class:`CGIHandler`,但不是使用 :mod:`sys` 和 :mod:`os` 模組,而是明確" "指定 CGI 環境與 I/O 串流。*multithread* 和 *multiprocess* 值用於設置由處理程" "式(handler)實例運行的任何應用程式的旗標。" -#: ../../library/wsgiref.rst:513 +#: ../../library/wsgiref.rst:518 msgid "" "This class is a subclass of :class:`SimpleHandler` intended for use with " "software other than HTTP \"origin servers\". If you are writing a gateway " @@ -818,37 +819,38 @@ msgid "" "``Status:`` header to send an HTTP status, you probably want to subclass " "this instead of :class:`SimpleHandler`." msgstr "" -"這個類別是專門為除了 HTTP \"origin servers\" 以外的軟體一起使用" -"的 :class:`SimpleHandler` 的子類別。如果你正在撰寫一個使用 ``Status:`` 標頭來" -"發送 HTTP 狀態的閘道協定實作(例如 CGI、FastCGI、SCGI 等),你可能會想要子類" -"化這個類別來替代 :class:`SimpleHandler`。" +"這個類別是專門為除了 HTTP \"origin servers\" 以外的軟體一起使用的 :class:" +"`SimpleHandler` 的子類別。如果你正在撰寫一個使用 ``Status:`` 標頭來發送 HTTP " +"狀態的閘道協定實作(例如 CGI、FastCGI、SCGI 等),你可能會想要子類化這個類別" +"來替代 :class:`SimpleHandler`。" -#: ../../library/wsgiref.rst:522 +#: ../../library/wsgiref.rst:527 msgid "" "Similar to :class:`BaseCGIHandler`, but designed for use with HTTP origin " "servers. If you are writing an HTTP server implementation, you will " "probably want to subclass this instead of :class:`BaseCGIHandler`." msgstr "" "類似於 :class:`BaseCGIHandler`,但是被設計使用在 HTTP origin 伺服器。如果你正" -"在撰寫 HTTP 伺服器的實作,你可能會想要子類別化這個類別來替" -"代 :class:`BaseCGIHandler`。" +"在撰寫 HTTP 伺服器的實作,你可能會想要子類別化這個類別來替代 :class:" +"`BaseCGIHandler`。" -#: ../../library/wsgiref.rst:526 +#: ../../library/wsgiref.rst:531 msgid "" "This class is a subclass of :class:`BaseHandler`. It overrides the :meth:`!" -"__init__`, :meth:`~BaseHandler.get_stdin`, :meth:`~BaseHandler.get_stderr`, :meth:`~BaseHandler.add_cgi_vars`, :meth:`~BaseHandler._write`, " -"and :meth:`~BaseHandler._flush` methods to support explicitly setting the " -"environment and streams via the constructor. The supplied environment and " -"streams are stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, " -"and :attr:`environ` attributes." +"__init__`, :meth:`~BaseHandler.get_stdin`, :meth:`~BaseHandler.get_stderr`, :" +"meth:`~BaseHandler.add_cgi_vars`, :meth:`~BaseHandler._write`, and :meth:" +"`~BaseHandler._flush` methods to support explicitly setting the environment " +"and streams via the constructor. The supplied environment and streams are " +"stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, and :attr:" +"`environ` attributes." msgstr "" "這個類別是 :class:`BaseHandler` 的子類別。它透過建構函式去覆寫 :meth:`!" -"__init__`、:meth:`~BaseHandler.get_stdin`、:meth:`~BaseHandler.get_stderr`、:meth:`~BaseHandler.add_cgi_vars`、:meth:`~BaseHandler._write`、" -"和 :meth:`~BaseHandler._flush` 方法來明確提供設置環境與串流。提供的環境與串流" -"被儲存在 :attr:`stdin`、:attr:`stdout`、:attr:`stderr`、和 :attr:`environ` 環" -"境中。" +"__init__`、:meth:`~BaseHandler.get_stdin`、:meth:`~BaseHandler.get_stderr`、:" +"meth:`~BaseHandler.add_cgi_vars`、:meth:`~BaseHandler._write`、和 :meth:" +"`~BaseHandler._flush` 方法來明確提供設置環境與串流。提供的環境與串流被儲存" +"在 :attr:`stdin`、:attr:`stdout`、:attr:`stderr`、和 :attr:`environ` 環境中。" -#: ../../library/wsgiref.rst:535 +#: ../../library/wsgiref.rst:540 msgid "" "The :meth:`~io.BufferedIOBase.write` method of *stdout* should write each " "chunk in full, like :class:`io.BufferedIOBase`." @@ -856,7 +858,7 @@ msgstr "" "*stdout* 的 :meth:`~io.BufferedIOBase.write` 方法應該完整地寫入每個塊" "(chunk),像是 :class:`io.BufferedIOBase`。" -#: ../../library/wsgiref.rst:541 +#: ../../library/wsgiref.rst:546 msgid "" "This is an abstract base class for running WSGI applications. Each instance " "will handle a single HTTP request, although in principle you could create a " @@ -865,17 +867,17 @@ msgstr "" "這是一個運行 WSGI 應用程式的抽象基底類別。每個實例將處理單個 HTTP 請求,儘管" "原則上你可以建立一個可重用於多個請求的子類別。" -#: ../../library/wsgiref.rst:545 +#: ../../library/wsgiref.rst:550 msgid "" ":class:`BaseHandler` instances have only one method intended for external " "use:" msgstr ":class:`BaseHandler` 實例只有一個供外部使用的方法:" -#: ../../library/wsgiref.rst:550 +#: ../../library/wsgiref.rst:555 msgid "Run the specified WSGI application, *app*." msgstr "運行指定 WSGI 應用程式,*app*。" -#: ../../library/wsgiref.rst:552 +#: ../../library/wsgiref.rst:557 msgid "" "All of the other :class:`BaseHandler` methods are invoked by this method in " "the process of running the application, and thus exist primarily to allow " @@ -884,11 +886,11 @@ msgstr "" "此方法在運行應用程式的過程中叫用了所有其他 :class:`BaseHandler` 的方法,因此" "這些方法主要存在是為了允許自訂整個過程。" -#: ../../library/wsgiref.rst:556 +#: ../../library/wsgiref.rst:561 msgid "The following methods MUST be overridden in a subclass:" msgstr "以下方法必須在子類別中覆寫:" -#: ../../library/wsgiref.rst:561 +#: ../../library/wsgiref.rst:566 msgid "" "Buffer the bytes *data* for transmission to the client. It's okay if this " "method actually transmits the data; :class:`BaseHandler` just separates " @@ -899,15 +901,15 @@ msgstr "" "底層系統實際具有這種區分時,:class:`BaseHandler` 為了更好的效能進而分離寫入和" "刷新操作。" -#: ../../library/wsgiref.rst:569 +#: ../../library/wsgiref.rst:574 msgid "" "Force buffered data to be transmitted to the client. It's okay if this " "method is a no-op (i.e., if :meth:`_write` actually sends the data)." msgstr "" -"強制將緩衝數據傳送到用戶端。如果這是一個無操作(no-op)的方法(即,如" -"果 :meth:`_write` 實際上發送了數據),那麼是可以的。" +"強制將緩衝數據傳送到用戶端。如果這是一個無操作(no-op)的方法(即,如果 :" +"meth:`_write` 實際上發送了數據),那麼是可以的。" -#: ../../library/wsgiref.rst:575 +#: ../../library/wsgiref.rst:580 msgid "" "Return an object compatible with :class:`~wsgiref.types.InputStream` " "suitable for use as the ``wsgi.input`` of the request currently being " @@ -916,7 +918,7 @@ msgstr "" "回傳一個與 :class:`~wsgiref.types.InputStream` 相容的物件並適用於用作目前正在" "處理請求的 ``wsgi.input``。" -#: ../../library/wsgiref.rst:582 +#: ../../library/wsgiref.rst:587 msgid "" "Return an object compatible with :class:`~wsgiref.types.ErrorStream` " "suitable for use as the ``wsgi.errors`` of the request currently being " @@ -925,29 +927,29 @@ msgstr "" "回傳一個與 :class:`~wsgiref.types.ErrorStream` 相容的物件並適用於用作目前正在" "處理請求的 ``wsgi.errors``。" -#: ../../library/wsgiref.rst:589 +#: ../../library/wsgiref.rst:594 msgid "" "Insert CGI variables for the current request into the :attr:`environ` " "attribute." msgstr "將目前請求的 CGI 變數插入到 :attr:`environ` 屬性中。" -#: ../../library/wsgiref.rst:591 +#: ../../library/wsgiref.rst:596 msgid "" "Here are some other methods and attributes you may wish to override. This " "list is only a summary, however, and does not include every method that can " "be overridden. You should consult the docstrings and source code for " -"additional information before attempting to create a " -"customized :class:`BaseHandler` subclass." +"additional information before attempting to create a customized :class:" +"`BaseHandler` subclass." msgstr "" "以下是你可能希望覆寫的其他方法和屬性。這個列表只是一個摘要,然而,不包括可以" -"被覆寫的每個方法。在嘗試建立自訂的 :class:`BaseHandler` 子類別之前,你應該" -"參考文件說明和原始碼以獲得更多資訊。" +"被覆寫的每個方法。在嘗試建立自訂的 :class:`BaseHandler` 子類別之前,你應該參" +"考文件說明和原始碼以獲得更多資訊。" -#: ../../library/wsgiref.rst:597 +#: ../../library/wsgiref.rst:602 msgid "Attributes and methods for customizing the WSGI environment:" msgstr "用於自訂 WSGI 環境的屬性和方法:" -#: ../../library/wsgiref.rst:602 +#: ../../library/wsgiref.rst:607 msgid "" "The value to be used for the ``wsgi.multithread`` environment variable. It " "defaults to true in :class:`BaseHandler`, but may have a different default " @@ -956,7 +958,7 @@ msgstr "" "用於 ``wsgi.multithread`` 環境變數的值。在 :class:`BaseHandler` 中預設為 " "true,但在其他子類別中可能有不同的預設值(或由建構函式設置)。" -#: ../../library/wsgiref.rst:609 +#: ../../library/wsgiref.rst:614 msgid "" "The value to be used for the ``wsgi.multiprocess`` environment variable. It " "defaults to true in :class:`BaseHandler`, but may have a different default " @@ -965,7 +967,7 @@ msgstr "" "用於 ``wsgi.multiprocess`` 環境變數的值。在 :class:`BaseHandler` 中預設為 " "true,但在其他子類別中可能有不同的預設值(或由建構函式設置)。" -#: ../../library/wsgiref.rst:616 +#: ../../library/wsgiref.rst:621 msgid "" "The value to be used for the ``wsgi.run_once`` environment variable. It " "defaults to false in :class:`BaseHandler`, but :class:`CGIHandler` sets it " @@ -974,21 +976,20 @@ msgstr "" "用於 ``wsgi.run_once`` 環境變數的值。在 :class:`BaseHandler` 中預設為 false," "但 :class:`CGIHandler` 預設將其設置為 true。" -#: ../../library/wsgiref.rst:623 +#: ../../library/wsgiref.rst:628 msgid "" "The default environment variables to be included in every request's WSGI " -"environment. By default, this is a copy of ``os.environ`` at the time " -"that :mod:`wsgiref.handlers` was imported, but subclasses can either create " -"their own at the class or instance level. Note that the dictionary should " -"be considered read-only, since the default value is shared between multiple " +"environment. By default, this is a copy of ``os.environ`` at the time that :" +"mod:`wsgiref.handlers` was imported, but subclasses can either create their " +"own at the class or instance level. Note that the dictionary should be " +"considered read-only, since the default value is shared between multiple " "classes and instances." msgstr "" -"預設環境變數包含在每一個請求的 WSGI 環境中。預設情況下,這是在載" -"入 :mod:`wsgiref.handlers` 時的 ``os.environ`` 副本,但子類別可以在類別或實例" -"層級建立自己的副本。注意字典應該被視為唯讀,因為預設值在多個類別與實例中共" -"享。" +"預設環境變數包含在每一個請求的 WSGI 環境中。預設情況下,這是在載入 :mod:" +"`wsgiref.handlers` 時的 ``os.environ`` 副本,但子類別可以在類別或實例層級建立" +"自己的副本。注意字典應該被視為唯讀,因為預設值在多個類別與實例中共享。" -#: ../../library/wsgiref.rst:633 +#: ../../library/wsgiref.rst:638 msgid "" "If the :attr:`origin_server` attribute is set, this attribute's value is " "used to set the default ``SERVER_SOFTWARE`` WSGI environment variable, and " @@ -998,28 +999,28 @@ msgid "" msgstr "" "如果設置 :attr:`origin_server` 屬性,則此屬性的值將用於設置預設的 " "``SERVER_SOFTWARE`` WSGI 環境變數,並且還將用於設置 HTTP 回應中的預設 " -"``Server:`` 標頭。對於不是 HTTP origin 伺服器的處置程式(例" -"如 :class:`BaseCGIHandler` 和 :class:`CGIHandler`),此屬性將被忽略。" +"``Server:`` 標頭。對於不是 HTTP origin 伺服器的處置程式(例如 :class:" +"`BaseCGIHandler` 和 :class:`CGIHandler`),此屬性將被忽略。" -#: ../../library/wsgiref.rst:639 +#: ../../library/wsgiref.rst:644 msgid "" "The term \"Python\" is replaced with implementation specific term like " "\"CPython\", \"Jython\" etc." msgstr "" "將術語 \"Python\" 替換為特定實作的術語,如 \"CPython\"、\"Jython\" 等。" -#: ../../library/wsgiref.rst:645 +#: ../../library/wsgiref.rst:650 msgid "" "Return the URL scheme being used for the current request. The default " -"implementation uses the :func:`guess_scheme` function " -"from :mod:`wsgiref.util` to guess whether the scheme should be \"http\" or " -"\"https\", based on the current request's :attr:`environ` variables." +"implementation uses the :func:`guess_scheme` function from :mod:`wsgiref." +"util` to guess whether the scheme should be \"http\" or \"https\", based on " +"the current request's :attr:`environ` variables." msgstr "" -"回傳用於目前請求的 URL scheme。預設的實作使用 :mod:`wsgiref.util` 中" -"的 :func:`guess_scheme` 函式去猜測 scheme 是 \"http\" 或是 \"https\",基於目" -"前請求的 :attr:`environ` 變數。" +"回傳用於目前請求的 URL scheme。預設的實作使用 :mod:`wsgiref.util` 中的 :func:" +"`guess_scheme` 函式去猜測 scheme 是 \"http\" 或是 \"https\",基於目前請求的 :" +"attr:`environ` 變數。" -#: ../../library/wsgiref.rst:653 +#: ../../library/wsgiref.rst:658 msgid "" "Set the :attr:`environ` attribute to a fully populated WSGI environment. " "The default implementation uses all of the above methods and attributes, " @@ -1034,11 +1035,11 @@ msgstr "" "``SERVER_SOFTWARE`` 關鍵字,只要 :attr:`origin_server` 屬性是一個 true 值並" "且 :attr:`server_software` 屬性被設置。" -#: ../../library/wsgiref.rst:660 +#: ../../library/wsgiref.rst:665 msgid "Methods and attributes for customizing exception handling:" msgstr "用於自訂例外處理的屬性和方法:" -#: ../../library/wsgiref.rst:665 +#: ../../library/wsgiref.rst:670 msgid "" "Log the *exc_info* tuple in the server log. *exc_info* is a ``(type, value, " "traceback)`` tuple. The default implementation simply writes the traceback " @@ -1052,15 +1053,15 @@ msgstr "" "並刷新它。子類別可以覆蓋此方法以更改格式或重新定向輸出,將追蹤資訊發送給管理" "員,或執行其他被認為合適的操作。" -#: ../../library/wsgiref.rst:674 +#: ../../library/wsgiref.rst:679 msgid "" -"The maximum number of frames to include in tracebacks output by the " -"default :meth:`log_exception` method. If ``None``, all frames are included." +"The maximum number of frames to include in tracebacks output by the default :" +"meth:`log_exception` method. If ``None``, all frames are included." msgstr "" "預設的 :meth:`log_exception` 方法追蹤輸出中包含的最大幀數 。如果為 ``None``," "則包含所有幀。" -#: ../../library/wsgiref.rst:680 +#: ../../library/wsgiref.rst:685 msgid "" "This method is a WSGI application to generate an error page for the user. " "It is only invoked if an error occurs before headers are sent to the client." @@ -1068,7 +1069,7 @@ msgstr "" "這個方法是一個為使用者去產生錯誤頁面的 WSGI 應用程式。只有在標頭傳送給用戶端" "前如果發生錯誤才會被叫用。" -#: ../../library/wsgiref.rst:683 +#: ../../library/wsgiref.rst:688 msgid "" "This method can access the current error using ``sys.exception()``, and " "should pass that information to *start_response* when calling it (as " @@ -1080,18 +1081,16 @@ msgstr "" "\"Error Handling\" 部分所描述)時應該傳遞資訊給 *start_response*。特別是 " "*start_response* 可呼叫物件應該遵循 :class:`.StartResponse` 協定。" -#: ../../library/wsgiref.rst:689 +#: ../../library/wsgiref.rst:694 msgid "" -"The default implementation just uses " -"the :attr:`error_status`, :attr:`error_headers`, and :attr:`error_body` " -"attributes to generate an output page. Subclasses can override this to " -"produce more dynamic error output." +"The default implementation just uses the :attr:`error_status`, :attr:" +"`error_headers`, and :attr:`error_body` attributes to generate an output " +"page. Subclasses can override this to produce more dynamic error output." msgstr "" -"預設的實作只是使用 :attr:`error_status`、:attr:`error_headers` " -"和 :attr:`error_body` 屬性產生輸出頁面。子類別可以覆蓋此方法以生成更動態的錯" -"誤輸出。" +"預設的實作只是使用 :attr:`error_status`、:attr:`error_headers` 和 :attr:" +"`error_body` 屬性產生輸出頁面。子類別可以覆蓋此方法以生成更動態的錯誤輸出。" -#: ../../library/wsgiref.rst:693 +#: ../../library/wsgiref.rst:698 msgid "" "Note, however, that it's not recommended from a security perspective to spit " "out diagnostics to any old user; ideally, you should have to do something " @@ -1101,7 +1100,7 @@ msgstr "" "然而,從安全的角度並不建議向任何普通使用者顯示診斷資訊;理想情況下,你應該需" "要採取特殊措施才能啟用診斷輸出,這就是預設實作不包括任何診斷資訊的原因。" -#: ../../library/wsgiref.rst:701 +#: ../../library/wsgiref.rst:706 msgid "" "The HTTP status used for error responses. This should be a status string as " "defined in :pep:`3333`; it defaults to a 500 code and message." @@ -1109,7 +1108,7 @@ msgstr "" "用於錯誤回應的 HTTP 狀態。這應該是一個按照 :pep:`3333` 定義的狀態字串;預設" "為 500 狀態碼和訊息。" -#: ../../library/wsgiref.rst:707 +#: ../../library/wsgiref.rst:712 msgid "" "The HTTP headers used for error responses. This should be a list of WSGI " "response headers (``(name, value)`` tuples), as described in :pep:`3333`. " @@ -1119,7 +1118,7 @@ msgstr "" "value)`` 元組),如 :pep:`3333` 中所描述。預設串列只設置內容種類為 ``text/" "plain``。" -#: ../../library/wsgiref.rst:714 +#: ../../library/wsgiref.rst:719 msgid "" "The error response body. This should be an HTTP response body bytestring. " "It defaults to the plain text, \"A server error occurred. Please contact " @@ -1128,7 +1127,7 @@ msgstr "" "錯誤回應的主體。這應該是一個 HTTP 回應內容的位元組字串。預設為純文字 \"A " "server error occurred. Please contact the administrator.\"" -#: ../../library/wsgiref.rst:718 +#: ../../library/wsgiref.rst:723 msgid "" "Methods and attributes for :pep:`3333`'s \"Optional Platform-Specific File " "Handling\" feature:" @@ -1136,17 +1135,17 @@ msgstr "" "用於 :pep:`3333` 中的 \"Optional Platform-Specific File Handling\" 功能的方法" "和屬性:" -#: ../../library/wsgiref.rst:724 +#: ../../library/wsgiref.rst:729 msgid "" -"A ``wsgi.file_wrapper`` factory, compatible " -"with :class:`wsgiref.types.FileWrapper`, or ``None``. The default value of " -"this attribute is the :class:`wsgiref.util.FileWrapper` class." +"A ``wsgi.file_wrapper`` factory, compatible with :class:`wsgiref.types." +"FileWrapper`, or ``None``. The default value of this attribute is the :" +"class:`wsgiref.util.FileWrapper` class." msgstr "" -"一個 ``wsgi.file_wrapper`` 工廠函式(factory)," -"與 :class:`wsgiref.types.FileWrapper` 相容,或者為 ``None``。這個屬性的預設值" -"是 :class:`wsgiref.util.FileWrapper` 類別。" +"一個 ``wsgi.file_wrapper`` 工廠函式(factory),與 :class:`wsgiref.types." +"FileWrapper` 相容,或者為 ``None``。這個屬性的預設值是 :class:`wsgiref.util." +"FileWrapper` 類別。" -#: ../../library/wsgiref.rst:731 +#: ../../library/wsgiref.rst:736 msgid "" "Override to implement platform-specific file transmission. This method is " "called only if the application's return value is an instance of the class " @@ -1155,35 +1154,35 @@ msgid "" "default transmission code will not be executed. The default implementation " "of this method just returns a false value." msgstr "" -"覆蓋以實作特定平台的檔案傳輸。只有當應用程式的回傳值是" -"由 :attr:`wsgi_file_wrapper` 屬性指定的類別實例時才會呼叫此方法。如果它能夠成" -"功傳輸檔案應該回傳一個 true 值,以便不執行預設的傳輸程式碼。該方法的預設實作" -"只回傳一個 false 值。" +"覆蓋以實作特定平台的檔案傳輸。只有當應用程式的回傳值是由 :attr:" +"`wsgi_file_wrapper` 屬性指定的類別實例時才會呼叫此方法。如果它能夠成功傳輸檔" +"案應該回傳一個 true 值,以便不執行預設的傳輸程式碼。該方法的預設實作只回傳一" +"個 false 值。" -#: ../../library/wsgiref.rst:738 +#: ../../library/wsgiref.rst:743 msgid "Miscellaneous methods and attributes:" msgstr "其他方法和屬性:" -#: ../../library/wsgiref.rst:743 +#: ../../library/wsgiref.rst:748 msgid "" "This attribute should be set to a true value if the handler's :meth:`_write` " "and :meth:`_flush` are being used to communicate directly to the client, " "rather than via a CGI-like gateway protocol that wants the HTTP status in a " "special ``Status:`` header." msgstr "" -"這個屬性應該被設置為 true 值,如果處理程式(handler)的 :meth:`_write` " -"和 :meth:`_flush` 被用於直接與用戶端通訊,而不是透過 CGI-like 的閘道協定希望 " +"這個屬性應該被設置為 true 值,如果處理程式(handler)的 :meth:`_write` 和 :" +"meth:`_flush` 被用於直接與用戶端通訊,而不是透過 CGI-like 的閘道協定希望 " "HTTP 狀態在特殊的 ``Status:`` 標頭中。" -#: ../../library/wsgiref.rst:748 +#: ../../library/wsgiref.rst:753 msgid "" "This attribute's default value is true in :class:`BaseHandler`, but false " "in :class:`BaseCGIHandler` and :class:`CGIHandler`." msgstr "" -"這個屬性在 :class:`BaseHandler` 預設值為 true,但是" -"在 :class:`BaseCGIHandler` 和 :class:`CGIHandler` 為 false。" +"這個屬性在 :class:`BaseHandler` 預設值為 true,但是在 :class:" +"`BaseCGIHandler` 和 :class:`CGIHandler` 為 false。" -#: ../../library/wsgiref.rst:754 +#: ../../library/wsgiref.rst:759 msgid "" "If :attr:`origin_server` is true, this string attribute is used to set the " "HTTP version of the response set to the client. It defaults to ``\"1.0\"``." @@ -1191,11 +1190,11 @@ msgstr "" "如果 :attr:`origin_server` 為 true,則此字串屬性用於設定傳送給用戶端的回應的 " "HTTP 版本。預設為 ``\"1.0\"``。" -#: ../../library/wsgiref.rst:760 +#: ../../library/wsgiref.rst:765 msgid "" "Transcode CGI variables from ``os.environ`` to :pep:`3333` \"bytes in " -"unicode\" strings, returning a new dictionary. This function is used " -"by :class:`CGIHandler` and :class:`IISCGIHandler` in place of directly using " +"unicode\" strings, returning a new dictionary. This function is used by :" +"class:`CGIHandler` and :class:`IISCGIHandler` in place of directly using " "``os.environ``, which is not necessarily WSGI-compliant on all platforms and " "web servers using Python 3 -- specifically, ones where the OS's actual " "environment is Unicode (i.e. Windows), or ones where the environment is " @@ -1203,13 +1202,13 @@ msgid "" "than ISO-8859-1 (e.g. Unix systems using UTF-8)." msgstr "" "從 ``os.environ`` 轉碼 CGI 變數到 :pep:`3333` 中的 \"bytes in unicode\" 字" -"串,並回傳一個新字典。這個函式被 :class:`CGIHandler` " -"和 :class:`IISCGIHandler` 使用來直接替代 ``os.environ``,在所有平台和使用 " -"Python 3 的網頁伺服器上不一定符合 WSGI 標準,具體來說,在 OS 的實際環境是 " -"Unicode(例如 Windows)的情況下,或者在環境是位元組的情況下,但 Python 用於解" -"碼它的系統編碼不是 ISO-8859-1 (例如使用 UTF-8 的 Unix 系統)。" +"串,並回傳一個新字典。這個函式被 :class:`CGIHandler` 和 :class:" +"`IISCGIHandler` 使用來直接替代 ``os.environ``,在所有平台和使用 Python 3 的網" +"頁伺服器上不一定符合 WSGI 標準,具體來說,在 OS 的實際環境是 Unicode(例如 " +"Windows)的情況下,或者在環境是位元組的情況下,但 Python 用於解碼它的系統編碼" +"不是 ISO-8859-1 (例如使用 UTF-8 的 Unix 系統)。" -#: ../../library/wsgiref.rst:769 +#: ../../library/wsgiref.rst:774 msgid "" "If you are implementing a CGI-based handler of your own, you probably want " "to use this routine instead of just copying values out of ``os.environ`` " @@ -1218,17 +1217,17 @@ msgstr "" "如果你自己正在實作 CGI-based 處理程式(handler),你可能想要使用這個函式來替" "換單純直接從 ``os.environ`` 中複製值。" -#: ../../library/wsgiref.rst:777 +#: ../../library/wsgiref.rst:782 msgid ":mod:`wsgiref.types` -- WSGI types for static type checking" msgstr ":mod:`wsgiref.types` -- 用於靜態型別檢查的 WSGI 型別" -#: ../../library/wsgiref.rst:783 +#: ../../library/wsgiref.rst:788 msgid "" -"This module provides various types for static type checking as described " -"in :pep:`3333`." +"This module provides various types for static type checking as described in :" +"pep:`3333`." msgstr "這個模組提供在 :pep:`3333` 中所描述的各種用於靜態型別檢查的型別。" -#: ../../library/wsgiref.rst:791 +#: ../../library/wsgiref.rst:796 msgid "" "A :class:`typing.Protocol` describing :pep:`start_response() <3333#the-start-" "response-callable>` callables (:pep:`3333`)." @@ -1236,52 +1235,52 @@ msgstr "" "一個描述 :pep:`start_response() <3333#the-start-response-callable>` 可呼叫物" "件的 :class:`typing.Protocol` (:pep:`3333`)。" -#: ../../library/wsgiref.rst:797 +#: ../../library/wsgiref.rst:802 msgid "A type alias describing a WSGI environment dictionary." msgstr "一個描述 WSGI 環境字典的型別別名。" -#: ../../library/wsgiref.rst:801 +#: ../../library/wsgiref.rst:806 msgid "A type alias describing a WSGI application callable." msgstr "一個描述 WSGI 應用程式可呼叫物件的型別別名。" -#: ../../library/wsgiref.rst:805 +#: ../../library/wsgiref.rst:810 msgid "" "A :class:`typing.Protocol` describing a :pep:`WSGI Input Stream <3333#input-" "and-error-streams>`." msgstr "" -"一個描述 :pep:`WSGI 輸入串流 <3333#input-and-error-streams>`\\ " -"的 :class:`typing.Protocol`。" +"一個描述 :pep:`WSGI 輸入串流 <3333#input-and-error-streams>`\\ 的 :class:" +"`typing.Protocol`。" -#: ../../library/wsgiref.rst:810 +#: ../../library/wsgiref.rst:815 msgid "" "A :class:`typing.Protocol` describing a :pep:`WSGI Error Stream <3333#input-" "and-error-streams>`." msgstr "" -"一個描述 :pep:`WSGI 錯誤串流 <3333#input-and-error-streams>`\\ " -"的 :class:`typing.Protocol`。" +"一個描述 :pep:`WSGI 錯誤串流 <3333#input-and-error-streams>`\\ 的 :class:" +"`typing.Protocol`。" -#: ../../library/wsgiref.rst:815 +#: ../../library/wsgiref.rst:820 msgid "" "A :class:`typing.Protocol` describing a :pep:`file wrapper <3333#optional-" "platform-specific-file-handling>`. See :class:`wsgiref.util.FileWrapper` for " "a concrete implementation of this protocol." msgstr "" "一個描述\\ :pep:`檔案包裝器 <3333#optional-platform-specific-file-" -"handling>`\\ 的 :class:`typing.Protocol`。請參" -"閱 :class:`wsgiref.util.FileWrapper` 來瞭解此協定的具體實作。" +"handling>`\\ 的 :class:`typing.Protocol`。請參閱 :class:`wsgiref.util." +"FileWrapper` 來瞭解此協定的具體實作。" -#: ../../library/wsgiref.rst:822 +#: ../../library/wsgiref.rst:827 msgid "Examples" msgstr "範例" -#: ../../library/wsgiref.rst:824 +#: ../../library/wsgiref.rst:829 msgid "" "This is a working \"Hello World\" WSGI application, where the " "*start_response* callable should follow the :class:`.StartResponse` " "protocol::" msgstr "" -#: ../../library/wsgiref.rst:827 +#: ../../library/wsgiref.rst:832 msgid "" "\"\"\"\n" "Every WSGI application must have an application object - a callable\n" @@ -1310,7 +1309,7 @@ msgid "" " httpd.serve_forever()" msgstr "" -#: ../../library/wsgiref.rst:854 +#: ../../library/wsgiref.rst:859 msgid "" "Example of a WSGI application serving the current directory, accept optional " "directory and port number (default: 8000) on the command line::" @@ -1318,7 +1317,7 @@ msgstr "" "提供目前目錄的 WSGI 應用程式範例,並接受命令列上的可選目錄和埠號(預設:" "8000): ::" -#: ../../library/wsgiref.rst:857 +#: ../../library/wsgiref.rst:862 msgid "" "\"\"\"\n" "Small wsgiref based web server. Takes a path to serve from and an\n" diff --git a/library/xml.sax.handler.po b/library/xml.sax.handler.po index 56431110ec..5cf0a00d3b 100644 --- a/library/xml.sax.handler.po +++ b/library/xml.sax.handler.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2016-11-19 00:36+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -87,7 +87,7 @@ msgstr "" msgid "true: Perform Namespace processing." msgstr "" -#: ../../library/xml.sax.handler.rst:64 +#: ../../library/xml.sax.handler.rst:65 msgid "" "false: Optionally do not perform Namespace processing (implies namespace-" "prefixes; default)." @@ -104,13 +104,13 @@ msgstr "" msgid "value: ``\"http://xml.org/sax/features/namespace-prefixes\"``" msgstr "" -#: ../../library/xml.sax.handler.rst:72 +#: ../../library/xml.sax.handler.rst:73 msgid "" "true: Report the original prefixed names and attributes used for Namespace " "declarations." msgstr "" -#: ../../library/xml.sax.handler.rst:74 +#: ../../library/xml.sax.handler.rst:75 msgid "" "false: Do not report attributes used for Namespace declarations, and " "optionally do not report original prefixed names (default)." @@ -120,7 +120,7 @@ msgstr "" msgid "value: ``\"http://xml.org/sax/features/string-interning\"``" msgstr "" -#: ../../library/xml.sax.handler.rst:82 +#: ../../library/xml.sax.handler.rst:83 msgid "" "true: All element names, prefixes, attribute names, Namespace URIs, and " "local names are interned using the built-in intern function." @@ -135,7 +135,7 @@ msgstr "" msgid "value: ``\"http://xml.org/sax/features/validation\"``" msgstr "" -#: ../../library/xml.sax.handler.rst:91 +#: ../../library/xml.sax.handler.rst:92 msgid "" "true: Report all validation errors (implies external-general-entities and " "external-parameter-entities)." @@ -169,13 +169,13 @@ msgstr "" msgid "value: ``\"http://xml.org/sax/features/external-parameter-entities\"``" msgstr "" -#: ../../library/xml.sax.handler.rst:116 +#: ../../library/xml.sax.handler.rst:117 msgid "" "true: Include all external parameter entities, including the external DTD " "subset." msgstr "" -#: ../../library/xml.sax.handler.rst:118 +#: ../../library/xml.sax.handler.rst:119 msgid "" "false: Do not include any external parameter entities, even the external DTD " "subset." @@ -193,7 +193,7 @@ msgstr "" msgid "data type: xml.sax.handler.LexicalHandler (not supported in Python 2)" msgstr "" -#: ../../library/xml.sax.handler.rst:132 +#: ../../library/xml.sax.handler.rst:133 msgid "" "description: An optional extension handler for lexical events like comments." msgstr "" @@ -210,7 +210,7 @@ msgstr "" msgid "data type: xml.sax.sax2lib.DeclHandler (not supported in Python 2)" msgstr "" -#: ../../library/xml.sax.handler.rst:141 +#: ../../library/xml.sax.handler.rst:142 msgid "" "description: An optional extension handler for DTD-related events other than " "notations and unparsed entities." @@ -224,7 +224,7 @@ msgstr "" msgid "data type: org.w3c.dom.Node (not supported in Python 2)" msgstr "" -#: ../../library/xml.sax.handler.rst:150 +#: ../../library/xml.sax.handler.rst:151 msgid "" "description: When parsing, the current DOM node being visited if this is a " "DOM iterator; when not parsing, the root DOM node for iteration." @@ -238,7 +238,7 @@ msgstr "" msgid "data type: Bytes" msgstr "" -#: ../../library/xml.sax.handler.rst:159 +#: ../../library/xml.sax.handler.rst:160 msgid "" "description: The literal string of characters that was the source for the " "current event." diff --git a/reference/datamodel.po b/reference/datamodel.po index 2485b3b16e..909cc08bef 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-08 07:22+0000\n" +"POT-Creation-Date: 2026-02-05 14:10+0000\n" "PO-Revision-Date: 2024-09-24 19:03+0900\n" "Last-Translator: Kisaragi Hiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -402,11 +402,11 @@ msgid "" "retrieved through the read-only attributes ``z.real`` and ``z.imag``." msgstr "" -#: ../../reference/datamodel.rst:295 +#: ../../reference/datamodel.rst:296 msgid "Sequences" msgstr "" -#: ../../reference/datamodel.rst:304 +#: ../../reference/datamodel.rst:305 msgid "" "These represent finite ordered sets indexed by non-negative numbers. The " "built-in function :func:`len` returns the number of items of a sequence. " @@ -417,30 +417,45 @@ msgid "" "second to last item of sequence a with length ``n``." msgstr "" -#: ../../reference/datamodel.rst:314 +#: ../../reference/datamodel.rst:313 msgid "" -"Sequences also support slicing: ``a[i:j]`` selects all items with index *k* " -"such that *i* ``<=`` *k* ``<`` *j*. When used as an expression, a slice is " -"a sequence of the same type. The comment above about negative indexes also " -"applies to negative slice positions." +"The resulting value must be a nonnegative integer less than the number of " +"items in the sequence. If it is not, an :exc:`IndexError` is raised." msgstr "" -#: ../../reference/datamodel.rst:319 +#: ../../reference/datamodel.rst:322 +msgid "" +"Sequences also support slicing: ``a[start:stop]`` selects all items with " +"index *k* such that *start* ``<=`` *k* ``<`` *stop*. When used as an " +"expression, a slice is a sequence of the same type. The comment above about " +"negative subscripts also applies to negative slice positions. Note that no " +"error is raised if a slice position is less than zero or larger than the " +"length of the sequence." +msgstr "" + +#: ../../reference/datamodel.rst:329 +msgid "" +"If *start* is missing or :data:`None`, slicing behaves as if *start* was " +"zero. If *stop* is missing or ``None``, slicing behaves as if *stop* was " +"equal to the length of the sequence." +msgstr "" + +#: ../../reference/datamodel.rst:333 msgid "" "Some sequences also support \"extended slicing\" with a third \"step\" " "parameter: ``a[i:j:k]`` selects all items of *a* with index *x* where ``x = " "i + n*k``, *n* ``>=`` ``0`` and *i* ``<=`` *x* ``<`` *j*." msgstr "" -#: ../../reference/datamodel.rst:323 +#: ../../reference/datamodel.rst:337 msgid "Sequences are distinguished according to their mutability:" msgstr "" -#: ../../reference/datamodel.rst:327 +#: ../../reference/datamodel.rst:341 msgid "Immutable sequences" msgstr "" -#: ../../reference/datamodel.rst:333 +#: ../../reference/datamodel.rst:347 msgid "" "An object of an immutable sequence type cannot change once it is created. " "(If the object contains references to other objects, these other objects may " @@ -448,92 +463,101 @@ msgid "" "referenced by an immutable object cannot change.)" msgstr "" -#: ../../reference/datamodel.rst:338 +#: ../../reference/datamodel.rst:352 msgid "The following types are immutable sequences:" msgstr "" -#: ../../reference/datamodel.rst:343 +#: ../../reference/datamodel.rst:357 msgid "Strings" msgstr "字串 (String)" -#: ../../reference/datamodel.rst:351 +#: ../../reference/datamodel.rst:365 +msgid "" +"A string (:class:`str`) is a sequence of values that represent :dfn:" +"`characters`, or more formally, *Unicode code points*. All the code points " +"in the range ``0`` to ``0x10FFFF`` can be represented in a string." +msgstr "" + +#: ../../reference/datamodel.rst:370 +msgid "" +"Python doesn't have a dedicated *character* type. Instead, every code point " +"in the string is represented as a string object with length ``1``." +msgstr "" + +#: ../../reference/datamodel.rst:374 msgid "" -"A string is a sequence of values that represent Unicode code points. All the " -"code points in the range ``U+0000 - U+10FFFF`` can be represented in a " -"string. Python doesn't have a :c:expr:`char` type; instead, every code " -"point in the string is represented as a string object with length ``1``. " "The built-in function :func:`ord` converts a code point from its string form " -"to an integer in the range ``0 - 10FFFF``; :func:`chr` converts an integer " -"in the range ``0 - 10FFFF`` to the corresponding length ``1`` string " -"object. :meth:`str.encode` can be used to convert a :class:`str` to :class:" -"`bytes` using the given text encoding, and :meth:`bytes.decode` can be used " -"to achieve the opposite." +"to an integer in the range ``0`` to ``0x10FFFF``; :func:`chr` converts an " +"integer in the range ``0`` to ``0x10FFFF`` to the corresponding length ``1`` " +"string object. :meth:`str.encode` can be used to convert a :class:`str` to :" +"class:`bytes` using the given text encoding, and :meth:`bytes.decode` can be " +"used to achieve the opposite." msgstr "" -#: ../../reference/datamodel.rst:363 +#: ../../reference/datamodel.rst:382 msgid "Tuples" msgstr "Tuple(元組)" -#: ../../reference/datamodel.rst:369 +#: ../../reference/datamodel.rst:388 msgid "" -"The items of a tuple are arbitrary Python objects. Tuples of two or more " -"items are formed by comma-separated lists of expressions. A tuple of one " -"item (a 'singleton') can be formed by affixing a comma to an expression (an " -"expression by itself does not create a tuple, since parentheses must be " +"The items of a :class:`tuple` are arbitrary Python objects. Tuples of two or " +"more items are formed by comma-separated lists of expressions. A tuple of " +"one item (a 'singleton') can be formed by affixing a comma to an expression " +"(an expression by itself does not create a tuple, since parentheses must be " "usable for grouping of expressions). An empty tuple can be formed by an " "empty pair of parentheses." msgstr "" -#: ../../reference/datamodel.rst:376 +#: ../../reference/datamodel.rst:395 msgid "Bytes" msgstr "位元組" -#: ../../reference/datamodel.rst:379 +#: ../../reference/datamodel.rst:398 msgid "" -"A bytes object is an immutable array. The items are 8-bit bytes, " +"A :class:`bytes` object is an immutable array. The items are 8-bit bytes, " "represented by integers in the range 0 <= x < 256. Bytes literals (like " "``b'abc'``) and the built-in :func:`bytes` constructor can be used to create " "bytes objects. Also, bytes objects can be decoded to strings via the :meth:" "`~bytes.decode` method." msgstr "" -#: ../../reference/datamodel.rst:387 +#: ../../reference/datamodel.rst:406 msgid "Mutable sequences" msgstr "可變序列" -#: ../../reference/datamodel.rst:396 +#: ../../reference/datamodel.rst:415 msgid "" "Mutable sequences can be changed after they are created. The subscription " "and slicing notations can be used as the target of assignment and :keyword:" "`del` (delete) statements." msgstr "" -#: ../../reference/datamodel.rst:404 +#: ../../reference/datamodel.rst:423 msgid "" "The :mod:`collections` and :mod:`array` module provide additional examples " "of mutable sequence types." msgstr "" -#: ../../reference/datamodel.rst:407 +#: ../../reference/datamodel.rst:426 msgid "There are currently two intrinsic mutable sequence types:" msgstr "" -#: ../../reference/datamodel.rst:409 +#: ../../reference/datamodel.rst:428 msgid "Lists" msgstr "List(串列)" -#: ../../reference/datamodel.rst:412 +#: ../../reference/datamodel.rst:431 msgid "" "The items of a list are arbitrary Python objects. Lists are formed by " "placing a comma-separated list of expressions in square brackets. (Note that " "there are no special cases needed to form lists of length 0 or 1.)" msgstr "" -#: ../../reference/datamodel.rst:416 +#: ../../reference/datamodel.rst:435 msgid "Byte Arrays" msgstr "位元組陣列" -#: ../../reference/datamodel.rst:419 +#: ../../reference/datamodel.rst:438 msgid "" "A bytearray object is a mutable array. They are created by the built-in :" "func:`bytearray` constructor. Aside from being mutable (and hence " @@ -541,11 +565,11 @@ msgid "" "functionality as immutable :class:`bytes` objects." msgstr "" -#: ../../reference/datamodel.rst:426 +#: ../../reference/datamodel.rst:445 msgid "Set types" msgstr "Set(集合)型別" -#: ../../reference/datamodel.rst:432 +#: ../../reference/datamodel.rst:451 msgid "" "These represent unordered, finite sets of unique, immutable objects. As " "such, they cannot be indexed by any subscript. However, they can be iterated " @@ -555,7 +579,7 @@ msgid "" "union, difference, and symmetric difference." msgstr "" -#: ../../reference/datamodel.rst:439 +#: ../../reference/datamodel.rst:458 msgid "" "For set elements, the same immutability rules apply as for dictionary keys. " "Note that numeric types obey the normal rules for numeric comparison: if two " @@ -563,37 +587,37 @@ msgid "" "contained in a set." msgstr "" -#: ../../reference/datamodel.rst:444 +#: ../../reference/datamodel.rst:463 msgid "There are currently two intrinsic set types:" msgstr "" -#: ../../reference/datamodel.rst:447 +#: ../../reference/datamodel.rst:466 msgid "Sets" msgstr "Set(集合)" -#: ../../reference/datamodel.rst:450 +#: ../../reference/datamodel.rst:469 msgid "" "These represent a mutable set. They are created by the built-in :func:`set` " "constructor and can be modified afterwards by several methods, such as :meth:" "`~set.add`." msgstr "" -#: ../../reference/datamodel.rst:455 +#: ../../reference/datamodel.rst:474 msgid "Frozen sets" msgstr "Frozen set(凍結集合)" -#: ../../reference/datamodel.rst:458 +#: ../../reference/datamodel.rst:477 msgid "" "These represent an immutable set. They are created by the built-in :func:" "`frozenset` constructor. As a frozenset is immutable and :term:`hashable`, " "it can be used again as an element of another set, or as a dictionary key." msgstr "" -#: ../../reference/datamodel.rst:465 +#: ../../reference/datamodel.rst:486 msgid "Mappings" msgstr "對映" -#: ../../reference/datamodel.rst:472 +#: ../../reference/datamodel.rst:493 msgid "" "These represent finite sets of objects indexed by arbitrary index sets. The " "subscript notation ``a[k]`` selects the item indexed by ``k`` from the " @@ -602,15 +626,15 @@ msgid "" "returns the number of items in a mapping." msgstr "" -#: ../../reference/datamodel.rst:478 +#: ../../reference/datamodel.rst:499 msgid "There is currently a single intrinsic mapping type:" msgstr "" -#: ../../reference/datamodel.rst:482 +#: ../../reference/datamodel.rst:503 msgid "Dictionaries" msgstr "字典" -#: ../../reference/datamodel.rst:486 +#: ../../reference/datamodel.rst:507 msgid "" "These represent finite sets of objects indexed by nearly arbitrary values. " "The only types of values not acceptable as keys are values containing lists " @@ -622,7 +646,7 @@ msgid "" "interchangeably to index the same dictionary entry." msgstr "" -#: ../../reference/datamodel.rst:495 +#: ../../reference/datamodel.rst:516 msgid "" "Dictionaries preserve insertion order, meaning that keys will be produced in " "the same order they were added sequentially over the dictionary. Replacing " @@ -630,131 +654,137 @@ msgid "" "inserting it will add it to the end instead of keeping its old place." msgstr "" -#: ../../reference/datamodel.rst:500 +#: ../../reference/datamodel.rst:521 msgid "" "Dictionaries are mutable; they can be created by the ``{}`` notation (see " "section :ref:`dict`)." msgstr "" -#: ../../reference/datamodel.rst:507 +#: ../../reference/datamodel.rst:528 msgid "" "The extension modules :mod:`dbm.ndbm` and :mod:`dbm.gnu` provide additional " "examples of mapping types, as does the :mod:`collections` module." msgstr "" -#: ../../reference/datamodel.rst:511 +#: ../../reference/datamodel.rst:532 msgid "" "Dictionaries did not preserve insertion order in versions of Python before " "3.6. In CPython 3.6, insertion order was preserved, but it was considered an " "implementation detail at that time rather than a language guarantee." msgstr "" -#: ../../reference/datamodel.rst:518 +#: ../../reference/datamodel.rst:539 msgid "Callable types" msgstr "可呼叫型別" -#: ../../reference/datamodel.rst:526 +#: ../../reference/datamodel.rst:547 msgid "" "These are the types to which the function call operation (see section :ref:" "`calls`) can be applied:" msgstr "" -#: ../../reference/datamodel.rst:533 +#: ../../reference/datamodel.rst:554 msgid "User-defined functions" msgstr "自訂函式" -#: ../../reference/datamodel.rst:540 +#: ../../reference/datamodel.rst:561 msgid "" "A user-defined function object is created by a function definition (see " "section :ref:`function`). It should be called with an argument list " "containing the same number of items as the function's formal parameter list." msgstr "" -#: ../../reference/datamodel.rst:546 ../../reference/datamodel.rst:1447 -#: ../../reference/datamodel.rst:1648 +#: ../../reference/datamodel.rst:567 ../../reference/datamodel.rst:1475 +#: ../../reference/datamodel.rst:1676 msgid "Special read-only attributes" msgstr "特殊唯讀屬性" -#: ../../reference/datamodel.rst:556 ../../reference/datamodel.rst:592 -#: ../../reference/datamodel.rst:1195 +#: ../../reference/datamodel.rst:578 ../../reference/datamodel.rst:620 +#: ../../reference/datamodel.rst:1223 msgid "Attribute" msgstr "屬性" -#: ../../reference/datamodel.rst:557 ../../reference/datamodel.rst:593 -#: ../../reference/datamodel.rst:1196 +#: ../../reference/datamodel.rst:579 ../../reference/datamodel.rst:621 +#: ../../reference/datamodel.rst:1224 msgid "Meaning" msgstr "含義" -#: ../../reference/datamodel.rst:560 +#: ../../reference/datamodel.rst:582 +msgid "" +"A reference to the :class:`dictionary ` that holds the function's " +"builtins namespace." +msgstr "" + +#: ../../reference/datamodel.rst:588 msgid "" "A reference to the :class:`dictionary ` that holds the function's :ref:" "`global variables ` -- the global namespace of the module in which " "the function was defined." msgstr "" -#: ../../reference/datamodel.rst:565 +#: ../../reference/datamodel.rst:593 msgid "" "``None`` or a :class:`tuple` of cells that contain bindings for the names " "specified in the :attr:`~codeobject.co_freevars` attribute of the " "function's :attr:`code object `." msgstr "" -#: ../../reference/datamodel.rst:569 +#: ../../reference/datamodel.rst:597 msgid "" "A cell object has the attribute ``cell_contents``. This can be used to get " "the value of the cell, as well as set the value." msgstr "" -#: ../../reference/datamodel.rst:573 ../../reference/datamodel.rst:1696 +#: ../../reference/datamodel.rst:601 ../../reference/datamodel.rst:1724 msgid "Special writable attributes" msgstr "特殊可寫屬性" -#: ../../reference/datamodel.rst:587 +#: ../../reference/datamodel.rst:615 msgid "Most of these attributes check the type of the assigned value:" msgstr "" -#: ../../reference/datamodel.rst:596 +#: ../../reference/datamodel.rst:624 msgid "The function's documentation string, or ``None`` if unavailable." msgstr "函式的文件字串,若不可用則為 ``None``。" -#: ../../reference/datamodel.rst:599 +#: ../../reference/datamodel.rst:627 msgid "" "The function's name. See also: :attr:`__name__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:603 +#: ../../reference/datamodel.rst:631 msgid "" "The function's :term:`qualified name`. See also: :attr:`__qualname__ " "attributes `." msgstr "" -#: ../../reference/datamodel.rst:609 +#: ../../reference/datamodel.rst:637 msgid "" "The name of the module the function was defined in, or ``None`` if " "unavailable." msgstr "" -#: ../../reference/datamodel.rst:613 +#: ../../reference/datamodel.rst:641 msgid "" "A :class:`tuple` containing default :term:`parameter` values for those " "parameters that have defaults, or ``None`` if no parameters have a default " "value." msgstr "" -#: ../../reference/datamodel.rst:618 +#: ../../reference/datamodel.rst:646 msgid "" "The :ref:`code object ` representing the compiled function " "body." msgstr "代表編譯函式主體的\\ :ref:`程式碼物件 `。" -#: ../../reference/datamodel.rst:622 +#: ../../reference/datamodel.rst:650 msgid "" "The namespace supporting arbitrary function attributes. See also: :attr:" "`__dict__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:626 +#: ../../reference/datamodel.rst:654 msgid "" "A :class:`dictionary ` containing annotations of :term:`parameters " "`. The keys of the dictionary are the parameter names, and " @@ -762,101 +792,101 @@ msgid "" "__annotations__`." msgstr "" -#: ../../reference/datamodel.rst:632 ../../reference/datamodel.rst:1101 -#: ../../reference/datamodel.rst:1253 +#: ../../reference/datamodel.rst:660 ../../reference/datamodel.rst:1129 +#: ../../reference/datamodel.rst:1281 msgid "" "Annotations are now :ref:`lazily evaluated `. See :pep:" "`649`." msgstr "" -#: ../../reference/datamodel.rst:637 +#: ../../reference/datamodel.rst:665 msgid "" "The :term:`annotate function` for this function, or ``None`` if the function " "has no annotations. See :attr:`object.__annotate__`." msgstr "" -#: ../../reference/datamodel.rst:643 +#: ../../reference/datamodel.rst:671 msgid "" "A :class:`dictionary ` containing defaults for keyword-only :term:" "`parameters `." msgstr "" -#: ../../reference/datamodel.rst:647 +#: ../../reference/datamodel.rst:675 msgid "" "A :class:`tuple` containing the :ref:`type parameters ` of a :" "ref:`generic function `." msgstr "" -#: ../../reference/datamodel.rst:652 +#: ../../reference/datamodel.rst:680 msgid "" "Function objects also support getting and setting arbitrary attributes, " "which can be used, for example, to attach metadata to functions. Regular " "attribute dot-notation is used to get and set such attributes." msgstr "" -#: ../../reference/datamodel.rst:658 +#: ../../reference/datamodel.rst:686 msgid "" "CPython's current implementation only supports function attributes on user-" "defined functions. Function attributes on :ref:`built-in functions ` may be supported in the future." msgstr "" -#: ../../reference/datamodel.rst:663 +#: ../../reference/datamodel.rst:691 msgid "" "Additional information about a function's definition can be retrieved from " "its :ref:`code object ` (accessible via the :attr:`~function." "__code__` attribute)." msgstr "" -#: ../../reference/datamodel.rst:671 +#: ../../reference/datamodel.rst:699 msgid "Instance methods" msgstr "實例方法" -#: ../../reference/datamodel.rst:678 +#: ../../reference/datamodel.rst:706 msgid "" "An instance method object combines a class, a class instance and any " "callable object (normally a user-defined function)." msgstr "" -#: ../../reference/datamodel.rst:688 ../../reference/datamodel.rst:1792 +#: ../../reference/datamodel.rst:716 ../../reference/datamodel.rst:1820 msgid "Special read-only attributes:" msgstr "特殊唯讀屬性:" -#: ../../reference/datamodel.rst:693 +#: ../../reference/datamodel.rst:721 msgid "" "Refers to the class instance object to which the method is :ref:`bound " "`" msgstr "" -#: ../../reference/datamodel.rst:697 +#: ../../reference/datamodel.rst:725 msgid "Refers to the original :ref:`function object `" msgstr "" -#: ../../reference/datamodel.rst:700 +#: ../../reference/datamodel.rst:728 msgid "" "The method's documentation (same as :attr:`method.__func__.__doc__ `). A :class:`string ` if the original function had a " "docstring, else ``None``." msgstr "" -#: ../../reference/datamodel.rst:706 +#: ../../reference/datamodel.rst:734 msgid "" "The name of the method (same as :attr:`method.__func__.__name__ `)" msgstr "" -#: ../../reference/datamodel.rst:710 +#: ../../reference/datamodel.rst:738 msgid "" "The name of the module the method was defined in, or ``None`` if unavailable." msgstr "" -#: ../../reference/datamodel.rst:713 +#: ../../reference/datamodel.rst:741 msgid "" "Methods also support accessing (but not setting) the arbitrary function " "attributes on the underlying :ref:`function object `." msgstr "" -#: ../../reference/datamodel.rst:716 +#: ../../reference/datamodel.rst:744 msgid "" "User-defined method objects may be created when getting an attribute of a " "class (perhaps via an instance of that class), if that attribute is a user-" @@ -864,7 +894,7 @@ msgid "" "`classmethod` object." msgstr "" -#: ../../reference/datamodel.rst:723 +#: ../../reference/datamodel.rst:751 msgid "" "When an instance method object is created by retrieving a user-defined :ref:" "`function object ` from a class via one of its " @@ -873,7 +903,7 @@ msgid "" "__func__` attribute is the original function object." msgstr "" -#: ../../reference/datamodel.rst:729 +#: ../../reference/datamodel.rst:757 msgid "" "When an instance method object is created by retrieving a :class:" "`classmethod` object from a class or instance, its :attr:`~method.__self__` " @@ -881,7 +911,7 @@ msgid "" "the function object underlying the class method." msgstr "" -#: ../../reference/datamodel.rst:734 +#: ../../reference/datamodel.rst:762 msgid "" "When an instance method object is called, the underlying function (:attr:" "`~method.__func__`) is called, inserting the class instance (:attr:`~method." @@ -891,7 +921,7 @@ msgid "" "f(x, 1)``." msgstr "" -#: ../../reference/datamodel.rst:741 +#: ../../reference/datamodel.rst:769 msgid "" "When an instance method object is derived from a :class:`classmethod` " "object, the \"class instance\" stored in :attr:`~method.__self__` will " @@ -900,18 +930,18 @@ msgid "" "function." msgstr "" -#: ../../reference/datamodel.rst:746 +#: ../../reference/datamodel.rst:774 msgid "" "It is important to note that user-defined functions which are attributes of " "a class instance are not converted to bound methods; this *only* happens " "when the function is an attribute of the class." msgstr "" -#: ../../reference/datamodel.rst:753 +#: ../../reference/datamodel.rst:781 msgid "Generator functions" msgstr "產生器函式" -#: ../../reference/datamodel.rst:759 +#: ../../reference/datamodel.rst:787 msgid "" "A function or method which uses the :keyword:`yield` statement (see section :" "ref:`yield`) is called a :dfn:`generator function`. Such a function, when " @@ -924,11 +954,11 @@ msgid "" "values to be returned." msgstr "" -#: ../../reference/datamodel.rst:771 +#: ../../reference/datamodel.rst:799 msgid "Coroutine functions" msgstr "Coroutine(協程)函式" -#: ../../reference/datamodel.rst:776 +#: ../../reference/datamodel.rst:804 msgid "" "A function or method which is defined using :keyword:`async def` is called " "a :dfn:`coroutine function`. Such a function, when called, returns a :term:" @@ -937,11 +967,11 @@ msgid "" "ref:`coroutine-objects` section." msgstr "" -#: ../../reference/datamodel.rst:784 +#: ../../reference/datamodel.rst:812 msgid "Asynchronous generator functions" msgstr "非同步產生器函式" -#: ../../reference/datamodel.rst:790 +#: ../../reference/datamodel.rst:818 msgid "" "A function or method which is defined using :keyword:`async def` and which " "uses the :keyword:`yield` statement is called a :dfn:`asynchronous generator " @@ -950,7 +980,7 @@ msgid "" "execute the body of the function." msgstr "" -#: ../../reference/datamodel.rst:796 +#: ../../reference/datamodel.rst:824 msgid "" "Calling the asynchronous iterator's :meth:`aiterator.__anext__ ` method will return an :term:`awaitable` which when awaited will " @@ -961,11 +991,11 @@ msgid "" "yielded." msgstr "" -#: ../../reference/datamodel.rst:809 +#: ../../reference/datamodel.rst:837 msgid "Built-in functions" msgstr "內建函式" -#: ../../reference/datamodel.rst:816 +#: ../../reference/datamodel.rst:844 msgid "" "A built-in function object is a wrapper around a C function. Examples of " "built-in functions are :func:`len` and :func:`math.sin` (:mod:`math` is a " @@ -976,7 +1006,7 @@ msgstr "" "func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數數量" "與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" -#: ../../reference/datamodel.rst:821 +#: ../../reference/datamodel.rst:849 msgid "" ":attr:`!__doc__` is the function's documentation string, or ``None`` if " "unavailable. See :attr:`function.__doc__`." @@ -984,26 +1014,26 @@ msgstr "" ":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請見 :attr:" "`function.__doc__`。" -#: ../../reference/datamodel.rst:823 +#: ../../reference/datamodel.rst:851 msgid "" ":attr:`!__name__` is the function's name. See :attr:`function.__name__`." msgstr ":attr:`!__name__` 是函式的名稱。請見 :attr:`function.__name__`。" -#: ../../reference/datamodel.rst:824 +#: ../../reference/datamodel.rst:852 msgid ":attr:`!__self__` is set to ``None`` (but see the next item)." msgstr "" -#: ../../reference/datamodel.rst:825 +#: ../../reference/datamodel.rst:853 msgid "" ":attr:`!__module__` is the name of the module the function was defined in or " "``None`` if unavailable. See :attr:`function.__module__`." msgstr "" -#: ../../reference/datamodel.rst:833 +#: ../../reference/datamodel.rst:861 msgid "Built-in methods" msgstr "內建方法" -#: ../../reference/datamodel.rst:840 +#: ../../reference/datamodel.rst:868 msgid "" "This is really a different disguise of a built-in function, this time " "containing an object passed to the C function as an implicit extra " @@ -1014,11 +1044,11 @@ msgid "" "__self__>`.)" msgstr "" -#: ../../reference/datamodel.rst:850 +#: ../../reference/datamodel.rst:878 msgid "Classes" msgstr "" -#: ../../reference/datamodel.rst:852 +#: ../../reference/datamodel.rst:880 msgid "" "Classes are callable. These objects normally act as factories for new " "instances of themselves, but variations are possible for class types that " @@ -1027,21 +1057,21 @@ msgid "" "initialize the new instance." msgstr "" -#: ../../reference/datamodel.rst:860 +#: ../../reference/datamodel.rst:888 msgid "Class Instances" msgstr "類別實例" -#: ../../reference/datamodel.rst:862 +#: ../../reference/datamodel.rst:890 msgid "" "Instances of arbitrary classes can be made callable by defining a :meth:" "`~object.__call__` method in their class." msgstr "" -#: ../../reference/datamodel.rst:869 +#: ../../reference/datamodel.rst:897 msgid "Modules" msgstr "模組" -#: ../../reference/datamodel.rst:875 +#: ../../reference/datamodel.rst:903 msgid "" "Modules are a basic organizational unit of Python code, and are created by " "the :ref:`import system ` as invoked either by the :keyword:" @@ -1056,17 +1086,17 @@ msgid "" "done)." msgstr "" -#: ../../reference/datamodel.rst:888 +#: ../../reference/datamodel.rst:916 msgid "" "Attribute assignment updates the module's namespace dictionary, e.g., ``m.x " "= 1`` is equivalent to ``m.__dict__[\"x\"] = 1``." msgstr "" -#: ../../reference/datamodel.rst:907 +#: ../../reference/datamodel.rst:935 msgid "Import-related attributes on module objects" msgstr "" -#: ../../reference/datamodel.rst:909 +#: ../../reference/datamodel.rst:937 msgid "" "Module objects have the following attributes that relate to the :ref:`import " "system `. When a module is created using the machinery " @@ -1075,7 +1105,7 @@ msgid "" "and loads the module." msgstr "" -#: ../../reference/datamodel.rst:915 +#: ../../reference/datamodel.rst:943 msgid "" "To create a module dynamically rather than using the import system, it's " "recommended to use :func:`importlib.util.module_from_spec`, which will set " @@ -1086,7 +1116,7 @@ msgid "" "approach." msgstr "" -#: ../../reference/datamodel.rst:925 +#: ../../reference/datamodel.rst:953 msgid "" "With the exception of :attr:`~module.__name__`, it is **strongly** " "recommended that you rely on :attr:`~module.__spec__` and its attributes " @@ -1095,7 +1125,7 @@ msgid "" "corresponding attribute on the module itself:" msgstr "" -#: ../../reference/datamodel.rst:931 +#: ../../reference/datamodel.rst:959 msgid "" ">>> import typing\n" ">>> typing.__name__, typing.__spec__.name\n" @@ -1117,34 +1147,34 @@ msgstr "" ">>> typing.__name__, typing.__spec__.name\n" "('keyboard_smashing', 'spelling')" -#: ../../reference/datamodel.rst:945 +#: ../../reference/datamodel.rst:973 msgid "" "The name used to uniquely identify the module in the import system. For a " "directly executed module, this will be set to ``\"__main__\"``." msgstr "" -#: ../../reference/datamodel.rst:948 +#: ../../reference/datamodel.rst:976 msgid "" "This attribute must be set to the fully qualified name of the module. It is " "expected to match the value of :attr:`module.__spec__.name `." msgstr "" -#: ../../reference/datamodel.rst:954 +#: ../../reference/datamodel.rst:982 msgid "A record of the module's import-system-related state." msgstr "" -#: ../../reference/datamodel.rst:956 +#: ../../reference/datamodel.rst:984 msgid "" "Set to the :class:`module spec ` that was " "used when importing the module. See :ref:`module-specs` for more details." msgstr "" -#: ../../reference/datamodel.rst:963 +#: ../../reference/datamodel.rst:991 msgid "The :term:`package` a module belongs to." msgstr "" -#: ../../reference/datamodel.rst:965 +#: ../../reference/datamodel.rst:993 msgid "" "If the module is top-level (that is, not a part of any specific package) " "then the attribute should be set to ``''`` (the empty string). Otherwise, it " @@ -1153,7 +1183,7 @@ msgid "" "for further details." msgstr "" -#: ../../reference/datamodel.rst:971 +#: ../../reference/datamodel.rst:999 msgid "" "This attribute is used instead of :attr:`~module.__name__` to calculate " "explicit relative imports for main modules. It defaults to ``None`` for " @@ -1162,7 +1192,7 @@ msgid "" "is set to a :class:`str`." msgstr "" -#: ../../reference/datamodel.rst:977 +#: ../../reference/datamodel.rst:1005 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.parent " "` instead of :attr:`!module." @@ -1170,14 +1200,14 @@ msgid "" "__spec__.parent` is not set, and this fallback path is deprecated." msgstr "" -#: ../../reference/datamodel.rst:983 ../../reference/datamodel.rst:1024 +#: ../../reference/datamodel.rst:1011 ../../reference/datamodel.rst:1052 msgid "" "This attribute now defaults to ``None`` for modules created dynamically " "using the :class:`types.ModuleType` constructor. Previously the attribute " "was optional." msgstr "" -#: ../../reference/datamodel.rst:988 +#: ../../reference/datamodel.rst:1016 msgid "" "The value of :attr:`!__package__` is expected to be the same as :attr:" "`__spec__.parent `. :attr:" @@ -1185,38 +1215,38 @@ msgid "" "attr:`!__spec__.parent` is not defined." msgstr "" -#: ../../reference/datamodel.rst:994 +#: ../../reference/datamodel.rst:1022 msgid "" ":exc:`ImportWarning` is raised if an import resolution falls back to :attr:`!" "__package__` instead of :attr:`__spec__.parent `." msgstr "" -#: ../../reference/datamodel.rst:999 +#: ../../reference/datamodel.rst:1027 msgid "" "Raise :exc:`DeprecationWarning` instead of :exc:`ImportWarning` when falling " "back to :attr:`!__package__` during import resolution." msgstr "" -#: ../../reference/datamodel.rst:1003 +#: ../../reference/datamodel.rst:1031 msgid "" ":attr:`!__package__` will cease to be set or taken into consideration by the " "import system or standard library." msgstr "" -#: ../../reference/datamodel.rst:1009 +#: ../../reference/datamodel.rst:1037 msgid "" "The :term:`loader` object that the import machinery used to load the module." msgstr "" -#: ../../reference/datamodel.rst:1011 +#: ../../reference/datamodel.rst:1039 msgid "" "This attribute is mostly useful for introspection, but can be used for " "additional loader-specific functionality, for example getting data " "associated with a loader." msgstr "" -#: ../../reference/datamodel.rst:1015 +#: ../../reference/datamodel.rst:1043 msgid "" ":attr:`!__loader__` defaults to ``None`` for modules created dynamically " "using the :class:`types.ModuleType` constructor; use :func:`importlib.util." @@ -1224,14 +1254,14 @@ msgid "" "object." msgstr "" -#: ../../reference/datamodel.rst:1020 +#: ../../reference/datamodel.rst:1048 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.loader " "` instead of :attr:`!module." "__loader__`." msgstr "" -#: ../../reference/datamodel.rst:1029 +#: ../../reference/datamodel.rst:1057 msgid "" "Setting :attr:`!__loader__` on a module while failing to set :attr:`!" "__spec__.loader` is deprecated. In Python 3.16, :attr:`!__loader__` will " @@ -1242,7 +1272,7 @@ msgstr "" "被棄用。在 Python 3.16 中,引入系統或標準函式庫將不再設定或考慮 :attr:`!" "__loader__`。" -#: ../../reference/datamodel.rst:1037 +#: ../../reference/datamodel.rst:1065 msgid "" "A (possibly empty) :term:`sequence` of strings enumerating the locations " "where the package's submodules will be found. Non-package modules should not " @@ -1250,21 +1280,21 @@ msgid "" "details." msgstr "" -#: ../../reference/datamodel.rst:1042 +#: ../../reference/datamodel.rst:1070 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__." "submodule_search_locations ` instead of :attr:`!module.__path__`." msgstr "" -#: ../../reference/datamodel.rst:1049 +#: ../../reference/datamodel.rst:1077 msgid "" ":attr:`!__file__` and :attr:`!__cached__` are both optional attributes that " "may or may not be set. Both attributes should be a :class:`str` when they " "are available." msgstr "" -#: ../../reference/datamodel.rst:1053 +#: ../../reference/datamodel.rst:1081 msgid "" ":attr:`!__file__` indicates the pathname of the file from which the module " "was loaded (if loaded from a file), or the pathname of the shared library " @@ -1275,7 +1305,7 @@ msgid "" "example, a module loaded from a database)." msgstr "" -#: ../../reference/datamodel.rst:1061 +#: ../../reference/datamodel.rst:1089 msgid "" "If :attr:`!__file__` is set then the :attr:`!__cached__` attribute might " "also be set, which is the path to any compiled version of the code (for " @@ -1284,7 +1314,7 @@ msgid "" "exist (see :pep:`3147`)." msgstr "" -#: ../../reference/datamodel.rst:1067 +#: ../../reference/datamodel.rst:1095 msgid "" "Note that :attr:`!__cached__` may be set even if :attr:`!__file__` is not " "set. However, that scenario is quite atypical. Ultimately, the :term:" @@ -1294,14 +1324,14 @@ msgid "" "file, that atypical scenario may be appropriate." msgstr "" -#: ../../reference/datamodel.rst:1074 +#: ../../reference/datamodel.rst:1102 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.cached " "` instead of :attr:`!module." "__cached__`." msgstr "" -#: ../../reference/datamodel.rst:1078 +#: ../../reference/datamodel.rst:1106 msgid "" "Setting :attr:`!__cached__` on a module while failing to set :attr:`!" "__spec__.cached` is deprecated. In Python 3.15, :attr:`!__cached__` will " @@ -1309,17 +1339,17 @@ msgid "" "library." msgstr "" -#: ../../reference/datamodel.rst:1085 +#: ../../reference/datamodel.rst:1113 msgid "Other writable attributes on module objects" msgstr "模組物件的其他可寫入屬性" -#: ../../reference/datamodel.rst:1087 +#: ../../reference/datamodel.rst:1115 msgid "" "As well as the import-related attributes listed above, module objects also " "have the following writable attributes:" msgstr "" -#: ../../reference/datamodel.rst:1092 +#: ../../reference/datamodel.rst:1120 msgid "" "The module's documentation string, or ``None`` if unavailable. See also: :" "attr:`__doc__ attributes `." @@ -1327,35 +1357,35 @@ msgstr "" "模組的文件字串,若不可用則為 ``None``。請見 :attr:`__doc__ attributes " "`。" -#: ../../reference/datamodel.rst:1097 +#: ../../reference/datamodel.rst:1125 msgid "" "A dictionary containing :term:`variable annotations ` " "collected during module body execution. For best practices on working with :" "attr:`!__annotations__`, see :mod:`annotationlib`." msgstr "" -#: ../../reference/datamodel.rst:1107 +#: ../../reference/datamodel.rst:1135 msgid "" "The :term:`annotate function` for this module, or ``None`` if the module has " "no annotations. See also: :attr:`~object.__annotate__` attributes." msgstr "" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1141 msgid "Module dictionaries" msgstr "模組字典" -#: ../../reference/datamodel.rst:1115 +#: ../../reference/datamodel.rst:1143 msgid "Module objects also have the following special read-only attribute:" msgstr "" -#: ../../reference/datamodel.rst:1120 +#: ../../reference/datamodel.rst:1148 msgid "" "The module's namespace as a dictionary object. Uniquely among the attributes " "listed here, :attr:`!__dict__` cannot be accessed as a global variable from " "within a module; it can only be accessed as an attribute on module objects." msgstr "" -#: ../../reference/datamodel.rst:1126 +#: ../../reference/datamodel.rst:1154 msgid "" "Because of the way CPython clears module dictionaries, the module dictionary " "will be cleared when the module falls out of scope even if the dictionary " @@ -1363,11 +1393,11 @@ msgid "" "module around while using its dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:1135 +#: ../../reference/datamodel.rst:1163 msgid "Custom classes" msgstr "" -#: ../../reference/datamodel.rst:1137 +#: ../../reference/datamodel.rst:1165 msgid "" "Custom class types are typically created by class definitions (see section :" "ref:`class`). A class has a namespace implemented by a dictionary object. " @@ -1382,7 +1412,7 @@ msgid "" "found at :ref:`python_2.3_mro`." msgstr "" -#: ../../reference/datamodel.rst:1158 +#: ../../reference/datamodel.rst:1186 msgid "" "When a class attribute reference (for class :class:`!C`, say) would yield a " "class method object, it is transformed into an instance method object whose :" @@ -1393,80 +1423,80 @@ msgid "" "contained in its :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:1169 +#: ../../reference/datamodel.rst:1197 msgid "" "Class attribute assignments update the class's dictionary, never the " "dictionary of a base class." msgstr "" -#: ../../reference/datamodel.rst:1174 +#: ../../reference/datamodel.rst:1202 msgid "" "A class object can be called (see above) to yield a class instance (see " "below)." msgstr "" -#: ../../reference/datamodel.rst:1177 ../../reference/datamodel.rst:1353 +#: ../../reference/datamodel.rst:1205 ../../reference/datamodel.rst:1381 msgid "Special attributes" msgstr "特殊屬性" -#: ../../reference/datamodel.rst:1199 +#: ../../reference/datamodel.rst:1227 msgid "" "The class's name. See also: :attr:`__name__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:1203 +#: ../../reference/datamodel.rst:1231 msgid "" "The class's :term:`qualified name`. See also: :attr:`__qualname__ attributes " "`." msgstr "" -#: ../../reference/datamodel.rst:1207 +#: ../../reference/datamodel.rst:1235 msgid "The name of the module in which the class was defined." msgstr "" -#: ../../reference/datamodel.rst:1210 +#: ../../reference/datamodel.rst:1238 msgid "" "A :class:`mapping proxy ` providing a read-only view " "of the class's namespace. See also: :attr:`__dict__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:1215 +#: ../../reference/datamodel.rst:1243 msgid "" "A :class:`tuple` containing the class's bases. In most cases, for a class " "defined as ``class X(A, B, C)``, ``X.__bases__`` will be exactly equal to " "``(A, B, C)``." msgstr "" -#: ../../reference/datamodel.rst:1222 +#: ../../reference/datamodel.rst:1250 msgid "" "The single base class in the inheritance chain that is responsible for the " "memory layout of instances. This attribute corresponds to :c:member:" "`~PyTypeObject.tp_base` at the C level." msgstr "" -#: ../../reference/datamodel.rst:1227 +#: ../../reference/datamodel.rst:1255 msgid "" "The class's documentation string, or ``None`` if undefined. Not inherited by " "subclasses." msgstr "" -#: ../../reference/datamodel.rst:1231 +#: ../../reference/datamodel.rst:1259 msgid "" "A dictionary containing :term:`variable annotations ` " "collected during class body execution. See also: :attr:`__annotations__ " "attributes `." msgstr "" -#: ../../reference/datamodel.rst:1236 +#: ../../reference/datamodel.rst:1264 msgid "" "For best practices on working with :attr:`~object.__annotations__`, please " "see :mod:`annotationlib`. Use :func:`annotationlib.get_annotations` instead " "of accessing this attribute directly." msgstr "" -#: ../../reference/datamodel.rst:1243 +#: ../../reference/datamodel.rst:1271 msgid "" "Accessing the :attr:`!__annotations__` attribute directly on a class object " "may return annotations for the wrong class, specifically in certain cases " @@ -1475,69 +1505,69 @@ msgid "" "details." msgstr "" -#: ../../reference/datamodel.rst:1249 +#: ../../reference/datamodel.rst:1277 msgid "" "This attribute does not exist on certain builtin classes. On user-defined " "classes without ``__annotations__``, it is an empty dictionary." msgstr "" -#: ../../reference/datamodel.rst:1258 +#: ../../reference/datamodel.rst:1286 msgid "" "The :term:`annotate function` for this class, or ``None`` if the class has " "no annotations. See also: :attr:`__annotate__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:1265 +#: ../../reference/datamodel.rst:1293 msgid "" "A :class:`tuple` containing the :ref:`type parameters ` of a :" "ref:`generic class `." msgstr "" -#: ../../reference/datamodel.rst:1271 +#: ../../reference/datamodel.rst:1299 msgid "" "A :class:`tuple` containing names of attributes of this class which are " "assigned through ``self.X`` from any function in its body." msgstr "" -#: ../../reference/datamodel.rst:1277 +#: ../../reference/datamodel.rst:1305 msgid "" "The line number of the first line of the class definition, including " "decorators. Setting the :attr:`~type.__module__` attribute removes the :attr:" "`!__firstlineno__` item from the type's dictionary." msgstr "" -#: ../../reference/datamodel.rst:1285 +#: ../../reference/datamodel.rst:1313 msgid "" "The :class:`tuple` of classes that are considered when looking for base " "classes during method resolution." msgstr "" -#: ../../reference/datamodel.rst:1290 +#: ../../reference/datamodel.rst:1318 msgid "Special methods" msgstr "特殊方法" -#: ../../reference/datamodel.rst:1292 +#: ../../reference/datamodel.rst:1320 msgid "" "In addition to the special attributes described above, all Python classes " "also have the following two methods available:" msgstr "" -#: ../../reference/datamodel.rst:1297 +#: ../../reference/datamodel.rst:1325 msgid "" "This method can be overridden by a metaclass to customize the method " "resolution order for its instances. It is called at class instantiation, " "and its result is stored in :attr:`~type.__mro__`." msgstr "" -#: ../../reference/datamodel.rst:1303 +#: ../../reference/datamodel.rst:1331 msgid "" "Each class keeps a list of weak references to its immediate subclasses. This " "method returns a list of all those references still alive. The list is in " "definition order. Example:" msgstr "" -#: ../../reference/datamodel.rst:1307 +#: ../../reference/datamodel.rst:1335 msgid "" ">>> class A: pass\n" ">>> class B(A): pass\n" @@ -1549,11 +1579,11 @@ msgstr "" ">>> A.__subclasses__()\n" "[]" -#: ../../reference/datamodel.rst:1315 +#: ../../reference/datamodel.rst:1343 msgid "Class instances" msgstr "類別實例" -#: ../../reference/datamodel.rst:1323 +#: ../../reference/datamodel.rst:1351 msgid "" "A class instance is created by calling a class object (see above). A class " "instance has a namespace implemented as a dictionary which is the first " @@ -1570,7 +1600,7 @@ msgid "" "__getattr__` method, that is called to satisfy the lookup." msgstr "" -#: ../../reference/datamodel.rst:1339 +#: ../../reference/datamodel.rst:1367 msgid "" "Attribute assignments and deletions update the instance's dictionary, never " "a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" @@ -1578,28 +1608,28 @@ msgid "" "instance dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1377 msgid "" "Class instances can pretend to be numbers, sequences, or mappings if they " "have methods with certain special names. See section :ref:`specialnames`." msgstr "" -#: ../../reference/datamodel.rst:1361 +#: ../../reference/datamodel.rst:1389 msgid "The class to which a class instance belongs." msgstr "" -#: ../../reference/datamodel.rst:1365 +#: ../../reference/datamodel.rst:1393 msgid "" "A dictionary or other mapping object used to store an object's (writable) " "attributes. Not all instances have a :attr:`!__dict__` attribute; see the " "section on :ref:`slots` for more details." msgstr "" -#: ../../reference/datamodel.rst:1371 +#: ../../reference/datamodel.rst:1399 msgid "I/O objects (also known as file objects)" msgstr "" -#: ../../reference/datamodel.rst:1386 +#: ../../reference/datamodel.rst:1414 msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " @@ -1608,7 +1638,7 @@ msgid "" "methods provided by extension modules)." msgstr "" -#: ../../reference/datamodel.rst:1392 +#: ../../reference/datamodel.rst:1420 msgid "" "The objects ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are initialized " "to file objects corresponding to the interpreter's standard input, output " @@ -1616,22 +1646,22 @@ msgid "" "interface defined by the :class:`io.TextIOBase` abstract class." msgstr "" -#: ../../reference/datamodel.rst:1400 +#: ../../reference/datamodel.rst:1428 msgid "Internal types" msgstr "" -#: ../../reference/datamodel.rst:1406 +#: ../../reference/datamodel.rst:1434 msgid "" "A few types used internally by the interpreter are exposed to the user. " "Their definitions may change with future versions of the interpreter, but " "they are mentioned here for completeness." msgstr "" -#: ../../reference/datamodel.rst:1414 +#: ../../reference/datamodel.rst:1442 msgid "Code objects" msgstr "程式碼物件" -#: ../../reference/datamodel.rst:1418 +#: ../../reference/datamodel.rst:1446 msgid "" "Code objects represent *byte-compiled* executable Python code, or :term:" "`bytecode`. The difference between a code object and a function object is " @@ -1643,111 +1673,111 @@ msgid "" "no references (directly or indirectly) to mutable objects." msgstr "" -#: ../../reference/datamodel.rst:1452 +#: ../../reference/datamodel.rst:1480 msgid "The function name" msgstr "函式名稱" -#: ../../reference/datamodel.rst:1455 +#: ../../reference/datamodel.rst:1483 msgid "The fully qualified function name" msgstr "" -#: ../../reference/datamodel.rst:1460 +#: ../../reference/datamodel.rst:1488 msgid "" "The total number of positional :term:`parameters ` (including " "positional-only parameters and parameters with default values) that the " "function has" msgstr "" -#: ../../reference/datamodel.rst:1465 +#: ../../reference/datamodel.rst:1493 msgid "" "The number of positional-only :term:`parameters ` (including " "arguments with default values) that the function has" msgstr "" -#: ../../reference/datamodel.rst:1469 +#: ../../reference/datamodel.rst:1497 msgid "" "The number of keyword-only :term:`parameters ` (including " "arguments with default values) that the function has" msgstr "" -#: ../../reference/datamodel.rst:1473 +#: ../../reference/datamodel.rst:1501 msgid "" "The number of :ref:`local variables ` used by the function " "(including parameters)" msgstr "" -#: ../../reference/datamodel.rst:1477 +#: ../../reference/datamodel.rst:1505 msgid "" "A :class:`tuple` containing the names of the local variables in the function " "(starting with the parameter names)" msgstr "" -#: ../../reference/datamodel.rst:1481 +#: ../../reference/datamodel.rst:1509 msgid "" "A :class:`tuple` containing the names of :ref:`local variables ` " "that are referenced from at least one :term:`nested scope` inside the " "function" msgstr "" -#: ../../reference/datamodel.rst:1485 +#: ../../reference/datamodel.rst:1513 msgid "" "A :class:`tuple` containing the names of :term:`free (closure) variables " "` that a :term:`nested scope` references in an outer " "scope. See also :attr:`function.__closure__`." msgstr "" -#: ../../reference/datamodel.rst:1489 +#: ../../reference/datamodel.rst:1517 msgid "Note: references to global and builtin names are *not* included." msgstr "" -#: ../../reference/datamodel.rst:1492 +#: ../../reference/datamodel.rst:1520 msgid "" "A string representing the sequence of :term:`bytecode` instructions in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1496 +#: ../../reference/datamodel.rst:1524 msgid "" "A :class:`tuple` containing the literals used by the :term:`bytecode` in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1500 +#: ../../reference/datamodel.rst:1528 msgid "" "A :class:`tuple` containing the names used by the :term:`bytecode` in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1504 +#: ../../reference/datamodel.rst:1532 msgid "The name of the file from which the code was compiled" msgstr "" -#: ../../reference/datamodel.rst:1507 +#: ../../reference/datamodel.rst:1535 msgid "The line number of the first line of the function" msgstr "" -#: ../../reference/datamodel.rst:1510 +#: ../../reference/datamodel.rst:1538 msgid "" "A string encoding the mapping from :term:`bytecode` offsets to line numbers. " "For details, see the source code of the interpreter." msgstr "" -#: ../../reference/datamodel.rst:1513 +#: ../../reference/datamodel.rst:1541 msgid "" "This attribute of code objects is deprecated, and may be removed in Python " "3.15." msgstr "" -#: ../../reference/datamodel.rst:1518 +#: ../../reference/datamodel.rst:1546 msgid "The required stack size of the code object" msgstr "" -#: ../../reference/datamodel.rst:1521 +#: ../../reference/datamodel.rst:1549 msgid "" "An :class:`integer ` encoding a number of flags for the interpreter." msgstr "" -#: ../../reference/datamodel.rst:1526 +#: ../../reference/datamodel.rst:1554 msgid "" "The following flag bits are defined for :attr:`~codeobject.co_flags`: bit " "``0x04`` is set if the function uses the ``*arguments`` syntax to accept an " @@ -1758,7 +1788,7 @@ msgid "" "might be present." msgstr "" -#: ../../reference/datamodel.rst:1534 +#: ../../reference/datamodel.rst:1562 msgid "" "Future feature declarations (for example, ``from __future__ import " "division``) also use bits in :attr:`~codeobject.co_flags` to indicate " @@ -1766,12 +1796,12 @@ msgid "" "attr:`~__future__._Feature.compiler_flag`." msgstr "" -#: ../../reference/datamodel.rst:1538 +#: ../../reference/datamodel.rst:1566 msgid "" "Other bits in :attr:`~codeobject.co_flags` are reserved for internal use." msgstr "" -#: ../../reference/datamodel.rst:1542 +#: ../../reference/datamodel.rst:1570 msgid "" "If a code object represents a function and has a docstring, the :data:" "`~inspect.CO_HAS_DOCSTRING` bit is set in :attr:`~codeobject.co_flags` and " @@ -1779,17 +1809,17 @@ msgid "" "function." msgstr "" -#: ../../reference/datamodel.rst:1548 +#: ../../reference/datamodel.rst:1576 msgid "Methods on code objects" msgstr "用於程式碼物件的方法" -#: ../../reference/datamodel.rst:1552 +#: ../../reference/datamodel.rst:1580 msgid "" "Returns an iterable over the source code positions of each :term:`bytecode` " "instruction in the code object." msgstr "" -#: ../../reference/datamodel.rst:1555 +#: ../../reference/datamodel.rst:1583 msgid "" "The iterator returns :class:`tuple`\\s containing the ``(start_line, " "end_line, start_column, end_column)``. The *i-th* tuple corresponds to the " @@ -1797,37 +1827,37 @@ msgid "" "information is 0-indexed utf-8 byte offsets on the given source line." msgstr "" -#: ../../reference/datamodel.rst:1561 +#: ../../reference/datamodel.rst:1589 msgid "" "This positional information can be missing. A non-exhaustive lists of cases " "where this may happen:" msgstr "" -#: ../../reference/datamodel.rst:1564 +#: ../../reference/datamodel.rst:1592 msgid "Running the interpreter with :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1565 +#: ../../reference/datamodel.rst:1593 msgid "" "Loading a pyc file compiled while using :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1566 +#: ../../reference/datamodel.rst:1594 msgid "Position tuples corresponding to artificial instructions." msgstr "" -#: ../../reference/datamodel.rst:1567 +#: ../../reference/datamodel.rst:1595 msgid "" "Line and column numbers that can't be represented due to implementation " "specific limitations." msgstr "" -#: ../../reference/datamodel.rst:1570 +#: ../../reference/datamodel.rst:1598 msgid "" "When this occurs, some or all of the tuple elements can be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:1576 +#: ../../reference/datamodel.rst:1604 msgid "" "This feature requires storing column positions in code objects which may " "result in a small increase of disk usage of compiled Python files or " @@ -1837,100 +1867,100 @@ msgid "" "environment variable can be used." msgstr "" -#: ../../reference/datamodel.rst:1585 +#: ../../reference/datamodel.rst:1613 msgid "" "Returns an iterator that yields information about successive ranges of :term:" "`bytecode`\\s. Each item yielded is a ``(start, end, lineno)`` :class:" "`tuple`:" msgstr "" -#: ../../reference/datamodel.rst:1589 +#: ../../reference/datamodel.rst:1617 msgid "" "``start`` (an :class:`int`) represents the offset (inclusive) of the start " "of the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1591 +#: ../../reference/datamodel.rst:1619 msgid "" "``end`` (an :class:`int`) represents the offset (exclusive) of the end of " "the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1593 +#: ../../reference/datamodel.rst:1621 msgid "" "``lineno`` is an :class:`int` representing the line number of the :term:" "`bytecode` range, or ``None`` if the bytecodes in the given range have no " "line number" msgstr "" -#: ../../reference/datamodel.rst:1597 +#: ../../reference/datamodel.rst:1625 msgid "The items yielded will have the following properties:" msgstr "" -#: ../../reference/datamodel.rst:1599 +#: ../../reference/datamodel.rst:1627 msgid "The first range yielded will have a ``start`` of 0." msgstr "" -#: ../../reference/datamodel.rst:1600 +#: ../../reference/datamodel.rst:1628 msgid "" "The ``(start, end)`` ranges will be non-decreasing and consecutive. That is, " "for any pair of :class:`tuple`\\s, the ``start`` of the second will be equal " "to the ``end`` of the first." msgstr "" -#: ../../reference/datamodel.rst:1603 +#: ../../reference/datamodel.rst:1631 msgid "No range will be backwards: ``end >= start`` for all triples." msgstr "" -#: ../../reference/datamodel.rst:1604 +#: ../../reference/datamodel.rst:1632 msgid "" "The last :class:`tuple` yielded will have ``end`` equal to the size of the :" "term:`bytecode`." msgstr "" -#: ../../reference/datamodel.rst:1607 +#: ../../reference/datamodel.rst:1635 msgid "" "Zero-width ranges, where ``start == end``, are allowed. Zero-width ranges " "are used for lines that are present in the source code, but have been " "eliminated by the :term:`bytecode` compiler." msgstr "" -#: ../../reference/datamodel.rst:1615 +#: ../../reference/datamodel.rst:1643 msgid ":pep:`626` - Precise line numbers for debugging and other tools." msgstr "" -#: ../../reference/datamodel.rst:1616 +#: ../../reference/datamodel.rst:1644 msgid "The PEP that introduced the :meth:`!co_lines` method." msgstr "" -#: ../../reference/datamodel.rst:1620 +#: ../../reference/datamodel.rst:1648 msgid "" "Return a copy of the code object with new values for the specified fields." msgstr "" -#: ../../reference/datamodel.rst:1622 +#: ../../reference/datamodel.rst:1650 msgid "" "Code objects are also supported by the generic function :func:`copy.replace`." msgstr "" -#: ../../reference/datamodel.rst:1630 +#: ../../reference/datamodel.rst:1658 msgid "Frame objects" msgstr "" -#: ../../reference/datamodel.rst:1634 +#: ../../reference/datamodel.rst:1662 msgid "" "Frame objects represent execution frames. They may occur in :ref:`traceback " "objects `, and are also passed to registered trace " "functions." msgstr "" -#: ../../reference/datamodel.rst:1653 +#: ../../reference/datamodel.rst:1681 msgid "" "Points to the previous stack frame (towards the caller), or ``None`` if this " "is the bottom stack frame" msgstr "" -#: ../../reference/datamodel.rst:1657 +#: ../../reference/datamodel.rst:1685 msgid "" "The :ref:`code object ` being executed in this frame. " "Accessing this attribute raises an :ref:`auditing event ` ``object." @@ -1940,61 +1970,61 @@ msgstr "" "這個屬性會引發一個附帶引數 ``obj`` 與 ``\"f_code\"`` 的\\ :ref:`稽核事件 " "` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1662 +#: ../../reference/datamodel.rst:1690 msgid "" "The mapping used by the frame to look up :ref:`local variables `. If " "the frame refers to an :term:`optimized scope`, this may return a write-" "through proxy object." msgstr "" -#: ../../reference/datamodel.rst:1667 +#: ../../reference/datamodel.rst:1695 msgid "Return a proxy for optimized scopes." msgstr "" -#: ../../reference/datamodel.rst:1671 +#: ../../reference/datamodel.rst:1699 msgid "" "The dictionary used by the frame to look up :ref:`global variables `" msgstr "" -#: ../../reference/datamodel.rst:1675 +#: ../../reference/datamodel.rst:1703 msgid "" "The dictionary used by the frame to look up :ref:`built-in (intrinsic) names " "`" msgstr "" -#: ../../reference/datamodel.rst:1679 +#: ../../reference/datamodel.rst:1707 msgid "" "The \"precise instruction\" of the frame object (this is an index into the :" "term:`bytecode` string of the :ref:`code object `)" msgstr "" -#: ../../reference/datamodel.rst:1684 +#: ../../reference/datamodel.rst:1712 msgid "" "The :term:`generator` or :term:`coroutine` object that owns this frame, or " "``None`` if the frame is a normal function." msgstr "" -#: ../../reference/datamodel.rst:1701 +#: ../../reference/datamodel.rst:1729 msgid "" "If not ``None``, this is a function called for various events during code " "execution (this is used by debuggers). Normally an event is triggered for " "each new source line (see :attr:`~frame.f_trace_lines`)." msgstr "" -#: ../../reference/datamodel.rst:1706 +#: ../../reference/datamodel.rst:1734 msgid "" "Set this attribute to :const:`False` to disable triggering a tracing event " "for each source line." msgstr "" -#: ../../reference/datamodel.rst:1710 +#: ../../reference/datamodel.rst:1738 msgid "" "Set this attribute to :const:`True` to allow per-opcode events to be " "requested. Note that this may lead to undefined interpreter behaviour if " "exceptions raised by the trace function escape to the function being traced." msgstr "" -#: ../../reference/datamodel.rst:1716 +#: ../../reference/datamodel.rst:1744 msgid "" "The current line number of the frame -- writing to this from within a trace " "function jumps to the given line (only for the bottom-most frame). A " @@ -2002,15 +2032,15 @@ msgid "" "this attribute." msgstr "" -#: ../../reference/datamodel.rst:1722 +#: ../../reference/datamodel.rst:1750 msgid "Frame object methods" msgstr "" -#: ../../reference/datamodel.rst:1724 +#: ../../reference/datamodel.rst:1752 msgid "Frame objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1728 +#: ../../reference/datamodel.rst:1756 msgid "" "This method clears all references to :ref:`local variables ` held by " "the frame. Also, if the frame belonged to a :term:`generator`, the " @@ -2019,34 +2049,34 @@ msgid "" "and storing its :ref:`traceback ` for later use)." msgstr "" -#: ../../reference/datamodel.rst:1734 +#: ../../reference/datamodel.rst:1762 msgid "" ":exc:`RuntimeError` is raised if the frame is currently executing or " "suspended." msgstr "" -#: ../../reference/datamodel.rst:1739 +#: ../../reference/datamodel.rst:1767 msgid "" "Attempting to clear a suspended frame raises :exc:`RuntimeError` (as has " "always been the case for executing frames)." msgstr "" -#: ../../reference/datamodel.rst:1747 +#: ../../reference/datamodel.rst:1775 msgid "Traceback objects" msgstr "" -#: ../../reference/datamodel.rst:1760 +#: ../../reference/datamodel.rst:1788 msgid "" "Traceback objects represent the stack trace of an :ref:`exception `. A traceback object is implicitly created when an exception occurs, " "and may also be explicitly created by calling :class:`types.TracebackType`." msgstr "" -#: ../../reference/datamodel.rst:1765 +#: ../../reference/datamodel.rst:1793 msgid "Traceback objects can now be explicitly instantiated from Python code." msgstr "" -#: ../../reference/datamodel.rst:1768 +#: ../../reference/datamodel.rst:1796 msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " @@ -2057,7 +2087,7 @@ msgid "" "the caught exception." msgstr "" -#: ../../reference/datamodel.rst:1777 +#: ../../reference/datamodel.rst:1805 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " @@ -2065,19 +2095,19 @@ msgid "" "last_traceback`." msgstr "" -#: ../../reference/datamodel.rst:1782 +#: ../../reference/datamodel.rst:1810 msgid "" "For explicitly created tracebacks, it is up to the creator of the traceback " "to determine how the :attr:`~traceback.tb_next` attributes should be linked " "to form a full stack trace." msgstr "" -#: ../../reference/datamodel.rst:1797 +#: ../../reference/datamodel.rst:1825 msgid "" "Points to the execution :ref:`frame ` of the current level." msgstr "" -#: ../../reference/datamodel.rst:1800 +#: ../../reference/datamodel.rst:1828 msgid "" "Accessing this attribute raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." @@ -2085,15 +2115,15 @@ msgstr "" "存取此屬性會引發一個附帶引數 ``obj`` 與 ``\"tb_frame\"`` 的\\ :ref:`稽核事件 " "` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1805 +#: ../../reference/datamodel.rst:1833 msgid "Gives the line number where the exception occurred" msgstr "" -#: ../../reference/datamodel.rst:1808 +#: ../../reference/datamodel.rst:1836 msgid "Indicates the \"precise instruction\"." msgstr "" -#: ../../reference/datamodel.rst:1810 +#: ../../reference/datamodel.rst:1838 msgid "" "The line number and last instruction in the traceback may differ from the " "line number of its :ref:`frame object ` if the exception " @@ -2101,39 +2131,39 @@ msgid "" "with a :keyword:`finally` clause." msgstr "" -#: ../../reference/datamodel.rst:1821 +#: ../../reference/datamodel.rst:1849 msgid "" "The special writable attribute :attr:`!tb_next` is the next level in the " "stack trace (towards the frame where the exception occurred), or ``None`` if " "there is no next level." msgstr "" -#: ../../reference/datamodel.rst:1825 +#: ../../reference/datamodel.rst:1853 msgid "This attribute is now writable" msgstr "此屬性現在可寫入" -#: ../../reference/datamodel.rst:1830 +#: ../../reference/datamodel.rst:1858 msgid "Slice objects" msgstr "" -#: ../../reference/datamodel.rst:1834 +#: ../../reference/datamodel.rst:1862 msgid "" "Slice objects are used to represent slices for :meth:`~object.__getitem__` " "methods. They are also created by the built-in :func:`slice` function." msgstr "" -#: ../../reference/datamodel.rst:1843 +#: ../../reference/datamodel.rst:1871 msgid "" "Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" "`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " "each is ``None`` if omitted. These attributes can have any type." msgstr "" -#: ../../reference/datamodel.rst:1847 +#: ../../reference/datamodel.rst:1875 msgid "Slice objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1851 +#: ../../reference/datamodel.rst:1879 msgid "" "This method takes a single integer argument *length* and computes " "information about the slice that the slice object would describe if applied " @@ -2143,11 +2173,11 @@ msgid "" "a manner consistent with regular slices." msgstr "" -#: ../../reference/datamodel.rst:1860 +#: ../../reference/datamodel.rst:1888 msgid "Static method objects" msgstr "" -#: ../../reference/datamodel.rst:1862 +#: ../../reference/datamodel.rst:1890 msgid "" "Static method objects provide a way of defeating the transformation of " "function objects to method objects described above. A static method object " @@ -2158,11 +2188,11 @@ msgid "" "method objects are created by the built-in :func:`staticmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1872 +#: ../../reference/datamodel.rst:1900 msgid "Class method objects" msgstr "" -#: ../../reference/datamodel.rst:1874 +#: ../../reference/datamodel.rst:1902 msgid "" "A class method object, like a static method object, is a wrapper around " "another object that alters the way in which that object is retrieved from " @@ -2172,11 +2202,11 @@ msgid "" "`classmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1884 +#: ../../reference/datamodel.rst:1912 msgid "Special method names" msgstr "" -#: ../../reference/datamodel.rst:1890 +#: ../../reference/datamodel.rst:1918 msgid "" "A class can implement certain operations that are invoked by special syntax " "(such as arithmetic operations or subscripting and slicing) by defining " @@ -2190,7 +2220,7 @@ msgid "" "`TypeError`)." msgstr "" -#: ../../reference/datamodel.rst:1901 +#: ../../reference/datamodel.rst:1929 msgid "" "Setting a special method to ``None`` indicates that the corresponding " "operation is not available. For example, if a class sets :meth:`~object." @@ -2199,7 +2229,7 @@ msgid "" "`~object.__getitem__`). [#]_" msgstr "" -#: ../../reference/datamodel.rst:1907 +#: ../../reference/datamodel.rst:1935 msgid "" "When implementing a class that emulates any built-in type, it is important " "that the emulation only be implemented to the degree that it makes sense for " @@ -2209,11 +2239,11 @@ msgid "" "in the W3C's Document Object Model.)" msgstr "" -#: ../../reference/datamodel.rst:1918 +#: ../../reference/datamodel.rst:1946 msgid "Basic customization" msgstr "" -#: ../../reference/datamodel.rst:1924 +#: ../../reference/datamodel.rst:1952 msgid "" "Called to create a new instance of class *cls*. :meth:`__new__` is a static " "method (special-cased so you need not declare it as such) that takes the " @@ -2223,7 +2253,7 @@ msgid "" "new object instance (usually an instance of *cls*)." msgstr "" -#: ../../reference/datamodel.rst:1931 +#: ../../reference/datamodel.rst:1959 msgid "" "Typical implementations create a new instance of the class by invoking the " "superclass's :meth:`__new__` method using ``super().__new__(cls[, ...])`` " @@ -2231,7 +2261,7 @@ msgid "" "necessary before returning it." msgstr "" -#: ../../reference/datamodel.rst:1936 +#: ../../reference/datamodel.rst:1964 msgid "" "If :meth:`__new__` is invoked during object construction and it returns an " "instance of *cls*, then the new instance’s :meth:`__init__` method will be " @@ -2240,13 +2270,13 @@ msgid "" "constructor." msgstr "" -#: ../../reference/datamodel.rst:1941 +#: ../../reference/datamodel.rst:1969 msgid "" "If :meth:`__new__` does not return an instance of *cls*, then the new " "instance's :meth:`__init__` method will not be invoked." msgstr "" -#: ../../reference/datamodel.rst:1944 +#: ../../reference/datamodel.rst:1972 msgid "" ":meth:`__new__` is intended mainly to allow subclasses of immutable types " "(like int, str, or tuple) to customize instance creation. It is also " @@ -2254,7 +2284,7 @@ msgid "" "creation." msgstr "" -#: ../../reference/datamodel.rst:1953 +#: ../../reference/datamodel.rst:1981 msgid "" "Called after the instance has been created (by :meth:`__new__`), but before " "it is returned to the caller. The arguments are those passed to the class " @@ -2264,7 +2294,7 @@ msgid "" "example: ``super().__init__([args...])``." msgstr "" -#: ../../reference/datamodel.rst:1960 +#: ../../reference/datamodel.rst:1988 msgid "" "Because :meth:`__new__` and :meth:`__init__` work together in constructing " "objects (:meth:`__new__` to create it, and :meth:`__init__` to customize " @@ -2272,7 +2302,7 @@ msgid "" "will cause a :exc:`TypeError` to be raised at runtime." msgstr "" -#: ../../reference/datamodel.rst:1973 +#: ../../reference/datamodel.rst:2001 msgid "" "Called when the instance is about to be destroyed. This is also called a " "finalizer or (improperly) a destructor. If a base class has a :meth:" @@ -2281,7 +2311,7 @@ msgid "" "instance." msgstr "" -#: ../../reference/datamodel.rst:1979 +#: ../../reference/datamodel.rst:2007 msgid "" "It is possible (though not recommended!) for the :meth:`__del__` method to " "postpone destruction of the instance by creating a new reference to it. " @@ -2291,7 +2321,7 @@ msgid "" "it once." msgstr "" -#: ../../reference/datamodel.rst:1986 +#: ../../reference/datamodel.rst:2014 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " "that still exist when the interpreter exits. :class:`weakref.finalize` " @@ -2299,14 +2329,14 @@ msgid "" "when an object is garbage collected." msgstr "" -#: ../../reference/datamodel.rst:1993 +#: ../../reference/datamodel.rst:2021 msgid "" "``del x`` doesn't directly call ``x.__del__()`` --- the former decrements " "the reference count for ``x`` by one, and the latter is only called when " "``x``'s reference count reaches zero." msgstr "" -#: ../../reference/datamodel.rst:1998 +#: ../../reference/datamodel.rst:2026 msgid "" "It is possible for a reference cycle to prevent the reference count of an " "object from going to zero. In this case, the cycle will be later detected " @@ -2317,18 +2347,18 @@ msgid "" "caught in the traceback." msgstr "" -#: ../../reference/datamodel.rst:2008 +#: ../../reference/datamodel.rst:2036 msgid "Documentation for the :mod:`gc` module." msgstr ":mod:`gc` 模組的文件。" -#: ../../reference/datamodel.rst:2012 +#: ../../reference/datamodel.rst:2040 msgid "" "Due to the precarious circumstances under which :meth:`__del__` methods are " "invoked, exceptions that occur during their execution are ignored, and a " "warning is printed to ``sys.stderr`` instead. In particular:" msgstr "" -#: ../../reference/datamodel.rst:2016 +#: ../../reference/datamodel.rst:2044 msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " @@ -2337,7 +2367,7 @@ msgid "" "`__del__`." msgstr "" -#: ../../reference/datamodel.rst:2022 +#: ../../reference/datamodel.rst:2050 msgid "" ":meth:`__del__` can be executed during interpreter shutdown. As a " "consequence, the global variables it needs to access (including other " @@ -2348,7 +2378,7 @@ msgid "" "still available at the time when the :meth:`__del__` method is called." msgstr "" -#: ../../reference/datamodel.rst:2037 +#: ../../reference/datamodel.rst:2065 msgid "" "Called by the :func:`repr` built-in function to compute the \"official\" " "string representation of an object. If at all possible, this should look " @@ -2360,14 +2390,14 @@ msgid "" "an \"informal\" string representation of instances of that class is required." msgstr "" -#: ../../reference/datamodel.rst:2046 +#: ../../reference/datamodel.rst:2074 msgid "" "This is typically used for debugging, so it is important that the " "representation is information-rich and unambiguous. A default implementation " "is provided by the :class:`object` class itself." msgstr "" -#: ../../reference/datamodel.rst:2058 +#: ../../reference/datamodel.rst:2086 msgid "" "Called by :func:`str(object) `, the default :meth:`__format__` " "implementation, and the built-in function :func:`print`, to compute the " @@ -2375,27 +2405,27 @@ msgid "" "return value must be a :ref:`str ` object." msgstr "" -#: ../../reference/datamodel.rst:2063 +#: ../../reference/datamodel.rst:2091 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:2067 +#: ../../reference/datamodel.rst:2095 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:2077 +#: ../../reference/datamodel.rst:2105 msgid "" "Called by :ref:`bytes ` to compute a byte-string representation " "of an object. This should return a :class:`bytes` object. The :class:" "`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:2089 +#: ../../reference/datamodel.rst:2117 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals ` and the :meth:`str.format` " @@ -2407,34 +2437,34 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:2099 +#: ../../reference/datamodel.rst:2127 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:2101 +#: ../../reference/datamodel.rst:2129 msgid "The return value must be a string object." msgstr "回傳值必須是個字串物件。" -#: ../../reference/datamodel.rst:2103 +#: ../../reference/datamodel.rst:2131 msgid "" "The default implementation by the :class:`object` class should be given an " "empty *format_spec* string. It delegates to :meth:`__str__`." msgstr "" -#: ../../reference/datamodel.rst:2106 +#: ../../reference/datamodel.rst:2134 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:2110 +#: ../../reference/datamodel.rst:2138 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:2126 +#: ../../reference/datamodel.rst:2154 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " "between operator symbols and method names is as follows: ``x.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:2224 +#: ../../reference/datamodel.rst:2252 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " @@ -2578,7 +2608,7 @@ msgid "" "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:2233 +#: ../../reference/datamodel.rst:2261 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are " "\"salted\" with an unpredictable random value. Although they remain " @@ -2586,7 +2616,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:2238 +#: ../../reference/datamodel.rst:2266 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " @@ -2594,22 +2624,22 @@ msgid "" "advisories/ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:2243 +#: ../../reference/datamodel.rst:2271 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:2247 +#: ../../reference/datamodel.rst:2275 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`。" -#: ../../reference/datamodel.rst:2249 +#: ../../reference/datamodel.rst:2277 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:2257 +#: ../../reference/datamodel.rst:2285 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " @@ -2619,18 +2649,18 @@ msgid "" "class itself), all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:2268 +#: ../../reference/datamodel.rst:2296 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:2270 +#: ../../reference/datamodel.rst:2298 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:2278 +#: ../../reference/datamodel.rst:2306 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " @@ -2641,7 +2671,7 @@ msgid "" "`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:2286 +#: ../../reference/datamodel.rst:2314 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" @@ -2654,7 +2684,7 @@ msgid "" "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:2299 +#: ../../reference/datamodel.rst:2327 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2666,64 +2696,64 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:2310 +#: ../../reference/datamodel.rst:2338 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions `. See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:2315 ../../reference/datamodel.rst:2317 +#: ../../reference/datamodel.rst:2343 ../../reference/datamodel.rst:2345 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2324 +#: ../../reference/datamodel.rst:2352 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:2328 +#: ../../reference/datamodel.rst:2356 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " "call the base class method with the same name, for example, ``object." "__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:2332 ../../reference/datamodel.rst:2334 +#: ../../reference/datamodel.rst:2360 ../../reference/datamodel.rst:2362 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:2341 +#: ../../reference/datamodel.rst:2369 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:2344 ../../reference/datamodel.rst:2346 +#: ../../reference/datamodel.rst:2372 ../../reference/datamodel.rst:2374 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2353 +#: ../../reference/datamodel.rst:2381 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:2358 +#: ../../reference/datamodel.rst:2386 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:2368 +#: ../../reference/datamodel.rst:2396 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " @@ -2735,21 +2765,21 @@ msgid "" "with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:2377 +#: ../../reference/datamodel.rst:2405 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:2383 +#: ../../reference/datamodel.rst:2411 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:2387 +#: ../../reference/datamodel.rst:2415 msgid "" "import sys\n" "from types import ModuleType\n" @@ -2777,7 +2807,7 @@ msgstr "" "\n" "sys.modules[__name__].__class__ = VerboseModule" -#: ../../reference/datamodel.rst:2401 +#: ../../reference/datamodel.rst:2429 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -2785,27 +2815,27 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:2406 +#: ../../reference/datamodel.rst:2434 msgid "``__class__`` module attribute is now writable." msgstr "``__class__`` 模組屬性現在是可寫入的。" -#: ../../reference/datamodel.rst:2409 +#: ../../reference/datamodel.rst:2437 msgid "``__getattr__`` and ``__dir__`` module attributes." msgstr "``__getattr__`` 和 ``__dir__`` 模組屬性。" -#: ../../reference/datamodel.rst:2414 +#: ../../reference/datamodel.rst:2442 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:2415 +#: ../../reference/datamodel.rst:2443 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:2421 +#: ../../reference/datamodel.rst:2449 msgid "Implementing Descriptors" msgstr "實作描述器" -#: ../../reference/datamodel.rst:2423 +#: ../../reference/datamodel.rst:2451 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " @@ -2816,7 +2846,7 @@ msgid "" "does not implement any of these protocols." msgstr "" -#: ../../reference/datamodel.rst:2433 +#: ../../reference/datamodel.rst:2461 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2825,13 +2855,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:2439 +#: ../../reference/datamodel.rst:2467 msgid "" "This method should return the computed attribute value or raise an :exc:" "`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:2442 +#: ../../reference/datamodel.rst:2470 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2841,31 +2871,31 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:2451 +#: ../../reference/datamodel.rst:2479 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:2454 +#: ../../reference/datamodel.rst:2482 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:2460 +#: ../../reference/datamodel.rst:2488 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:2462 +#: ../../reference/datamodel.rst:2490 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" -#: ../../reference/datamodel.rst:2467 +#: ../../reference/datamodel.rst:2495 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2876,11 +2906,11 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:2478 +#: ../../reference/datamodel.rst:2506 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2480 +#: ../../reference/datamodel.rst:2508 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " @@ -2889,7 +2919,7 @@ msgid "" "is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:2486 +#: ../../reference/datamodel.rst:2514 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2897,7 +2927,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:2491 +#: ../../reference/datamodel.rst:2519 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2905,54 +2935,54 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:2496 +#: ../../reference/datamodel.rst:2524 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:2499 +#: ../../reference/datamodel.rst:2527 msgid "Direct Call" msgstr "直接呼叫" -#: ../../reference/datamodel.rst:2500 +#: ../../reference/datamodel.rst:2528 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:2503 +#: ../../reference/datamodel.rst:2531 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:2504 +#: ../../reference/datamodel.rst:2532 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:2507 +#: ../../reference/datamodel.rst:2535 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:2508 +#: ../../reference/datamodel.rst:2536 msgid "" "If binding to a class, ``A.x`` is transformed into the call: ``A." "__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:2511 +#: ../../reference/datamodel.rst:2539 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:2512 +#: ../../reference/datamodel.rst:2540 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " "for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." "__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." msgstr "" -#: ../../reference/datamodel.rst:2549 +#: ../../reference/datamodel.rst:2577 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " @@ -2970,7 +3000,7 @@ msgid "" "instances." msgstr "" -#: ../../reference/datamodel.rst:2564 +#: ../../reference/datamodel.rst:2592 msgid "" "Python methods (including those decorated with :deco:`staticmethod` and :" "deco:`classmethod`) are implemented as non-data descriptors. Accordingly, " @@ -2979,30 +3009,30 @@ msgid "" "class." msgstr "" -#: ../../reference/datamodel.rst:2570 +#: ../../reference/datamodel.rst:2598 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:2577 +#: ../../reference/datamodel.rst:2605 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:2579 +#: ../../reference/datamodel.rst:2607 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:2583 +#: ../../reference/datamodel.rst:2611 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:2588 +#: ../../reference/datamodel.rst:2616 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " @@ -3010,18 +3040,18 @@ msgid "" "`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:2597 +#: ../../reference/datamodel.rst:2625 msgid "Notes on using *__slots__*:" msgstr "" -#: ../../reference/datamodel.rst:2599 +#: ../../reference/datamodel.rst:2627 msgid "" "When inheriting from a class without *__slots__*, the :attr:`~object." "__dict__` and *__weakref__* attribute of the instances will always be " "accessible." msgstr "" -#: ../../reference/datamodel.rst:2603 +#: ../../reference/datamodel.rst:2631 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -3030,7 +3060,7 @@ msgid "" "sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2610 +#: ../../reference/datamodel.rst:2638 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references ` to its " @@ -3038,7 +3068,7 @@ msgid "" "to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2616 +#: ../../reference/datamodel.rst:2644 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "` for each variable name. As a result, class attributes cannot " @@ -3046,7 +3076,7 @@ msgid "" "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:2622 +#: ../../reference/datamodel.rst:2650 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " @@ -3055,7 +3085,7 @@ msgid "" "only contain names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:2628 +#: ../../reference/datamodel.rst:2656 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -3064,7 +3094,7 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:2633 +#: ../../reference/datamodel.rst:2661 msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " @@ -3072,11 +3102,11 @@ msgid "" "`tuple`." msgstr "" -#: ../../reference/datamodel.rst:2638 +#: ../../reference/datamodel.rst:2666 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2640 +#: ../../reference/datamodel.rst:2668 msgid "" "If a :class:`dictionary ` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " @@ -3084,13 +3114,13 @@ msgid "" "func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" -#: ../../reference/datamodel.rst:2645 +#: ../../reference/datamodel.rst:2673 msgid "" ":attr:`~object.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2648 +#: ../../reference/datamodel.rst:2676 msgid "" ":ref:`Multiple inheritance ` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " @@ -3098,18 +3128,18 @@ msgid "" "raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2654 +#: ../../reference/datamodel.rst:2682 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:2662 +#: ../../reference/datamodel.rst:2690 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:2664 +#: ../../reference/datamodel.rst:2692 msgid "" "Whenever a class inherits from another class, :meth:`~object." "__init_subclass__` is called on the parent class. This way, it is possible " @@ -3119,14 +3149,14 @@ msgid "" "future subclasses of the class defining the method." msgstr "" -#: ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:2701 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:2677 +#: ../../reference/datamodel.rst:2705 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " @@ -3134,7 +3164,7 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:2683 +#: ../../reference/datamodel.rst:2711 msgid "" "class Philosopher:\n" " def __init_subclass__(cls, /, default_name, **kwargs):\n" @@ -3152,13 +3182,13 @@ msgstr "" "class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" " pass" -#: ../../reference/datamodel.rst:2691 +#: ../../reference/datamodel.rst:2719 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:2696 +#: ../../reference/datamodel.rst:2724 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -3166,19 +3196,19 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:2704 +#: ../../reference/datamodel.rst:2732 msgid "" "When a class is created, :meth:`!type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:2709 +#: ../../reference/datamodel.rst:2737 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:2712 +#: ../../reference/datamodel.rst:2740 msgid "" "class A:\n" " x = C() # Automatically calls: x.__set_name__(A, 'x')" @@ -3186,14 +3216,14 @@ msgstr "" "class A:\n" " x = C() # 自動呼叫:x.__set_name__(A, 'x')" -#: ../../reference/datamodel.rst:2715 +#: ../../reference/datamodel.rst:2743 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:2719 +#: ../../reference/datamodel.rst:2747 msgid "" "class A:\n" " pass\n" @@ -3203,22 +3233,22 @@ msgid "" "c.__set_name__(A, 'x') # Manually invoke the hook" msgstr "" -#: ../../reference/datamodel.rst:2726 +#: ../../reference/datamodel.rst:2754 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`。" -#: ../../reference/datamodel.rst:2734 +#: ../../reference/datamodel.rst:2762 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2741 +#: ../../reference/datamodel.rst:2769 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:2745 +#: ../../reference/datamodel.rst:2773 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -3226,7 +3256,7 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:2750 +#: ../../reference/datamodel.rst:2778 msgid "" "class Meta(type):\n" " pass\n" @@ -3246,41 +3276,41 @@ msgstr "" "class MySubclass(MyClass):\n" " pass" -#: ../../reference/datamodel.rst:2759 +#: ../../reference/datamodel.rst:2787 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:2762 +#: ../../reference/datamodel.rst:2790 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:2764 +#: ../../reference/datamodel.rst:2792 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:2765 +#: ../../reference/datamodel.rst:2793 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:2766 +#: ../../reference/datamodel.rst:2794 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:2767 +#: ../../reference/datamodel.rst:2795 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:2768 +#: ../../reference/datamodel.rst:2796 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:2772 +#: ../../reference/datamodel.rst:2800 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2776 +#: ../../reference/datamodel.rst:2804 msgid "" "If a base that appears in a class definition is not an instance of :class:" "`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " @@ -3292,59 +3322,59 @@ msgid "" "is ignored." msgstr "" -#: ../../reference/datamodel.rst:2787 +#: ../../reference/datamodel.rst:2815 msgid ":func:`types.resolve_bases`" msgstr ":func:`types.resolve_bases`" -#: ../../reference/datamodel.rst:2788 +#: ../../reference/datamodel.rst:2816 msgid "Dynamically resolve bases that are not instances of :class:`type`." msgstr "" -#: ../../reference/datamodel.rst:2790 +#: ../../reference/datamodel.rst:2818 msgid ":func:`types.get_original_bases`" msgstr ":func:`types.get_original_bases`" -#: ../../reference/datamodel.rst:2791 +#: ../../reference/datamodel.rst:2819 msgid "" "Retrieve a class's \"original bases\" prior to modifications by :meth:" "`~object.__mro_entries__`." msgstr "" -#: ../../reference/datamodel.rst:2794 +#: ../../reference/datamodel.rst:2822 msgid ":pep:`560`" msgstr ":pep:`560`" -#: ../../reference/datamodel.rst:2795 +#: ../../reference/datamodel.rst:2823 msgid "Core support for typing module and generic types." msgstr "" -#: ../../reference/datamodel.rst:2799 +#: ../../reference/datamodel.rst:2827 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2803 +#: ../../reference/datamodel.rst:2831 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2805 +#: ../../reference/datamodel.rst:2833 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2806 +#: ../../reference/datamodel.rst:2834 msgid "" "if an explicit metaclass is given and it is *not* an instance of :func:" "`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2808 +#: ../../reference/datamodel.rst:2836 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2811 +#: ../../reference/datamodel.rst:2839 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -3353,11 +3383,11 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2821 +#: ../../reference/datamodel.rst:2849 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2826 +#: ../../reference/datamodel.rst:2854 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -3369,25 +3399,25 @@ msgid "" "copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2835 +#: ../../reference/datamodel.rst:2863 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2840 +#: ../../reference/datamodel.rst:2868 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2841 +#: ../../reference/datamodel.rst:2869 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2845 +#: ../../reference/datamodel.rst:2873 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2850 +#: ../../reference/datamodel.rst:2878 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -3396,7 +3426,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2856 +#: ../../reference/datamodel.rst:2884 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -3405,11 +3435,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2865 +#: ../../reference/datamodel.rst:2893 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2872 +#: ../../reference/datamodel.rst:2900 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -3417,7 +3447,7 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2877 +#: ../../reference/datamodel.rst:2905 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " @@ -3428,7 +3458,7 @@ msgid "" "is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2887 +#: ../../reference/datamodel.rst:2915 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -3437,39 +3467,39 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2893 +#: ../../reference/datamodel.rst:2921 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2897 +#: ../../reference/datamodel.rst:2925 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2899 +#: ../../reference/datamodel.rst:2927 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2901 +#: ../../reference/datamodel.rst:2929 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2904 +#: ../../reference/datamodel.rst:2932 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2908 +#: ../../reference/datamodel.rst:2936 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " @@ -3477,19 +3507,19 @@ msgid "" "becomes the :attr:`~type.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2915 +#: ../../reference/datamodel.rst:2943 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2916 +#: ../../reference/datamodel.rst:2944 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2920 +#: ../../reference/datamodel.rst:2948 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2922 +#: ../../reference/datamodel.rst:2950 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -3497,17 +3527,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2929 +#: ../../reference/datamodel.rst:2957 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2931 +#: ../../reference/datamodel.rst:2959 msgid "" "The following methods are used to override the default behavior of the :func:" "`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2934 +#: ../../reference/datamodel.rst:2962 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -3515,21 +3545,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2941 +#: ../../reference/datamodel.rst:2969 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2948 +#: ../../reference/datamodel.rst:2976 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2953 +#: ../../reference/datamodel.rst:2981 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -3537,11 +3567,11 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2960 +#: ../../reference/datamodel.rst:2988 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2961 +#: ../../reference/datamodel.rst:2989 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" "`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" @@ -3550,11 +3580,11 @@ msgid "" "language." msgstr "" -#: ../../reference/datamodel.rst:2969 +#: ../../reference/datamodel.rst:2997 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2971 +#: ../../reference/datamodel.rst:2999 msgid "" "When using :term:`type annotations`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -3562,65 +3592,65 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2978 +#: ../../reference/datamodel.rst:3006 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../reference/datamodel.rst:2979 +#: ../../reference/datamodel.rst:3007 msgid "Introducing Python's framework for type annotations" msgstr "引入 Python 的型別註釋框架" -#: ../../reference/datamodel.rst:2981 +#: ../../reference/datamodel.rst:3009 msgid ":ref:`Generic Alias Types`" msgstr ":ref:`泛型別名型別 `" -#: ../../reference/datamodel.rst:2982 +#: ../../reference/datamodel.rst:3010 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2984 +#: ../../reference/datamodel.rst:3012 msgid "" ":ref:`Generics`, :ref:`user-defined generics` and :" "class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2985 +#: ../../reference/datamodel.rst:3013 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2988 +#: ../../reference/datamodel.rst:3016 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2993 +#: ../../reference/datamodel.rst:3021 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2996 +#: ../../reference/datamodel.rst:3024 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " "method. As such, there is no need for it to be decorated with :deco:" "`classmethod` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:3002 +#: ../../reference/datamodel.rst:3030 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:3004 +#: ../../reference/datamodel.rst:3032 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints` to these classes." msgstr "" -#: ../../reference/datamodel.rst:3008 +#: ../../reference/datamodel.rst:3036 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -3629,7 +3659,7 @@ msgid "" "own implementation of ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:3014 +#: ../../reference/datamodel.rst:3042 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -3637,11 +3667,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:3024 +#: ../../reference/datamodel.rst:3052 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:3026 +#: ../../reference/datamodel.rst:3054 msgid "" "Usually, the :ref:`subscription` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -3651,14 +3681,14 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:3033 +#: ../../reference/datamodel.rst:3061 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " "follows something like the following process to decide whether :meth:" "`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" -#: ../../reference/datamodel.rst:3038 +#: ../../reference/datamodel.rst:3066 msgid "" "from inspect import isclass\n" "\n" @@ -3684,7 +3714,7 @@ msgid "" " )" msgstr "" -#: ../../reference/datamodel.rst:3061 +#: ../../reference/datamodel.rst:3089 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " @@ -3694,7 +3724,7 @@ msgid "" "__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:3068 +#: ../../reference/datamodel.rst:3096 msgid "" ">>> # list has class \"type\" as its metaclass, like most classes:\n" ">>> type(list)\n" @@ -3709,14 +3739,14 @@ msgid "" "" msgstr "" -#: ../../reference/datamodel.rst:3080 +#: ../../reference/datamodel.rst:3108 msgid "" "However, if a class has a custom metaclass that defines :meth:`~object." "__getitem__`, subscribing the class may result in different behaviour. An " "example of this can be found in the :mod:`enum` module::" msgstr "" -#: ../../reference/datamodel.rst:3084 +#: ../../reference/datamodel.rst:3112 msgid "" ">>> from enum import Enum\n" ">>> class Menu(Enum):\n" @@ -3736,33 +3766,33 @@ msgid "" "" msgstr "" -#: ../../reference/datamodel.rst:3103 +#: ../../reference/datamodel.rst:3131 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:3104 +#: ../../reference/datamodel.rst:3132 msgid "" "Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" "`subscription` results in ``__class_getitem__()`` being " "called instead of :meth:`~object.__getitem__`" msgstr "" -#: ../../reference/datamodel.rst:3112 +#: ../../reference/datamodel.rst:3140 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:3119 +#: ../../reference/datamodel.rst:3147 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " "arg1, ...)``. The :class:`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:3127 +#: ../../reference/datamodel.rst:3155 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:3129 +#: ../../reference/datamodel.rst:3157 msgid "" "The following methods can be defined to implement container objects. None of " "them are provided by the :class:`object` class itself. Containers usually " @@ -3783,7 +3813,7 @@ msgid "" "__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`." msgstr "" -#: ../../reference/datamodel.rst:3148 +#: ../../reference/datamodel.rst:3176 msgid "" "Mutable sequences should provide methods :meth:`~sequence.append`, :meth:" "`~sequence.clear`, :meth:`~sequence.count`, :meth:`~sequence.extend`, :meth:" @@ -3797,7 +3827,7 @@ msgid "" "numerical operators." msgstr "" -#: ../../reference/datamodel.rst:3160 +#: ../../reference/datamodel.rst:3188 msgid "" "It is recommended that both mappings and sequences implement the :meth:" "`~object.__contains__` method to allow efficient use of the ``in`` operator; " @@ -3809,7 +3839,7 @@ msgid "" "iterate through the values." msgstr "" -#: ../../reference/datamodel.rst:3175 +#: ../../reference/datamodel.rst:3203 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -3817,7 +3847,7 @@ msgid "" "returns zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:3182 +#: ../../reference/datamodel.rst:3210 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " "length is larger than :data:`!sys.maxsize` some features (such as :func:" @@ -3826,7 +3856,7 @@ msgid "" "`~object.__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:3191 +#: ../../reference/datamodel.rst:3219 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -3836,53 +3866,76 @@ msgid "" "never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:3205 +#: ../../reference/datamodel.rst:3233 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:3207 +#: ../../reference/datamodel.rst:3235 msgid "a[1:2] = b" msgstr "a[1:2] = b" -#: ../../reference/datamodel.rst:3209 +#: ../../reference/datamodel.rst:3237 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:3211 +#: ../../reference/datamodel.rst:3239 msgid "a[slice(1, 2, None)] = b" msgstr "a[slice(1, 2, None)] = b" -#: ../../reference/datamodel.rst:3213 +#: ../../reference/datamodel.rst:3241 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:3218 +#: ../../reference/datamodel.rst:3246 msgid "" -"Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " -"the accepted keys should be integers. Optionally, they may support :class:" -"`slice` objects as well. Negative index support is also optional. If *key* " -"is of an inappropriate type, :exc:`TypeError` may be raised; if *key* is a " -"value outside the set of indexes for the sequence (after any special " -"interpretation of negative values), :exc:`IndexError` should be raised. For :" -"term:`mapping` types, if *key* is missing (not in the container), :exc:" -"`KeyError` should be raised." +"Called to implement *subscription*, that is, ``self[subscript]``. See :ref:" +"`subscriptions` for details on the syntax." msgstr "" -#: ../../reference/datamodel.rst:3230 +#: ../../reference/datamodel.rst:3249 msgid "" -":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " -"illegal indexes to allow proper detection of the end of the sequence." +"There are two types of built-in objects that support subscription via :meth:" +"`!__getitem__`:" msgstr "" -#: ../../reference/datamodel.rst:3235 +#: ../../reference/datamodel.rst:3252 +msgid "" +"**sequences**, where *subscript* (also called :term:`index`) should be an " +"integer or a :class:`slice` object. See the :ref:`sequence documentation " +"` for the expected behavior, including handling :class:" +"`slice` objects and negative indices." +msgstr "" + +#: ../../reference/datamodel.rst:3256 +msgid "" +"**mappings**, where *subscript* is also called the :term:`key`. See :ref:" +"`mapping documentation ` for the expected behavior." +msgstr "" + +#: ../../reference/datamodel.rst:3260 +msgid "" +"If *subscript* is of an inappropriate type, :meth:`!__getitem__` should " +"raise :exc:`TypeError`. If *subscript* has an inappropriate value, :meth:`!" +"__getitem__` should raise an :exc:`LookupError` or one of its subclasses (:" +"exc:`IndexError` for sequences; :exc:`KeyError` for mappings)." +msgstr "" + +#: ../../reference/datamodel.rst:3268 +msgid "" +"The sequence iteration protocol (used, for example, in :keyword:`for` " +"loops), expects that an :exc:`IndexError` will be raised for illegal indexes " +"to allow proper detection of the end of a sequence." +msgstr "" + +#: ../../reference/datamodel.rst:3274 msgid "" -"When :ref:`subscripting` a *class*, the special class method :" -"meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " -"See :ref:`classgetitem-versus-getitem` for more details." +"When :ref:`subscripting ` a *class*, the special class " +"method :meth:`~object.__class_getitem__` may be called instead of :meth:`!" +"__getitem__`. See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:3243 +#: ../../reference/datamodel.rst:3282 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3891,7 +3944,7 @@ msgid "" "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:3252 +#: ../../reference/datamodel.rst:3291 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3900,13 +3953,13 @@ msgid "" "values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:3261 +#: ../../reference/datamodel.rst:3300 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:3267 +#: ../../reference/datamodel.rst:3306 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -3914,14 +3967,14 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:3275 +#: ../../reference/datamodel.rst:3314 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:3279 +#: ../../reference/datamodel.rst:3318 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " "built-in will fall back to using the sequence protocol (:meth:`__len__` and :" @@ -3930,7 +3983,7 @@ msgid "" "more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:3286 +#: ../../reference/datamodel.rst:3325 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -3938,14 +3991,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:3293 +#: ../../reference/datamodel.rst:3332 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:3297 +#: ../../reference/datamodel.rst:3336 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -3953,11 +4006,11 @@ msgid "" "reference `." msgstr "" -#: ../../reference/datamodel.rst:3306 +#: ../../reference/datamodel.rst:3345 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:3308 +#: ../../reference/datamodel.rst:3347 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3965,7 +4018,7 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:3334 +#: ../../reference/datamodel.rst:3373 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3979,13 +4032,13 @@ msgid "" "`pow` function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:3345 +#: ../../reference/datamodel.rst:3384 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3368 +#: ../../reference/datamodel.rst:3407 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3999,21 +4052,21 @@ msgid "" "`NotImplemented` or ``type(y)`` is a subclass of ``type(x)``. [#]_" msgstr "" -#: ../../reference/datamodel.rst:3379 +#: ../../reference/datamodel.rst:3418 msgid "" "Note that :meth:`__rpow__` should be defined to accept an optional third " "argument if the three-argument version of the built-in :func:`pow` function " "is to be supported." msgstr "" -#: ../../reference/datamodel.rst:3385 +#: ../../reference/datamodel.rst:3424 msgid "" "Three-argument :func:`pow` now try calling :meth:`~object.__rpow__` if " "necessary. Previously it was only called in two-argument :func:`!pow` and " "the binary power operator." msgstr "" -#: ../../reference/datamodel.rst:3391 +#: ../../reference/datamodel.rst:3430 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -4022,7 +4075,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:3411 +#: ../../reference/datamodel.rst:3450 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -4040,19 +4093,19 @@ msgid "" "data model." msgstr "" -#: ../../reference/datamodel.rst:3434 +#: ../../reference/datamodel.rst:3473 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:3447 +#: ../../reference/datamodel.rst:3486 msgid "" "Called to implement the built-in functions :func:`complex`, :func:`int` and :" "func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:3454 +#: ../../reference/datamodel.rst:3493 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -4061,14 +4114,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:3460 +#: ../../reference/datamodel.rst:3499 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:3472 +#: ../../reference/datamodel.rst:3511 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -4077,16 +4130,16 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:3478 +#: ../../reference/datamodel.rst:3517 msgid "" ":func:`int` no longer delegates to the :meth:`~object.__trunc__` method." msgstr "" -#: ../../reference/datamodel.rst:3485 +#: ../../reference/datamodel.rst:3524 msgid "With Statement Context Managers" msgstr "With 陳述式的情境管理器" -#: ../../reference/datamodel.rst:3487 +#: ../../reference/datamodel.rst:3526 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -4096,34 +4149,34 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:3498 +#: ../../reference/datamodel.rst:3537 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:3501 +#: ../../reference/datamodel.rst:3540 msgid "" "For more information on context managers, see :ref:`typecontextmanager`. " "The :class:`object` class itself does not provide the context manager " "methods." msgstr "" -#: ../../reference/datamodel.rst:3507 +#: ../../reference/datamodel.rst:3546 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:3514 +#: ../../reference/datamodel.rst:3553 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:3518 +#: ../../reference/datamodel.rst:3557 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -4131,27 +4184,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:3522 +#: ../../reference/datamodel.rst:3561 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:3528 +#: ../../reference/datamodel.rst:3567 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../reference/datamodel.rst:3529 +#: ../../reference/datamodel.rst:3568 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3536 +#: ../../reference/datamodel.rst:3575 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:3538 +#: ../../reference/datamodel.rst:3577 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -4159,7 +4212,7 @@ msgid "" "pattern, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:3545 +#: ../../reference/datamodel.rst:3584 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -4168,7 +4221,7 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:3551 +#: ../../reference/datamodel.rst:3590 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -4178,19 +4231,19 @@ msgid "" "exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:3561 +#: ../../reference/datamodel.rst:3600 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:3562 +#: ../../reference/datamodel.rst:3601 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:3568 +#: ../../reference/datamodel.rst:3607 msgid "Emulating buffer types" msgstr "" -#: ../../reference/datamodel.rst:3570 +#: ../../reference/datamodel.rst:3609 msgid "" "The :ref:`buffer protocol ` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " @@ -4198,13 +4251,13 @@ msgid "" "and third-party libraries may define additional buffer types." msgstr "" -#: ../../reference/datamodel.rst:3575 +#: ../../reference/datamodel.rst:3614 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" -#: ../../reference/datamodel.rst:3580 +#: ../../reference/datamodel.rst:3619 msgid "" "Called when a buffer is requested from *self* (for example, by the :class:" "`memoryview` constructor). The *flags* argument is an integer representing " @@ -4214,7 +4267,7 @@ msgid "" "`memoryview` object." msgstr "" -#: ../../reference/datamodel.rst:3589 +#: ../../reference/datamodel.rst:3628 msgid "" "Called when a buffer is no longer needed. The *buffer* argument is a :class:" "`memoryview` object that was previously returned by :meth:`~object." @@ -4223,35 +4276,35 @@ msgid "" "to perform any cleanup are not required to implement this method." msgstr "" -#: ../../reference/datamodel.rst:3600 +#: ../../reference/datamodel.rst:3639 msgid ":pep:`688` - Making the buffer protocol accessible in Python" msgstr "" -#: ../../reference/datamodel.rst:3601 +#: ../../reference/datamodel.rst:3640 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3603 +#: ../../reference/datamodel.rst:3642 msgid ":class:`collections.abc.Buffer`" msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3604 +#: ../../reference/datamodel.rst:3643 msgid "ABC for buffer types." msgstr "" -#: ../../reference/datamodel.rst:3607 +#: ../../reference/datamodel.rst:3646 msgid "Annotations" msgstr "" -#: ../../reference/datamodel.rst:3609 +#: ../../reference/datamodel.rst:3648 msgid "" "Functions, classes, and modules may contain :term:`annotations " "`, which are a way to associate information (usually :term:`type " "hints `) with a symbol." msgstr "" -#: ../../reference/datamodel.rst:3615 +#: ../../reference/datamodel.rst:3654 msgid "" "This attribute contains the annotations for an object. It is :ref:`lazily " "evaluated `, so accessing the attribute may execute " @@ -4259,24 +4312,24 @@ msgid "" "attribute is set to a dictionary mapping from variable names to annotations." msgstr "" -#: ../../reference/datamodel.rst:3620 +#: ../../reference/datamodel.rst:3659 msgid "Annotations are now lazily evaluated." msgstr "" -#: ../../reference/datamodel.rst:3625 +#: ../../reference/datamodel.rst:3664 msgid "" "An :term:`annotate function`. Returns a new dictionary object mapping " "attribute/parameter names to their annotation values." msgstr "" -#: ../../reference/datamodel.rst:3628 +#: ../../reference/datamodel.rst:3667 msgid "" "Takes a format parameter specifying the format in which annotations values " "should be provided. It must be a member of the :class:`annotationlib.Format` " "enum, or an integer with a value corresponding to a member of the enum." msgstr "" -#: ../../reference/datamodel.rst:3632 +#: ../../reference/datamodel.rst:3671 msgid "" "If an annotate function doesn't support the requested format, it must raise :" "exc:`NotImplementedError`. Annotate functions must always support :attr:" @@ -4284,34 +4337,34 @@ msgid "" "`NotImplementedError()` when called with this format." msgstr "" -#: ../../reference/datamodel.rst:3637 +#: ../../reference/datamodel.rst:3676 msgid "" "When called with :attr:`~annotationlib.Format.VALUE` format, an annotate " "function may raise :exc:`NameError`; it must not raise :exc:`!NameError` " "when called requesting any other format." msgstr "" -#: ../../reference/datamodel.rst:3640 +#: ../../reference/datamodel.rst:3679 msgid "" "If an object does not have any annotations, :attr:`~object.__annotate__` " "should preferably be set to ``None`` (it can’t be deleted), rather than set " "to a function that returns an empty dict." msgstr "" -#: ../../reference/datamodel.rst:3647 +#: ../../reference/datamodel.rst:3686 msgid ":pep:`649` --- Deferred evaluation of annotation using descriptors" msgstr "" -#: ../../reference/datamodel.rst:3648 +#: ../../reference/datamodel.rst:3687 msgid "" "Introduces lazy evaluation of annotations and the ``__annotate__`` function." msgstr "" -#: ../../reference/datamodel.rst:3654 +#: ../../reference/datamodel.rst:3693 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:3656 +#: ../../reference/datamodel.rst:3695 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -4319,7 +4372,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:3661 +#: ../../reference/datamodel.rst:3700 msgid "" ">>> class C:\n" "... pass\n" @@ -4341,7 +4394,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: object of type 'C' has no len()" -#: ../../reference/datamodel.rst:3671 +#: ../../reference/datamodel.rst:3710 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -4350,7 +4403,7 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:3678 +#: ../../reference/datamodel.rst:3717 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -4366,14 +4419,14 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: descriptor '__hash__' of 'int' object needs an argument" -#: ../../reference/datamodel.rst:3685 +#: ../../reference/datamodel.rst:3724 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:3689 +#: ../../reference/datamodel.rst:3728 msgid "" ">>> type(1).__hash__(1) == hash(1)\n" "True\n" @@ -4385,14 +4438,14 @@ msgstr "" ">>> type(int).__hash__(int) == hash(int)\n" "True" -#: ../../reference/datamodel.rst:3694 +#: ../../reference/datamodel.rst:3733 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" "meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:3698 +#: ../../reference/datamodel.rst:3737 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -4417,7 +4470,7 @@ msgid "" "10" msgstr "" -#: ../../reference/datamodel.rst:3720 +#: ../../reference/datamodel.rst:3759 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -4426,29 +4479,29 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:3731 +#: ../../reference/datamodel.rst:3770 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:3735 +#: ../../reference/datamodel.rst:3774 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:3737 +#: ../../reference/datamodel.rst:3776 msgid "" "An :term:`awaitable` object generally implements an :meth:`~object." "__await__` method. :term:`Coroutine objects ` returned from :" "keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:3743 +#: ../../reference/datamodel.rst:3782 msgid "" "The :term:`generator iterator` objects returned from generators decorated " "with :func:`types.coroutine` are also awaitable, but they do not implement :" "meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:3749 +#: ../../reference/datamodel.rst:3788 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " @@ -4456,7 +4509,7 @@ msgid "" "`object` class itself is not awaitable and does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:3757 +#: ../../reference/datamodel.rst:3796 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " @@ -4464,15 +4517,15 @@ msgid "" "g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" -#: ../../reference/datamodel.rst:3765 +#: ../../reference/datamodel.rst:3804 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:3771 +#: ../../reference/datamodel.rst:3810 msgid "Coroutine Objects" msgstr "協程物件" -#: ../../reference/datamodel.rst:3773 +#: ../../reference/datamodel.rst:3812 msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " @@ -4483,18 +4536,18 @@ msgid "" "should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:3781 +#: ../../reference/datamodel.rst:3820 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:3785 +#: ../../reference/datamodel.rst:3824 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:3791 +#: ../../reference/datamodel.rst:3830 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`~object." @@ -4505,7 +4558,7 @@ msgid "" "value, described above." msgstr "" -#: ../../reference/datamodel.rst:3802 +#: ../../reference/datamodel.rst:3841 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -4516,13 +4569,13 @@ msgid "" "not caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:3813 +#: ../../reference/datamodel.rst:3852 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/datamodel.rst:3818 +#: ../../reference/datamodel.rst:3857 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -4532,46 +4585,46 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:3826 +#: ../../reference/datamodel.rst:3865 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:3832 +#: ../../reference/datamodel.rst:3871 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:3834 +#: ../../reference/datamodel.rst:3873 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:3837 +#: ../../reference/datamodel.rst:3876 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:3839 ../../reference/datamodel.rst:3888 +#: ../../reference/datamodel.rst:3878 ../../reference/datamodel.rst:3927 msgid "The :class:`object` class itself does not provide these methods." msgstr "" -#: ../../reference/datamodel.rst:3844 +#: ../../reference/datamodel.rst:3883 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:3848 +#: ../../reference/datamodel.rst:3887 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:3851 +#: ../../reference/datamodel.rst:3890 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:3853 +#: ../../reference/datamodel.rst:3892 msgid "" "class Reader:\n" " async def readline(self):\n" @@ -4599,53 +4652,53 @@ msgstr "" " raise StopAsyncIteration\n" " return val" -#: ../../reference/datamodel.rst:3868 +#: ../../reference/datamodel.rst:3907 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator `." msgstr "" -#: ../../reference/datamodel.rst:3873 +#: ../../reference/datamodel.rst:3912 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " "asynchronous iterator object. Returning anything else will result in a :exc:" "`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:3881 +#: ../../reference/datamodel.rst:3920 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3883 +#: ../../reference/datamodel.rst:3922 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3886 +#: ../../reference/datamodel.rst:3925 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3892 +#: ../../reference/datamodel.rst:3931 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3897 +#: ../../reference/datamodel.rst:3936 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3900 +#: ../../reference/datamodel.rst:3939 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3902 +#: ../../reference/datamodel.rst:3941 msgid "" "class AsyncContextManager:\n" " async def __aenter__(self):\n" @@ -4661,18 +4714,18 @@ msgstr "" " async def __aexit__(self, exc_type, exc, tb):\n" " await log('exiting context')" -#: ../../reference/datamodel.rst:3913 +#: ../../reference/datamodel.rst:3952 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3914 +#: ../../reference/datamodel.rst:3953 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3918 +#: ../../reference/datamodel.rst:3957 msgid "" "The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." "__reversed__`, :meth:`~object.__contains__`, :meth:`~object." @@ -4681,7 +4734,7 @@ msgid "" "by relying on the behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3925 +#: ../../reference/datamodel.rst:3964 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " @@ -4689,14 +4742,14 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3931 +#: ../../reference/datamodel.rst:3970 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method (such as :meth:`~object.__add__`) fails then the operation is not " "supported, which is why the reflected method is not called." msgstr "" -#: ../../reference/datamodel.rst:3935 +#: ../../reference/datamodel.rst:3974 msgid "" "If the right operand's type is a subclass of the left operand's type, the " "reflected method having precedence allows subclasses to override their " @@ -4707,19 +4760,19 @@ msgstr "" #: ../../reference/datamodel.rst:159 ../../reference/datamodel.rst:183 #: ../../reference/datamodel.rst:195 ../../reference/datamodel.rst:228 #: ../../reference/datamodel.rst:249 ../../reference/datamodel.rst:266 -#: ../../reference/datamodel.rst:284 ../../reference/datamodel.rst:297 -#: ../../reference/datamodel.rst:329 ../../reference/datamodel.rst:364 -#: ../../reference/datamodel.rst:389 ../../reference/datamodel.rst:410 -#: ../../reference/datamodel.rst:428 ../../reference/datamodel.rst:448 -#: ../../reference/datamodel.rst:456 ../../reference/datamodel.rst:467 -#: ../../reference/datamodel.rst:484 ../../reference/datamodel.rst:520 -#: ../../reference/datamodel.rst:535 ../../reference/datamodel.rst:673 -#: ../../reference/datamodel.rst:811 ../../reference/datamodel.rst:835 -#: ../../reference/datamodel.rst:871 ../../reference/datamodel.rst:1149 -#: ../../reference/datamodel.rst:1317 ../../reference/datamodel.rst:1344 -#: ../../reference/datamodel.rst:1416 ../../reference/datamodel.rst:1524 -#: ../../reference/datamodel.rst:1632 ../../reference/datamodel.rst:1749 -#: ../../reference/datamodel.rst:2174 ../../reference/datamodel.rst:3201 +#: ../../reference/datamodel.rst:284 ../../reference/datamodel.rst:298 +#: ../../reference/datamodel.rst:343 ../../reference/datamodel.rst:383 +#: ../../reference/datamodel.rst:408 ../../reference/datamodel.rst:429 +#: ../../reference/datamodel.rst:447 ../../reference/datamodel.rst:467 +#: ../../reference/datamodel.rst:475 ../../reference/datamodel.rst:488 +#: ../../reference/datamodel.rst:505 ../../reference/datamodel.rst:541 +#: ../../reference/datamodel.rst:556 ../../reference/datamodel.rst:701 +#: ../../reference/datamodel.rst:839 ../../reference/datamodel.rst:863 +#: ../../reference/datamodel.rst:899 ../../reference/datamodel.rst:1177 +#: ../../reference/datamodel.rst:1345 ../../reference/datamodel.rst:1372 +#: ../../reference/datamodel.rst:1444 ../../reference/datamodel.rst:1552 +#: ../../reference/datamodel.rst:1660 ../../reference/datamodel.rst:1777 +#: ../../reference/datamodel.rst:2202 ../../reference/datamodel.rst:3229 msgid "object" msgstr "object(物件)" @@ -4727,15 +4780,15 @@ msgstr "object(物件)" msgid "data" msgstr "data(資料)" -#: ../../reference/datamodel.rst:22 ../../reference/datamodel.rst:297 -#: ../../reference/datamodel.rst:344 ../../reference/datamodel.rst:428 -#: ../../reference/datamodel.rst:467 ../../reference/datamodel.rst:811 -#: ../../reference/datamodel.rst:1373 ../../reference/datamodel.rst:1832 -#: ../../reference/datamodel.rst:2075 ../../reference/datamodel.rst:2081 -#: ../../reference/datamodel.rst:2174 ../../reference/datamodel.rst:2736 -#: ../../reference/datamodel.rst:3171 ../../reference/datamodel.rst:3329 -#: ../../reference/datamodel.rst:3364 ../../reference/datamodel.rst:3432 -#: ../../reference/datamodel.rst:3442 ../../reference/datamodel.rst:3470 +#: ../../reference/datamodel.rst:22 ../../reference/datamodel.rst:298 +#: ../../reference/datamodel.rst:358 ../../reference/datamodel.rst:447 +#: ../../reference/datamodel.rst:488 ../../reference/datamodel.rst:839 +#: ../../reference/datamodel.rst:1401 ../../reference/datamodel.rst:1860 +#: ../../reference/datamodel.rst:2103 ../../reference/datamodel.rst:2109 +#: ../../reference/datamodel.rst:2202 ../../reference/datamodel.rst:2764 +#: ../../reference/datamodel.rst:3199 ../../reference/datamodel.rst:3368 +#: ../../reference/datamodel.rst:3403 ../../reference/datamodel.rst:3471 +#: ../../reference/datamodel.rst:3481 ../../reference/datamodel.rst:3509 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -4744,7 +4797,7 @@ msgid "id" msgstr "id" #: ../../reference/datamodel.rst:22 ../../reference/datamodel.rst:122 -#: ../../reference/datamodel.rst:2736 +#: ../../reference/datamodel.rst:2764 msgid "type" msgstr "type(型別)" @@ -4780,7 +4833,7 @@ msgstr "reference counting(參照計數)" msgid "unreachable object" msgstr "unreachable object(不可達物件)" -#: ../../reference/datamodel.rst:91 ../../reference/datamodel.rst:1149 +#: ../../reference/datamodel.rst:91 ../../reference/datamodel.rst:1177 msgid "container" msgstr "container(容器)" @@ -4792,26 +4845,26 @@ msgstr "hierarchy(階層)" msgid "extension" msgstr "extension(擴充)" -#: ../../reference/datamodel.rst:122 ../../reference/datamodel.rst:401 -#: ../../reference/datamodel.rst:402 ../../reference/datamodel.rst:503 -#: ../../reference/datamodel.rst:871 ../../reference/datamodel.rst:891 -#: ../../reference/datamodel.rst:1373 +#: ../../reference/datamodel.rst:122 ../../reference/datamodel.rst:420 +#: ../../reference/datamodel.rst:421 ../../reference/datamodel.rst:524 +#: ../../reference/datamodel.rst:899 ../../reference/datamodel.rst:919 +#: ../../reference/datamodel.rst:1401 msgid "module" msgstr "module(模組)" #: ../../reference/datamodel.rst:122 ../../reference/datamodel.rst:266 -#: ../../reference/datamodel.rst:811 +#: ../../reference/datamodel.rst:839 msgid "C" msgstr "C" #: ../../reference/datamodel.rst:122 ../../reference/datamodel.rst:266 -#: ../../reference/datamodel.rst:811 +#: ../../reference/datamodel.rst:839 msgid "language" msgstr "language(語言)" -#: ../../reference/datamodel.rst:135 ../../reference/datamodel.rst:1149 -#: ../../reference/datamodel.rst:1167 ../../reference/datamodel.rst:1317 -#: ../../reference/datamodel.rst:1337 +#: ../../reference/datamodel.rst:135 ../../reference/datamodel.rst:1177 +#: ../../reference/datamodel.rst:1195 ../../reference/datamodel.rst:1345 +#: ../../reference/datamodel.rst:1365 msgid "attribute" msgstr "attribute(屬性)" @@ -4831,12 +4884,11 @@ msgstr "..." msgid "ellipsis literal" msgstr "ellipsis literal(刪節號字面值)" -#: ../../reference/datamodel.rst:195 ../../reference/datamodel.rst:1344 +#: ../../reference/datamodel.rst:195 ../../reference/datamodel.rst:1372 msgid "numeric" msgstr "numeric(數值)" #: ../../reference/datamodel.rst:228 ../../reference/datamodel.rst:234 -#: ../../reference/datamodel.rst:344 msgid "integer" msgstr "integer(整數)" @@ -4868,836 +4920,844 @@ msgstr "number(數字)" msgid "Java" msgstr "Java" -#: ../../reference/datamodel.rst:284 ../../reference/datamodel.rst:3442 +#: ../../reference/datamodel.rst:284 ../../reference/datamodel.rst:3481 msgid "complex" msgstr "complex(複數)" -#: ../../reference/datamodel.rst:297 ../../reference/datamodel.rst:428 -#: ../../reference/datamodel.rst:467 ../../reference/datamodel.rst:3171 +#: ../../reference/datamodel.rst:298 ../../reference/datamodel.rst:447 +#: ../../reference/datamodel.rst:488 ../../reference/datamodel.rst:3199 msgid "len" msgstr "len" -#: ../../reference/datamodel.rst:297 ../../reference/datamodel.rst:1344 +#: ../../reference/datamodel.rst:298 ../../reference/datamodel.rst:1372 msgid "sequence" msgstr "sequence(序列)" -#: ../../reference/datamodel.rst:297 +#: ../../reference/datamodel.rst:298 msgid "index operation" msgstr "index operation(索引操作)" -#: ../../reference/datamodel.rst:297 +#: ../../reference/datamodel.rst:298 msgid "item selection" msgstr "item selection(項目選取)" -#: ../../reference/datamodel.rst:297 ../../reference/datamodel.rst:389 -#: ../../reference/datamodel.rst:467 +#: ../../reference/datamodel.rst:298 ../../reference/datamodel.rst:408 +#: ../../reference/datamodel.rst:488 msgid "subscription" msgstr "subscription(下標)" -#: ../../reference/datamodel.rst:312 ../../reference/datamodel.rst:389 +#: ../../reference/datamodel.rst:316 ../../reference/datamodel.rst:408 msgid "slicing" msgstr "slice(切片)" -#: ../../reference/datamodel.rst:329 +#: ../../reference/datamodel.rst:316 ../../reference/datamodel.rst:1866 +msgid "start (slice object attribute)" +msgstr "start (slice 物件屬性)" + +#: ../../reference/datamodel.rst:316 ../../reference/datamodel.rst:1866 +msgid "stop (slice object attribute)" +msgstr "stop (slice 物件屬性)" + +#: ../../reference/datamodel.rst:316 ../../reference/datamodel.rst:1866 +msgid "step (slice object attribute)" +msgstr "step (slice 物件屬性)" + +#: ../../reference/datamodel.rst:343 msgid "immutable sequence" msgstr "immutable sequence(不可變序列)" -#: ../../reference/datamodel.rst:329 +#: ../../reference/datamodel.rst:343 msgid "immutable" msgstr "immutable(不可變)" -#: ../../reference/datamodel.rst:340 ../../reference/datamodel.rst:2050 -#: ../../reference/datamodel.rst:2081 +#: ../../reference/datamodel.rst:354 ../../reference/datamodel.rst:358 +#: ../../reference/datamodel.rst:2078 ../../reference/datamodel.rst:2109 msgid "string" msgstr "string(字串)" -#: ../../reference/datamodel.rst:340 +#: ../../reference/datamodel.rst:354 msgid "immutable sequences" msgstr "immutable sequences(不可變序列)" -#: ../../reference/datamodel.rst:344 +#: ../../reference/datamodel.rst:358 msgid "chr" msgstr "chr" -#: ../../reference/datamodel.rst:344 +#: ../../reference/datamodel.rst:358 msgid "ord" msgstr "ord" -#: ../../reference/datamodel.rst:344 +#: ../../reference/datamodel.rst:358 msgid "character" msgstr "character(字元)" -#: ../../reference/datamodel.rst:344 +#: ../../reference/datamodel.rst:358 +msgid "item" +msgstr "" + +#: ../../reference/datamodel.rst:358 msgid "Unicode" msgstr "Unicode" -#: ../../reference/datamodel.rst:364 +#: ../../reference/datamodel.rst:383 msgid "tuple" msgstr "tuple(元組)" -#: ../../reference/datamodel.rst:364 +#: ../../reference/datamodel.rst:383 msgid "singleton" msgstr "singleton(單例)" -#: ../../reference/datamodel.rst:364 +#: ../../reference/datamodel.rst:383 msgid "empty" msgstr "empty(空的)" -#: ../../reference/datamodel.rst:377 ../../reference/datamodel.rst:2075 +#: ../../reference/datamodel.rst:396 ../../reference/datamodel.rst:2103 msgid "bytes" msgstr "bytes(位元組)" -#: ../../reference/datamodel.rst:377 +#: ../../reference/datamodel.rst:396 msgid "byte" msgstr "byte(位元組)" -#: ../../reference/datamodel.rst:389 +#: ../../reference/datamodel.rst:408 msgid "mutable sequence" msgstr "mutable sequence(可變序列)" -#: ../../reference/datamodel.rst:389 +#: ../../reference/datamodel.rst:408 msgid "mutable" msgstr "mutable(可變的)" -#: ../../reference/datamodel.rst:389 ../../reference/datamodel.rst:1167 -#: ../../reference/datamodel.rst:1337 +#: ../../reference/datamodel.rst:408 ../../reference/datamodel.rst:1195 +#: ../../reference/datamodel.rst:1365 msgid "assignment" msgstr "assignment(賦值)" -#: ../../reference/datamodel.rst:389 ../../reference/datamodel.rst:871 -#: ../../reference/datamodel.rst:1786 ../../reference/datamodel.rst:1968 -#: ../../reference/datamodel.rst:3494 +#: ../../reference/datamodel.rst:408 ../../reference/datamodel.rst:899 +#: ../../reference/datamodel.rst:1814 ../../reference/datamodel.rst:1996 +#: ../../reference/datamodel.rst:3533 msgid "statement" msgstr "statement(陳述式)" -#: ../../reference/datamodel.rst:401 +#: ../../reference/datamodel.rst:420 msgid "array" msgstr "array(陣列)" -#: ../../reference/datamodel.rst:402 +#: ../../reference/datamodel.rst:421 msgid "collections" msgstr "collections" -#: ../../reference/datamodel.rst:410 +#: ../../reference/datamodel.rst:429 msgid "list" msgstr "list(串列)" -#: ../../reference/datamodel.rst:417 +#: ../../reference/datamodel.rst:436 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../reference/datamodel.rst:428 +#: ../../reference/datamodel.rst:447 msgid "set type" msgstr "set type(集合型別)" -#: ../../reference/datamodel.rst:448 +#: ../../reference/datamodel.rst:467 msgid "set" msgstr "set(集合)" -#: ../../reference/datamodel.rst:456 +#: ../../reference/datamodel.rst:475 msgid "frozenset" msgstr "frozenset(凍結集合)" -#: ../../reference/datamodel.rst:467 ../../reference/datamodel.rst:1344 +#: ../../reference/datamodel.rst:488 ../../reference/datamodel.rst:1372 msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/datamodel.rst:484 ../../reference/datamodel.rst:1149 -#: ../../reference/datamodel.rst:2174 +#: ../../reference/datamodel.rst:505 ../../reference/datamodel.rst:1177 +#: ../../reference/datamodel.rst:2202 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../reference/datamodel.rst:503 +#: ../../reference/datamodel.rst:524 msgid "dbm.ndbm" msgstr "dbm.ndbm" -#: ../../reference/datamodel.rst:503 +#: ../../reference/datamodel.rst:524 msgid "dbm.gnu" msgstr "dbm.gnu" -#: ../../reference/datamodel.rst:520 +#: ../../reference/datamodel.rst:541 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../reference/datamodel.rst:520 ../../reference/datamodel.rst:535 -#: ../../reference/datamodel.rst:755 ../../reference/datamodel.rst:773 -#: ../../reference/datamodel.rst:786 ../../reference/datamodel.rst:811 +#: ../../reference/datamodel.rst:541 ../../reference/datamodel.rst:556 +#: ../../reference/datamodel.rst:783 ../../reference/datamodel.rst:801 +#: ../../reference/datamodel.rst:814 ../../reference/datamodel.rst:839 msgid "function" msgstr "function (函式)" -#: ../../reference/datamodel.rst:520 ../../reference/datamodel.rst:1149 -#: ../../reference/datamodel.rst:1172 ../../reference/datamodel.rst:3117 +#: ../../reference/datamodel.rst:541 ../../reference/datamodel.rst:1177 +#: ../../reference/datamodel.rst:1200 ../../reference/datamodel.rst:3145 msgid "call" msgstr "call(呼叫)" -#: ../../reference/datamodel.rst:520 +#: ../../reference/datamodel.rst:541 msgid "invocation" msgstr "invocation(呼叫)" -#: ../../reference/datamodel.rst:520 +#: ../../reference/datamodel.rst:541 msgid "argument" msgstr "argument(引數)" -#: ../../reference/datamodel.rst:535 ../../reference/datamodel.rst:673 +#: ../../reference/datamodel.rst:556 ../../reference/datamodel.rst:701 msgid "user-defined" msgstr "user-defined(使用者定義)" -#: ../../reference/datamodel.rst:535 +#: ../../reference/datamodel.rst:556 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/datamodel.rst:548 +#: ../../reference/datamodel.rst:569 +msgid "__builtins__ (function attribute)" +msgstr "__builtins__ (函式屬性)" + +#: ../../reference/datamodel.rst:569 msgid "__closure__ (function attribute)" msgstr "__closure__ (函式屬性)" -#: ../../reference/datamodel.rst:548 +#: ../../reference/datamodel.rst:569 msgid "__globals__ (function attribute)" msgstr "__globals__ (函式屬性)" -#: ../../reference/datamodel.rst:548 +#: ../../reference/datamodel.rst:569 msgid "global" msgstr "global(全域)" -#: ../../reference/datamodel.rst:548 ../../reference/datamodel.rst:891 +#: ../../reference/datamodel.rst:569 ../../reference/datamodel.rst:919 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../reference/datamodel.rst:575 +#: ../../reference/datamodel.rst:603 msgid "__doc__ (function attribute)" msgstr "__doc__ (函式屬性)" -#: ../../reference/datamodel.rst:575 +#: ../../reference/datamodel.rst:603 msgid "__name__ (function attribute)" msgstr "__name__ (函式屬性)" -#: ../../reference/datamodel.rst:575 +#: ../../reference/datamodel.rst:603 msgid "__module__ (function attribute)" msgstr "__module__ (函式屬性)" -#: ../../reference/datamodel.rst:575 +#: ../../reference/datamodel.rst:603 msgid "__dict__ (function attribute)" msgstr "__dict__ (函式屬性)" -#: ../../reference/datamodel.rst:575 +#: ../../reference/datamodel.rst:603 msgid "__defaults__ (function attribute)" msgstr "__defaults__ (函式屬性)" -#: ../../reference/datamodel.rst:575 +#: ../../reference/datamodel.rst:603 msgid "__code__ (function attribute)" msgstr "__code__ (函式屬性)" -#: ../../reference/datamodel.rst:575 +#: ../../reference/datamodel.rst:603 msgid "__annotations__ (function attribute)" msgstr "__annotations__ (函式屬性)" -#: ../../reference/datamodel.rst:575 +#: ../../reference/datamodel.rst:603 msgid "__annotate__ (function attribute)" msgstr "__annotate__ (函式屬性)" -#: ../../reference/datamodel.rst:575 +#: ../../reference/datamodel.rst:603 msgid "__kwdefaults__ (function attribute)" msgstr "__kwdefaults__ (函式屬性)" -#: ../../reference/datamodel.rst:575 +#: ../../reference/datamodel.rst:603 msgid "__type_params__ (function attribute)" msgstr "__type_params__ (函式屬性)" -#: ../../reference/datamodel.rst:673 ../../reference/datamodel.rst:835 +#: ../../reference/datamodel.rst:701 ../../reference/datamodel.rst:863 msgid "method" msgstr "method(方法)" -#: ../../reference/datamodel.rst:673 +#: ../../reference/datamodel.rst:701 msgid "user-defined method" msgstr "user-defined method(使用者定義方法)" -#: ../../reference/datamodel.rst:681 +#: ../../reference/datamodel.rst:709 msgid "__func__ (method attribute)" msgstr "__func__ (方法屬性)" -#: ../../reference/datamodel.rst:681 +#: ../../reference/datamodel.rst:709 msgid "__self__ (method attribute)" msgstr "__self__ (方法屬性)" -#: ../../reference/datamodel.rst:681 +#: ../../reference/datamodel.rst:709 msgid "__doc__ (method attribute)" msgstr "__doc__ (方法屬性)" -#: ../../reference/datamodel.rst:681 +#: ../../reference/datamodel.rst:709 msgid "__name__ (method attribute)" msgstr "__name__ (方法屬性)" -#: ../../reference/datamodel.rst:681 +#: ../../reference/datamodel.rst:709 msgid "__module__ (method attribute)" msgstr "__module__ (方法屬性)" -#: ../../reference/datamodel.rst:755 ../../reference/datamodel.rst:1524 +#: ../../reference/datamodel.rst:783 ../../reference/datamodel.rst:1552 msgid "generator" msgstr "generator(產生器)" -#: ../../reference/datamodel.rst:755 +#: ../../reference/datamodel.rst:783 msgid "iterator" msgstr "itorator(疊代器)" -#: ../../reference/datamodel.rst:773 ../../reference/datamodel.rst:3727 +#: ../../reference/datamodel.rst:801 ../../reference/datamodel.rst:3766 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../reference/datamodel.rst:786 +#: ../../reference/datamodel.rst:814 msgid "asynchronous generator" msgstr "asynchronous generator(非同步產生器)" -#: ../../reference/datamodel.rst:786 +#: ../../reference/datamodel.rst:814 msgid "asynchronous iterator" msgstr "asynchronous iterator(非同步疊代器)" -#: ../../reference/datamodel.rst:835 +#: ../../reference/datamodel.rst:863 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/datamodel.rst:835 +#: ../../reference/datamodel.rst:863 msgid "built-in" msgstr "built-in(內建)" -#: ../../reference/datamodel.rst:871 +#: ../../reference/datamodel.rst:899 msgid "import" msgstr "import(引入)" -#: ../../reference/datamodel.rst:891 +#: ../../reference/datamodel.rst:919 msgid "__name__ (module attribute)" msgstr "__name__ (模組屬性)" -#: ../../reference/datamodel.rst:891 +#: ../../reference/datamodel.rst:919 msgid "__spec__ (module attribute)" msgstr "__spec__ (模組屬性)" -#: ../../reference/datamodel.rst:891 +#: ../../reference/datamodel.rst:919 msgid "__package__ (module attribute)" msgstr "__package__ (模組屬性)" -#: ../../reference/datamodel.rst:891 +#: ../../reference/datamodel.rst:919 msgid "__loader__ (module attribute)" msgstr "__loader__ (模組屬性)" -#: ../../reference/datamodel.rst:891 +#: ../../reference/datamodel.rst:919 msgid "__path__ (module attribute)" msgstr "__path__ (模組屬性)" -#: ../../reference/datamodel.rst:891 +#: ../../reference/datamodel.rst:919 msgid "__file__ (module attribute)" msgstr "__file__ (模組屬性)" -#: ../../reference/datamodel.rst:891 +#: ../../reference/datamodel.rst:919 msgid "__cached__ (module attribute)" msgstr "__cached__ (模組屬性)" -#: ../../reference/datamodel.rst:891 +#: ../../reference/datamodel.rst:919 msgid "__doc__ (module attribute)" msgstr "__doc__ (模組屬性)" -#: ../../reference/datamodel.rst:891 +#: ../../reference/datamodel.rst:919 msgid "__annotations__ (module attribute)" msgstr "__annotations__ (模組屬性)" -#: ../../reference/datamodel.rst:891 +#: ../../reference/datamodel.rst:919 msgid "__annotate__ (module attribute)" msgstr "__annotate__ (模組屬性)" -#: ../../reference/datamodel.rst:1117 +#: ../../reference/datamodel.rst:1145 msgid "__dict__ (module attribute)" msgstr "__dict__ (模組屬性)" -#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:1167 -#: ../../reference/datamodel.rst:1317 ../../reference/datamodel.rst:1951 -#: ../../reference/datamodel.rst:2847 +#: ../../reference/datamodel.rst:1177 ../../reference/datamodel.rst:1195 +#: ../../reference/datamodel.rst:1345 ../../reference/datamodel.rst:1979 +#: ../../reference/datamodel.rst:2875 msgid "class" msgstr "class(類別)" -#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:1317 -#: ../../reference/datamodel.rst:1337 +#: ../../reference/datamodel.rst:1177 ../../reference/datamodel.rst:1345 +#: ../../reference/datamodel.rst:1365 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:1317 -#: ../../reference/datamodel.rst:3117 +#: ../../reference/datamodel.rst:1177 ../../reference/datamodel.rst:1345 +#: ../../reference/datamodel.rst:3145 msgid "instance" msgstr "instance(實例)" -#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:1172 +#: ../../reference/datamodel.rst:1177 ../../reference/datamodel.rst:1200 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/datamodel.rst:1179 +#: ../../reference/datamodel.rst:1207 msgid "__name__ (class attribute)" msgstr "__name__ (類別屬性)" -#: ../../reference/datamodel.rst:1179 +#: ../../reference/datamodel.rst:1207 msgid "__module__ (class attribute)" msgstr "__module__ (類別屬性)" -#: ../../reference/datamodel.rst:1179 +#: ../../reference/datamodel.rst:1207 msgid "__dict__ (class attribute)" msgstr "__dict__ (類別屬性)" -#: ../../reference/datamodel.rst:1179 +#: ../../reference/datamodel.rst:1207 msgid "__bases__ (class attribute)" msgstr "__bases__ (類別屬性)" -#: ../../reference/datamodel.rst:1179 +#: ../../reference/datamodel.rst:1207 msgid "__base__ (class attribute)" msgstr "__base__ (類別屬性)" -#: ../../reference/datamodel.rst:1179 +#: ../../reference/datamodel.rst:1207 msgid "__doc__ (class attribute)" msgstr "__doc__ (類別屬性)" -#: ../../reference/datamodel.rst:1179 +#: ../../reference/datamodel.rst:1207 msgid "__annotations__ (class attribute)" msgstr "__annotations__ (類別屬性)" -#: ../../reference/datamodel.rst:1179 +#: ../../reference/datamodel.rst:1207 msgid "__annotate__ (class attribute)" msgstr "__annotate__ (類別屬性)" -#: ../../reference/datamodel.rst:1179 +#: ../../reference/datamodel.rst:1207 msgid "__type_params__ (class attribute)" msgstr "__type_params__ (類別屬性)" -#: ../../reference/datamodel.rst:1179 +#: ../../reference/datamodel.rst:1207 msgid "__static_attributes__ (class attribute)" msgstr "__static_attributes__ (類別屬性)" -#: ../../reference/datamodel.rst:1179 +#: ../../reference/datamodel.rst:1207 msgid "__firstlineno__ (class attribute)" msgstr "__firstlineno__ (類別屬性)" -#: ../../reference/datamodel.rst:1355 +#: ../../reference/datamodel.rst:1383 msgid "__dict__ (instance attribute)" msgstr "__dict__ (實例屬性)" -#: ../../reference/datamodel.rst:1355 +#: ../../reference/datamodel.rst:1383 msgid "__class__ (instance attribute)" msgstr "__class__ (實例屬性)" -#: ../../reference/datamodel.rst:1373 +#: ../../reference/datamodel.rst:1401 msgid "open" msgstr "open" -#: ../../reference/datamodel.rst:1373 +#: ../../reference/datamodel.rst:1401 msgid "io" msgstr "io" -#: ../../reference/datamodel.rst:1373 +#: ../../reference/datamodel.rst:1401 msgid "popen() (in module os)" msgstr "popen() (於 os 模組中)" -#: ../../reference/datamodel.rst:1373 +#: ../../reference/datamodel.rst:1401 msgid "makefile() (socket method)" msgstr "makefile() (socket 方法)" -#: ../../reference/datamodel.rst:1373 +#: ../../reference/datamodel.rst:1401 msgid "sys.stdin" msgstr "sys.stdin" -#: ../../reference/datamodel.rst:1373 +#: ../../reference/datamodel.rst:1401 msgid "sys.stdout" msgstr "sys.stdout" -#: ../../reference/datamodel.rst:1373 +#: ../../reference/datamodel.rst:1401 msgid "sys.stderr" msgstr "sys.stderr" -#: ../../reference/datamodel.rst:1373 +#: ../../reference/datamodel.rst:1401 msgid "stdio" msgstr "stdio" -#: ../../reference/datamodel.rst:1373 +#: ../../reference/datamodel.rst:1401 msgid "stdin (in module sys)" msgstr "stdin (sys 模組中)" -#: ../../reference/datamodel.rst:1373 +#: ../../reference/datamodel.rst:1401 msgid "stdout (in module sys)" msgstr "stdout (sys 模組中)" -#: ../../reference/datamodel.rst:1373 +#: ../../reference/datamodel.rst:1401 msgid "stderr (in module sys)" msgstr "stderr (sys 模組中)" -#: ../../reference/datamodel.rst:1402 +#: ../../reference/datamodel.rst:1430 msgid "internal type" msgstr "internal type(內部型別)" -#: ../../reference/datamodel.rst:1402 +#: ../../reference/datamodel.rst:1430 msgid "types, internal" msgstr "types(型別), internal(內部)" -#: ../../reference/datamodel.rst:1416 +#: ../../reference/datamodel.rst:1444 msgid "bytecode" msgstr "bytecode(位元組碼)" -#: ../../reference/datamodel.rst:1416 +#: ../../reference/datamodel.rst:1444 msgid "code" msgstr "code(程式碼)" -#: ../../reference/datamodel.rst:1416 +#: ../../reference/datamodel.rst:1444 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_argcount (code object attribute)" msgstr "co_argcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_posonlyargcount (code object attribute)" msgstr "co_posonlyargcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_kwonlyargcount (code object attribute)" msgstr "co_kwonlyargcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_code (code object attribute)" msgstr "co_code (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_consts (code object attribute)" msgstr "co_consts (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_filename (code object attribute)" msgstr "co_filename (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_firstlineno (code object attribute)" msgstr "co_firstlineno (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_flags (code object attribute)" msgstr "co_flags (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_lnotab (code object attribute)" msgstr "co_lnotab (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_name (code object attribute)" msgstr "co_name (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_names (code object attribute)" msgstr "co_names (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_nlocals (code object attribute)" msgstr "co_nlocals (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_stacksize (code object attribute)" msgstr "co_stacksize (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_varnames (code object attribute)" msgstr "co_varnames (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_cellvars (code object attribute)" msgstr "co_cellvars (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_freevars (code object attribute)" msgstr "co_freevars (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1427 +#: ../../reference/datamodel.rst:1455 msgid "co_qualname (code object attribute)" msgstr "co_qualname (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1540 +#: ../../reference/datamodel.rst:1568 msgid "documentation string" msgstr "documentation string(文件字串)" -#: ../../reference/datamodel.rst:1632 +#: ../../reference/datamodel.rst:1660 msgid "frame" msgstr "frame" -#: ../../reference/datamodel.rst:1638 +#: ../../reference/datamodel.rst:1666 msgid "f_back (frame attribute)" msgstr "f_back (frame 屬性)" -#: ../../reference/datamodel.rst:1638 +#: ../../reference/datamodel.rst:1666 msgid "f_code (frame attribute)" msgstr "f_code (frame 屬性)" -#: ../../reference/datamodel.rst:1638 +#: ../../reference/datamodel.rst:1666 msgid "f_globals (frame attribute)" msgstr "f_globals (frame 屬性)" -#: ../../reference/datamodel.rst:1638 +#: ../../reference/datamodel.rst:1666 msgid "f_locals (frame attribute)" msgstr "f_locals (frame 屬性)" -#: ../../reference/datamodel.rst:1638 +#: ../../reference/datamodel.rst:1666 msgid "f_lasti (frame attribute)" msgstr "f_lasti (frame 屬性)" -#: ../../reference/datamodel.rst:1638 +#: ../../reference/datamodel.rst:1666 msgid "f_builtins (frame attribute)" msgstr "f_builtins (frame 屬性)" -#: ../../reference/datamodel.rst:1638 +#: ../../reference/datamodel.rst:1666 msgid "f_generator (frame attribute)" msgstr "f_generator (frame 屬性)" -#: ../../reference/datamodel.rst:1689 +#: ../../reference/datamodel.rst:1717 msgid "f_trace (frame attribute)" msgstr "f_trace (frame 屬性)" -#: ../../reference/datamodel.rst:1689 +#: ../../reference/datamodel.rst:1717 msgid "f_trace_lines (frame attribute)" msgstr "f_trace_lines (frame 屬性)" -#: ../../reference/datamodel.rst:1689 +#: ../../reference/datamodel.rst:1717 msgid "f_trace_opcodes (frame attribute)" msgstr "f_trace_opcodes (frame 屬性)" -#: ../../reference/datamodel.rst:1689 +#: ../../reference/datamodel.rst:1717 msgid "f_lineno (frame attribute)" msgstr "f_lineno (frame 屬性)" -#: ../../reference/datamodel.rst:1749 +#: ../../reference/datamodel.rst:1777 msgid "traceback" msgstr "traceback" -#: ../../reference/datamodel.rst:1749 +#: ../../reference/datamodel.rst:1777 msgid "stack" msgstr "stack(堆疊)" -#: ../../reference/datamodel.rst:1749 +#: ../../reference/datamodel.rst:1777 msgid "trace" msgstr "trace(追蹤)" -#: ../../reference/datamodel.rst:1749 +#: ../../reference/datamodel.rst:1777 msgid "exception" msgstr "exception(例外)" -#: ../../reference/datamodel.rst:1749 +#: ../../reference/datamodel.rst:1777 msgid "handler" msgstr "handler(處理器)" -#: ../../reference/datamodel.rst:1749 +#: ../../reference/datamodel.rst:1777 msgid "execution" msgstr "execution(執行)" -#: ../../reference/datamodel.rst:1749 +#: ../../reference/datamodel.rst:1777 msgid "exc_info (in module sys)" msgstr "exc_info (sys 模組中)" -#: ../../reference/datamodel.rst:1749 +#: ../../reference/datamodel.rst:1777 msgid "last_traceback (in module sys)" msgstr "last_traceback (sys 模組中)" -#: ../../reference/datamodel.rst:1749 +#: ../../reference/datamodel.rst:1777 msgid "sys.exc_info" msgstr "sys.exc_info" -#: ../../reference/datamodel.rst:1749 +#: ../../reference/datamodel.rst:1777 msgid "sys.exception" msgstr "sys.exception" -#: ../../reference/datamodel.rst:1749 +#: ../../reference/datamodel.rst:1777 msgid "sys.last_traceback" msgstr "sys.last_traceback" -#: ../../reference/datamodel.rst:1786 +#: ../../reference/datamodel.rst:1814 msgid "tb_frame (traceback attribute)" msgstr "tb_frame (traceback 屬性)" -#: ../../reference/datamodel.rst:1786 +#: ../../reference/datamodel.rst:1814 msgid "tb_lineno (traceback attribute)" msgstr "tb_lineno (traceback 屬性)" -#: ../../reference/datamodel.rst:1786 +#: ../../reference/datamodel.rst:1814 msgid "tb_lasti (traceback attribute)" msgstr "tb_lasti (traceback 屬性)" -#: ../../reference/datamodel.rst:1786 +#: ../../reference/datamodel.rst:1814 msgid "try" msgstr "try" -#: ../../reference/datamodel.rst:1816 +#: ../../reference/datamodel.rst:1844 msgid "tb_next (traceback attribute)" msgstr "tb_next (traceback 屬性)" -#: ../../reference/datamodel.rst:1832 ../../reference/datamodel.rst:3201 +#: ../../reference/datamodel.rst:1860 ../../reference/datamodel.rst:3229 msgid "slice" msgstr "slice(切片)" -#: ../../reference/datamodel.rst:1838 -msgid "start (slice object attribute)" -msgstr "start (slice 物件屬性)" - -#: ../../reference/datamodel.rst:1838 -msgid "stop (slice object attribute)" -msgstr "stop (slice 物件屬性)" - -#: ../../reference/datamodel.rst:1838 -msgid "step (slice object attribute)" -msgstr "step (slice 物件屬性)" - -#: ../../reference/datamodel.rst:1886 +#: ../../reference/datamodel.rst:1914 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/datamodel.rst:1886 +#: ../../reference/datamodel.rst:1914 msgid "overloading" msgstr "overloading(多載)" -#: ../../reference/datamodel.rst:1886 +#: ../../reference/datamodel.rst:1914 msgid "__getitem__() (mapping object method)" msgstr "__getitem__() (對映物件方法)" -#: ../../reference/datamodel.rst:1922 +#: ../../reference/datamodel.rst:1950 msgid "subclassing" msgstr "subclassing(子類別化)" -#: ../../reference/datamodel.rst:1922 +#: ../../reference/datamodel.rst:1950 msgid "immutable types" msgstr "immutable types(不可變型別)" -#: ../../reference/datamodel.rst:1951 +#: ../../reference/datamodel.rst:1979 msgid "constructor" msgstr "constructor(建構函式)" -#: ../../reference/datamodel.rst:1968 +#: ../../reference/datamodel.rst:1996 msgid "destructor" msgstr "destructor(解構函式)" -#: ../../reference/datamodel.rst:1968 +#: ../../reference/datamodel.rst:1996 msgid "finalizer" msgstr "finalizer(終結函式)" -#: ../../reference/datamodel.rst:1968 +#: ../../reference/datamodel.rst:1996 msgid "del" msgstr "del" -#: ../../reference/datamodel.rst:2032 +#: ../../reference/datamodel.rst:2060 msgid "repr() (built-in function)" msgstr "repr() (內建函式)" -#: ../../reference/datamodel.rst:2032 +#: ../../reference/datamodel.rst:2060 msgid "__repr__() (object method)" msgstr "__repr__() (物件方法)" -#: ../../reference/datamodel.rst:2050 +#: ../../reference/datamodel.rst:2078 msgid "__str__() (object method)" msgstr "__str__() (物件方法)" -#: ../../reference/datamodel.rst:2050 +#: ../../reference/datamodel.rst:2078 msgid "format() (built-in function)" msgstr "format() (內建函式)" -#: ../../reference/datamodel.rst:2050 +#: ../../reference/datamodel.rst:2078 msgid "print() (built-in function)" msgstr "print() (內建函式)" -#: ../../reference/datamodel.rst:2081 +#: ../../reference/datamodel.rst:2109 msgid "__format__() (object method)" msgstr "__format__() (物件方法)" -#: ../../reference/datamodel.rst:2081 +#: ../../reference/datamodel.rst:2109 msgid "conversion" msgstr "conversion" -#: ../../reference/datamodel.rst:2081 +#: ../../reference/datamodel.rst:2109 msgid "print" msgstr "print" -#: ../../reference/datamodel.rst:2123 +#: ../../reference/datamodel.rst:2151 msgid "comparisons" msgstr "comparison(比較)" -#: ../../reference/datamodel.rst:2174 +#: ../../reference/datamodel.rst:2202 msgid "hash" msgstr "hash(雜湊)" -#: ../../reference/datamodel.rst:2255 +#: ../../reference/datamodel.rst:2283 msgid "__len__() (mapping object method)" msgstr "__len__() (對映物件方法)" -#: ../../reference/datamodel.rst:2360 +#: ../../reference/datamodel.rst:2388 msgid "__getattr__ (module attribute)" msgstr "__getattr__ (模組屬性)" -#: ../../reference/datamodel.rst:2360 +#: ../../reference/datamodel.rst:2388 msgid "__dir__ (module attribute)" msgstr "__dir__ (模組屬性)" -#: ../../reference/datamodel.rst:2360 +#: ../../reference/datamodel.rst:2388 msgid "__class__ (module attribute)" msgstr "__class__ (模組屬性)" -#: ../../reference/datamodel.rst:2736 +#: ../../reference/datamodel.rst:2764 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../reference/datamodel.rst:2736 +#: ../../reference/datamodel.rst:2764 msgid "= (equals)" msgstr "= (等號)" -#: ../../reference/datamodel.rst:2736 +#: ../../reference/datamodel.rst:2764 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/datamodel.rst:2800 +#: ../../reference/datamodel.rst:2828 msgid "metaclass hint" msgstr "metaclass hint(元類別提示)" -#: ../../reference/datamodel.rst:2823 +#: ../../reference/datamodel.rst:2851 msgid "__prepare__ (metaclass method)" msgstr "__prepare__ (元類別方法)" -#: ../../reference/datamodel.rst:2847 +#: ../../reference/datamodel.rst:2875 msgid "body" msgstr "body" -#: ../../reference/datamodel.rst:2867 +#: ../../reference/datamodel.rst:2895 msgid "__class__ (method cell)" msgstr "__class__ (方法 cell)" -#: ../../reference/datamodel.rst:2867 +#: ../../reference/datamodel.rst:2895 msgid "__classcell__ (class namespace entry)" msgstr "__classcell__ (類別命名空間項目)" -#: ../../reference/datamodel.rst:3171 +#: ../../reference/datamodel.rst:3199 msgid "__bool__() (object method)" msgstr "__bool__() (物件方法)" -#: ../../reference/datamodel.rst:3329 ../../reference/datamodel.rst:3364 +#: ../../reference/datamodel.rst:3368 ../../reference/datamodel.rst:3403 msgid "divmod" msgstr "divmod" -#: ../../reference/datamodel.rst:3329 ../../reference/datamodel.rst:3364 +#: ../../reference/datamodel.rst:3368 ../../reference/datamodel.rst:3403 msgid "pow" msgstr "pow" -#: ../../reference/datamodel.rst:3432 +#: ../../reference/datamodel.rst:3471 msgid "abs" msgstr "abs" -#: ../../reference/datamodel.rst:3442 +#: ../../reference/datamodel.rst:3481 msgid "int" msgstr "int" -#: ../../reference/datamodel.rst:3442 +#: ../../reference/datamodel.rst:3481 msgid "float" msgstr "float" -#: ../../reference/datamodel.rst:3470 +#: ../../reference/datamodel.rst:3509 msgid "round" msgstr "round" -#: ../../reference/datamodel.rst:3494 +#: ../../reference/datamodel.rst:3533 msgid "with" msgstr "with" -#: ../../reference/datamodel.rst:3494 +#: ../../reference/datamodel.rst:3533 msgid "context manager" msgstr "context manager(情境管理器)" diff --git a/reference/executionmodel.po b/reference/executionmodel.po index 036403c608..566bdb6d9b 100644 --- a/reference/executionmodel.po +++ b/reference/executionmodel.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -591,17 +591,15 @@ msgid "" "how it runs on the host look something like this:" msgstr "" -#: ../../reference/executionmodel.rst:415 -#: ../../reference/executionmodel.rst:474 +#: ../../reference/executionmodel.rst:0 msgid "**host machine**" msgstr "" -#: ../../reference/executionmodel.rst:416 -#: ../../reference/executionmodel.rst:475 +#: ../../reference/executionmodel.rst:0 msgid "**process** (global resources)" msgstr "" -#: ../../reference/executionmodel.rst:417 +#: ../../reference/executionmodel.rst:0 msgid "**thread** (runs machine code)" msgstr "" @@ -683,19 +681,19 @@ msgid "" "data layers specific to Python:" msgstr "" -#: ../../reference/executionmodel.rst:476 +#: ../../reference/executionmodel.rst:0 msgid "Python global runtime (*state*)" msgstr "" -#: ../../reference/executionmodel.rst:477 +#: ../../reference/executionmodel.rst:0 msgid "Python interpreter (*state*)" msgstr "" -#: ../../reference/executionmodel.rst:478 +#: ../../reference/executionmodel.rst:0 msgid "**thread** (runs Python bytecode and \"C-API\")" msgstr "" -#: ../../reference/executionmodel.rst:479 +#: ../../reference/executionmodel.rst:0 msgid "Python thread *state*" msgstr "" diff --git a/reference/expressions.po b/reference/expressions.po index e8fef8714c..d98b483f27 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-15 00:16+0000\n" +"POT-Creation-Date: 2026-02-05 14:10+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1101,141 +1101,265 @@ msgid "" msgstr "" #: ../../reference/expressions.rst:936 -msgid "Subscriptions" +msgid "Subscriptions and slicings" msgstr "" #: ../../reference/expressions.rst:951 msgid "" -"The subscription of an instance of a :ref:`container class ` " -"will generally select an element from the container. The subscription of a :" -"term:`generic class ` will generally return a :ref:" -"`GenericAlias ` object." +"The :dfn:`subscription` syntax is usually used for selecting an element from " +"a :ref:`container ` -- for example, to get a value from a :" +"class:`dict`::" +msgstr "" + +#: ../../reference/expressions.rst:955 +msgid "" +">>> digits_by_name = {'one': 1, 'two': 2}\n" +">>> digits_by_name['two'] # Subscripting a dictionary using the key 'two'\n" +"2" msgstr "" #: ../../reference/expressions.rst:959 msgid "" -"When an object is subscripted, the interpreter will evaluate the primary and " -"the expression list." +"In the subscription syntax, the object being subscribed -- a :ref:`primary " +"` -- is followed by a :dfn:`subscript` in square brackets. In the " +"simplest case, the subscript is a single expression." msgstr "" -#: ../../reference/expressions.rst:962 +#: ../../reference/expressions.rst:964 msgid "" -"The primary must evaluate to an object that supports subscription. An object " -"may support subscription through defining one or both of :meth:`~object." -"__getitem__` and :meth:`~object.__class_getitem__`. When the primary is " -"subscripted, the evaluated result of the expression list will be passed to " -"one of these methods. For more details on when ``__class_getitem__`` is " -"called instead of ``__getitem__``, see :ref:`classgetitem-versus-getitem`." +"Depending on the type of the object being subscribed, the subscript is " +"sometimes called a :term:`key` (for mappings), :term:`index` (for " +"sequences), or *type argument* (for :term:`generic types `). " +"Syntactically, these are all equivalent::" msgstr "" #: ../../reference/expressions.rst:969 msgid "" -"If the expression list contains at least one comma, or if any of the " -"expressions are starred, the expression list will evaluate to a :class:" -"`tuple` containing the items of the expression list. Otherwise, the " -"expression list will evaluate to the value of the list's sole member." +">>> colors = ['red', 'blue', 'green', 'black']\n" +">>> colors[3] # Subscripting a list using the index 3\n" +"'black'\n" +"\n" +">>> list[str] # Parameterizing the list type using the type argument str\n" +"list[str]" +msgstr "" + +#: ../../reference/expressions.rst:976 +msgid "" +"At runtime, the interpreter will evaluate the primary and the subscript, and " +"call the primary's :meth:`~object.__getitem__` or :meth:`~object." +"__class_getitem__` :term:`special method` with the subscript as argument. " +"For more details on which of these methods is called, see :ref:`classgetitem-" +"versus-getitem`." msgstr "" -#: ../../reference/expressions.rst:974 -msgid "Expressions in an expression list may be starred. See :pep:`646`." +#: ../../reference/expressions.rst:983 +msgid "" +"To show how subscription works, we can define a custom object that " +"implements :meth:`~object.__getitem__` and prints out the value of the " +"subscript::" msgstr "" -#: ../../reference/expressions.rst:977 +#: ../../reference/expressions.rst:987 msgid "" -"For built-in objects, there are two types of objects that support " -"subscription via :meth:`~object.__getitem__`:" +">>> class SubscriptionDemo:\n" +"... def __getitem__(self, key):\n" +"... print(f'subscripted with: {key!r}')\n" +"...\n" +">>> demo = SubscriptionDemo()\n" +">>> demo[1]\n" +"subscripted with: 1\n" +">>> demo['a' * 3]\n" +"subscripted with: 'aaa'" msgstr "" -#: ../../reference/expressions.rst:980 +#: ../../reference/expressions.rst:997 msgid "" -"Mappings. If the primary is a :term:`mapping`, the expression list must " -"evaluate to an object whose value is one of the keys of the mapping, and the " -"subscription selects the value in the mapping that corresponds to that key. " -"An example of a builtin mapping class is the :class:`dict` class." +"See :meth:`~object.__getitem__` documentation for how built-in types handle " +"subscription." msgstr "" -#: ../../reference/expressions.rst:984 +#: ../../reference/expressions.rst:1000 msgid "" -"Sequences. If the primary is a :term:`sequence`, the expression list must " -"evaluate to an :class:`int` or a :class:`slice` (as discussed in the " -"following section). Examples of builtin sequence classes include the :class:" -"`str`, :class:`list` and :class:`tuple` classes." +"Subscriptions may also be used as targets in :ref:`assignment ` " +"or :ref:`deletion ` statements. In these cases, the interpreter will " +"call the subscripted object's :meth:`~object.__setitem__` or :meth:`~object." +"__delitem__` :term:`special method`, respectively, instead of :meth:`~object." +"__getitem__`." msgstr "" -#: ../../reference/expressions.rst:989 +#: ../../reference/expressions.rst:1006 msgid "" -"The formal syntax makes no special provision for negative indices in :term:" -"`sequences `. However, built-in sequences all provide a :meth:" -"`~object.__getitem__` method that interprets negative indices by adding the " -"length of the sequence to the index so that, for example, ``x[-1]`` selects " -"the last item of ``x``. The resulting value must be a nonnegative integer " -"less than the number of items in the sequence, and the subscription selects " -"the item whose index is that value (counting from zero). Since the support " -"for negative indices and slicing occurs in the object's :meth:`~object." -"__getitem__` method, subclasses overriding this method will need to " -"explicitly add that support." +">>> colors = ['red', 'blue', 'green', 'black']\n" +">>> colors[3] = 'white' # Setting item at index\n" +">>> colors\n" +"['red', 'blue', 'green', 'white']\n" +">>> del colors[3] # Deleting item at index 3\n" +">>> colors\n" +"['red', 'blue', 'green']" msgstr "" -#: ../../reference/expressions.rst:1003 +#: ../../reference/expressions.rst:1016 msgid "" -"A :class:`string ` is a special kind of sequence whose items are " -"*characters*. A character is not a separate data type but a string of " -"exactly one character." +"All advanced forms of *subscript* documented in the following sections are " +"also usable for assignment and deletion." msgstr "" -#: ../../reference/expressions.rst:1011 +#: ../../reference/expressions.rst:1035 msgid "Slicings" msgstr "" -#: ../../reference/expressions.rst:1025 +#: ../../reference/expressions.rst:1037 +msgid "" +"A more advanced form of subscription, :dfn:`slicing`, is commonly used to " +"extract a portion of a :ref:`sequence `. In this form, " +"the subscript is a :term:`slice`: up to three expressions separated by " +"colons. Any of the expressions may be omitted, but a slice must contain at " +"least one colon::" +msgstr "" + +#: ../../reference/expressions.rst:1044 +msgid "" +">>> number_names = ['zero', 'one', 'two', 'three', 'four', 'five']\n" +">>> number_names[1:3]\n" +"['one', 'two']\n" +">>> number_names[1:]\n" +"['one', 'two', 'three', 'four', 'five']\n" +">>> number_names[:3]\n" +"['zero', 'one', 'two']\n" +">>> number_names[:]\n" +"['zero', 'one', 'two', 'three', 'four', 'five']\n" +">>> number_names[::2]\n" +"['zero', 'two', 'four']\n" +">>> number_names[:-3]\n" +"['zero', 'one', 'two']\n" +">>> del number_names[4:]\n" +">>> number_names\n" +"['zero', 'one', 'two', 'three']" +msgstr "" + +#: ../../reference/expressions.rst:1061 +msgid "" +"When a slice is evaluated, the interpreter constructs a :class:`slice` " +"object whose :attr:`~slice.start`, :attr:`~slice.stop` and :attr:`~slice." +"step` attributes, respectively, are the results of the expressions between " +"the colons. Any missing expression evaluates to :const:`None`. This :class:`!" +"slice` object is then passed to the :meth:`~object.__getitem__` or :meth:" +"`~object.__class_getitem__` :term:`special method`, as above. ::" +msgstr "" + +#: ../../reference/expressions.rst:1069 +msgid "" +"# continuing with the SubscriptionDemo instance defined above:\n" +">>> demo[2:3]\n" +"subscripted with: slice(2, 3, None)\n" +">>> demo[::'spam']\n" +"subscripted with: slice(None, None, 'spam')" +msgstr "" + +#: ../../reference/expressions.rst:1077 +msgid "Comma-separated subscripts" +msgstr "" + +#: ../../reference/expressions.rst:1079 +msgid "" +"The subscript can also be given as two or more comma-separated expressions " +"or slices::" +msgstr "" + +#: ../../reference/expressions.rst:1082 +msgid "" +"# continuing with the SubscriptionDemo instance defined above:\n" +">>> demo[1, 2, 3]\n" +"subscripted with: (1, 2, 3)\n" +">>> demo[1:2, 3]\n" +"subscripted with: (slice(1, 2, None), 3)" +msgstr "" + +#: ../../reference/expressions.rst:1088 +msgid "" +"This form is commonly used with numerical libraries for slicing multi-" +"dimensional data. In this case, the interpreter constructs a :class:`tuple` " +"of the results of the expressions or slices, and passes this tuple to the :" +"meth:`~object.__getitem__` or :meth:`~object.__class_getitem__` :term:" +"`special method`, as above." +msgstr "" + +#: ../../reference/expressions.rst:1094 +msgid "" +"The subscript may also be given as a single expression or slice followed by " +"a comma, to specify a one-element tuple::" +msgstr "" + +#: ../../reference/expressions.rst:1097 +msgid "" +">>> demo['spam',]\n" +"subscripted with: ('spam',)" +msgstr "" + +#: ../../reference/expressions.rst:1102 +#, fuzzy +msgid "\"Starred\" subscriptions" +msgstr "subscription(下標)" + +#: ../../reference/expressions.rst:1104 +msgid "Expressions in *tuple_slices* may be starred. See :pep:`646`." +msgstr "" + +#: ../../reference/expressions.rst:1107 +msgid "" +"The subscript can also contain a starred expression. In this case, the " +"interpreter unpacks the result into a tuple, and passes this tuple to :meth:" +"`~object.__getitem__` or :meth:`~object.__class_getitem__`::" +msgstr "" + +#: ../../reference/expressions.rst:1111 msgid "" -"A slicing selects a range of items in a sequence object (e.g., a string, " -"tuple or list). Slicings may be used as expressions or as targets in " -"assignment or :keyword:`del` statements. The syntax for a slicing:" +"# continuing with the SubscriptionDemo instance defined above:\n" +">>> demo[*range(10)]\n" +"subscripted with: (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)" msgstr "" -#: ../../reference/expressions.rst:1038 +#: ../../reference/expressions.rst:1115 msgid "" -"There is ambiguity in the formal syntax here: anything that looks like an " -"expression list also looks like a slice list, so any subscription can be " -"interpreted as a slicing. Rather than further complicating the syntax, this " -"is disambiguated by defining that in this case the interpretation as a " -"subscription takes priority over the interpretation as a slicing (this is " -"the case if the slice list contains no proper slice)." +"Starred expressions may be combined with comma-separated expressions and " +"slices::" msgstr "" -#: ../../reference/expressions.rst:1050 +#: ../../reference/expressions.rst:1118 msgid "" -"The semantics for a slicing are as follows. The primary is indexed (using " -"the same :meth:`~object.__getitem__` method as normal subscription) with a " -"key that is constructed from the slice list, as follows. If the slice list " -"contains at least one comma, the key is a tuple containing the conversion of " -"the slice items; otherwise, the conversion of the lone slice item is the " -"key. The conversion of a slice item that is an expression is that " -"expression. The conversion of a proper slice is a slice object (see " -"section :ref:`types`) whose :attr:`~slice.start`, :attr:`~slice.stop` and :" -"attr:`~slice.step` attributes are the values of the expressions given as " -"lower bound, upper bound and stride, respectively, substituting ``None`` for " -"missing expressions." +">>> demo['a', 'b', *range(3), 'c']\n" +"subscripted with: ('a', 'b', 0, 1, 2, 'c')" msgstr "" -#: ../../reference/expressions.rst:1074 +#: ../../reference/expressions.rst:1123 +#, fuzzy +msgid "Formal subscription grammar" +msgstr "subscription(下標)" + +#: ../../reference/expressions.rst:1134 +msgid "" +"Recall that the ``|`` operator :ref:`denotes ordered choice `. " +"Specifically, in :token:`!subscript`, if both alternatives would match, the " +"first (:token:`!single_subscript`) has priority." +msgstr "" + +#: ../../reference/expressions.rst:1149 msgid "Calls" msgstr "" -#: ../../reference/expressions.rst:1076 +#: ../../reference/expressions.rst:1151 msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments `:" msgstr "" -#: ../../reference/expressions.rst:1093 +#: ../../reference/expressions.rst:1168 msgid "" "An optional trailing comma may be present after the positional and keyword " "arguments but does not affect the semantics." msgstr "" -#: ../../reference/expressions.rst:1099 +#: ../../reference/expressions.rst:1174 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -1245,7 +1369,7 @@ msgid "" "formal :term:`parameter` lists." msgstr "" -#: ../../reference/expressions.rst:1107 +#: ../../reference/expressions.rst:1182 msgid "" "If keyword arguments are present, they are first converted to positional " "arguments, as follows. First, a list of unfilled slots is created for the " @@ -1266,7 +1390,7 @@ msgid "" "filled slots is used as the argument list for the call." msgstr "" -#: ../../reference/expressions.rst:1127 +#: ../../reference/expressions.rst:1202 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " @@ -1275,7 +1399,7 @@ msgid "" "`PyArg_ParseTuple` to parse their arguments." msgstr "" -#: ../../reference/expressions.rst:1133 +#: ../../reference/expressions.rst:1208 msgid "" "If there are more positional arguments than there are formal parameter " "slots, a :exc:`TypeError` exception is raised, unless a formal parameter " @@ -1284,7 +1408,7 @@ msgid "" "empty tuple if there were no excess positional arguments)." msgstr "" -#: ../../reference/expressions.rst:1139 +#: ../../reference/expressions.rst:1214 msgid "" "If any keyword argument does not correspond to a formal parameter name, a :" "exc:`TypeError` exception is raised, unless a formal parameter using the " @@ -1294,7 +1418,7 @@ msgid "" "(new) empty dictionary if there were no excess keyword arguments." msgstr "" -#: ../../reference/expressions.rst:1150 +#: ../../reference/expressions.rst:1225 msgid "" "If the syntax ``*expression`` appears in the function call, ``expression`` " "must evaluate to an :term:`iterable`. Elements from these iterables are " @@ -1304,14 +1428,14 @@ msgid "" "*y1*, ..., *yM*, *x3*, *x4*." msgstr "" -#: ../../reference/expressions.rst:1157 +#: ../../reference/expressions.rst:1232 msgid "" "A consequence of this is that although the ``*expression`` syntax may appear " "*after* explicit keyword arguments, it is processed *before* the keyword " "arguments (and any ``**expression`` arguments -- see below). So::" msgstr "" -#: ../../reference/expressions.rst:1161 +#: ../../reference/expressions.rst:1236 msgid "" ">>> def f(a, b):\n" "... print(a, b)\n" @@ -1337,13 +1461,13 @@ msgstr "" ">>> f(1, *(2,))\n" "1 2" -#: ../../reference/expressions.rst:1173 +#: ../../reference/expressions.rst:1248 msgid "" "It is unusual for both keyword arguments and the ``*expression`` syntax to " "be used in the same call, so in practice this confusion does not often arise." msgstr "" -#: ../../reference/expressions.rst:1179 +#: ../../reference/expressions.rst:1254 msgid "" "If the syntax ``**expression`` appears in the function call, ``expression`` " "must evaluate to a :term:`mapping`, the contents of which are treated as " @@ -1352,7 +1476,7 @@ msgid "" "a :exc:`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1185 +#: ../../reference/expressions.rst:1260 msgid "" "When ``**expression`` is used, each key in this mapping must be a string. " "Each value from the mapping is assigned to the first formal parameter " @@ -1364,35 +1488,35 @@ msgid "" "is raised." msgstr "" -#: ../../reference/expressions.rst:1195 +#: ../../reference/expressions.rst:1270 msgid "" "Formal parameters using the syntax ``*identifier`` or ``**identifier`` " "cannot be used as positional argument slots or as keyword argument names." msgstr "" -#: ../../reference/expressions.rst:1198 +#: ../../reference/expressions.rst:1273 msgid "" "Function calls accept any number of ``*`` and ``**`` unpackings, positional " "arguments may follow iterable unpackings (``*``), and keyword arguments may " "follow dictionary unpackings (``**``). Originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1204 +#: ../../reference/expressions.rst:1279 msgid "" "A call always returns some value, possibly ``None``, unless it raises an " "exception. How this value is computed depends on the type of the callable " "object." msgstr "" -#: ../../reference/expressions.rst:1208 +#: ../../reference/expressions.rst:1283 msgid "If it is---" msgstr "" -#: ../../reference/expressions.rst:1210 +#: ../../reference/expressions.rst:1285 msgid "a user-defined function:" msgstr "" -#: ../../reference/expressions.rst:1217 +#: ../../reference/expressions.rst:1292 msgid "" "The code block for the function is executed, passing it the argument list. " "The first thing the code block will do is bind the formal parameters to the " @@ -1403,73 +1527,73 @@ msgid "" "``None``." msgstr "" -#: ../../reference/expressions.rst:1224 +#: ../../reference/expressions.rst:1299 msgid "a built-in function or method:" msgstr "" -#: ../../reference/expressions.rst:1235 +#: ../../reference/expressions.rst:1310 msgid "" "The result is up to the interpreter; see :ref:`built-in-funcs` for the " "descriptions of built-in functions and methods." msgstr "" -#: ../../reference/expressions.rst:1238 +#: ../../reference/expressions.rst:1313 msgid "a class object:" msgstr "" -#: ../../reference/expressions.rst:1243 +#: ../../reference/expressions.rst:1318 msgid "A new instance of that class is returned." msgstr "" -#: ../../reference/expressions.rst:1245 +#: ../../reference/expressions.rst:1320 msgid "a class instance method:" msgstr "" -#: ../../reference/expressions.rst:1251 +#: ../../reference/expressions.rst:1326 msgid "" "The corresponding user-defined function is called, with an argument list " "that is one longer than the argument list of the call: the instance becomes " "the first argument." msgstr "" -#: ../../reference/expressions.rst:1255 +#: ../../reference/expressions.rst:1330 msgid "a class instance:" msgstr "" -#: ../../reference/expressions.rst:1260 +#: ../../reference/expressions.rst:1335 msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" -#: ../../reference/expressions.rst:1268 ../../reference/expressions.rst:2082 +#: ../../reference/expressions.rst:1343 ../../reference/expressions.rst:2157 msgid "Await expression" msgstr "" -#: ../../reference/expressions.rst:1270 +#: ../../reference/expressions.rst:1345 msgid "" "Suspend the execution of :term:`coroutine` on an :term:`awaitable` object. " "Can only be used inside a :term:`coroutine function`." msgstr "" -#: ../../reference/expressions.rst:1282 +#: ../../reference/expressions.rst:1357 msgid "The power operator" msgstr "" -#: ../../reference/expressions.rst:1288 +#: ../../reference/expressions.rst:1363 msgid "" "The power operator binds more tightly than unary operators on its left; it " "binds less tightly than unary operators on its right. The syntax is:" msgstr "" -#: ../../reference/expressions.rst:1294 +#: ../../reference/expressions.rst:1369 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -#: ../../reference/expressions.rst:1298 +#: ../../reference/expressions.rst:1373 msgid "" "The power operator has the same semantics as the built-in :func:`pow` " "function, when called with two arguments: it yields its left argument raised " @@ -1477,7 +1601,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: ../../reference/expressions.rst:1303 +#: ../../reference/expressions.rst:1378 msgid "" "For int operands, the result has the same type as the operands unless the " "second argument is negative; in that case, all arguments are converted to " @@ -1485,41 +1609,41 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: ../../reference/expressions.rst:1308 +#: ../../reference/expressions.rst:1383 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " "Raising a negative number to a fractional power results in a :class:" "`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" msgstr "" -#: ../../reference/expressions.rst:1312 +#: ../../reference/expressions.rst:1387 msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " "and :meth:`~object.__rpow__` methods." msgstr "" -#: ../../reference/expressions.rst:1318 +#: ../../reference/expressions.rst:1393 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1324 +#: ../../reference/expressions.rst:1399 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: ../../reference/expressions.rst:1335 +#: ../../reference/expressions.rst:1410 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" -#: ../../reference/expressions.rst:1343 +#: ../../reference/expressions.rst:1418 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" -#: ../../reference/expressions.rst:1350 +#: ../../reference/expressions.rst:1425 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " @@ -1527,17 +1651,17 @@ msgid "" "meth:`~object.__invert__` special method." msgstr "" -#: ../../reference/expressions.rst:1359 +#: ../../reference/expressions.rst:1434 msgid "" "In all three cases, if the argument does not have the proper type, a :exc:" "`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1366 +#: ../../reference/expressions.rst:1441 msgid "Binary arithmetic operations" msgstr "" -#: ../../reference/expressions.rst:1370 +#: ../../reference/expressions.rst:1445 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1545,7 +1669,7 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: ../../reference/expressions.rst:1385 +#: ../../reference/expressions.rst:1460 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " @@ -1555,32 +1679,32 @@ msgid "" "yields an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1391 +#: ../../reference/expressions.rst:1466 msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1394 ../../reference/expressions.rst:1471 -#: ../../reference/expressions.rst:1486 +#: ../../reference/expressions.rst:1469 ../../reference/expressions.rst:1546 +#: ../../reference/expressions.rst:1561 msgid "" "If only one operand is a complex number, the other operand is converted to a " "floating-point number." msgstr "" -#: ../../reference/expressions.rst:1402 +#: ../../reference/expressions.rst:1477 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1480 msgid "" "This operation can be customized using the special :meth:`~object." "__matmul__` and :meth:`~object.__rmatmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1416 +#: ../../reference/expressions.rst:1491 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1590,7 +1714,7 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: ../../reference/expressions.rst:1423 +#: ../../reference/expressions.rst:1498 msgid "" "The division operation can be customized using the special :meth:`~object." "__truediv__` and :meth:`~object.__rtruediv__` methods. The floor division " @@ -1598,7 +1722,7 @@ msgid "" "and :meth:`~object.__rfloordiv__` methods." msgstr "" -#: ../../reference/expressions.rst:1432 +#: ../../reference/expressions.rst:1507 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -1610,7 +1734,7 @@ msgid "" "absolute value of the second operand [#]_." msgstr "" -#: ../../reference/expressions.rst:1441 +#: ../../reference/expressions.rst:1516 msgid "" "The floor division and modulo operators are connected by the following " "identity: ``x == (x//y)*y + (x%y)``. Floor division and modulo are also " @@ -1618,7 +1742,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: ../../reference/expressions.rst:1446 +#: ../../reference/expressions.rst:1521 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1627,20 +1751,20 @@ msgid "" "formatting`." msgstr "" -#: ../../reference/expressions.rst:1451 +#: ../../reference/expressions.rst:1526 msgid "" "The *modulo* operation can be customized using the special :meth:`~object." "__mod__` and :meth:`~object.__rmod__` methods." msgstr "" -#: ../../reference/expressions.rst:1454 +#: ../../reference/expressions.rst:1529 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " "floating-point number using the :func:`abs` function if appropriate." msgstr "" -#: ../../reference/expressions.rst:1463 +#: ../../reference/expressions.rst:1538 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " @@ -1648,40 +1772,40 @@ msgid "" "and then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1543 msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1555 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common real type." msgstr "" -#: ../../reference/expressions.rst:1483 +#: ../../reference/expressions.rst:1558 msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " "and :meth:`~object.__rsub__` methods." msgstr "" -#: ../../reference/expressions.rst:1494 +#: ../../reference/expressions.rst:1569 msgid "Shifting operations" msgstr "" -#: ../../reference/expressions.rst:1501 +#: ../../reference/expressions.rst:1576 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: ../../reference/expressions.rst:1506 +#: ../../reference/expressions.rst:1581 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -#: ../../reference/expressions.rst:1509 +#: ../../reference/expressions.rst:1584 msgid "" "The left shift operation can be customized using the special :meth:`~object." "__lshift__` and :meth:`~object.__rlshift__` methods. The right shift " @@ -1689,46 +1813,46 @@ msgid "" "and :meth:`~object.__rrshift__` methods." msgstr "" -#: ../../reference/expressions.rst:1516 +#: ../../reference/expressions.rst:1591 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -#: ../../reference/expressions.rst:1523 +#: ../../reference/expressions.rst:1598 msgid "Binary bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1527 +#: ../../reference/expressions.rst:1602 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: ../../reference/expressions.rst:1538 +#: ../../reference/expressions.rst:1613 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " "integers or one of them must be a custom object overriding :meth:`~object." "__and__` or :meth:`~object.__rand__` special methods." msgstr "" -#: ../../reference/expressions.rst:1547 +#: ../../reference/expressions.rst:1622 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " "which must be integers or one of them must be a custom object overriding :" "meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." msgstr "" -#: ../../reference/expressions.rst:1556 +#: ../../reference/expressions.rst:1631 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " "must be integers or one of them must be a custom object overriding :meth:" "`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" -#: ../../reference/expressions.rst:1564 +#: ../../reference/expressions.rst:1639 msgid "Comparisons" msgstr "" -#: ../../reference/expressions.rst:1576 +#: ../../reference/expressions.rst:1651 msgid "" "Unlike C, all comparison operations in Python have the same priority, which " "is lower than that of any arithmetic, shifting or bitwise operation. Also " @@ -1736,14 +1860,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: ../../reference/expressions.rst:1586 +#: ../../reference/expressions.rst:1661 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -#: ../../reference/expressions.rst:1592 +#: ../../reference/expressions.rst:1667 msgid "" "Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent " "to ``x < y and y <= z``, except that ``y`` is evaluated only once (but in " @@ -1751,7 +1875,7 @@ msgid "" "false)." msgstr "" -#: ../../reference/expressions.rst:1596 +#: ../../reference/expressions.rst:1671 msgid "" "Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, " "*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN " @@ -1759,24 +1883,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: ../../reference/expressions.rst:1601 +#: ../../reference/expressions.rst:1676 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -#: ../../reference/expressions.rst:1608 +#: ../../reference/expressions.rst:1683 msgid "Value comparisons" msgstr "" -#: ../../reference/expressions.rst:1610 +#: ../../reference/expressions.rst:1685 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: ../../reference/expressions.rst:1613 +#: ../../reference/expressions.rst:1688 msgid "" "Chapter :ref:`objects` states that objects have a value (in addition to type " "and identity). The value of an object is a rather abstract notion in " @@ -1788,7 +1912,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: ../../reference/expressions.rst:1622 +#: ../../reference/expressions.rst:1697 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1796,7 +1920,7 @@ msgid "" "methods` like :meth:`~object.__lt__`, described in :ref:`customization`." msgstr "" -#: ../../reference/expressions.rst:1628 +#: ../../reference/expressions.rst:1703 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1806,14 +1930,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: ../../reference/expressions.rst:1635 +#: ../../reference/expressions.rst:1710 msgid "" "A default order comparison (``<``, ``>``, ``<=``, and ``>=``) is not " "provided; an attempt raises :exc:`TypeError`. A motivation for this default " "behavior is the lack of a similar invariant as for equality." msgstr "" -#: ../../reference/expressions.rst:1639 +#: ../../reference/expressions.rst:1714 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1822,13 +1946,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: ../../reference/expressions.rst:1645 +#: ../../reference/expressions.rst:1720 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: ../../reference/expressions.rst:1648 +#: ../../reference/expressions.rst:1723 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1838,7 +1962,7 @@ msgid "" "of precision." msgstr "" -#: ../../reference/expressions.rst:1655 +#: ../../reference/expressions.rst:1730 msgid "" "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are " "special. Any ordered comparison of a number to a not-a-number value is " @@ -1848,32 +1972,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: ../../reference/expressions.rst:1662 +#: ../../reference/expressions.rst:1737 msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -#: ../../reference/expressions.rst:1666 +#: ../../reference/expressions.rst:1741 msgid "" "Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be " "compared within and across their types. They compare lexicographically " "using the numeric values of their elements." msgstr "" -#: ../../reference/expressions.rst:1670 +#: ../../reference/expressions.rst:1745 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " "numerical Unicode code points (the result of the built-in function :func:" "`ord`) of their characters. [#]_" msgstr "" -#: ../../reference/expressions.rst:1674 +#: ../../reference/expressions.rst:1749 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: ../../reference/expressions.rst:1676 +#: ../../reference/expressions.rst:1751 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1882,7 +2006,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1682 +#: ../../reference/expressions.rst:1757 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1890,19 +2014,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: ../../reference/expressions.rst:1687 +#: ../../reference/expressions.rst:1762 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: ../../reference/expressions.rst:1689 +#: ../../reference/expressions.rst:1764 msgid "" "For two collections to compare equal, they must be of the same type, have " "the same length, and each pair of corresponding elements must compare equal " "(for example, ``[1,2] == (1,2)`` is false because the type is not the same)." msgstr "" -#: ../../reference/expressions.rst:1694 +#: ../../reference/expressions.rst:1769 msgid "" "Collections that support order comparison are ordered the same as their " "first unequal elements (for example, ``[1,2,x] <= [1,2,y]`` has the same " @@ -1911,25 +2035,25 @@ msgid "" "true)." msgstr "" -#: ../../reference/expressions.rst:1700 +#: ../../reference/expressions.rst:1775 msgid "" "Mappings (instances of :class:`dict`) compare equal if and only if they have " "equal ``(key, value)`` pairs. Equality comparison of the keys and values " "enforces reflexivity." msgstr "" -#: ../../reference/expressions.rst:1704 +#: ../../reference/expressions.rst:1779 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1706 +#: ../../reference/expressions.rst:1781 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: ../../reference/expressions.rst:1709 +#: ../../reference/expressions.rst:1784 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " @@ -1940,110 +2064,110 @@ msgid "" "sets as inputs)." msgstr "" -#: ../../reference/expressions.rst:1717 +#: ../../reference/expressions.rst:1792 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:1794 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: ../../reference/expressions.rst:1722 +#: ../../reference/expressions.rst:1797 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: ../../reference/expressions.rst:1725 +#: ../../reference/expressions.rst:1800 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: ../../reference/expressions.rst:1728 +#: ../../reference/expressions.rst:1803 msgid "``x is y`` implies ``x == y``" msgstr "" -#: ../../reference/expressions.rst:1730 +#: ../../reference/expressions.rst:1805 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1733 +#: ../../reference/expressions.rst:1808 msgid "``x == y`` and ``y == x``" msgstr "``x == y`` 和 ``y == x``" -#: ../../reference/expressions.rst:1735 +#: ../../reference/expressions.rst:1810 msgid "``x != y`` and ``y != x``" msgstr "``x != y`` 和 ``y != x``" -#: ../../reference/expressions.rst:1737 +#: ../../reference/expressions.rst:1812 msgid "``x < y`` and ``y > x``" msgstr "``x < y`` 和 ``y > x``" -#: ../../reference/expressions.rst:1739 +#: ../../reference/expressions.rst:1814 msgid "``x <= y`` and ``y >= x``" msgstr "``x <= y`` 和 ``y >= x``" -#: ../../reference/expressions.rst:1741 +#: ../../reference/expressions.rst:1816 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: ../../reference/expressions.rst:1744 +#: ../../reference/expressions.rst:1819 msgid "``x > y and y > z`` implies ``x > z``" msgstr "``x > y and y > z`` 暗示了 ``x > z``" -#: ../../reference/expressions.rst:1746 +#: ../../reference/expressions.rst:1821 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "``x < y and y <= z`` 暗示了 ``x < z``" -#: ../../reference/expressions.rst:1748 +#: ../../reference/expressions.rst:1823 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1751 +#: ../../reference/expressions.rst:1826 msgid "``x == y`` and ``not x != y``" msgstr "``x == y`` 和 ``not x != y``" -#: ../../reference/expressions.rst:1753 +#: ../../reference/expressions.rst:1828 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1755 +#: ../../reference/expressions.rst:1830 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1757 +#: ../../reference/expressions.rst:1832 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " "sequences, but not to sets or mappings). See also the :func:`~functools." "total_ordering` decorator." msgstr "" -#: ../../reference/expressions.rst:1761 +#: ../../reference/expressions.rst:1836 msgid "" "The :func:`hash` result should be consistent with equality. Objects that are " "equal should either have the same hash value, or be marked as unhashable." msgstr "" -#: ../../reference/expressions.rst:1765 +#: ../../reference/expressions.rst:1840 msgid "" "Python does not enforce these consistency rules. In fact, the not-a-number " "values are an example for not following these rules." msgstr "" -#: ../../reference/expressions.rst:1774 +#: ../../reference/expressions.rst:1849 msgid "Membership test operations" msgstr "" -#: ../../reference/expressions.rst:1776 +#: ../../reference/expressions.rst:1851 msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " @@ -2054,7 +2178,7 @@ msgid "" "expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." msgstr "" -#: ../../reference/expressions.rst:1784 +#: ../../reference/expressions.rst:1859 msgid "" "For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is " "a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty " @@ -2062,14 +2186,14 @@ msgid "" "``\"\" in \"abc\"`` will return ``True``." msgstr "" -#: ../../reference/expressions.rst:1789 +#: ../../reference/expressions.rst:1864 msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1793 +#: ../../reference/expressions.rst:1868 msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -2078,7 +2202,7 @@ msgid "" "it is as if :keyword:`in` raised that exception." msgstr "" -#: ../../reference/expressions.rst:1799 +#: ../../reference/expressions.rst:1874 msgid "" "Lastly, the old-style iteration protocol is tried: if a class defines :meth:" "`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" @@ -2087,17 +2211,17 @@ msgid "" "exception is raised, it is as if :keyword:`in` raised that exception)." msgstr "" -#: ../../reference/expressions.rst:1811 +#: ../../reference/expressions.rst:1886 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: ../../reference/expressions.rst:1824 +#: ../../reference/expressions.rst:1899 msgid "Identity comparisons" msgstr "" -#: ../../reference/expressions.rst:1826 +#: ../../reference/expressions.rst:1901 msgid "" "The operators :keyword:`is` and :keyword:`is not` test for an object's " "identity: ``x is y`` is true if and only if *x* and *y* are the same " @@ -2105,11 +2229,11 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: ../../reference/expressions.rst:1838 +#: ../../reference/expressions.rst:1913 msgid "Boolean operations" msgstr "" -#: ../../reference/expressions.rst:1849 +#: ../../reference/expressions.rst:1924 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " @@ -2120,25 +2244,25 @@ msgid "" "__bool__` method." msgstr "" -#: ../../reference/expressions.rst:1858 +#: ../../reference/expressions.rst:1933 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1863 +#: ../../reference/expressions.rst:1938 msgid "" "The expression ``x and y`` first evaluates *x*; if *x* is false, its value " "is returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:1943 msgid "" "The expression ``x or y`` first evaluates *x*; if *x* is true, its value is " "returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1871 +#: ../../reference/expressions.rst:1946 msgid "" "Note that neither :keyword:`and` nor :keyword:`or` restrict the value and " "type they return to ``False`` and ``True``, but rather return the last " @@ -2149,11 +2273,11 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1890 +#: ../../reference/expressions.rst:1965 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1895 +#: ../../reference/expressions.rst:1970 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " "\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" @@ -2161,11 +2285,11 @@ msgid "" "`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1900 +#: ../../reference/expressions.rst:1975 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1902 +#: ../../reference/expressions.rst:1977 msgid "" "if matching := pattern.search(data):\n" " do_something(matching)" @@ -2173,11 +2297,11 @@ msgstr "" "if matching := pattern.search(data):\n" " do_something(matching)" -#: ../../reference/expressions.rst:1907 +#: ../../reference/expressions.rst:1982 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1909 +#: ../../reference/expressions.rst:1984 msgid "" "while chunk := file.read(9000):\n" " process(chunk)" @@ -2185,7 +2309,7 @@ msgstr "" "while chunk := file.read(9000):\n" " process(chunk)" -#: ../../reference/expressions.rst:1914 +#: ../../reference/expressions.rst:1989 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -2195,37 +2319,37 @@ msgid "" "and ``while`` statements." msgstr "" -#: ../../reference/expressions.rst:1922 +#: ../../reference/expressions.rst:1997 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1929 +#: ../../reference/expressions.rst:2004 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1941 +#: ../../reference/expressions.rst:2016 msgid "" "A conditional expression (sometimes called a \"ternary operator\") is an " "alternative to the if-else statement. As it is an expression, it returns a " "value and can appear as a sub-expression." msgstr "" -#: ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:2020 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: ../../reference/expressions.rst:1949 +#: ../../reference/expressions.rst:2024 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1956 +#: ../../reference/expressions.rst:2031 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1967 +#: ../../reference/expressions.rst:2042 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -2233,7 +2357,7 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1971 +#: ../../reference/expressions.rst:2046 msgid "" "def (parameters):\n" " return expression" @@ -2241,25 +2365,25 @@ msgstr "" "def (parameters):\n" " return expression" -#: ../../reference/expressions.rst:1976 +#: ../../reference/expressions.rst:2051 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: ../../reference/expressions.rst:1984 +#: ../../reference/expressions.rst:2059 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:2000 +#: ../../reference/expressions.rst:2075 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: ../../reference/expressions.rst:2009 +#: ../../reference/expressions.rst:2084 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -2267,16 +2391,16 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:2014 +#: ../../reference/expressions.rst:2089 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:2017 +#: ../../reference/expressions.rst:2092 msgid "Any item in an expression list may be starred. See :pep:`646`." msgstr "" -#: ../../reference/expressions.rst:2022 +#: ../../reference/expressions.rst:2097 msgid "" "A trailing comma is required only to create a one-item tuple, such as ``1," "``; it is optional in all other cases. A single expression without a " @@ -2285,24 +2409,24 @@ msgid "" "``()``.)" msgstr "" -#: ../../reference/expressions.rst:2033 +#: ../../reference/expressions.rst:2108 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:2037 +#: ../../reference/expressions.rst:2112 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: ../../reference/expressions.rst:2040 +#: ../../reference/expressions.rst:2115 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:2043 +#: ../../reference/expressions.rst:2118 msgid "" "expr1, expr2, expr3, expr4\n" "(expr1, expr2, expr3, expr4)\n" @@ -2318,11 +2442,11 @@ msgstr "" "expr1(expr2, expr3, *expr4, **expr5)\n" "expr3, expr4 = expr1, expr2" -#: ../../reference/expressions.rst:2054 +#: ../../reference/expressions.rst:2129 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:2059 +#: ../../reference/expressions.rst:2134 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -2332,176 +2456,177 @@ msgid "" "group from right to left)." msgstr "" -#: ../../reference/expressions.rst:2065 +#: ../../reference/expressions.rst:2140 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: ../../reference/expressions.rst:2071 +#: ../../reference/expressions.rst:2146 msgid "Operator" msgstr "運算子" -#: ../../reference/expressions.rst:2071 +#: ../../reference/expressions.rst:2146 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:2073 +#: ../../reference/expressions.rst:2148 msgid "``(expressions...)``," msgstr "``(expressions...)``," -#: ../../reference/expressions.rst:2075 +#: ../../reference/expressions.rst:2150 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" -#: ../../reference/expressions.rst:2073 +#: ../../reference/expressions.rst:2148 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:2079 -msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" +#: ../../reference/expressions.rst:2154 +#, fuzzy +msgid "``x[index]``, ``x[index:index]`` ``x(arguments...)``, ``x.attribute``" msgstr "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" -#: ../../reference/expressions.rst:2079 -msgid "Subscription, slicing, call, attribute reference" +#: ../../reference/expressions.rst:2154 +msgid "Subscription (including slicing), call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:2082 +#: ../../reference/expressions.rst:2157 msgid ":keyword:`await x `" msgstr ":keyword:`await x `" -#: ../../reference/expressions.rst:2084 +#: ../../reference/expressions.rst:2159 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:2084 +#: ../../reference/expressions.rst:2159 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:2086 +#: ../../reference/expressions.rst:2161 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:2086 +#: ../../reference/expressions.rst:2161 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:2088 +#: ../../reference/expressions.rst:2163 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:2088 +#: ../../reference/expressions.rst:2163 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:2092 +#: ../../reference/expressions.rst:2167 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:2092 +#: ../../reference/expressions.rst:2167 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:2094 +#: ../../reference/expressions.rst:2169 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:2094 +#: ../../reference/expressions.rst:2169 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:2096 +#: ../../reference/expressions.rst:2171 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:2096 +#: ../../reference/expressions.rst:2171 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:2098 +#: ../../reference/expressions.rst:2173 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:2098 +#: ../../reference/expressions.rst:2173 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:2100 +#: ../../reference/expressions.rst:2175 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:2100 +#: ../../reference/expressions.rst:2175 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:2102 +#: ../../reference/expressions.rst:2177 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:2102 +#: ../../reference/expressions.rst:2177 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:2106 +#: ../../reference/expressions.rst:2181 msgid ":keyword:`not x `" msgstr ":keyword:`not x `" -#: ../../reference/expressions.rst:2106 +#: ../../reference/expressions.rst:2181 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:2108 +#: ../../reference/expressions.rst:2183 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:2108 +#: ../../reference/expressions.rst:2183 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:2110 +#: ../../reference/expressions.rst:2185 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:2110 +#: ../../reference/expressions.rst:2185 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:2112 +#: ../../reference/expressions.rst:2187 msgid ":keyword:`if ` -- :keyword:`!else`" msgstr ":keyword:`if ` -- :keyword:`!else`" -#: ../../reference/expressions.rst:2112 +#: ../../reference/expressions.rst:2187 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:2114 +#: ../../reference/expressions.rst:2189 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:2114 +#: ../../reference/expressions.rst:2189 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:2116 +#: ../../reference/expressions.rst:2191 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:2116 +#: ../../reference/expressions.rst:2191 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:2121 +#: ../../reference/expressions.rst:2196 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:2122 +#: ../../reference/expressions.rst:2197 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2513,7 +2638,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:2131 +#: ../../reference/expressions.rst:2206 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2521,7 +2646,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:2136 +#: ../../reference/expressions.rst:2211 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2535,7 +2660,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:2147 +#: ../../reference/expressions.rst:2222 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2543,13 +2668,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:2152 +#: ../../reference/expressions.rst:2227 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: ../../reference/expressions.rst:2155 +#: ../../reference/expressions.rst:2230 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2557,22 +2682,22 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:2160 +#: ../../reference/expressions.rst:2235 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: ../../reference/expressions.rst:2163 +#: ../../reference/expressions.rst:2238 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." msgstr "" #: ../../reference/expressions.rst:8 ../../reference/expressions.rst:448 -#: ../../reference/expressions.rst:504 ../../reference/expressions.rst:1840 -#: ../../reference/expressions.rst:1880 ../../reference/expressions.rst:1931 -#: ../../reference/expressions.rst:1958 ../../reference/expressions.rst:1986 +#: ../../reference/expressions.rst:504 ../../reference/expressions.rst:1915 +#: ../../reference/expressions.rst:1955 ../../reference/expressions.rst:2006 +#: ../../reference/expressions.rst:2033 ../../reference/expressions.rst:2061 msgid "expression" msgstr "" @@ -2580,8 +2705,8 @@ msgstr "" msgid "BNF" msgstr "BNF" -#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1320 -#: ../../reference/expressions.rst:1368 +#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1395 +#: ../../reference/expressions.rst:1443 msgid "arithmetic" msgstr "" @@ -2604,8 +2729,8 @@ msgstr "" #: ../../reference/expressions.rst:73 ../../reference/expressions.rst:625 #: ../../reference/expressions.rst:680 ../../reference/expressions.rst:811 #: ../../reference/expressions.rst:866 ../../reference/expressions.rst:913 -#: ../../reference/expressions.rst:1357 ../../reference/expressions.rst:1410 -#: ../../reference/expressions.rst:1514 +#: ../../reference/expressions.rst:1432 ../../reference/expressions.rst:1485 +#: ../../reference/expressions.rst:1589 msgid "exception" msgstr "" @@ -2646,10 +2771,10 @@ msgstr "type(型別)" #: ../../reference/expressions.rst:427 ../../reference/expressions.rst:448 #: ../../reference/expressions.rst:613 ../../reference/expressions.rst:801 #: ../../reference/expressions.rst:913 ../../reference/expressions.rst:942 -#: ../../reference/expressions.rst:1019 ../../reference/expressions.rst:1063 -#: ../../reference/expressions.rst:1211 ../../reference/expressions.rst:1225 -#: ../../reference/expressions.rst:1239 ../../reference/expressions.rst:1246 -#: ../../reference/expressions.rst:1805 ../../reference/expressions.rst:1998 +#: ../../reference/expressions.rst:1026 ../../reference/expressions.rst:1138 +#: ../../reference/expressions.rst:1286 ../../reference/expressions.rst:1300 +#: ../../reference/expressions.rst:1314 ../../reference/expressions.rst:1321 +#: ../../reference/expressions.rst:1880 ../../reference/expressions.rst:2073 msgid "object" msgstr "object(物件)" @@ -2658,7 +2783,7 @@ msgid "parenthesized form" msgstr "" #: ../../reference/expressions.rst:217 ../../reference/expressions.rst:448 -#: ../../reference/expressions.rst:1063 +#: ../../reference/expressions.rst:1138 msgid "() (parentheses)" msgstr "() (圓括號)" @@ -2671,18 +2796,18 @@ msgid "empty" msgstr "" #: ../../reference/expressions.rst:230 ../../reference/expressions.rst:942 -#: ../../reference/expressions.rst:1019 ../../reference/expressions.rst:1998 +#: ../../reference/expressions.rst:1026 ../../reference/expressions.rst:2073 msgid "tuple" msgstr "" -#: ../../reference/expressions.rst:236 ../../reference/expressions.rst:2020 +#: ../../reference/expressions.rst:236 ../../reference/expressions.rst:2095 msgid "comma" msgstr "" #: ../../reference/expressions.rst:236 ../../reference/expressions.rst:330 #: ../../reference/expressions.rst:356 ../../reference/expressions.rst:384 -#: ../../reference/expressions.rst:1013 ../../reference/expressions.rst:1063 -#: ../../reference/expressions.rst:1986 +#: ../../reference/expressions.rst:1020 ../../reference/expressions.rst:1138 +#: ../../reference/expressions.rst:2061 msgid ", (comma)" msgstr ", (逗號)" @@ -2699,7 +2824,7 @@ msgstr "for" msgid "in comprehensions" msgstr "於 comprehensions(綜合運算)" -#: ../../reference/expressions.rst:261 ../../reference/expressions.rst:1931 +#: ../../reference/expressions.rst:261 ../../reference/expressions.rst:2006 msgid "if" msgstr "if" @@ -2707,13 +2832,13 @@ msgstr "if" msgid "async for" msgstr "async for" -#: ../../reference/expressions.rst:296 ../../reference/expressions.rst:1264 +#: ../../reference/expressions.rst:296 ../../reference/expressions.rst:1339 msgid "await" msgstr "await" #: ../../reference/expressions.rst:330 ../../reference/expressions.rst:913 -#: ../../reference/expressions.rst:942 ../../reference/expressions.rst:1019 -#: ../../reference/expressions.rst:1986 +#: ../../reference/expressions.rst:942 ../../reference/expressions.rst:1026 +#: ../../reference/expressions.rst:2061 msgid "list" msgstr "list(串列)" @@ -2731,7 +2856,7 @@ msgid "list expression" msgstr "list expression(串列運算式)" #: ../../reference/expressions.rst:330 ../../reference/expressions.rst:356 -#: ../../reference/expressions.rst:1986 +#: ../../reference/expressions.rst:2061 msgid "expression list" msgstr "expression list(運算式串列)" @@ -2768,8 +2893,8 @@ msgstr "key/value pair(鍵/值對)" msgid "dictionary expression" msgstr "dictionary expression(字典運算式)" -#: ../../reference/expressions.rst:384 ../../reference/expressions.rst:1013 -#: ../../reference/expressions.rst:1958 +#: ../../reference/expressions.rst:384 ../../reference/expressions.rst:1020 +#: ../../reference/expressions.rst:2033 msgid ": (colon)" msgstr ": (冒號)" @@ -2781,13 +2906,13 @@ msgstr "於字典運算式" msgid "in dictionary displays" msgstr "於字典顯示" -#: ../../reference/expressions.rst:410 ../../reference/expressions.rst:1146 -#: ../../reference/expressions.rst:2005 +#: ../../reference/expressions.rst:410 ../../reference/expressions.rst:1221 +#: ../../reference/expressions.rst:2080 msgid "unpacking" msgstr "unpacking(解包)" -#: ../../reference/expressions.rst:410 ../../reference/expressions.rst:1176 -#: ../../reference/expressions.rst:1284 +#: ../../reference/expressions.rst:410 ../../reference/expressions.rst:1251 +#: ../../reference/expressions.rst:1359 msgid "**" msgstr "**" @@ -2804,7 +2929,7 @@ msgstr "generator(產生器)" msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../reference/expressions.rst:504 ../../reference/expressions.rst:1264 +#: ../../reference/expressions.rst:504 ../../reference/expressions.rst:1339 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2816,8 +2941,8 @@ msgstr "yield" msgid "from" msgstr "from" -#: ../../reference/expressions.rst:504 ../../reference/expressions.rst:1211 -#: ../../reference/expressions.rst:1225 ../../reference/expressions.rst:1958 +#: ../../reference/expressions.rst:504 ../../reference/expressions.rst:1286 +#: ../../reference/expressions.rst:1300 ../../reference/expressions.rst:2033 msgid "function" msgstr "function (函式)" @@ -2881,8 +3006,8 @@ msgstr "module(模組)" msgid "subscription" msgstr "subscription(下標)" -#: ../../reference/expressions.rst:942 ../../reference/expressions.rst:1019 -#: ../../reference/expressions.rst:1805 +#: ../../reference/expressions.rst:942 ../../reference/expressions.rst:1026 +#: ../../reference/expressions.rst:1880 msgid "sequence" msgstr "sequence(序列)" @@ -2890,449 +3015,444 @@ msgstr "sequence(序列)" msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/expressions.rst:942 ../../reference/expressions.rst:999 -#: ../../reference/expressions.rst:1019 +#: ../../reference/expressions.rst:942 ../../reference/expressions.rst:1026 msgid "string" msgstr "string(字串)" -#: ../../reference/expressions.rst:942 ../../reference/expressions.rst:999 +#: ../../reference/expressions.rst:942 msgid "item" msgstr "item(項目)" -#: ../../reference/expressions.rst:999 -msgid "character" -msgstr "character(字元)" - -#: ../../reference/expressions.rst:1013 +#: ../../reference/expressions.rst:1020 msgid "slicing" msgstr "slicing(切片)" -#: ../../reference/expressions.rst:1013 +#: ../../reference/expressions.rst:1020 msgid "slice" msgstr "slice(切片)" -#: ../../reference/expressions.rst:1045 -msgid "start (slice object attribute)" -msgstr "start(切片物件屬性)" - -#: ../../reference/expressions.rst:1045 -msgid "stop (slice object attribute)" -msgstr "stop(切片物件屬性)" - -#: ../../reference/expressions.rst:1045 -msgid "step (slice object attribute)" -msgstr "step(切片物件屬性)" - -#: ../../reference/expressions.rst:1063 +#: ../../reference/expressions.rst:1138 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../reference/expressions.rst:1063 ../../reference/expressions.rst:1211 -#: ../../reference/expressions.rst:1225 ../../reference/expressions.rst:1239 -#: ../../reference/expressions.rst:1246 ../../reference/expressions.rst:1256 +#: ../../reference/expressions.rst:1138 ../../reference/expressions.rst:1286 +#: ../../reference/expressions.rst:1300 ../../reference/expressions.rst:1314 +#: ../../reference/expressions.rst:1321 ../../reference/expressions.rst:1331 msgid "call" msgstr "call(呼叫)" -#: ../../reference/expressions.rst:1063 +#: ../../reference/expressions.rst:1138 msgid "argument" msgstr "argument(引數)" -#: ../../reference/expressions.rst:1063 ../../reference/expressions.rst:1096 +#: ../../reference/expressions.rst:1138 ../../reference/expressions.rst:1171 msgid "call semantics" msgstr "call semantics(呼叫語意)" -#: ../../reference/expressions.rst:1063 +#: ../../reference/expressions.rst:1138 msgid "argument list" msgstr "argument list(引數列表)" -#: ../../reference/expressions.rst:1063 +#: ../../reference/expressions.rst:1138 msgid "= (equals)" msgstr "= (等號)" -#: ../../reference/expressions.rst:1063 ../../reference/expressions.rst:1146 -#: ../../reference/expressions.rst:1176 +#: ../../reference/expressions.rst:1138 ../../reference/expressions.rst:1221 +#: ../../reference/expressions.rst:1251 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../reference/expressions.rst:1096 +#: ../../reference/expressions.rst:1171 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/expressions.rst:1146 ../../reference/expressions.rst:1381 -#: ../../reference/expressions.rst:2005 +#: ../../reference/expressions.rst:1221 ../../reference/expressions.rst:1456 +#: ../../reference/expressions.rst:2080 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/expressions.rst:1211 +#: ../../reference/expressions.rst:1286 msgid "user-defined" msgstr "user-defined(使用者定義)" -#: ../../reference/expressions.rst:1211 +#: ../../reference/expressions.rst:1286 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/expressions.rst:1225 +#: ../../reference/expressions.rst:1300 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../reference/expressions.rst:1225 +#: ../../reference/expressions.rst:1300 msgid "method" msgstr "method(方法)" -#: ../../reference/expressions.rst:1225 +#: ../../reference/expressions.rst:1300 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/expressions.rst:1239 +#: ../../reference/expressions.rst:1314 msgid "class" msgstr "class(類別)" -#: ../../reference/expressions.rst:1239 +#: ../../reference/expressions.rst:1314 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/expressions.rst:1246 +#: ../../reference/expressions.rst:1321 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/expressions.rst:1246 ../../reference/expressions.rst:1256 +#: ../../reference/expressions.rst:1321 ../../reference/expressions.rst:1331 msgid "instance" msgstr "instance(實例)" -#: ../../reference/expressions.rst:1256 +#: ../../reference/expressions.rst:1331 msgid "__call__() (object method)" msgstr "__call__() (物件方法)" -#: ../../reference/expressions.rst:1284 +#: ../../reference/expressions.rst:1359 msgid "power" msgstr "power(次方)" -#: ../../reference/expressions.rst:1284 ../../reference/expressions.rst:1320 -#: ../../reference/expressions.rst:1368 ../../reference/expressions.rst:1496 -#: ../../reference/expressions.rst:1525 ../../reference/expressions.rst:1840 +#: ../../reference/expressions.rst:1359 ../../reference/expressions.rst:1395 +#: ../../reference/expressions.rst:1443 ../../reference/expressions.rst:1571 +#: ../../reference/expressions.rst:1600 ../../reference/expressions.rst:1915 msgid "operation" msgstr "operation(操作)" -#: ../../reference/expressions.rst:1284 ../../reference/expressions.rst:1329 -#: ../../reference/expressions.rst:1338 ../../reference/expressions.rst:1346 -#: ../../reference/expressions.rst:1381 ../../reference/expressions.rst:1398 -#: ../../reference/expressions.rst:1410 ../../reference/expressions.rst:1428 -#: ../../reference/expressions.rst:1458 ../../reference/expressions.rst:1475 -#: ../../reference/expressions.rst:1496 ../../reference/expressions.rst:1534 -#: ../../reference/expressions.rst:1542 ../../reference/expressions.rst:1551 -#: ../../reference/expressions.rst:1566 ../../reference/expressions.rst:1805 -#: ../../reference/expressions.rst:1814 ../../reference/expressions.rst:1856 -#: ../../reference/expressions.rst:1861 ../../reference/expressions.rst:1866 -#: ../../reference/expressions.rst:1931 ../../reference/expressions.rst:2056 +#: ../../reference/expressions.rst:1359 ../../reference/expressions.rst:1404 +#: ../../reference/expressions.rst:1413 ../../reference/expressions.rst:1421 +#: ../../reference/expressions.rst:1456 ../../reference/expressions.rst:1473 +#: ../../reference/expressions.rst:1485 ../../reference/expressions.rst:1503 +#: ../../reference/expressions.rst:1533 ../../reference/expressions.rst:1550 +#: ../../reference/expressions.rst:1571 ../../reference/expressions.rst:1609 +#: ../../reference/expressions.rst:1617 ../../reference/expressions.rst:1626 +#: ../../reference/expressions.rst:1641 ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1889 ../../reference/expressions.rst:1931 +#: ../../reference/expressions.rst:1936 ../../reference/expressions.rst:1941 +#: ../../reference/expressions.rst:2006 ../../reference/expressions.rst:2131 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/expressions.rst:1320 +#: ../../reference/expressions.rst:1395 msgid "unary" msgstr "unary(一元)" -#: ../../reference/expressions.rst:1320 ../../reference/expressions.rst:1525 -#: ../../reference/expressions.rst:1534 ../../reference/expressions.rst:1542 -#: ../../reference/expressions.rst:1551 +#: ../../reference/expressions.rst:1395 ../../reference/expressions.rst:1600 +#: ../../reference/expressions.rst:1609 ../../reference/expressions.rst:1617 +#: ../../reference/expressions.rst:1626 msgid "bitwise" msgstr "bitwise(位元)" -#: ../../reference/expressions.rst:1329 +#: ../../reference/expressions.rst:1404 msgid "negation" msgstr "negation(否定)" -#: ../../reference/expressions.rst:1329 +#: ../../reference/expressions.rst:1404 msgid "minus" msgstr "minus(減)" -#: ../../reference/expressions.rst:1329 ../../reference/expressions.rst:1475 +#: ../../reference/expressions.rst:1404 ../../reference/expressions.rst:1550 msgid "- (minus)" msgstr "- (減號)" -#: ../../reference/expressions.rst:1329 ../../reference/expressions.rst:1338 +#: ../../reference/expressions.rst:1404 ../../reference/expressions.rst:1413 msgid "unary operator" msgstr "unary operator(一元運算子)" -#: ../../reference/expressions.rst:1338 +#: ../../reference/expressions.rst:1413 msgid "plus" msgstr "plus(加)" -#: ../../reference/expressions.rst:1338 ../../reference/expressions.rst:1458 +#: ../../reference/expressions.rst:1413 ../../reference/expressions.rst:1533 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../reference/expressions.rst:1346 +#: ../../reference/expressions.rst:1421 msgid "inversion" msgstr "inversion(反轉)" -#: ../../reference/expressions.rst:1346 +#: ../../reference/expressions.rst:1421 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../reference/expressions.rst:1357 +#: ../../reference/expressions.rst:1432 msgid "TypeError" msgstr "TypeError" -#: ../../reference/expressions.rst:1368 ../../reference/expressions.rst:1525 +#: ../../reference/expressions.rst:1443 ../../reference/expressions.rst:1600 msgid "binary" msgstr "binary(二進位)" -#: ../../reference/expressions.rst:1381 +#: ../../reference/expressions.rst:1456 msgid "multiplication" msgstr "multiplication(乘)" -#: ../../reference/expressions.rst:1398 +#: ../../reference/expressions.rst:1473 msgid "matrix multiplication" msgstr "matrix multiplication(矩陣乘法)" -#: ../../reference/expressions.rst:1398 +#: ../../reference/expressions.rst:1473 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1485 msgid "ZeroDivisionError" msgstr "ZeroDivisionError" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1485 msgid "division" msgstr "division(除)" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1485 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1485 msgid "//" msgstr "//" -#: ../../reference/expressions.rst:1428 +#: ../../reference/expressions.rst:1503 msgid "modulo" msgstr "modulo(餘數)" -#: ../../reference/expressions.rst:1428 +#: ../../reference/expressions.rst:1503 msgid "% (percent)" msgstr "% (百分號)" -#: ../../reference/expressions.rst:1458 +#: ../../reference/expressions.rst:1533 msgid "addition" msgstr "addition(加)" -#: ../../reference/expressions.rst:1458 ../../reference/expressions.rst:1475 +#: ../../reference/expressions.rst:1533 ../../reference/expressions.rst:1550 msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../reference/expressions.rst:1475 +#: ../../reference/expressions.rst:1550 msgid "subtraction" msgstr "subtraction(減)" -#: ../../reference/expressions.rst:1496 +#: ../../reference/expressions.rst:1571 msgid "shifting" msgstr "shifting(移動)" -#: ../../reference/expressions.rst:1496 +#: ../../reference/expressions.rst:1571 msgid "<<" msgstr "<<" -#: ../../reference/expressions.rst:1496 +#: ../../reference/expressions.rst:1571 msgid ">>" msgstr ">>" -#: ../../reference/expressions.rst:1514 +#: ../../reference/expressions.rst:1589 msgid "ValueError" msgstr "ValueError" -#: ../../reference/expressions.rst:1534 ../../reference/expressions.rst:1861 +#: ../../reference/expressions.rst:1609 ../../reference/expressions.rst:1936 msgid "and" msgstr "and" -#: ../../reference/expressions.rst:1534 +#: ../../reference/expressions.rst:1609 msgid "& (ampersand)" msgstr "& (和號)" -#: ../../reference/expressions.rst:1542 +#: ../../reference/expressions.rst:1617 msgid "xor" msgstr "xor" -#: ../../reference/expressions.rst:1542 +#: ../../reference/expressions.rst:1617 msgid "exclusive" msgstr "exclusive(排外)" -#: ../../reference/expressions.rst:1542 ../../reference/expressions.rst:1551 -#: ../../reference/expressions.rst:1866 +#: ../../reference/expressions.rst:1617 ../../reference/expressions.rst:1626 +#: ../../reference/expressions.rst:1941 msgid "or" msgstr "or" -#: ../../reference/expressions.rst:1542 +#: ../../reference/expressions.rst:1617 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../reference/expressions.rst:1551 +#: ../../reference/expressions.rst:1626 msgid "inclusive" msgstr "inclusive(包含)" -#: ../../reference/expressions.rst:1551 +#: ../../reference/expressions.rst:1626 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../reference/expressions.rst:1566 +#: ../../reference/expressions.rst:1641 msgid "comparison" msgstr "comparison(比較)" -#: ../../reference/expressions.rst:1566 +#: ../../reference/expressions.rst:1641 msgid "C" msgstr "C" -#: ../../reference/expressions.rst:1566 +#: ../../reference/expressions.rst:1641 msgid "language" msgstr "language(語言)" -#: ../../reference/expressions.rst:1566 +#: ../../reference/expressions.rst:1641 msgid "< (less)" msgstr "< (小於)" -#: ../../reference/expressions.rst:1566 +#: ../../reference/expressions.rst:1641 msgid "> (greater)" msgstr "> (大於)" -#: ../../reference/expressions.rst:1566 +#: ../../reference/expressions.rst:1641 msgid "<=" msgstr "<=" -#: ../../reference/expressions.rst:1566 +#: ../../reference/expressions.rst:1641 msgid ">=" msgstr ">=" -#: ../../reference/expressions.rst:1566 +#: ../../reference/expressions.rst:1641 msgid "==" msgstr "==" -#: ../../reference/expressions.rst:1566 +#: ../../reference/expressions.rst:1641 msgid "!=" msgstr "!=" -#: ../../reference/expressions.rst:1590 +#: ../../reference/expressions.rst:1665 msgid "chaining" msgstr "chaining(鏈接)" -#: ../../reference/expressions.rst:1590 +#: ../../reference/expressions.rst:1665 msgid "comparisons" msgstr "comparisons(比較)" -#: ../../reference/expressions.rst:1805 +#: ../../reference/expressions.rst:1880 msgid "in" msgstr "in" -#: ../../reference/expressions.rst:1805 +#: ../../reference/expressions.rst:1880 msgid "not in" msgstr "not in" -#: ../../reference/expressions.rst:1805 +#: ../../reference/expressions.rst:1880 msgid "membership" msgstr "membership(成員)" -#: ../../reference/expressions.rst:1805 ../../reference/expressions.rst:1814 +#: ../../reference/expressions.rst:1880 ../../reference/expressions.rst:1889 msgid "test" msgstr "test(測試)" -#: ../../reference/expressions.rst:1814 +#: ../../reference/expressions.rst:1889 msgid "is" msgstr "is" -#: ../../reference/expressions.rst:1814 +#: ../../reference/expressions.rst:1889 msgid "is not" msgstr "is not" -#: ../../reference/expressions.rst:1814 +#: ../../reference/expressions.rst:1889 msgid "identity" msgstr "identity" -#: ../../reference/expressions.rst:1840 +#: ../../reference/expressions.rst:1915 msgid "Conditional" msgstr "Conditional(條件式)" -#: ../../reference/expressions.rst:1840 +#: ../../reference/expressions.rst:1915 msgid "Boolean" msgstr "Boolean(布林)" -#: ../../reference/expressions.rst:1856 +#: ../../reference/expressions.rst:1931 msgid "not" msgstr "not" -#: ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1955 msgid ":= (colon equals)" msgstr ":= (冒號等於)" -#: ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1955 msgid "assignment expression" msgstr "assignment expression(賦值運算式)" -#: ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1955 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1955 msgid "named expression" msgstr "named expression(附名運算式)" -#: ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1955 msgid "assignment" msgstr "assignment(賦值)" -#: ../../reference/expressions.rst:1931 +#: ../../reference/expressions.rst:2006 msgid "conditional" msgstr "conditional(條件式)" -#: ../../reference/expressions.rst:1931 +#: ../../reference/expressions.rst:2006 msgid "ternary" msgstr "ternary(三元)" -#: ../../reference/expressions.rst:1931 +#: ../../reference/expressions.rst:2006 msgid "conditional expression" msgstr "conditional expression(條件運算式)" -#: ../../reference/expressions.rst:1931 +#: ../../reference/expressions.rst:2006 msgid "else" msgstr "else" -#: ../../reference/expressions.rst:1958 +#: ../../reference/expressions.rst:2033 msgid "lambda" msgstr "lambda" -#: ../../reference/expressions.rst:1958 +#: ../../reference/expressions.rst:2033 msgid "form" msgstr "form" -#: ../../reference/expressions.rst:1958 +#: ../../reference/expressions.rst:2033 msgid "anonymous" msgstr "anonymous(匿名)" -#: ../../reference/expressions.rst:1958 +#: ../../reference/expressions.rst:2033 msgid "lambda expression" msgstr "lambda expression(lambda 運算式)" -#: ../../reference/expressions.rst:2005 +#: ../../reference/expressions.rst:2080 msgid "iterable" msgstr "iterable(可疊代)" -#: ../../reference/expressions.rst:2005 +#: ../../reference/expressions.rst:2080 msgid "in expression lists" msgstr "於 expression list(運算式串列)" -#: ../../reference/expressions.rst:2020 +#: ../../reference/expressions.rst:2095 msgid "trailing" msgstr "trailing" -#: ../../reference/expressions.rst:2035 +#: ../../reference/expressions.rst:2110 msgid "evaluation" msgstr "evaluation" -#: ../../reference/expressions.rst:2035 +#: ../../reference/expressions.rst:2110 msgid "order" msgstr "order(順序)" -#: ../../reference/expressions.rst:2056 +#: ../../reference/expressions.rst:2131 msgid "precedence" msgstr "precedence(優先順序)" +#~ msgid "character" +#~ msgstr "character(字元)" + +#~ msgid "start (slice object attribute)" +#~ msgstr "start(切片物件屬性)" + +#~ msgid "stop (slice object attribute)" +#~ msgstr "stop(切片物件屬性)" + +#~ msgid "step (slice object attribute)" +#~ msgstr "step(切片物件屬性)" + #~ msgid "datum" #~ msgstr "datum(資料元)" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index 1fc396d1e1..c3d85c07db 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-08 00:15+0000\n" +"POT-Creation-Date: 2026-02-06 00:18+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -65,13 +65,13 @@ msgid "" "attributes or items of mutable objects:" msgstr "" -#: ../../reference/simple_stmts.rst:97 +#: ../../reference/simple_stmts.rst:96 msgid "" -"(See section :ref:`primaries` for the syntax definitions for *attributeref*, " -"*subscription*, and *slicing*.)" +"(See section :ref:`primaries` for the syntax definitions for *attributeref* " +"and *subscription*.)" msgstr "" -#: ../../reference/simple_stmts.rst:100 +#: ../../reference/simple_stmts.rst:99 msgid "" "An assignment statement evaluates the expression list (remember that this " "can be a single expression or a comma-separated list, the latter yielding a " @@ -79,34 +79,33 @@ msgid "" "from left to right." msgstr "" -#: ../../reference/simple_stmts.rst:109 +#: ../../reference/simple_stmts.rst:108 msgid "" "Assignment is defined recursively depending on the form of the target " -"(list). When a target is part of a mutable object (an attribute reference, " -"subscription or slicing), the mutable object must ultimately perform the " -"assignment and decide about its validity, and may raise an exception if the " -"assignment is unacceptable. The rules observed by various types and the " -"exceptions raised are given with the definition of the object types (see " -"section :ref:`types`)." +"(list). When a target is part of a mutable object (an attribute reference or " +"subscription), the mutable object must ultimately perform the assignment and " +"decide about its validity, and may raise an exception if the assignment is " +"unacceptable. The rules observed by various types and the exceptions raised " +"are given with the definition of the object types (see section :ref:`types`)." msgstr "" -#: ../../reference/simple_stmts.rst:122 +#: ../../reference/simple_stmts.rst:121 msgid "" "Assignment of an object to a target list, optionally enclosed in parentheses " "or square brackets, is recursively defined as follows." msgstr "" -#: ../../reference/simple_stmts.rst:125 +#: ../../reference/simple_stmts.rst:124 msgid "" "If the target list is a single target with no trailing comma, optionally in " "parentheses, the object is assigned to that target." msgstr "" -#: ../../reference/simple_stmts.rst:128 +#: ../../reference/simple_stmts.rst:127 msgid "Else:" msgstr "" -#: ../../reference/simple_stmts.rst:130 +#: ../../reference/simple_stmts.rst:129 msgid "" "If the target list contains one target prefixed with an asterisk, called a " "\"starred\" target: The object must be an iterable with at least as many " @@ -117,43 +116,43 @@ msgid "" "then assigned to the starred target (the list can be empty)." msgstr "" -#: ../../reference/simple_stmts.rst:138 +#: ../../reference/simple_stmts.rst:137 msgid "" "Else: The object must be an iterable with the same number of items as there " "are targets in the target list, and the items are assigned, from left to " "right, to the corresponding targets." msgstr "" -#: ../../reference/simple_stmts.rst:142 +#: ../../reference/simple_stmts.rst:141 msgid "" "Assignment of an object to a single target is recursively defined as follows." msgstr "" -#: ../../reference/simple_stmts.rst:144 +#: ../../reference/simple_stmts.rst:143 msgid "If the target is an identifier (name):" msgstr "" -#: ../../reference/simple_stmts.rst:146 +#: ../../reference/simple_stmts.rst:145 msgid "" "If the name does not occur in a :keyword:`global` or :keyword:`nonlocal` " "statement in the current code block: the name is bound to the object in the " "current local namespace." msgstr "" -#: ../../reference/simple_stmts.rst:150 +#: ../../reference/simple_stmts.rst:149 msgid "" "Otherwise: the name is bound to the object in the global namespace or the " "outer namespace determined by :keyword:`nonlocal`, respectively." msgstr "" -#: ../../reference/simple_stmts.rst:155 +#: ../../reference/simple_stmts.rst:154 msgid "" "The name is rebound if it was already bound. This may cause the reference " "count for the object previously bound to the name to reach zero, causing the " "object to be deallocated and its destructor (if it has one) to be called." msgstr "" -#: ../../reference/simple_stmts.rst:161 +#: ../../reference/simple_stmts.rst:160 msgid "" "If the target is an attribute reference: The primary expression in the " "reference is evaluated. It should yield an object with assignable " @@ -163,7 +162,7 @@ msgid "" "necessarily :exc:`AttributeError`)." msgstr "" -#: ../../reference/simple_stmts.rst:170 +#: ../../reference/simple_stmts.rst:169 msgid "" "Note: If the object is a class instance and the attribute reference occurs " "on both sides of the assignment operator, the right-hand side expression, " @@ -175,7 +174,7 @@ msgid "" "side creates a new instance attribute as the target of the assignment::" msgstr "" -#: ../../reference/simple_stmts.rst:179 +#: ../../reference/simple_stmts.rst:178 msgid "" "class Cls:\n" " x = 3 # class variable\n" @@ -183,21 +182,28 @@ msgid "" "inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3" msgstr "" -#: ../../reference/simple_stmts.rst:184 +#: ../../reference/simple_stmts.rst:183 msgid "" "This description does not necessarily apply to descriptor attributes, such " "as properties created with :func:`property`." msgstr "" -#: ../../reference/simple_stmts.rst:191 +#: ../../reference/simple_stmts.rst:190 msgid "" "If the target is a subscription: The primary expression in the reference is " -"evaluated. It should yield either a mutable sequence object (such as a " -"list) or a mapping object (such as a dictionary). Next, the subscript " -"expression is evaluated." +"evaluated. Next, the subscript expression is evaluated. Then, the primary's :" +"meth:`~object.__setitem__` method is called with two arguments: the " +"subscript and the assigned object." msgstr "" -#: ../../reference/simple_stmts.rst:200 +#: ../../reference/simple_stmts.rst:196 +msgid "" +"Typically, :meth:`~object.__setitem__` is defined on mutable sequence " +"objects (such as lists) and mapping objects (such as dictionaries), and " +"behaves as follows." +msgstr "" + +#: ../../reference/simple_stmts.rst:204 msgid "" "If the primary is a mutable sequence object (such as a list), the subscript " "must yield an integer. If it is negative, the sequence's length is added to " @@ -208,7 +214,7 @@ msgid "" "items to a list)." msgstr "" -#: ../../reference/simple_stmts.rst:211 +#: ../../reference/simple_stmts.rst:215 msgid "" "If the primary is a mapping object (such as a dictionary), the subscript " "must have a type compatible with the mapping's key type, and the mapping is " @@ -218,35 +224,21 @@ msgid "" "value existed)." msgstr "" -#: ../../reference/simple_stmts.rst:217 +#: ../../reference/simple_stmts.rst:223 msgid "" -"For user-defined objects, the :meth:`~object.__setitem__` method is called " -"with appropriate arguments." -msgstr "" - -#: ../../reference/simple_stmts.rst:222 -msgid "" -"If the target is a slicing: The primary expression in the reference is " -"evaluated. It should yield a mutable sequence object (such as a list). The " -"assigned object should be a sequence object of the same type. Next, the " -"lower and upper bound expressions are evaluated, insofar they are present; " -"defaults are zero and the sequence's length. The bounds should evaluate to " -"integers. If either bound is negative, the sequence's length is added to " -"it. The resulting bounds are clipped to lie between zero and the sequence's " +"If the target is a slicing: The primary expression should evaluate to a " +"mutable sequence object (such as a list). The assigned object should be :" +"term:`iterable`. The slicing's lower and upper bounds should be integers; if " +"they are ``None`` (or not present), the defaults are zero and the sequence's " +"length. If either bound is negative, the sequence's length is added to it. " +"The resulting bounds are clipped to lie between zero and the sequence's " "length, inclusive. Finally, the sequence object is asked to replace the " "slice with the items of the assigned sequence. The length of the slice may " "be different from the length of the assigned sequence, thus changing the " "length of the target sequence, if the target sequence allows it." msgstr "" -#: ../../reference/simple_stmts.rst:236 -msgid "" -"In the current implementation, the syntax for targets is taken to be the " -"same as for expressions, and invalid syntax is rejected during the code " -"generation phase, causing less detailed error messages." -msgstr "" - -#: ../../reference/simple_stmts.rst:240 +#: ../../reference/simple_stmts.rst:235 msgid "" "Although the definition of assignment implies that overlaps between the left-" "hand side and the right-hand side are 'simultaneous' (for example ``a, b = " @@ -255,7 +247,7 @@ msgid "" "instance, the following program prints ``[0, 2]``::" msgstr "" -#: ../../reference/simple_stmts.rst:246 +#: ../../reference/simple_stmts.rst:241 msgid "" "x = [0, 1]\n" "i = 0\n" @@ -267,31 +259,31 @@ msgstr "" "i, x[i] = 1, 2 # i 先被更新,然後 x[i] 再被更新\n" "print(x)" -#: ../../reference/simple_stmts.rst:254 +#: ../../reference/simple_stmts.rst:249 msgid ":pep:`3132` - Extended Iterable Unpacking" msgstr "" -#: ../../reference/simple_stmts.rst:255 +#: ../../reference/simple_stmts.rst:250 msgid "The specification for the ``*target`` feature." msgstr "" -#: ../../reference/simple_stmts.rst:261 +#: ../../reference/simple_stmts.rst:256 msgid "Augmented assignment statements" msgstr "擴增賦值陳述式" -#: ../../reference/simple_stmts.rst:279 +#: ../../reference/simple_stmts.rst:274 msgid "" "Augmented assignment is the combination, in a single statement, of a binary " "operation and an assignment statement:" msgstr "" -#: ../../reference/simple_stmts.rst:288 +#: ../../reference/simple_stmts.rst:283 msgid "" "(See section :ref:`primaries` for the syntax definitions of the last three " "symbols.)" msgstr "" -#: ../../reference/simple_stmts.rst:291 +#: ../../reference/simple_stmts.rst:286 msgid "" "An augmented assignment evaluates the target (which, unlike normal " "assignment statements, cannot be an unpacking) and the expression list, " @@ -300,7 +292,7 @@ msgid "" "evaluated once." msgstr "" -#: ../../reference/simple_stmts.rst:296 +#: ../../reference/simple_stmts.rst:291 msgid "" "An augmented assignment statement like ``x += 1`` can be rewritten as ``x = " "x + 1`` to achieve a similar, but not exactly equal effect. In the augmented " @@ -309,7 +301,7 @@ msgid "" "object and assigning that to the target, the old object is modified instead." msgstr "" -#: ../../reference/simple_stmts.rst:302 +#: ../../reference/simple_stmts.rst:297 msgid "" "Unlike normal assignments, augmented assignments evaluate the left-hand side " "*before* evaluating the right-hand side. For example, ``a[i] += f(x)`` " @@ -317,7 +309,7 @@ msgid "" "addition, and lastly, it writes the result back to ``a[i]``." msgstr "" -#: ../../reference/simple_stmts.rst:307 +#: ../../reference/simple_stmts.rst:302 msgid "" "With the exception of assigning to tuples and multiple targets in a single " "statement, the assignment done by augmented assignment statements is handled " @@ -326,18 +318,18 @@ msgid "" "assignment is the same as the normal binary operations." msgstr "" -#: ../../reference/simple_stmts.rst:313 +#: ../../reference/simple_stmts.rst:308 msgid "" "For targets which are attribute references, the same :ref:`caveat about " "class and instance attributes ` applies as for regular " "assignments." msgstr "" -#: ../../reference/simple_stmts.rst:320 +#: ../../reference/simple_stmts.rst:315 msgid "Annotated assignment statements" msgstr "註釋賦值陳述式" -#: ../../reference/simple_stmts.rst:327 +#: ../../reference/simple_stmts.rst:322 msgid "" ":term:`Annotation ` assignment is the combination, in a " "single statement, of a variable or attribute annotation and an optional " @@ -346,13 +338,13 @@ msgstr "" ":term:`註釋 ` 賦值是將變數或屬性註釋與可選的賦值陳述式結" "合在一個陳述式中:" -#: ../../reference/simple_stmts.rst:334 +#: ../../reference/simple_stmts.rst:329 msgid "" "The difference from normal :ref:`assignment` is that only a single target is " "allowed." msgstr "" -#: ../../reference/simple_stmts.rst:336 +#: ../../reference/simple_stmts.rst:331 msgid "" "The assignment target is considered \"simple\" if it consists of a single " "name that is not enclosed in parentheses. For simple assignment targets, if " @@ -362,19 +354,19 @@ msgid "" "or module, or using the facilities in the :mod:`annotationlib` module." msgstr "" -#: ../../reference/simple_stmts.rst:345 +#: ../../reference/simple_stmts.rst:340 msgid "" "If the assignment target is not simple (an attribute, subscript node, or " "parenthesized name), the annotation is never evaluated." msgstr "" -#: ../../reference/simple_stmts.rst:348 +#: ../../reference/simple_stmts.rst:343 msgid "" "If a name is annotated in a function scope, then this name is local for that " "scope. Annotations are never evaluated and stored in function scopes." msgstr "" -#: ../../reference/simple_stmts.rst:351 +#: ../../reference/simple_stmts.rst:346 msgid "" "If the right hand side is present, an annotated assignment performs the " "actual assignment as if there was no annotation present. If the right hand " @@ -383,57 +375,57 @@ msgid "" "__setattr__` call." msgstr "" -#: ../../reference/simple_stmts.rst:359 +#: ../../reference/simple_stmts.rst:354 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: ../../reference/simple_stmts.rst:360 +#: ../../reference/simple_stmts.rst:355 msgid "" "The proposal that added syntax for annotating the types of variables " "(including class variables and instance variables), instead of expressing " "them through comments." msgstr "" -#: ../../reference/simple_stmts.rst:364 +#: ../../reference/simple_stmts.rst:359 msgid ":pep:`484` - Type hints" msgstr ":pep:`484` - 型別提示" -#: ../../reference/simple_stmts.rst:365 +#: ../../reference/simple_stmts.rst:360 msgid "" "The proposal that added the :mod:`typing` module to provide a standard " "syntax for type annotations that can be used in static analysis tools and " "IDEs." msgstr "" -#: ../../reference/simple_stmts.rst:369 +#: ../../reference/simple_stmts.rst:364 msgid "" "Now annotated assignments allow the same expressions in the right hand side " "as regular assignments. Previously, some expressions (like un-parenthesized " "tuple expressions) caused a syntax error." msgstr "" -#: ../../reference/simple_stmts.rst:374 +#: ../../reference/simple_stmts.rst:369 msgid "" "Annotations are now lazily evaluated in a separate :ref:`annotation scope " "`. If the assignment target is not simple, annotations " "are never evaluated." msgstr "" -#: ../../reference/simple_stmts.rst:382 +#: ../../reference/simple_stmts.rst:377 msgid "The :keyword:`!assert` statement" msgstr ":keyword:`!assert` 陳述式" -#: ../../reference/simple_stmts.rst:389 +#: ../../reference/simple_stmts.rst:384 msgid "" "Assert statements are a convenient way to insert debugging assertions into a " "program:" msgstr "" -#: ../../reference/simple_stmts.rst:395 +#: ../../reference/simple_stmts.rst:390 msgid "The simple form, ``assert expression``, is equivalent to ::" msgstr "" -#: ../../reference/simple_stmts.rst:397 +#: ../../reference/simple_stmts.rst:392 msgid "" "if __debug__:\n" " if not expression: raise AssertionError" @@ -441,12 +433,12 @@ msgstr "" "if __debug__:\n" " if not expression: raise AssertionError" -#: ../../reference/simple_stmts.rst:400 +#: ../../reference/simple_stmts.rst:395 msgid "" "The extended form, ``assert expression1, expression2``, is equivalent to ::" msgstr "" -#: ../../reference/simple_stmts.rst:402 +#: ../../reference/simple_stmts.rst:397 msgid "" "if __debug__:\n" " if not expression1: raise AssertionError(expression2)" @@ -454,7 +446,7 @@ msgstr "" "if __debug__:\n" " if not expression1: raise AssertionError(expression2)" -#: ../../reference/simple_stmts.rst:409 +#: ../../reference/simple_stmts.rst:404 msgid "" "These equivalences assume that :const:`__debug__` and :exc:`AssertionError` " "refer to the built-in variables with those names. In the current " @@ -467,24 +459,24 @@ msgid "" "trace." msgstr "" -#: ../../reference/simple_stmts.rst:418 +#: ../../reference/simple_stmts.rst:413 msgid "" "Assignments to :const:`__debug__` are illegal. The value for the built-in " "variable is determined when the interpreter starts." msgstr "" -#: ../../reference/simple_stmts.rst:425 +#: ../../reference/simple_stmts.rst:420 msgid "The :keyword:`!pass` statement" msgstr ":keyword:`!pass` 陳述式" -#: ../../reference/simple_stmts.rst:435 +#: ../../reference/simple_stmts.rst:430 msgid "" ":keyword:`pass` is a null operation --- when it is executed, nothing " "happens. It is useful as a placeholder when a statement is required " "syntactically, but no code needs to be executed, for example::" msgstr "" -#: ../../reference/simple_stmts.rst:439 +#: ../../reference/simple_stmts.rst:434 msgid "" "def f(arg): pass # a function that does nothing (yet)\n" "\n" @@ -494,23 +486,23 @@ msgstr "" "\n" "class C: pass # 一個(還)沒有方法的類別" -#: ../../reference/simple_stmts.rst:447 +#: ../../reference/simple_stmts.rst:442 msgid "The :keyword:`!del` statement" msgstr ":keyword:`!del` 陳述式" -#: ../../reference/simple_stmts.rst:457 +#: ../../reference/simple_stmts.rst:452 msgid "" "Deletion is recursively defined very similar to the way assignment is " "defined. Rather than spelling it out in full details, here are some hints." msgstr "" -#: ../../reference/simple_stmts.rst:460 +#: ../../reference/simple_stmts.rst:455 msgid "" "Deletion of a target list recursively deletes each target, from left to " "right." msgstr "" -#: ../../reference/simple_stmts.rst:466 +#: ../../reference/simple_stmts.rst:461 msgid "" "Deletion of a name removes the binding of that name from the local or global " "namespace, depending on whether the name occurs in a :keyword:`global` " @@ -518,50 +510,50 @@ msgid "" "a :exc:`NameError` exception." msgstr "" -#: ../../reference/simple_stmts.rst:473 +#: ../../reference/simple_stmts.rst:468 msgid "" -"Deletion of attribute references, subscriptions and slicings is passed to " -"the primary object involved; deletion of a slicing is in general equivalent " -"to assignment of an empty slice of the right type (but even this is " -"determined by the sliced object)." +"Deletion of attribute references and subscriptions is passed to the primary " +"object involved; deletion of a slicing is in general equivalent to " +"assignment of an empty slice of the right type (but even this is determined " +"by the sliced object)." msgstr "" -#: ../../reference/simple_stmts.rst:478 +#: ../../reference/simple_stmts.rst:473 msgid "" "Previously it was illegal to delete a name from the local namespace if it " "occurs as a free variable in a nested block." msgstr "" -#: ../../reference/simple_stmts.rst:486 +#: ../../reference/simple_stmts.rst:481 msgid "The :keyword:`!return` statement" msgstr ":keyword:`!return` 陳述式" -#: ../../reference/simple_stmts.rst:496 +#: ../../reference/simple_stmts.rst:491 msgid "" ":keyword:`return` may only occur syntactically nested in a function " "definition, not within a nested class definition." msgstr "" -#: ../../reference/simple_stmts.rst:499 +#: ../../reference/simple_stmts.rst:494 msgid "" "If an expression list is present, it is evaluated, else ``None`` is " "substituted." msgstr "" -#: ../../reference/simple_stmts.rst:501 +#: ../../reference/simple_stmts.rst:496 msgid "" ":keyword:`return` leaves the current function call with the expression list " "(or ``None``) as return value." msgstr "" -#: ../../reference/simple_stmts.rst:506 +#: ../../reference/simple_stmts.rst:501 msgid "" "When :keyword:`return` passes control out of a :keyword:`try` statement with " "a :keyword:`finally` clause, that :keyword:`!finally` clause is executed " "before really leaving the function." msgstr "" -#: ../../reference/simple_stmts.rst:510 +#: ../../reference/simple_stmts.rst:505 msgid "" "In a generator function, the :keyword:`return` statement indicates that the " "generator is done and will cause :exc:`StopIteration` to be raised. The " @@ -569,7 +561,7 @@ msgid "" "`StopIteration` and becomes the :attr:`StopIteration.value` attribute." msgstr "" -#: ../../reference/simple_stmts.rst:515 +#: ../../reference/simple_stmts.rst:510 msgid "" "In an asynchronous generator function, an empty :keyword:`return` statement " "indicates that the asynchronous generator is done and will cause :exc:" @@ -577,11 +569,11 @@ msgid "" "is a syntax error in an asynchronous generator function." msgstr "" -#: ../../reference/simple_stmts.rst:523 +#: ../../reference/simple_stmts.rst:518 msgid "The :keyword:`!yield` statement" msgstr ":keyword:`!yield` 陳述式" -#: ../../reference/simple_stmts.rst:535 +#: ../../reference/simple_stmts.rst:530 msgid "" "A :keyword:`yield` statement is semantically equivalent to a :ref:`yield " "expression `. The ``yield`` statement can be used to omit the " @@ -589,7 +581,7 @@ msgid "" "expression statement. For example, the yield statements ::" msgstr "" -#: ../../reference/simple_stmts.rst:540 +#: ../../reference/simple_stmts.rst:535 msgid "" "yield \n" "yield from " @@ -597,11 +589,11 @@ msgstr "" "yield \n" "yield from " -#: ../../reference/simple_stmts.rst:543 +#: ../../reference/simple_stmts.rst:538 msgid "are equivalent to the yield expression statements ::" msgstr "" -#: ../../reference/simple_stmts.rst:545 +#: ../../reference/simple_stmts.rst:540 msgid "" "(yield )\n" "(yield from )" @@ -609,7 +601,7 @@ msgstr "" "(yield )\n" "(yield from )" -#: ../../reference/simple_stmts.rst:548 +#: ../../reference/simple_stmts.rst:543 msgid "" "Yield expressions and statements are only used when defining a :term:" "`generator` function, and are only used in the body of the generator " @@ -618,17 +610,17 @@ msgid "" "function." msgstr "" -#: ../../reference/simple_stmts.rst:553 +#: ../../reference/simple_stmts.rst:548 msgid "" "For full details of :keyword:`yield` semantics, refer to the :ref:" "`yieldexpr` section." msgstr "" -#: ../../reference/simple_stmts.rst:559 +#: ../../reference/simple_stmts.rst:554 msgid "The :keyword:`!raise` statement" msgstr ":keyword:`!raise` 陳述式" -#: ../../reference/simple_stmts.rst:570 +#: ../../reference/simple_stmts.rst:565 msgid "" "If no expressions are present, :keyword:`raise` re-raises the exception that " "is currently being handled, which is also known as the *active exception*. " @@ -636,7 +628,7 @@ msgid "" "exception is raised indicating that this is an error." msgstr "" -#: ../../reference/simple_stmts.rst:575 +#: ../../reference/simple_stmts.rst:570 msgid "" "Otherwise, :keyword:`raise` evaluates the first expression as the exception " "object. It must be either a subclass or an instance of :class:" @@ -644,13 +636,13 @@ msgid "" "when needed by instantiating the class with no arguments." msgstr "" -#: ../../reference/simple_stmts.rst:580 +#: ../../reference/simple_stmts.rst:575 msgid "" "The :dfn:`type` of the exception is the exception instance's class, the :dfn:" "`value` is the instance itself." msgstr "" -#: ../../reference/simple_stmts.rst:585 +#: ../../reference/simple_stmts.rst:580 msgid "" "A traceback object is normally created automatically when an exception is " "raised and attached to it as the :attr:`~BaseException.__traceback__` " @@ -660,11 +652,11 @@ msgid "" "argument), like so::" msgstr "" -#: ../../reference/simple_stmts.rst:591 +#: ../../reference/simple_stmts.rst:586 msgid "raise Exception(\"foo occurred\").with_traceback(tracebackobj)" msgstr "raise Exception(\"foo occurred\").with_traceback(tracebackobj)" -#: ../../reference/simple_stmts.rst:597 +#: ../../reference/simple_stmts.rst:592 msgid "" "The ``from`` clause is used for exception chaining: if given, the second " "*expression* must be another exception class or instance. If the second " @@ -676,7 +668,7 @@ msgid "" "exception is not handled, both exceptions will be printed:" msgstr "" -#: ../../reference/simple_stmts.rst:606 +#: ../../reference/simple_stmts.rst:601 msgid "" ">>> try:\n" "... print(1 / 0)\n" @@ -714,7 +706,7 @@ msgstr "" " raise RuntimeError(\"Something bad happened\") from exc\n" "RuntimeError: Something bad happened" -#: ../../reference/simple_stmts.rst:626 +#: ../../reference/simple_stmts.rst:621 msgid "" "A similar mechanism works implicitly if a new exception is raised when an " "exception is already being handled. An exception may be handled when an :" @@ -723,7 +715,7 @@ msgid "" "exception's :attr:`~BaseException.__context__` attribute:" msgstr "" -#: ../../reference/simple_stmts.rst:632 +#: ../../reference/simple_stmts.rst:627 msgid "" ">>> try:\n" "... print(1 / 0)\n" @@ -761,13 +753,13 @@ msgstr "" " raise RuntimeError(\"Something bad happened\")\n" "RuntimeError: Something bad happened" -#: ../../reference/simple_stmts.rst:652 +#: ../../reference/simple_stmts.rst:647 msgid "" "Exception chaining can be explicitly suppressed by specifying :const:`None` " "in the ``from`` clause:" msgstr "" -#: ../../reference/simple_stmts.rst:655 +#: ../../reference/simple_stmts.rst:650 msgid "" ">>> try:\n" "... print(1 / 0)\n" @@ -787,24 +779,24 @@ msgstr "" " File \"\", line 4, in \n" "RuntimeError: Something bad happened" -#: ../../reference/simple_stmts.rst:666 +#: ../../reference/simple_stmts.rst:661 msgid "" "Additional information on exceptions can be found in section :ref:" "`exceptions`, and information about handling exceptions is in section :ref:" "`try`." msgstr "" -#: ../../reference/simple_stmts.rst:669 +#: ../../reference/simple_stmts.rst:664 msgid ":const:`None` is now permitted as ``Y`` in ``raise X from Y``." msgstr ":const:`None` 現在允許作為 ``raise X from Y`` 中的 ``Y``。" -#: ../../reference/simple_stmts.rst:672 +#: ../../reference/simple_stmts.rst:667 msgid "" "Added the :attr:`~BaseException.__suppress_context__` attribute to suppress " "automatic display of the exception context." msgstr "" -#: ../../reference/simple_stmts.rst:675 +#: ../../reference/simple_stmts.rst:670 msgid "" "If the traceback of the active exception is modified in an :keyword:`except` " "clause, a subsequent ``raise`` statement re-raises the exception with the " @@ -812,41 +804,41 @@ msgid "" "traceback it had when it was caught." msgstr "" -#: ../../reference/simple_stmts.rst:684 +#: ../../reference/simple_stmts.rst:679 msgid "The :keyword:`!break` statement" msgstr ":keyword:`!break` 陳述式" -#: ../../reference/simple_stmts.rst:695 +#: ../../reference/simple_stmts.rst:690 msgid "" ":keyword:`break` may only occur syntactically nested in a :keyword:`for` or :" "keyword:`while` loop, but not nested in a function or class definition " "within that loop." msgstr "" -#: ../../reference/simple_stmts.rst:702 +#: ../../reference/simple_stmts.rst:697 msgid "" "It terminates the nearest enclosing loop, skipping the optional :keyword:`!" "else` clause if the loop has one." msgstr "" -#: ../../reference/simple_stmts.rst:705 +#: ../../reference/simple_stmts.rst:700 msgid "" "If a :keyword:`for` loop is terminated by :keyword:`break`, the loop control " "target keeps its current value." msgstr "" -#: ../../reference/simple_stmts.rst:710 +#: ../../reference/simple_stmts.rst:705 msgid "" "When :keyword:`break` passes control out of a :keyword:`try` statement with " "a :keyword:`finally` clause, that :keyword:`!finally` clause is executed " "before really leaving the loop." msgstr "" -#: ../../reference/simple_stmts.rst:718 +#: ../../reference/simple_stmts.rst:713 msgid "The :keyword:`!continue` statement" msgstr ":keyword:`!continue` 陳述式" -#: ../../reference/simple_stmts.rst:730 +#: ../../reference/simple_stmts.rst:725 msgid "" ":keyword:`continue` may only occur syntactically nested in a :keyword:`for` " "or :keyword:`while` loop, but not nested in a function or class definition " @@ -854,41 +846,41 @@ msgid "" "loop." msgstr "" -#: ../../reference/simple_stmts.rst:734 +#: ../../reference/simple_stmts.rst:729 msgid "" "When :keyword:`continue` passes control out of a :keyword:`try` statement " "with a :keyword:`finally` clause, that :keyword:`!finally` clause is " "executed before really starting the next loop cycle." msgstr "" -#: ../../reference/simple_stmts.rst:743 +#: ../../reference/simple_stmts.rst:738 msgid "The :keyword:`!import` statement" msgstr ":keyword:`!import` 陳述式" -#: ../../reference/simple_stmts.rst:764 +#: ../../reference/simple_stmts.rst:759 msgid "" "The basic import statement (no :keyword:`from` clause) is executed in two " "steps:" msgstr "" -#: ../../reference/simple_stmts.rst:767 +#: ../../reference/simple_stmts.rst:762 msgid "find a module, loading and initializing it if necessary" msgstr "" -#: ../../reference/simple_stmts.rst:768 +#: ../../reference/simple_stmts.rst:763 msgid "" "define a name or names in the local namespace for the scope where the :" "keyword:`import` statement occurs." msgstr "" -#: ../../reference/simple_stmts.rst:771 +#: ../../reference/simple_stmts.rst:766 msgid "" "When the statement contains multiple clauses (separated by commas) the two " "steps are carried out separately for each clause, just as though the clauses " "had been separated out into individual import statements." msgstr "" -#: ../../reference/simple_stmts.rst:776 +#: ../../reference/simple_stmts.rst:771 msgid "" "The details of the first step, finding and loading modules, are described in " "greater detail in the section on the :ref:`import system `, " @@ -899,26 +891,26 @@ msgid "" "module, which includes execution of the module's code." msgstr "" -#: ../../reference/simple_stmts.rst:784 +#: ../../reference/simple_stmts.rst:779 msgid "" "If the requested module is retrieved successfully, it will be made available " "in the local namespace in one of three ways:" msgstr "" -#: ../../reference/simple_stmts.rst:789 +#: ../../reference/simple_stmts.rst:784 msgid "" "If the module name is followed by :keyword:`!as`, then the name following :" "keyword:`!as` is bound directly to the imported module." msgstr "" -#: ../../reference/simple_stmts.rst:791 +#: ../../reference/simple_stmts.rst:786 msgid "" "If no other name is specified, and the module being imported is a top level " "module, the module's name is bound in the local namespace as a reference to " "the imported module" msgstr "" -#: ../../reference/simple_stmts.rst:794 +#: ../../reference/simple_stmts.rst:789 msgid "" "If the module being imported is *not* a top level module, then the name of " "the top level package that contains the module is bound in the local " @@ -926,46 +918,46 @@ msgid "" "be accessed using its full qualified name rather than directly" msgstr "" -#: ../../reference/simple_stmts.rst:804 +#: ../../reference/simple_stmts.rst:799 msgid "The :keyword:`from` form uses a slightly more complex process:" msgstr "" -#: ../../reference/simple_stmts.rst:806 +#: ../../reference/simple_stmts.rst:801 msgid "" "find the module specified in the :keyword:`from` clause, loading and " "initializing it if necessary;" msgstr "" -#: ../../reference/simple_stmts.rst:808 +#: ../../reference/simple_stmts.rst:803 msgid "for each of the identifiers specified in the :keyword:`import` clauses:" msgstr "" -#: ../../reference/simple_stmts.rst:810 +#: ../../reference/simple_stmts.rst:805 msgid "check if the imported module has an attribute by that name" msgstr "" -#: ../../reference/simple_stmts.rst:811 +#: ../../reference/simple_stmts.rst:806 msgid "" "if not, attempt to import a submodule with that name and then check the " "imported module again for that attribute" msgstr "" -#: ../../reference/simple_stmts.rst:813 +#: ../../reference/simple_stmts.rst:808 msgid "if the attribute is not found, :exc:`ImportError` is raised." msgstr "" -#: ../../reference/simple_stmts.rst:814 +#: ../../reference/simple_stmts.rst:809 msgid "" "otherwise, a reference to that value is stored in the local namespace, using " "the name in the :keyword:`!as` clause if it is present, otherwise using the " "attribute name" msgstr "" -#: ../../reference/simple_stmts.rst:818 +#: ../../reference/simple_stmts.rst:813 msgid "Examples::" msgstr "範例: ::" -#: ../../reference/simple_stmts.rst:820 +#: ../../reference/simple_stmts.rst:815 msgid "" "import foo # foo imported and bound locally\n" "import foo.bar.baz # foo, foo.bar, and foo.bar.baz imported, foo " @@ -977,34 +969,36 @@ msgid "" "from foo import attr # foo imported and foo.attr bound as attr" msgstr "" -#: ../../reference/simple_stmts.rst:828 +#: ../../reference/simple_stmts.rst:823 msgid "" "If the list of identifiers is replaced by a star (``'*'``), all public names " "defined in the module are bound in the local namespace for the scope where " "the :keyword:`import` statement occurs." msgstr "" -#: ../../reference/simple_stmts.rst:837 +#: ../../reference/simple_stmts.rst:832 msgid "" "The *public names* defined by a module are determined by checking the " "module's namespace for a variable named ``__all__``; if defined, it must be " -"a sequence of strings which are names defined or imported by that module. " -"The names given in ``__all__`` are all considered public and are required to " -"exist. If ``__all__`` is not defined, the set of public names includes all " -"names found in the module's namespace which do not begin with an underscore " -"character (``'_'``). ``__all__`` should contain the entire public API. It " -"is intended to avoid accidentally exporting items that are not part of the " -"API (such as library modules which were imported and used within the module)." +"a sequence of strings which are names defined or imported by that module. " +"Names containing non-ASCII characters must be in the `normalization form`_ " +"NFKC; see :ref:`lexical-names-nonascii` for details. The names given in " +"``__all__`` are all considered public and are required to exist. If " +"``__all__`` is not defined, the set of public names includes all names found " +"in the module's namespace which do not begin with an underscore character " +"(``'_'``). ``__all__`` should contain the entire public API. It is intended " +"to avoid accidentally exporting items that are not part of the API (such as " +"library modules which were imported and used within the module)." msgstr "" -#: ../../reference/simple_stmts.rst:847 +#: ../../reference/simple_stmts.rst:844 msgid "" "The wild card form of import --- ``from module import *`` --- is only " "allowed at the module level. Attempting to use it in class or function " "definitions will raise a :exc:`SyntaxError`." msgstr "" -#: ../../reference/simple_stmts.rst:854 +#: ../../reference/simple_stmts.rst:851 msgid "" "When specifying what module to import you do not have to specify the " "absolute name of the module. When a module or package is contained within " @@ -1021,13 +1015,13 @@ msgid "" "the :ref:`relativeimports` section." msgstr "" -#: ../../reference/simple_stmts.rst:868 +#: ../../reference/simple_stmts.rst:865 msgid "" ":func:`importlib.import_module` is provided to support applications that " "determine dynamically the modules to be loaded." msgstr "" -#: ../../reference/simple_stmts.rst:871 +#: ../../reference/simple_stmts.rst:868 msgid "" "Raises an :ref:`auditing event ` ``import`` with arguments " "``module``, ``filename``, ``sys.path``, ``sys.meta_path``, ``sys." @@ -1036,18 +1030,18 @@ msgstr "" "引發一個附帶引數 ``module``、``filename``、``sys.path``、``sys.meta_path``、" "``sys.path_hooks`` 的\\ :ref:`稽核事件 ` ``import``。" -#: ../../reference/simple_stmts.rst:876 +#: ../../reference/simple_stmts.rst:875 msgid "Future statements" msgstr "" -#: ../../reference/simple_stmts.rst:882 +#: ../../reference/simple_stmts.rst:881 msgid "" "A :dfn:`future statement` is a directive to the compiler that a particular " "module should be compiled using syntax or semantics that will be available " "in a specified future release of Python where the feature becomes standard." msgstr "" -#: ../../reference/simple_stmts.rst:886 +#: ../../reference/simple_stmts.rst:885 msgid "" "The future statement is intended to ease migration to future versions of " "Python that introduce incompatible changes to the language. It allows use " @@ -1055,35 +1049,35 @@ msgid "" "feature becomes standard." msgstr "" -#: ../../reference/simple_stmts.rst:898 +#: ../../reference/simple_stmts.rst:897 msgid "" "A future statement must appear near the top of the module. The only lines " "that can appear before a future statement are:" msgstr "" -#: ../../reference/simple_stmts.rst:901 +#: ../../reference/simple_stmts.rst:900 msgid "the module docstring (if any)," msgstr "" -#: ../../reference/simple_stmts.rst:902 +#: ../../reference/simple_stmts.rst:901 msgid "comments," msgstr "" -#: ../../reference/simple_stmts.rst:903 +#: ../../reference/simple_stmts.rst:902 msgid "blank lines, and" msgstr "" -#: ../../reference/simple_stmts.rst:904 +#: ../../reference/simple_stmts.rst:903 msgid "other future statements." msgstr "" -#: ../../reference/simple_stmts.rst:906 +#: ../../reference/simple_stmts.rst:905 msgid "" "The only feature that requires using the future statement is ``annotations`` " "(see :pep:`563`)." msgstr "" -#: ../../reference/simple_stmts.rst:909 +#: ../../reference/simple_stmts.rst:908 msgid "" "All historical features enabled by the future statement are still recognized " "by Python 3. The list includes ``absolute_import``, ``division``, " @@ -1093,7 +1087,7 @@ msgid "" "compatibility." msgstr "" -#: ../../reference/simple_stmts.rst:916 +#: ../../reference/simple_stmts.rst:915 msgid "" "A future statement is recognized and treated specially at compile time: " "Changes to the semantics of core constructs are often implemented by " @@ -1103,41 +1097,41 @@ msgid "" "cannot be pushed off until runtime." msgstr "" -#: ../../reference/simple_stmts.rst:923 +#: ../../reference/simple_stmts.rst:922 msgid "" "For any given release, the compiler knows which feature names have been " "defined, and raises a compile-time error if a future statement contains a " "feature not known to it." msgstr "" -#: ../../reference/simple_stmts.rst:927 +#: ../../reference/simple_stmts.rst:926 msgid "" "The direct runtime semantics are the same as for any import statement: there " "is a standard module :mod:`__future__`, described later, and it will be " "imported in the usual way at the time the future statement is executed." msgstr "" -#: ../../reference/simple_stmts.rst:931 +#: ../../reference/simple_stmts.rst:930 msgid "" "The interesting runtime semantics depend on the specific feature enabled by " "the future statement." msgstr "" -#: ../../reference/simple_stmts.rst:934 +#: ../../reference/simple_stmts.rst:933 msgid "Note that there is nothing special about the statement::" msgstr "" -#: ../../reference/simple_stmts.rst:936 +#: ../../reference/simple_stmts.rst:935 msgid "import __future__ [as name]" msgstr "import __future__ [as name]" -#: ../../reference/simple_stmts.rst:938 +#: ../../reference/simple_stmts.rst:937 msgid "" "That is not a future statement; it's an ordinary import statement with no " "special semantics or syntax restrictions." msgstr "" -#: ../../reference/simple_stmts.rst:941 +#: ../../reference/simple_stmts.rst:940 msgid "" "Code compiled by calls to the built-in functions :func:`exec` and :func:" "`compile` that occur in a module :mod:`!M` containing a future statement " @@ -1146,7 +1140,7 @@ msgid "" "--- see the documentation of that function for details." msgstr "" -#: ../../reference/simple_stmts.rst:947 +#: ../../reference/simple_stmts.rst:946 msgid "" "A future statement typed at an interactive interpreter prompt will take " "effect for the rest of the interpreter session. If an interpreter is " @@ -1155,19 +1149,19 @@ msgid "" "interactive session started after the script is executed." msgstr "" -#: ../../reference/simple_stmts.rst:955 +#: ../../reference/simple_stmts.rst:954 msgid ":pep:`236` - Back to the __future__" msgstr "" -#: ../../reference/simple_stmts.rst:956 +#: ../../reference/simple_stmts.rst:955 msgid "The original proposal for the __future__ mechanism." msgstr "" -#: ../../reference/simple_stmts.rst:962 +#: ../../reference/simple_stmts.rst:961 msgid "The :keyword:`!global` statement" msgstr ":keyword:`!global` 陳述式" -#: ../../reference/simple_stmts.rst:972 +#: ../../reference/simple_stmts.rst:971 msgid "" "The :keyword:`global` statement causes the listed identifiers to be " "interpreted as globals. It would be impossible to assign to a global " @@ -1175,7 +1169,7 @@ msgid "" "globals without being declared global." msgstr "" -#: ../../reference/simple_stmts.rst:977 +#: ../../reference/simple_stmts.rst:976 msgid "" "The :keyword:`!global` statement applies to the entire current scope " "(module, function body or class definition). A :exc:`SyntaxError` is raised " @@ -1183,7 +1177,7 @@ msgid "" "scope." msgstr "" -#: ../../reference/simple_stmts.rst:982 +#: ../../reference/simple_stmts.rst:981 msgid "" "At the module level, all variables are global, so a :keyword:`!global` " "statement has no effect. However, variables must still not be used or " @@ -1191,7 +1185,7 @@ msgid "" "is relaxed in the interactive prompt (:term:`REPL`)." msgstr "" -#: ../../reference/simple_stmts.rst:993 +#: ../../reference/simple_stmts.rst:992 msgid "" "**Programmer's note:** :keyword:`global` is a directive to the parser. It " "applies only to code parsed at the same time as the :keyword:`!global` " @@ -1203,11 +1197,11 @@ msgid "" "func:`compile` functions." msgstr "" -#: ../../reference/simple_stmts.rst:1005 +#: ../../reference/simple_stmts.rst:1004 msgid "The :keyword:`!nonlocal` statement" msgstr ":keyword:`!nonlocal` 陳述式" -#: ../../reference/simple_stmts.rst:1013 +#: ../../reference/simple_stmts.rst:1012 msgid "" "When the definition of a function or class is nested (enclosed) within the " "definitions of other functions, its nonlocal scopes are the local scopes of " @@ -1219,64 +1213,64 @@ msgid "" "`SyntaxError` is raised." msgstr "" -#: ../../reference/simple_stmts.rst:1022 +#: ../../reference/simple_stmts.rst:1021 msgid "" "The :keyword:`nonlocal` statement applies to the entire scope of a function " "or class body. A :exc:`SyntaxError` is raised if a variable is used or " "assigned to prior to its nonlocal declaration in the scope." msgstr "" -#: ../../reference/simple_stmts.rst:1028 +#: ../../reference/simple_stmts.rst:1027 msgid ":pep:`3104` - Access to Names in Outer Scopes" msgstr "" -#: ../../reference/simple_stmts.rst:1029 +#: ../../reference/simple_stmts.rst:1028 msgid "The specification for the :keyword:`nonlocal` statement." msgstr "" -#: ../../reference/simple_stmts.rst:1031 +#: ../../reference/simple_stmts.rst:1030 msgid "" "**Programmer's note:** :keyword:`nonlocal` is a directive to the parser and " "applies only to code parsed along with it. See the note for the :keyword:" "`global` statement." msgstr "" -#: ../../reference/simple_stmts.rst:1039 +#: ../../reference/simple_stmts.rst:1038 msgid "The :keyword:`!type` statement" msgstr ":keyword:`!type` 陳述式" -#: ../../reference/simple_stmts.rst:1046 +#: ../../reference/simple_stmts.rst:1045 msgid "" "The :keyword:`!type` statement declares a type alias, which is an instance " "of :class:`typing.TypeAliasType`." msgstr "" -#: ../../reference/simple_stmts.rst:1049 +#: ../../reference/simple_stmts.rst:1048 msgid "For example, the following statement creates a type alias::" msgstr "" -#: ../../reference/simple_stmts.rst:1051 +#: ../../reference/simple_stmts.rst:1050 msgid "type Point = tuple[float, float]" msgstr "" -#: ../../reference/simple_stmts.rst:1053 +#: ../../reference/simple_stmts.rst:1052 msgid "This code is roughly equivalent to::" msgstr "" -#: ../../reference/simple_stmts.rst:1055 +#: ../../reference/simple_stmts.rst:1054 msgid "" "annotation-def VALUE_OF_Point():\n" " return tuple[float, float]\n" "Point = typing.TypeAliasType(\"Point\", VALUE_OF_Point())" msgstr "" -#: ../../reference/simple_stmts.rst:1059 +#: ../../reference/simple_stmts.rst:1058 msgid "" "``annotation-def`` indicates an :ref:`annotation scope `, " "which behaves mostly like a function, but with several small differences." msgstr "" -#: ../../reference/simple_stmts.rst:1062 +#: ../../reference/simple_stmts.rst:1061 msgid "" "The value of the type alias is evaluated in the annotation scope. It is not " "evaluated when the type alias is created, but only when the value is " @@ -1285,21 +1279,21 @@ msgid "" "not yet defined." msgstr "" -#: ../../reference/simple_stmts.rst:1068 +#: ../../reference/simple_stmts.rst:1067 msgid "" "Type aliases may be made generic by adding a :ref:`type parameter list ` after the name. See :ref:`generic-type-aliases` for more." msgstr "" -#: ../../reference/simple_stmts.rst:1071 +#: ../../reference/simple_stmts.rst:1070 msgid ":keyword:`!type` is a :ref:`soft keyword `." msgstr "" -#: ../../reference/simple_stmts.rst:1077 +#: ../../reference/simple_stmts.rst:1076 msgid ":pep:`695` - Type Parameter Syntax" msgstr "" -#: ../../reference/simple_stmts.rst:1078 +#: ../../reference/simple_stmts.rst:1077 msgid "" "Introduced the :keyword:`!type` statement and syntax for generic classes and " "functions." @@ -1310,15 +1304,15 @@ msgid "simple" msgstr "" #: ../../reference/simple_stmts.rst:8 ../../reference/simple_stmts.rst:39 -#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:263 -#: ../../reference/simple_stmts.rst:322 ../../reference/simple_stmts.rst:384 -#: ../../reference/simple_stmts.rst:427 ../../reference/simple_stmts.rst:449 -#: ../../reference/simple_stmts.rst:462 ../../reference/simple_stmts.rst:488 -#: ../../reference/simple_stmts.rst:525 ../../reference/simple_stmts.rst:561 -#: ../../reference/simple_stmts.rst:686 ../../reference/simple_stmts.rst:720 -#: ../../reference/simple_stmts.rst:745 ../../reference/simple_stmts.rst:878 -#: ../../reference/simple_stmts.rst:964 ../../reference/simple_stmts.rst:1007 -#: ../../reference/simple_stmts.rst:1041 +#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:258 +#: ../../reference/simple_stmts.rst:317 ../../reference/simple_stmts.rst:379 +#: ../../reference/simple_stmts.rst:422 ../../reference/simple_stmts.rst:444 +#: ../../reference/simple_stmts.rst:457 ../../reference/simple_stmts.rst:483 +#: ../../reference/simple_stmts.rst:520 ../../reference/simple_stmts.rst:556 +#: ../../reference/simple_stmts.rst:681 ../../reference/simple_stmts.rst:715 +#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:877 +#: ../../reference/simple_stmts.rst:963 ../../reference/simple_stmts.rst:1006 +#: ../../reference/simple_stmts.rst:1040 msgid "statement" msgstr "statement(陳述式)" @@ -1327,12 +1321,12 @@ msgid "expression" msgstr "" #: ../../reference/simple_stmts.rst:39 ../../reference/simple_stmts.rst:42 -#: ../../reference/simple_stmts.rst:105 ../../reference/simple_stmts.rst:116 -#: ../../reference/simple_stmts.rst:196 ../../reference/simple_stmts.rst:449 +#: ../../reference/simple_stmts.rst:104 ../../reference/simple_stmts.rst:115 +#: ../../reference/simple_stmts.rst:200 ../../reference/simple_stmts.rst:444 msgid "list" msgstr "list(串列)" -#: ../../reference/simple_stmts.rst:56 ../../reference/simple_stmts.rst:988 +#: ../../reference/simple_stmts.rst:56 ../../reference/simple_stmts.rst:987 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -1341,8 +1335,8 @@ msgid "repr" msgstr "repr" #: ../../reference/simple_stmts.rst:56 ../../reference/simple_stmts.rst:75 -#: ../../reference/simple_stmts.rst:187 ../../reference/simple_stmts.rst:196 -#: ../../reference/simple_stmts.rst:207 ../../reference/simple_stmts.rst:583 +#: ../../reference/simple_stmts.rst:186 ../../reference/simple_stmts.rst:200 +#: ../../reference/simple_stmts.rst:211 ../../reference/simple_stmts.rst:578 msgid "object" msgstr "object(物件)" @@ -1390,21 +1384,21 @@ msgstr "= (等號)" msgid "assignment statement" msgstr "assignment statement(賦值陳述式)" -#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:116 -#: ../../reference/simple_stmts.rst:159 ../../reference/simple_stmts.rst:187 -#: ../../reference/simple_stmts.rst:220 ../../reference/simple_stmts.rst:263 -#: ../../reference/simple_stmts.rst:322 +#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:115 +#: ../../reference/simple_stmts.rst:158 ../../reference/simple_stmts.rst:186 +#: ../../reference/simple_stmts.rst:221 ../../reference/simple_stmts.rst:258 +#: ../../reference/simple_stmts.rst:317 msgid "assignment" msgstr "assignment(賦值)" -#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:745 -#: ../../reference/simple_stmts.rst:800 ../../reference/simple_stmts.rst:964 +#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:740 +#: ../../reference/simple_stmts.rst:795 ../../reference/simple_stmts.rst:963 msgid "binding" msgstr "binding(繫結)" -#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:462 -#: ../../reference/simple_stmts.rst:745 ../../reference/simple_stmts.rst:800 -#: ../../reference/simple_stmts.rst:964 +#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:457 +#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:795 +#: ../../reference/simple_stmts.rst:963 msgid "name" msgstr "name(名稱)" @@ -1412,372 +1406,372 @@ msgstr "name(名稱)" msgid "rebinding" msgstr "rebinding(重新繫結)" -#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:187 +#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:186 msgid "mutable" msgstr "mutable(可變的)" -#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:159 -#: ../../reference/simple_stmts.rst:471 +#: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:158 +#: ../../reference/simple_stmts.rst:466 msgid "attribute" msgstr "attribute(屬性)" -#: ../../reference/simple_stmts.rst:105 ../../reference/simple_stmts.rst:116 -#: ../../reference/simple_stmts.rst:449 ../../reference/simple_stmts.rst:699 +#: ../../reference/simple_stmts.rst:104 ../../reference/simple_stmts.rst:115 +#: ../../reference/simple_stmts.rst:444 ../../reference/simple_stmts.rst:694 msgid "target" msgstr "target" -#: ../../reference/simple_stmts.rst:116 ../../reference/simple_stmts.rst:384 -#: ../../reference/simple_stmts.rst:745 ../../reference/simple_stmts.rst:964 -#: ../../reference/simple_stmts.rst:1007 +#: ../../reference/simple_stmts.rst:115 ../../reference/simple_stmts.rst:379 +#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:963 +#: ../../reference/simple_stmts.rst:1006 msgid ", (comma)" msgstr ", (逗號)" -#: ../../reference/simple_stmts.rst:116 +#: ../../reference/simple_stmts.rst:115 msgid "in target list" msgstr "於目標列表中" -#: ../../reference/simple_stmts.rst:116 ../../reference/simple_stmts.rst:826 +#: ../../reference/simple_stmts.rst:115 ../../reference/simple_stmts.rst:821 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/simple_stmts.rst:116 +#: ../../reference/simple_stmts.rst:115 msgid "in assignment target list" msgstr "於賦值目標列表中" -#: ../../reference/simple_stmts.rst:116 +#: ../../reference/simple_stmts.rst:115 msgid "[] (square brackets)" msgstr "[] (方括號)" -#: ../../reference/simple_stmts.rst:116 +#: ../../reference/simple_stmts.rst:115 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../reference/simple_stmts.rst:153 +#: ../../reference/simple_stmts.rst:152 msgid "destructor" msgstr "destructor(解構函式)" -#: ../../reference/simple_stmts.rst:187 +#: ../../reference/simple_stmts.rst:186 msgid "subscription" msgstr "subscription(下標)" -#: ../../reference/simple_stmts.rst:196 +#: ../../reference/simple_stmts.rst:200 msgid "sequence" msgstr "sequence(序列)" -#: ../../reference/simple_stmts.rst:207 +#: ../../reference/simple_stmts.rst:211 msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/simple_stmts.rst:207 +#: ../../reference/simple_stmts.rst:211 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../reference/simple_stmts.rst:220 +#: ../../reference/simple_stmts.rst:221 msgid "slicing" msgstr "slice(切片)" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "augmented" msgstr "augmented(增強)" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "assignment, augmented" msgstr "assignment(賦值)、augmented(增強)" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "+=" msgstr "+=" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "augmented assignment" msgstr "augmented assignment(增強賦值)" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "-=" msgstr "-=" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "*=" msgstr "*=" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "/=" msgstr "/=" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "%=" msgstr "%=" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "&=" msgstr "&=" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "^=" msgstr "^=" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "|=" msgstr "|=" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "**=" msgstr "**=" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "//=" msgstr "//=" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid ">>=" msgstr ">>=" -#: ../../reference/simple_stmts.rst:263 +#: ../../reference/simple_stmts.rst:258 msgid "<<=" msgstr "<<=" -#: ../../reference/simple_stmts.rst:322 +#: ../../reference/simple_stmts.rst:317 msgid "annotated" msgstr "annotated(註釋)" -#: ../../reference/simple_stmts.rst:322 +#: ../../reference/simple_stmts.rst:317 msgid "assignment, annotated" msgstr "assignment(賦值)、annotated(註釋)" -#: ../../reference/simple_stmts.rst:322 +#: ../../reference/simple_stmts.rst:317 msgid ": (colon)" msgstr ": (冒號)" -#: ../../reference/simple_stmts.rst:322 +#: ../../reference/simple_stmts.rst:317 msgid "annotated variable" msgstr "annotated variable(註釋變數)" -#: ../../reference/simple_stmts.rst:384 +#: ../../reference/simple_stmts.rst:379 msgid "assert" msgstr "assert" -#: ../../reference/simple_stmts.rst:384 +#: ../../reference/simple_stmts.rst:379 msgid "debugging" msgstr "debugging(除錯)" -#: ../../reference/simple_stmts.rst:384 +#: ../../reference/simple_stmts.rst:379 msgid "assertions" msgstr "assertions(斷言)" -#: ../../reference/simple_stmts.rst:384 +#: ../../reference/simple_stmts.rst:379 msgid "expression list" msgstr "expression list(運算式列表)" -#: ../../reference/simple_stmts.rst:405 +#: ../../reference/simple_stmts.rst:400 msgid "__debug__" msgstr "__debug__" -#: ../../reference/simple_stmts.rst:405 ../../reference/simple_stmts.rst:525 -#: ../../reference/simple_stmts.rst:561 ../../reference/simple_stmts.rst:593 -#: ../../reference/simple_stmts.rst:745 +#: ../../reference/simple_stmts.rst:400 ../../reference/simple_stmts.rst:520 +#: ../../reference/simple_stmts.rst:556 ../../reference/simple_stmts.rst:588 +#: ../../reference/simple_stmts.rst:740 msgid "exception" msgstr "exception(例外)" -#: ../../reference/simple_stmts.rst:405 +#: ../../reference/simple_stmts.rst:400 msgid "AssertionError" msgstr "AssertionError" -#: ../../reference/simple_stmts.rst:427 +#: ../../reference/simple_stmts.rst:422 msgid "pass" msgstr "pass" -#: ../../reference/simple_stmts.rst:427 +#: ../../reference/simple_stmts.rst:422 msgid "null" msgstr "null" -#: ../../reference/simple_stmts.rst:427 +#: ../../reference/simple_stmts.rst:422 msgid "operation" msgstr "operation(操作)" -#: ../../reference/simple_stmts.rst:449 +#: ../../reference/simple_stmts.rst:444 msgid "del" msgstr "del" -#: ../../reference/simple_stmts.rst:449 ../../reference/simple_stmts.rst:471 +#: ../../reference/simple_stmts.rst:444 ../../reference/simple_stmts.rst:466 msgid "deletion" msgstr "deletion(刪除)" -#: ../../reference/simple_stmts.rst:462 ../../reference/simple_stmts.rst:964 +#: ../../reference/simple_stmts.rst:457 ../../reference/simple_stmts.rst:963 msgid "global" msgstr "global" -#: ../../reference/simple_stmts.rst:462 +#: ../../reference/simple_stmts.rst:457 msgid "unbinding" msgstr "unbinding(解除繫結)" -#: ../../reference/simple_stmts.rst:488 +#: ../../reference/simple_stmts.rst:483 msgid "return" msgstr "return (回傳)" -#: ../../reference/simple_stmts.rst:488 ../../reference/simple_stmts.rst:525 +#: ../../reference/simple_stmts.rst:483 ../../reference/simple_stmts.rst:520 msgid "function" msgstr "function (函式)" -#: ../../reference/simple_stmts.rst:488 +#: ../../reference/simple_stmts.rst:483 msgid "definition" msgstr "definition(定義)" -#: ../../reference/simple_stmts.rst:488 +#: ../../reference/simple_stmts.rst:483 msgid "class" msgstr "class(類別)" -#: ../../reference/simple_stmts.rst:504 ../../reference/simple_stmts.rst:699 -#: ../../reference/simple_stmts.rst:708 ../../reference/simple_stmts.rst:720 -#: ../../reference/simple_stmts.rst:745 +#: ../../reference/simple_stmts.rst:499 ../../reference/simple_stmts.rst:694 +#: ../../reference/simple_stmts.rst:703 ../../reference/simple_stmts.rst:715 +#: ../../reference/simple_stmts.rst:740 msgid "keyword" msgstr "keyword(關鍵字)" -#: ../../reference/simple_stmts.rst:504 ../../reference/simple_stmts.rst:708 -#: ../../reference/simple_stmts.rst:720 +#: ../../reference/simple_stmts.rst:499 ../../reference/simple_stmts.rst:703 +#: ../../reference/simple_stmts.rst:715 msgid "finally" msgstr "finally" -#: ../../reference/simple_stmts.rst:525 +#: ../../reference/simple_stmts.rst:520 msgid "yield" msgstr "yield" -#: ../../reference/simple_stmts.rst:525 +#: ../../reference/simple_stmts.rst:520 msgid "generator" msgstr "generator(產生器)" -#: ../../reference/simple_stmts.rst:525 +#: ../../reference/simple_stmts.rst:520 msgid "iterator" msgstr "iterator(疊代器)" -#: ../../reference/simple_stmts.rst:525 +#: ../../reference/simple_stmts.rst:520 msgid "StopIteration" msgstr "StopIteration" -#: ../../reference/simple_stmts.rst:561 +#: ../../reference/simple_stmts.rst:556 msgid "raise" msgstr "raise" -#: ../../reference/simple_stmts.rst:561 +#: ../../reference/simple_stmts.rst:556 msgid "raising" msgstr "raiseing" -#: ../../reference/simple_stmts.rst:561 +#: ../../reference/simple_stmts.rst:556 msgid "__traceback__ (exception attribute)" msgstr "__traceback__(例外屬性)" -#: ../../reference/simple_stmts.rst:583 +#: ../../reference/simple_stmts.rst:578 msgid "traceback" msgstr "traceback" -#: ../../reference/simple_stmts.rst:593 +#: ../../reference/simple_stmts.rst:588 msgid "chaining" msgstr "chaining(鏈結)" -#: ../../reference/simple_stmts.rst:593 +#: ../../reference/simple_stmts.rst:588 msgid "__cause__ (exception attribute)" msgstr "__cause__(例外屬性)" -#: ../../reference/simple_stmts.rst:593 +#: ../../reference/simple_stmts.rst:588 msgid "__context__ (exception attribute)" msgstr "__context__(例外屬性)" -#: ../../reference/simple_stmts.rst:686 +#: ../../reference/simple_stmts.rst:681 msgid "break" msgstr "break" -#: ../../reference/simple_stmts.rst:686 ../../reference/simple_stmts.rst:720 +#: ../../reference/simple_stmts.rst:681 ../../reference/simple_stmts.rst:715 msgid "for" msgstr "for" -#: ../../reference/simple_stmts.rst:686 ../../reference/simple_stmts.rst:720 +#: ../../reference/simple_stmts.rst:681 ../../reference/simple_stmts.rst:715 msgid "while" msgstr "while" -#: ../../reference/simple_stmts.rst:686 ../../reference/simple_stmts.rst:720 +#: ../../reference/simple_stmts.rst:681 ../../reference/simple_stmts.rst:715 msgid "loop" msgstr "loop(迴圈)" -#: ../../reference/simple_stmts.rst:699 +#: ../../reference/simple_stmts.rst:694 msgid "else" msgstr "else" -#: ../../reference/simple_stmts.rst:699 +#: ../../reference/simple_stmts.rst:694 msgid "loop control" msgstr "loop control(迴圈控制)" -#: ../../reference/simple_stmts.rst:720 +#: ../../reference/simple_stmts.rst:715 msgid "continue" msgstr "continue" -#: ../../reference/simple_stmts.rst:745 ../../reference/simple_stmts.rst:851 +#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:848 msgid "import" msgstr "import(引入)" -#: ../../reference/simple_stmts.rst:745 +#: ../../reference/simple_stmts.rst:740 msgid "module" msgstr "module(模組)" -#: ../../reference/simple_stmts.rst:745 +#: ../../reference/simple_stmts.rst:740 msgid "importing" msgstr "importing(引入)" -#: ../../reference/simple_stmts.rst:745 ../../reference/simple_stmts.rst:800 +#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:795 msgid "from" msgstr "from" -#: ../../reference/simple_stmts.rst:745 ../../reference/simple_stmts.rst:787 +#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:782 msgid "as" msgstr "as" -#: ../../reference/simple_stmts.rst:745 +#: ../../reference/simple_stmts.rst:740 msgid "ImportError" msgstr "ImportError" -#: ../../reference/simple_stmts.rst:745 ../../reference/simple_stmts.rst:787 -#: ../../reference/simple_stmts.rst:800 ../../reference/simple_stmts.rst:826 +#: ../../reference/simple_stmts.rst:740 ../../reference/simple_stmts.rst:782 +#: ../../reference/simple_stmts.rst:795 ../../reference/simple_stmts.rst:821 msgid "import statement" msgstr "import statement(引入陳述式)" -#: ../../reference/simple_stmts.rst:832 +#: ../../reference/simple_stmts.rst:827 msgid "__all__ (optional module attribute)" msgstr "__all__(可選模組屬性)" -#: ../../reference/simple_stmts.rst:851 +#: ../../reference/simple_stmts.rst:848 msgid "relative" msgstr "relative(相對)" -#: ../../reference/simple_stmts.rst:878 +#: ../../reference/simple_stmts.rst:877 msgid "future" msgstr "future" -#: ../../reference/simple_stmts.rst:878 +#: ../../reference/simple_stmts.rst:877 msgid "__future__" msgstr "__future__" -#: ../../reference/simple_stmts.rst:878 +#: ../../reference/simple_stmts.rst:877 msgid "future statement" msgstr "future statement(future 陳述式)" -#: ../../reference/simple_stmts.rst:964 ../../reference/simple_stmts.rst:1007 +#: ../../reference/simple_stmts.rst:963 ../../reference/simple_stmts.rst:1006 msgid "identifier list" msgstr "identifier list(識別符號清單)" -#: ../../reference/simple_stmts.rst:988 +#: ../../reference/simple_stmts.rst:987 msgid "exec" msgstr "exec" -#: ../../reference/simple_stmts.rst:988 +#: ../../reference/simple_stmts.rst:987 msgid "eval" msgstr "eval" -#: ../../reference/simple_stmts.rst:988 +#: ../../reference/simple_stmts.rst:987 msgid "compile" msgstr "compile(編譯)" -#: ../../reference/simple_stmts.rst:1007 +#: ../../reference/simple_stmts.rst:1006 msgid "nonlocal" msgstr "nonlocal" -#: ../../reference/simple_stmts.rst:1041 +#: ../../reference/simple_stmts.rst:1040 msgid "type" msgstr "" diff --git a/using/configure.po b/using/configure.po index c01f0c9f01..5e4ebea1e8 100644 --- a/using/configure.po +++ b/using/configure.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-02-03 00:20+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-" @@ -196,11 +196,11 @@ msgstr ":mod:`curses`" msgid "`OpenSSL `_" msgstr "`OpenSSL `_" -#: ../../using/configure.rst:97 +#: ../../using/configure.rst:0 msgid "3.0.18 recommended" msgstr "" -#: ../../using/configure.rst:98 +#: ../../using/configure.rst:0 msgid "(1.1.1 minimum)" msgstr "" @@ -769,7 +769,7 @@ msgstr "" #: ../../using/configure.rst:396 msgid "" "Enables support for running Python without the :term:`global interpreter " -"lock` (GIL): free threading build." +"lock` (GIL): :term:`free-threaded build`." msgstr "" #: ../../using/configure.rst:399 diff --git a/using/windows.po b/using/windows.po index 67611d22c1..ae5977a0aa 100644 --- a/using/windows.po +++ b/using/windows.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-01-22 00:16+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2340,11 +2340,11 @@ msgstr "" #: ../../using/windows.rst:1452 msgid "" -":file:`%ProgramFiles%\\\\ Python X.Y` or :file:` %ProgramFiles(x86)%\\\\ " -"Python X.Y`" +":file:`%ProgramFiles%\\\\\\ Python X.Y` or :file:`\\ %ProgramFiles(x86)%\\\\" +"\\ Python X.Y`" msgstr "" -":file:`%ProgramFiles%\\\\ Python X.Y` or :file:` %ProgramFiles(x86)%\\\\ " -"Python X.Y`" +":file:`%ProgramFiles%\\\\\\ Python X.Y` or :file:`\\ %ProgramFiles(x86)%\\\\" +"\\ Python X.Y`" #: ../../using/windows.rst:1457 msgid "DefaultJustForMeTargetDir" @@ -2356,13 +2356,13 @@ msgstr "" #: ../../using/windows.rst:1457 msgid "" -":file:`%LocalAppData%\\\\ Programs\\\\Python\\\\ PythonXY` or :file:" -"`%LocalAppData%\\\\ Programs\\\\Python\\\\ PythonXY-32` or :file:" -"`%LocalAppData%\\\\ Programs\\\\Python\\\\ PythonXY-64`" +":file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY` or :file:" +"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-32` or :file:" +"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-64`" msgstr "" -":file:`%LocalAppData%\\\\ Programs\\\\Python\\\\ PythonXY` 或 :file:" -"`%LocalAppData%\\\\ Programs\\\\Python\\\\ PythonXY-32` 或 :file:" -"`%LocalAppData%\\\\ Programs\\\\Python\\\\ PythonXY-64`" +":file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY` 或 :file:" +"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-32` 或 :file:" +"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-64`" #: ../../using/windows.rst:1467 msgid "DefaultCustomTargetDir" diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index ef699f40c2..0fefe72458 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-22 16:55+0000\n" "PO-Revision-Date: 2023-05-28 18:21+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1852,9 +1852,9 @@ msgid "" msgstr "" "在 Unix 上,如果 ``sem_clockwait()`` 函式在 C 函式庫(glibc 2.30 與其更新的版" "本)中可被使用,則 :meth:`threading.Lock.acquire` 方法現在會使用單調時鐘 (:" -"const:`time.CLOCK_MONOTONIC`) 用於超時 (timeout),而不是使用系統時鐘 (:" -"const:`time.CLOCK_REALTIME`),以免受系統時鐘變化的影響。 由 Victor Stinner " -"在 :issue:`41710` 中貢獻。)" +"const:`time.CLOCK_MONOTONIC`) 用於超時 (timeout),而不是使用系統時鐘 (:const:" +"`time.CLOCK_REALTIME`),以免受系統時鐘變化的影響。 由 Victor Stinner 在 :" +"issue:`41710` 中貢獻。)" #: ../../whatsnew/3.11.rst:1093 msgid "time" @@ -2588,8 +2588,7 @@ msgid "" "Subscripting custom :meth:`~object.__getitem__` is also inlined similar to :" "ref:`inline-calls`." msgstr "" -"下標自訂 :meth:`~object.__getitem__` 也是行內的,類似於 :ref:`inline-" -"calls`。" +"下標自訂 :meth:`~object.__getitem__` 也是行內的,類似於 :ref:`inline-calls`。" #: ../../whatsnew/3.11.rst:1474 ../../whatsnew/3.11.rst:1481 msgid "10-25%" @@ -2981,11 +2980,11 @@ msgstr "新的操作碼" msgid "Notes" msgstr "註記" -#: ../../whatsnew/3.11.rst:1650 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!BINARY_*`" msgstr ":opcode:`!BINARY_*`" -#: ../../whatsnew/3.11.rst:1651 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!INPLACE_*`" msgstr ":opcode:`!INPLACE_*`" @@ -2997,31 +2996,31 @@ msgstr ":opcode:`BINARY_OP`" msgid "Replaced all numeric binary/in-place opcodes with a single opcode" msgstr "以單一一個操作碼來取代所有數值的、二進位/原位 (in-place) 操作碼" -#: ../../whatsnew/3.11.rst:1653 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!CALL_FUNCTION`" msgstr ":opcode:`!CALL_FUNCTION`" -#: ../../whatsnew/3.11.rst:1654 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!CALL_FUNCTION_KW`" msgstr ":opcode:`!CALL_FUNCTION_KW`" -#: ../../whatsnew/3.11.rst:1655 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!CALL_METHOD`" msgstr ":opcode:`!CALL_METHOD`" -#: ../../whatsnew/3.11.rst:1653 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`CALL`" msgstr ":opcode:`CALL`" -#: ../../whatsnew/3.11.rst:1654 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!KW_NAMES`" msgstr ":opcode:`!KW_NAMES`" -#: ../../whatsnew/3.11.rst:1655 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!PRECALL`" msgstr ":opcode:`!PRECALL`" -#: ../../whatsnew/3.11.rst:1656 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`PUSH_NULL`" msgstr ":opcode:`PUSH_NULL`" @@ -3033,35 +3032,35 @@ msgstr "" "將方法的引數搬移 (argument shifting) 與關鍵字引數的處理分離開來;允許更好的呼" "叫特化" -#: ../../whatsnew/3.11.rst:1658 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!DUP_TOP`" msgstr ":opcode:`!DUP_TOP`" -#: ../../whatsnew/3.11.rst:1659 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!DUP_TOP_TWO`" msgstr ":opcode:`!DUP_TOP_TWO`" -#: ../../whatsnew/3.11.rst:1660 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!ROT_TWO`" msgstr ":opcode:`!ROT_TWO`" -#: ../../whatsnew/3.11.rst:1661 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!ROT_THREE`" msgstr ":opcode:`!ROT_THREE`" -#: ../../whatsnew/3.11.rst:1662 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!ROT_FOUR`" msgstr ":opcode:`!ROT_FOUR`" -#: ../../whatsnew/3.11.rst:1663 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!ROT_N`" msgstr ":opcode:`!ROT_N`" -#: ../../whatsnew/3.11.rst:1658 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`COPY`" msgstr ":opcode:`COPY`" -#: ../../whatsnew/3.11.rst:1659 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`SWAP`" msgstr ":opcode:`SWAP`" @@ -3069,11 +3068,11 @@ msgstr ":opcode:`SWAP`" msgid "Stack manipulation instructions" msgstr "堆疊操作指示" -#: ../../whatsnew/3.11.rst:1665 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!JUMP_IF_NOT_EXC_MATCH`" msgstr ":opcode:`!JUMP_IF_NOT_EXC_MATCH`" -#: ../../whatsnew/3.11.rst:1665 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`CHECK_EXC_MATCH`" msgstr ":opcode:`CHECK_EXC_MATCH`" @@ -3081,27 +3080,27 @@ msgstr ":opcode:`CHECK_EXC_MATCH`" msgid "Now performs check but doesn't jump" msgstr "現在執行檢查但不跳位 (jump)" -#: ../../whatsnew/3.11.rst:1667 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!JUMP_ABSOLUTE`" msgstr ":opcode:`!JUMP_ABSOLUTE`" -#: ../../whatsnew/3.11.rst:1668 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!POP_JUMP_IF_FALSE`" msgstr ":opcode:`!POP_JUMP_IF_FALSE`" -#: ../../whatsnew/3.11.rst:1669 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!POP_JUMP_IF_TRUE`" msgstr ":opcode:`!POP_JUMP_IF_TRUE`" -#: ../../whatsnew/3.11.rst:1667 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`JUMP_BACKWARD`" msgstr ":opcode:`JUMP_BACKWARD`" -#: ../../whatsnew/3.11.rst:1668 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!POP_JUMP_BACKWARD_IF_*`" msgstr ":opcode:`!POP_JUMP_BACKWARD_IF_*`" -#: ../../whatsnew/3.11.rst:1669 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!POP_JUMP_FORWARD_IF_*`" msgstr ":opcode:`!POP_JUMP_FORWARD_IF_*`" @@ -3113,11 +3112,11 @@ msgstr "" "參見 [#bytecode-jump]_;每個方向的 ``TRUE``、``FALSE``、``NONE`` 和 " "``NOT_NONE`` 變體" -#: ../../whatsnew/3.11.rst:1673 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!SETUP_WITH`" msgstr ":opcode:`!SETUP_WITH`" -#: ../../whatsnew/3.11.rst:1674 +#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!SETUP_ASYNC_WITH`" msgstr ":opcode:`!SETUP_ASYNC_WITH`" @@ -4598,9 +4597,9 @@ msgid "" "method." msgstr "" ":c:func:`!PyCode_New` 和 :c:func:`!PyCode_NewWithPosOnlyArgs` 現在採用額外的 " -"``exception_table`` 引數。如果可能的話應該避免使用這些函式。要取得自訂程式" -"碼物件,使用編譯器建立一個程式碼物件,然後使用 ``replace`` 方法來得到修改後的" -"版本。" +"``exception_table`` 引數。如果可能的話應該避免使用這些函式。要取得自訂程式碼" +"物件,使用編譯器建立一個程式碼物件,然後使用 ``replace`` 方法來得到修改後的版" +"本。" #: ../../whatsnew/3.11.rst:2318 msgid "" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 54c4904499..024bd8d699 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2026-01-24 22:47+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -875,7 +875,7 @@ msgid "" "new ABC for access to, opening, and reading *resources* inside packages. " "Resources are roughly similar to files inside packages, but they needn't be " "actual files on the physical file system. Module loaders can provide a :" -"meth:`!get_resource_reader` function which returns a :class:`importlib.abc." +"meth:`!get_resource_reader` function which returns a :class:`!importlib.abc." "ResourceReader` instance to support this new API. Built-in file path " "loaders and zip file loaders both support this." msgstr "" @@ -1048,7 +1048,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:731 msgid "" -"The :meth:`loop.create_datagram_endpoint() ` method gained support for Unix sockets. " "(Contributed by Quentin Dawans in :issue:`31245`.)" msgstr "" @@ -1500,7 +1500,7 @@ msgstr "importlib" #: ../../whatsnew/3.7.rst:1046 msgid "" -"The :class:`importlib.abc.ResourceReader` ABC was introduced to support the " +"The :class:`!importlib.abc.ResourceReader` ABC was introduced to support the " "loading of resources from packages. See also :ref:" "`whatsnew37_importlib_resources`. (Contributed by Barry Warsaw, Brett Cannon " "in :issue:`32248`.)" @@ -2911,7 +2911,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:2034 msgid "" "The :class:`importlib.abc.ResourceLoader` ABC has been deprecated in favour " -"of :class:`importlib.abc.ResourceReader`." +"of :class:`!importlib.abc.ResourceReader`." msgstr "" #: ../../whatsnew/3.7.rst:2041