diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index 1489b716d5..a95dd47f00 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.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: 2025-12-09 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:31+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -75,8 +75,8 @@ msgstr "" #: ../../c-api/gcsupport.rst:37 msgid "" -"Before fields which refer to other containers are " -"invalidated, :c:func:`PyObject_GC_UnTrack` must be called." +"Before fields which refer to other containers are invalidated, :c:func:" +"`PyObject_GC_UnTrack` must be called." msgstr "" #: ../../c-api/gcsupport.rst:40 @@ -86,39 +86,39 @@ msgstr "" #: ../../c-api/gcsupport.rst:43 msgid "" -"If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least " -"a :c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from " -"its subclass or subclasses." +"If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least a :" +"c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from its " +"subclass or subclasses." msgstr "" #: ../../c-api/gcsupport.rst:47 msgid "" "When calling :c:func:`PyType_Ready` or some of the APIs that indirectly call " "it like :c:func:`PyType_FromSpecWithBases` or :c:func:`PyType_FromSpec` the " -"interpreter will automatically populate " -"the :c:member:`~PyTypeObject.tp_flags`, :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields if the type inherits from a " -"class that implements the garbage collector protocol and the child class " -"does *not* include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." +"interpreter will automatically populate the :c:member:`~PyTypeObject." +"tp_flags`, :c:member:`~PyTypeObject.tp_traverse` and :c:member:" +"`~PyTypeObject.tp_clear` fields if the type inherits from a class that " +"implements the garbage collector protocol and the child class does *not* " +"include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" #: ../../c-api/gcsupport.rst:57 msgid "" -"Analogous to :c:macro:`PyObject_New` but for container objects with " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set." +"Analogous to :c:macro:`PyObject_New` but for container objects with the :c:" +"macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" #: ../../c-api/gcsupport.rst:60 ../../c-api/gcsupport.rst:84 msgid "" -"Do not call this directly to allocate memory for an object; call the " -"type's :c:member:`~PyTypeObject.tp_alloc` slot instead." +"Do not call this directly to allocate memory for an object; call the type's :" +"c:member:`~PyTypeObject.tp_alloc` slot instead." msgstr "" #: ../../c-api/gcsupport.rst:63 ../../c-api/gcsupport.rst:87 msgid "" -"When populating a type's :c:member:`~PyTypeObject.tp_alloc` " -"slot, :c:func:`PyType_GenericAlloc` is preferred over a custom function that " -"simply calls this macro." +"When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, :c:func:" +"`PyType_GenericAlloc` is preferred over a custom function that simply calls " +"this macro." msgstr "" #: ../../c-api/gcsupport.rst:67 ../../c-api/gcsupport.rst:91 @@ -146,8 +146,8 @@ msgstr ":c:member:`~PyTypeObject.tp_alloc`" #: ../../c-api/gcsupport.rst:81 msgid "" -"Analogous to :c:macro:`PyObject_NewVar` but for container objects with " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set." +"Analogous to :c:macro:`PyObject_NewVar` but for container objects with the :" +"c:macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" #: ../../c-api/gcsupport.rst:98 @@ -170,17 +170,17 @@ msgstr "" #: ../../c-api/gcsupport.rst:114 msgid "" -"Memory allocated by this function must be freed " -"with :c:func:`PyObject_GC_Del` (usually called via the " -"object's :c:member:`~PyTypeObject.tp_free` slot)." +"Memory allocated by this function must be freed with :c:func:" +"`PyObject_GC_Del` (usually called via the object's :c:member:`~PyTypeObject." +"tp_free` slot)." msgstr "" #: ../../c-api/gcsupport.rst:119 msgid "" "The function is marked as unstable because the final mechanism for reserving " "extra data after an instance is not yet decided. For allocating a variable " -"number of fields, prefer using :c:type:`PyVarObject` " -"and :c:member:`~PyTypeObject.tp_itemsize` instead." +"number of fields, prefer using :c:type:`PyVarObject` and :c:member:" +"`~PyTypeObject.tp_itemsize` instead." msgstr "" #: ../../c-api/gcsupport.rst:130 @@ -239,21 +239,21 @@ msgstr "" #: ../../c-api/gcsupport.rst:178 msgid "" -"Releases memory allocated to an object using :c:macro:`PyObject_GC_New` " -"or :c:macro:`PyObject_GC_NewVar`." +"Releases memory allocated to an object using :c:macro:`PyObject_GC_New` or :" +"c:macro:`PyObject_GC_NewVar`." msgstr "" #: ../../c-api/gcsupport.rst:181 msgid "" -"Do not call this directly to free an object's memory; call the " -"type's :c:member:`~PyTypeObject.tp_free` slot instead." +"Do not call this directly to free an object's memory; call the type's :c:" +"member:`~PyTypeObject.tp_free` slot instead." msgstr "" #: ../../c-api/gcsupport.rst:184 msgid "" -"Do not use this for memory allocated " -"by :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, or related " -"allocation functions; use :c:func:`PyObject_Free` instead." +"Do not use this for memory allocated by :c:macro:`PyObject_New`, :c:macro:" +"`PyObject_NewVar`, or related allocation functions; use :c:func:" +"`PyObject_Free` instead." msgstr "" #: ../../c-api/gcsupport.rst:190 @@ -276,10 +276,10 @@ msgstr ":c:member:`~PyTypeObject.tp_free`" msgid "" "Remove the object *op* from the set of container objects tracked by the " "collector. Note that :c:func:`PyObject_GC_Track` can be called again on " -"this object to add it back to the set of tracked objects. The deallocator " -"(:c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the " -"object before any of the fields used by " -"the :c:member:`~PyTypeObject.tp_traverse` handler become invalid." +"this object to add it back to the set of tracked objects. The deallocator (:" +"c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the object " +"before any of the fields used by the :c:member:`~PyTypeObject.tp_traverse` " +"handler become invalid." msgstr "" #: ../../c-api/gcsupport.rst:208 @@ -296,12 +296,12 @@ msgstr "" #: ../../c-api/gcsupport.rst:216 msgid "" -"Type of the visitor function passed to " -"the :c:member:`~PyTypeObject.tp_traverse` handler. The function should be " -"called with an object to traverse as *object* and the third parameter to " -"the :c:member:`~PyTypeObject.tp_traverse` handler as *arg*. The Python core " -"uses several visitor functions to implement cyclic garbage detection; it's " -"not expected that users will need to write their own visitor functions." +"Type of the visitor function passed to the :c:member:`~PyTypeObject." +"tp_traverse` handler. The function should be called with an object to " +"traverse as *object* and the third parameter to the :c:member:`~PyTypeObject." +"tp_traverse` handler as *arg*. The Python core uses several visitor " +"functions to implement cyclic garbage detection; it's not expected that " +"users will need to write their own visitor functions." msgstr "" #: ../../c-api/gcsupport.rst:223 @@ -322,13 +322,20 @@ msgstr "" #: ../../c-api/gcsupport.rst:235 msgid "" -"To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, " -"a :c:func:`Py_VISIT` macro is provided. In order to use this macro, " -"the :c:member:`~PyTypeObject.tp_traverse` implementation must name its " -"arguments exactly *visit* and *arg*:" +"The traversal function must not have any side effects. Implementations may " +"not modify the reference counts of any Python objects nor create or destroy " +"any Python objects." +msgstr "" + +#: ../../c-api/gcsupport.rst:239 +msgid "" +"To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, a :c:" +"func:`Py_VISIT` macro is provided. In order to use this macro, the :c:" +"member:`~PyTypeObject.tp_traverse` implementation must name its arguments " +"exactly *visit* and *arg*:" msgstr "" -#: ../../c-api/gcsupport.rst:242 +#: ../../c-api/gcsupport.rst:246 msgid "" "If the :c:expr:`PyObject *` *o* is not ``NULL``, call the *visit* callback, " "with arguments *o* and *arg*. If *visit* returns a non-zero value, then " @@ -336,7 +343,7 @@ msgid "" "look like::" msgstr "" -#: ../../c-api/gcsupport.rst:247 +#: ../../c-api/gcsupport.rst:251 msgid "" "static int\n" "my_traverse(Noddy *self, visitproc visit, void *arg)\n" @@ -354,13 +361,13 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/gcsupport.rst:255 +#: ../../c-api/gcsupport.rst:259 msgid "" -"The :c:member:`~PyTypeObject.tp_clear` handler must be of " -"the :c:type:`inquiry` type, or ``NULL`` if the object is immutable." +"The :c:member:`~PyTypeObject.tp_clear` handler must be of the :c:type:" +"`inquiry` type, or ``NULL`` if the object is immutable." msgstr "" -#: ../../c-api/gcsupport.rst:261 +#: ../../c-api/gcsupport.rst:265 msgid "" "Drop references that may have created reference cycles. Immutable objects " "do not have to define this method since they can never directly create " @@ -370,82 +377,82 @@ msgid "" "in a reference cycle." msgstr "" -#: ../../c-api/gcsupport.rst:270 +#: ../../c-api/gcsupport.rst:274 msgid "Controlling the Garbage Collector State" msgstr "" -#: ../../c-api/gcsupport.rst:272 +#: ../../c-api/gcsupport.rst:276 msgid "" "The C-API provides the following functions for controlling garbage " "collection runs." msgstr "" -#: ../../c-api/gcsupport.rst:277 +#: ../../c-api/gcsupport.rst:281 msgid "" "Perform a full garbage collection, if the garbage collector is enabled. " "(Note that :func:`gc.collect` runs it unconditionally.)" msgstr "" -#: ../../c-api/gcsupport.rst:280 +#: ../../c-api/gcsupport.rst:284 msgid "" "Returns the number of collected + unreachable objects which cannot be " "collected. If the garbage collector is disabled or already collecting, " -"returns ``0`` immediately. Errors during garbage collection are passed " -"to :data:`sys.unraisablehook`. This function does not raise exceptions." +"returns ``0`` immediately. Errors during garbage collection are passed to :" +"data:`sys.unraisablehook`. This function does not raise exceptions." msgstr "" -#: ../../c-api/gcsupport.rst:290 +#: ../../c-api/gcsupport.rst:294 msgid "" "Enable the garbage collector: similar to :func:`gc.enable`. Returns the " "previous state, 0 for disabled and 1 for enabled." msgstr "" -#: ../../c-api/gcsupport.rst:298 +#: ../../c-api/gcsupport.rst:302 msgid "" "Disable the garbage collector: similar to :func:`gc.disable`. Returns the " "previous state, 0 for disabled and 1 for enabled." msgstr "" -#: ../../c-api/gcsupport.rst:306 +#: ../../c-api/gcsupport.rst:310 msgid "" "Query the state of the garbage collector: similar to :func:`gc.isenabled`. " "Returns the current state, 0 for disabled and 1 for enabled." msgstr "" -#: ../../c-api/gcsupport.rst:313 +#: ../../c-api/gcsupport.rst:317 msgid "Querying Garbage Collector State" msgstr "" -#: ../../c-api/gcsupport.rst:315 +#: ../../c-api/gcsupport.rst:319 msgid "" "The C-API provides the following interface for querying information about " "the garbage collector." msgstr "" -#: ../../c-api/gcsupport.rst:320 +#: ../../c-api/gcsupport.rst:324 msgid "" "Run supplied *callback* on all live GC-capable objects. *arg* is passed " "through to all invocations of *callback*." msgstr "" -#: ../../c-api/gcsupport.rst:324 +#: ../../c-api/gcsupport.rst:328 msgid "" "If new objects are (de)allocated by the callback it is undefined if they " "will be visited." msgstr "" -#: ../../c-api/gcsupport.rst:327 +#: ../../c-api/gcsupport.rst:331 msgid "" "Garbage collection is disabled during operation. Explicitly running a " "collection in the callback may lead to undefined behaviour e.g. visiting the " "same objects multiple times or not at all." msgstr "" -#: ../../c-api/gcsupport.rst:335 +#: ../../c-api/gcsupport.rst:339 msgid "" -"Type of the visitor function to be passed " -"to :c:func:`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* " -"passed to ``PyUnstable_GC_VisitObjects``. Return ``1`` to continue " -"iteration, return ``0`` to stop iteration. Other return values are reserved " -"for now so behavior on returning anything else is undefined." +"Type of the visitor function to be passed to :c:func:" +"`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* passed to " +"``PyUnstable_GC_VisitObjects``. Return ``1`` to continue iteration, return " +"``0`` to stop iteration. Other return values are reserved for now so " +"behavior on returning anything else is undefined." msgstr "" diff --git a/c-api/set.po b/c-api/set.po index 2bdbc21349..2fbd3280b8 100644 --- a/c-api/set.po +++ b/c-api/set.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-27 00:03+0000\n" +"POT-Creation-Date: 2025-12-08 07:22+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -167,9 +167,9 @@ msgid "" "Return ``1`` if found and removed, ``0`` if not found (no action taken), and " "``-1`` if an error is encountered. Does not raise :exc:`KeyError` for " "missing keys. Raise a :exc:`TypeError` if the *key* is unhashable. Unlike " -"the Python :meth:`~frozenset.discard` method, this function does not " -"automatically convert unhashable sets into temporary frozensets. Raise :exc:" -"`SystemError` if *set* is not an instance of :class:`set` or its subtype." +"the Python :meth:`~set.discard` method, this function does not automatically " +"convert unhashable sets into temporary frozensets. Raise :exc:`SystemError` " +"if *set* is not an instance of :class:`set` or its subtype." msgstr "" #: ../../c-api/set.rst:158 diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 285808351b..b17161e990 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: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2025-12-09 00:14+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-" @@ -1347,20 +1347,20 @@ msgstr "" #: ../../c-api/typeobj.rst:1323 ../../c-api/typeobj.rst:1367 #: ../../c-api/typeobj.rst:1388 ../../c-api/typeobj.rst:1407 #: ../../c-api/typeobj.rst:1437 ../../c-api/typeobj.rst:1459 -#: ../../c-api/typeobj.rst:1487 ../../c-api/typeobj.rst:1580 -#: ../../c-api/typeobj.rst:1726 ../../c-api/typeobj.rst:1793 -#: ../../c-api/typeobj.rst:1829 ../../c-api/typeobj.rst:1856 -#: ../../c-api/typeobj.rst:1881 ../../c-api/typeobj.rst:1896 -#: ../../c-api/typeobj.rst:1913 ../../c-api/typeobj.rst:1929 -#: ../../c-api/typeobj.rst:1961 ../../c-api/typeobj.rst:1993 -#: ../../c-api/typeobj.rst:2021 ../../c-api/typeobj.rst:2041 -#: ../../c-api/typeobj.rst:2070 ../../c-api/typeobj.rst:2116 -#: ../../c-api/typeobj.rst:2135 ../../c-api/typeobj.rst:2177 -#: ../../c-api/typeobj.rst:2202 ../../c-api/typeobj.rst:2242 -#: ../../c-api/typeobj.rst:2272 ../../c-api/typeobj.rst:2285 -#: ../../c-api/typeobj.rst:2295 ../../c-api/typeobj.rst:2312 -#: ../../c-api/typeobj.rst:2329 ../../c-api/typeobj.rst:2345 -#: ../../c-api/typeobj.rst:2489 ../../c-api/typeobj.rst:2549 +#: ../../c-api/typeobj.rst:1487 ../../c-api/typeobj.rst:1585 +#: ../../c-api/typeobj.rst:1731 ../../c-api/typeobj.rst:1798 +#: ../../c-api/typeobj.rst:1834 ../../c-api/typeobj.rst:1861 +#: ../../c-api/typeobj.rst:1886 ../../c-api/typeobj.rst:1901 +#: ../../c-api/typeobj.rst:1918 ../../c-api/typeobj.rst:1934 +#: ../../c-api/typeobj.rst:1966 ../../c-api/typeobj.rst:1998 +#: ../../c-api/typeobj.rst:2026 ../../c-api/typeobj.rst:2046 +#: ../../c-api/typeobj.rst:2075 ../../c-api/typeobj.rst:2121 +#: ../../c-api/typeobj.rst:2140 ../../c-api/typeobj.rst:2182 +#: ../../c-api/typeobj.rst:2207 ../../c-api/typeobj.rst:2247 +#: ../../c-api/typeobj.rst:2277 ../../c-api/typeobj.rst:2290 +#: ../../c-api/typeobj.rst:2300 ../../c-api/typeobj.rst:2317 +#: ../../c-api/typeobj.rst:2334 ../../c-api/typeobj.rst:2350 +#: ../../c-api/typeobj.rst:2494 ../../c-api/typeobj.rst:2554 msgid "**Inheritance:**" msgstr "" @@ -1399,10 +1399,10 @@ msgstr "" #: ../../c-api/typeobj.rst:529 ../../c-api/typeobj.rst:811 #: ../../c-api/typeobj.rst:938 ../../c-api/typeobj.rst:1038 -#: ../../c-api/typeobj.rst:1060 ../../c-api/typeobj.rst:1858 -#: ../../c-api/typeobj.rst:1883 ../../c-api/typeobj.rst:2023 -#: ../../c-api/typeobj.rst:2043 ../../c-api/typeobj.rst:2118 -#: ../../c-api/typeobj.rst:2244 ../../c-api/typeobj.rst:2491 +#: ../../c-api/typeobj.rst:1060 ../../c-api/typeobj.rst:1863 +#: ../../c-api/typeobj.rst:1888 ../../c-api/typeobj.rst:2028 +#: ../../c-api/typeobj.rst:2048 ../../c-api/typeobj.rst:2123 +#: ../../c-api/typeobj.rst:2249 ../../c-api/typeobj.rst:2496 msgid "This field is inherited by subtypes." msgstr "" @@ -1789,8 +1789,8 @@ msgid "" "violate any assumptions of the library." msgstr "" -#: ../../c-api/typeobj.rst:815 ../../c-api/typeobj.rst:1737 -#: ../../c-api/typeobj.rst:2504 +#: ../../c-api/typeobj.rst:815 ../../c-api/typeobj.rst:1742 +#: ../../c-api/typeobj.rst:2509 msgid "" ":ref:`life-cycle` for details about how this slot relates to other slots." msgstr "" @@ -1954,11 +1954,11 @@ msgstr "" #: ../../c-api/typeobj.rst:940 ../../c-api/typeobj.rst:1021 #: ../../c-api/typeobj.rst:1062 ../../c-api/typeobj.rst:1089 #: ../../c-api/typeobj.rst:1117 ../../c-api/typeobj.rst:1159 -#: ../../c-api/typeobj.rst:1802 ../../c-api/typeobj.rst:1836 -#: ../../c-api/typeobj.rst:1965 ../../c-api/typeobj.rst:1998 -#: ../../c-api/typeobj.rst:2077 ../../c-api/typeobj.rst:2120 -#: ../../c-api/typeobj.rst:2142 ../../c-api/typeobj.rst:2183 -#: ../../c-api/typeobj.rst:2213 ../../c-api/typeobj.rst:2246 +#: ../../c-api/typeobj.rst:1807 ../../c-api/typeobj.rst:1841 +#: ../../c-api/typeobj.rst:1970 ../../c-api/typeobj.rst:2003 +#: ../../c-api/typeobj.rst:2082 ../../c-api/typeobj.rst:2125 +#: ../../c-api/typeobj.rst:2147 ../../c-api/typeobj.rst:2188 +#: ../../c-api/typeobj.rst:2218 ../../c-api/typeobj.rst:2251 msgid "**Default:**" msgstr "**預設:**" @@ -2048,7 +2048,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:1014 ../../c-api/typeobj.rst:1795 +#: ../../c-api/typeobj.rst:1014 ../../c-api/typeobj.rst:1800 msgid "" "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." "tp_richcompare`" @@ -2281,8 +2281,8 @@ msgid "" "`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1231 ../../c-api/typeobj.rst:1582 -#: ../../c-api/typeobj.rst:1728 +#: ../../c-api/typeobj.rst:1231 ../../c-api/typeobj.rst:1587 +#: ../../c-api/typeobj.rst:1733 msgid "" "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." "tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" @@ -2567,7 +2567,7 @@ msgstr "" msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "int tp_traverse(PyObject *self, visitproc visit, void *arg);" -#: ../../c-api/typeobj.rst:1501 ../../c-api/typeobj.rst:1723 +#: ../../c-api/typeobj.rst:1501 ../../c-api/typeobj.rst:1728 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." @@ -2669,14 +2669,21 @@ msgid "" "it, as they are allowed to be removed even if the instance is still alive)." msgstr "" -#: ../../c-api/typeobj.rst:1557 +#: ../../c-api/typeobj.rst:1558 +msgid "" +"The traversal function must not have any side effects. It must not modify " +"the reference counts of any Python objects nor create or destroy any Python " +"objects." +msgstr "" + +#: ../../c-api/typeobj.rst:1562 msgid "" "Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to :c:" "func:`!local_traverse` to have these specific names; don't name them just " "anything." msgstr "" -#: ../../c-api/typeobj.rst:1561 +#: ../../c-api/typeobj.rst:1566 msgid "" "Instances of :ref:`heap-allocated types ` hold a reference to " "their type. Their traversal function must therefore either visit :c:func:" @@ -2685,20 +2692,20 @@ msgid "" "superclass). If they do not, the type object may not be garbage-collected." msgstr "" -#: ../../c-api/typeobj.rst:1570 +#: ../../c-api/typeobj.rst:1575 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` function can be called from any " "thread." msgstr ":c:member:`~PyTypeObject.tp_traverse` 函式可以從任何執行緒呼叫。" -#: ../../c-api/typeobj.rst:1575 +#: ../../c-api/typeobj.rst:1580 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1584 +#: ../../c-api/typeobj.rst:1589 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" @@ -2706,15 +2713,15 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1594 +#: ../../c-api/typeobj.rst:1599 msgid "An optional pointer to a clear function. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1596 +#: ../../c-api/typeobj.rst:1601 msgid "int tp_clear(PyObject *);" msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1598 +#: ../../c-api/typeobj.rst:1603 msgid "" "The purpose of this function is to break reference cycles that are causing " "a :term:`cyclic isolate` so that the objects can be safely destroyed. A " @@ -2722,7 +2729,7 @@ msgid "" "to satisfy design invariants held during normal use." msgstr "" -#: ../../c-api/typeobj.rst:1603 +#: ../../c-api/typeobj.rst:1608 msgid "" ":c:member:`!tp_clear` does not need to delete references to objects that " "can't participate in reference cycles, such as Python strings or Python " @@ -2733,44 +2740,44 @@ msgid "" "func:`Py_CLEAR`.)" msgstr "" -#: ../../c-api/typeobj.rst:1611 +#: ../../c-api/typeobj.rst:1616 msgid "" "Any non-trivial cleanup should be performed in :c:member:`~PyTypeObject." "tp_finalize` instead of :c:member:`!tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1616 +#: ../../c-api/typeobj.rst:1621 msgid "" "If :c:member:`!tp_clear` fails to break a reference cycle then the objects " "in the :term:`cyclic isolate` may remain indefinitely uncollectable " "(\"leak\"). See :data:`gc.garbage`." msgstr "" -#: ../../c-api/typeobj.rst:1622 +#: ../../c-api/typeobj.rst:1627 msgid "" "Referents (direct and indirect) might have already been cleared; they are " "not guaranteed to be in a consistent state." msgstr "" -#: ../../c-api/typeobj.rst:1627 +#: ../../c-api/typeobj.rst:1632 msgid "" "The :c:member:`~PyTypeObject.tp_clear` function can be called from any " "thread." msgstr ":c:member:`~PyTypeObject.tp_clear` 函式可以從任何執行緒呼叫。" -#: ../../c-api/typeobj.rst:1632 +#: ../../c-api/typeobj.rst:1637 msgid "" "An object is not guaranteed to be automatically cleared before its " "destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called." msgstr "" -#: ../../c-api/typeobj.rst:1635 +#: ../../c-api/typeobj.rst:1640 msgid "" "This function differs from the destructor (:c:member:`~PyTypeObject." "tp_dealloc`) in the following ways:" msgstr "" -#: ../../c-api/typeobj.rst:1638 +#: ../../c-api/typeobj.rst:1643 msgid "" "The purpose of clearing an object is to remove references to other objects " "that might participate in a reference cycle. The purpose of the destructor, " @@ -2780,7 +2787,7 @@ msgid "" "`~PyTypeObject.tp_free`)." msgstr "" -#: ../../c-api/typeobj.rst:1644 +#: ../../c-api/typeobj.rst:1649 msgid "" "When :c:member:`!tp_clear` is called, other objects might still hold " "references to the object being cleared. Because of this, :c:member:`!" @@ -2790,7 +2797,7 @@ msgid "" "object itself by deallocating it." msgstr "" -#: ../../c-api/typeobj.rst:1650 +#: ../../c-api/typeobj.rst:1655 msgid "" ":c:member:`!tp_clear` might never be automatically called. An object's " "destructor, on the other hand, will be automatically called some time after " @@ -2798,20 +2805,20 @@ msgid "" "object or the object is a member of a :term:`cyclic isolate`)." msgstr "" -#: ../../c-api/typeobj.rst:1655 +#: ../../c-api/typeobj.rst:1660 msgid "" "No guarantees are made about when, if, or how often Python automatically " "clears an object, except:" msgstr "" -#: ../../c-api/typeobj.rst:1658 +#: ../../c-api/typeobj.rst:1663 msgid "" "Python will not automatically clear an object if it is reachable, i.e., " "there is a reference to it and it is not a member of a :term:`cyclic " "isolate`." msgstr "" -#: ../../c-api/typeobj.rst:1661 +#: ../../c-api/typeobj.rst:1666 msgid "" "Python will not automatically clear an object if it has not been " "automatically finalized (see :c:member:`~PyTypeObject.tp_finalize`). (If " @@ -2819,14 +2826,14 @@ msgid "" "automatically finalized again before it is cleared.)" msgstr "" -#: ../../c-api/typeobj.rst:1665 +#: ../../c-api/typeobj.rst:1670 msgid "" "If an object is a member of a :term:`cyclic isolate`, Python will not " "automatically clear it if any member of the cyclic isolate has not yet been " "automatically finalized (:c:member:`~PyTypeObject.tp_finalize`)." msgstr "" -#: ../../c-api/typeobj.rst:1668 +#: ../../c-api/typeobj.rst:1673 msgid "" "Python will not destroy an object until after any automatic calls to its :c:" "member:`!tp_clear` function have returned. This ensures that the act of " @@ -2834,20 +2841,20 @@ msgid "" "member:`!tp_clear` is still executing." msgstr "" -#: ../../c-api/typeobj.rst:1672 +#: ../../c-api/typeobj.rst:1677 msgid "" "Python will not automatically call :c:member:`!tp_clear` multiple times " "concurrently." msgstr "" -#: ../../c-api/typeobj.rst:1675 +#: ../../c-api/typeobj.rst:1680 msgid "" "CPython currently only automatically clears objects as needed to break " "reference cycles in a :term:`cyclic isolate`, but future versions might " "clear objects regularly before their destruction." msgstr "" -#: ../../c-api/typeobj.rst:1679 +#: ../../c-api/typeobj.rst:1684 msgid "" "Taken together, all :c:member:`~PyTypeObject.tp_clear` functions in the " "system must combine to break all reference cycles. This is subtle, and if " @@ -2860,7 +2867,7 @@ msgid "" "good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1690 +#: ../../c-api/typeobj.rst:1695 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2868,7 +2875,7 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1694 +#: ../../c-api/typeobj.rst:1699 msgid "" "static int\n" "local_clear(PyObject *op)\n" @@ -2892,7 +2899,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1705 +#: ../../c-api/typeobj.rst:1710 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " "delicate: the reference to the contained object must not be released (via :" @@ -2907,18 +2914,18 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1717 +#: ../../c-api/typeobj.rst:1722 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, the clear function must call :c:func:" "`PyObject_ClearManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1721 +#: ../../c-api/typeobj.rst:1726 msgid "PyObject_ClearManagedDict((PyObject*)self);" msgstr "PyObject_ClearManagedDict((PyObject*)self);" -#: ../../c-api/typeobj.rst:1730 +#: ../../c-api/typeobj.rst:1735 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" @@ -2926,22 +2933,22 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1744 +#: ../../c-api/typeobj.rst:1749 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1746 +#: ../../c-api/typeobj.rst:1751 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1748 +#: ../../c-api/typeobj.rst:1753 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: ../../c-api/typeobj.rst:1751 +#: ../../c-api/typeobj.rst:1756 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2949,50 +2956,50 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1756 +#: ../../c-api/typeobj.rst:1761 msgid "" "The following constants are defined to be used as the third argument for :c:" "member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" msgstr "" -#: ../../c-api/typeobj.rst:1762 +#: ../../c-api/typeobj.rst:1767 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1762 +#: ../../c-api/typeobj.rst:1767 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1764 +#: ../../c-api/typeobj.rst:1769 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1766 +#: ../../c-api/typeobj.rst:1771 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1768 +#: ../../c-api/typeobj.rst:1773 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1770 +#: ../../c-api/typeobj.rst:1775 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1772 +#: ../../c-api/typeobj.rst:1777 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1774 +#: ../../c-api/typeobj.rst:1779 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1777 +#: ../../c-api/typeobj.rst:1782 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1781 +#: ../../c-api/typeobj.rst:1786 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -3000,15 +3007,15 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1787 +#: ../../c-api/typeobj.rst:1792 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: ../../c-api/typeobj.rst:1789 +#: ../../c-api/typeobj.rst:1794 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1797 +#: ../../c-api/typeobj.rst:1802 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" @@ -3016,7 +3023,7 @@ msgid "" "tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1804 +#: ../../c-api/typeobj.rst:1809 msgid "" ":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." "tp_richcompare` implementation, which may be inherited. However, if only :c:" @@ -3025,13 +3032,13 @@ msgid "" "comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1813 +#: ../../c-api/typeobj.rst:1818 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1816 +#: ../../c-api/typeobj.rst:1821 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " @@ -3041,19 +3048,19 @@ msgid "" "`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1823 +#: ../../c-api/typeobj.rst:1828 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1826 +#: ../../c-api/typeobj.rst:1831 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1831 +#: ../../c-api/typeobj.rst:1836 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -3062,7 +3069,7 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1838 +#: ../../c-api/typeobj.rst:1843 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." @@ -3070,32 +3077,32 @@ msgid "" "unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1848 +#: ../../c-api/typeobj.rst:1853 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " "object. Its presence normally signals that the instances of this type are :" "term:`iterable` (although sequences may be iterable without this function)." msgstr "" -#: ../../c-api/typeobj.rst:1852 +#: ../../c-api/typeobj.rst:1857 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1854 +#: ../../c-api/typeobj.rst:1859 msgid "PyObject *tp_iter(PyObject *self);" msgstr "PyObject *tp_iter(PyObject *self);" -#: ../../c-api/typeobj.rst:1865 +#: ../../c-api/typeobj.rst:1870 msgid "" "An optional pointer to a function that returns the next item in an :term:" "`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1868 +#: ../../c-api/typeobj.rst:1873 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "PyObject *tp_iternext(PyObject *self);" -#: ../../c-api/typeobj.rst:1870 +#: ../../c-api/typeobj.rst:1875 msgid "" "When the iterator is exhausted, it must return ``NULL``; a :exc:" "`StopIteration` exception may or may not be set. When another error occurs, " @@ -3103,74 +3110,74 @@ msgid "" "this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1875 +#: ../../c-api/typeobj.rst:1880 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: ../../c-api/typeobj.rst:1879 +#: ../../c-api/typeobj.rst:1884 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1890 +#: ../../c-api/typeobj.rst:1895 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: ../../c-api/typeobj.rst:1893 +#: ../../c-api/typeobj.rst:1898 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1898 +#: ../../c-api/typeobj.rst:1903 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1906 +#: ../../c-api/typeobj.rst:1911 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMemberDef` structures, declaring regular data members (fields or slots) " "of instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1910 +#: ../../c-api/typeobj.rst:1915 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1915 +#: ../../c-api/typeobj.rst:1920 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1923 +#: ../../c-api/typeobj.rst:1928 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyGetSetDef` structures, declaring computed attributes of instances of this " "type." msgstr "" -#: ../../c-api/typeobj.rst:1926 +#: ../../c-api/typeobj.rst:1931 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1931 +#: ../../c-api/typeobj.rst:1936 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1939 +#: ../../c-api/typeobj.rst:1944 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -3178,7 +3185,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1947 +#: ../../c-api/typeobj.rst:1952 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -3186,7 +3193,7 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1952 +#: ../../c-api/typeobj.rst:1957 msgid "" "However, the unary '&' operator applied to a non-static variable like :c:" "data:`PyBaseObject_Type` is not required to produce an address constant. " @@ -3194,27 +3201,27 @@ msgid "" "strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1958 +#: ../../c-api/typeobj.rst:1963 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1963 +#: ../../c-api/typeobj.rst:1968 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1967 +#: ../../c-api/typeobj.rst:1972 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1973 +#: ../../c-api/typeobj.rst:1978 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1975 +#: ../../c-api/typeobj.rst:1980 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " @@ -3225,73 +3232,73 @@ msgid "" "be treated as read-only." msgstr "" -#: ../../c-api/typeobj.rst:1983 +#: ../../c-api/typeobj.rst:1988 msgid "" "Some types may not store their dictionary in this slot. Use :c:func:" "`PyType_GetDict` to retrieve the dictionary for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1989 +#: ../../c-api/typeobj.rst:1994 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " "Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" "func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1995 +#: ../../c-api/typeobj.rst:2000 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:2000 +#: ../../c-api/typeobj.rst:2005 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:2005 +#: ../../c-api/typeobj.rst:2010 msgid "" "It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" "member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: ../../c-api/typeobj.rst:2013 +#: ../../c-api/typeobj.rst:2018 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:2015 ../../c-api/typeobj.rst:2033 -#: ../../c-api/typeobj.rst:2099 ../../c-api/typeobj.rst:2131 -#: ../../c-api/typeobj.rst:2156 +#: ../../c-api/typeobj.rst:2020 ../../c-api/typeobj.rst:2038 +#: ../../c-api/typeobj.rst:2104 ../../c-api/typeobj.rst:2136 +#: ../../c-api/typeobj.rst:2161 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2017 +#: ../../c-api/typeobj.rst:2022 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" -#: ../../c-api/typeobj.rst:2030 +#: ../../c-api/typeobj.rst:2035 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:2035 +#: ../../c-api/typeobj.rst:2040 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" msgstr "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" -#: ../../c-api/typeobj.rst:2037 +#: ../../c-api/typeobj.rst:2042 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:2048 +#: ../../c-api/typeobj.rst:2053 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:2051 +#: ../../c-api/typeobj.rst:2056 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " @@ -3299,19 +3306,19 @@ msgid "" "func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:2056 +#: ../../c-api/typeobj.rst:2061 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:2059 +#: ../../c-api/typeobj.rst:2064 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: ../../c-api/typeobj.rst:2061 +#: ../../c-api/typeobj.rst:2066 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" "only. To get the pointer to the dictionary call :c:func:" @@ -3320,13 +3327,13 @@ msgid "" "to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:2067 +#: ../../c-api/typeobj.rst:2072 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit and :c:" "member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: ../../c-api/typeobj.rst:2072 +#: ../../c-api/typeobj.rst:2077 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " @@ -3334,25 +3341,25 @@ msgid "" "`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: ../../c-api/typeobj.rst:2079 +#: ../../c-api/typeobj.rst:2084 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" -#: ../../c-api/typeobj.rst:2082 +#: ../../c-api/typeobj.rst:2087 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " "will be set to ``-1``, to indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:2092 +#: ../../c-api/typeobj.rst:2097 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:2094 +#: ../../c-api/typeobj.rst:2099 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -3360,18 +3367,18 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:2101 +#: ../../c-api/typeobj.rst:2106 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:2103 +#: ../../c-api/typeobj.rst:2108 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " "arguments represent positional and keyword arguments of the call to :meth:" "`~object.__init__`." msgstr "" -#: ../../c-api/typeobj.rst:2107 +#: ../../c-api/typeobj.rst:2112 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " "when an instance is created normally by calling its type, after the type's :" @@ -3383,53 +3390,53 @@ msgid "" "subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:2114 +#: ../../c-api/typeobj.rst:2119 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:2122 +#: ../../c-api/typeobj.rst:2127 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:2129 +#: ../../c-api/typeobj.rst:2134 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:2133 +#: ../../c-api/typeobj.rst:2138 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:2137 +#: ../../c-api/typeobj.rst:2142 msgid "" "Static subtypes inherit this slot, which will be :c:func:" "`PyType_GenericAlloc` if inherited from :class:`object`." msgstr "" -#: ../../c-api/typeobj.rst:2140 ../../c-api/typeobj.rst:2211 +#: ../../c-api/typeobj.rst:2145 ../../c-api/typeobj.rst:2216 msgid ":ref:`Heap subtypes ` do not inherit this slot." msgstr "" -#: ../../c-api/typeobj.rst:2144 +#: ../../c-api/typeobj.rst:2149 msgid "" "For heap subtypes, this field is always set to :c:func:`PyType_GenericAlloc`." msgstr "" -#: ../../c-api/typeobj.rst:2147 ../../c-api/typeobj.rst:2219 +#: ../../c-api/typeobj.rst:2152 ../../c-api/typeobj.rst:2224 msgid "For static subtypes, this slot is inherited (see above)." msgstr "" -#: ../../c-api/typeobj.rst:2154 +#: ../../c-api/typeobj.rst:2159 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:2158 +#: ../../c-api/typeobj.rst:2163 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:2160 +#: ../../c-api/typeobj.rst:2165 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " @@ -3438,7 +3445,7 @@ msgid "" "that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:2166 +#: ../../c-api/typeobj.rst:2171 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " @@ -3450,20 +3457,20 @@ msgid "" "be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:2174 +#: ../../c-api/typeobj.rst:2179 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:2179 +#: ../../c-api/typeobj.rst:2184 msgid "" "This field is inherited by subtypes, except it is not inherited by :ref:" "`static types ` whose :c:member:`~PyTypeObject.tp_base` is " "``NULL`` or ``&PyBaseObject_Type``." msgstr "" -#: ../../c-api/typeobj.rst:2185 +#: ../../c-api/typeobj.rst:2190 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -3471,22 +3478,22 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:2195 +#: ../../c-api/typeobj.rst:2200 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2197 +#: ../../c-api/typeobj.rst:2202 msgid "void tp_free(void *self);" msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:2199 +#: ../../c-api/typeobj.rst:2204 msgid "" "This function must free the memory allocated by :c:member:`~PyTypeObject." "tp_alloc`." msgstr "" -#: ../../c-api/typeobj.rst:2204 +#: ../../c-api/typeobj.rst:2209 msgid "" "Static subtypes inherit this slot, which will be :c:func:`PyObject_Free` if " "inherited from :class:`object`. Exception: If the type supports garbage " @@ -3495,18 +3502,18 @@ msgid "" "this slot is not inherited but instead defaults to :c:func:`PyObject_GC_Del`." msgstr "" -#: ../../c-api/typeobj.rst:2215 +#: ../../c-api/typeobj.rst:2220 msgid "" "For :ref:`heap subtypes `, this slot defaults to a deallocator " "suitable to match :c:func:`PyType_GenericAlloc` and the value of the :c:" "macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" -#: ../../c-api/typeobj.rst:2226 +#: ../../c-api/typeobj.rst:2231 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:2228 +#: ../../c-api/typeobj.rst:2233 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " @@ -3518,93 +3525,93 @@ msgid "" "instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2236 +#: ../../c-api/typeobj.rst:2241 msgid "int tp_is_gc(PyObject *self);" msgstr "int tp_is_gc(PyObject *self);" -#: ../../c-api/typeobj.rst:2238 +#: ../../c-api/typeobj.rst:2243 msgid "" "(The only example of this are types themselves. The metatype, :c:data:" "`PyType_Type`, defines this function to distinguish between statically and :" "ref:`dynamically allocated types `.)" msgstr "" -#: ../../c-api/typeobj.rst:2248 +#: ../../c-api/typeobj.rst:2253 msgid "" "This slot has no default. If this field is ``NULL``, :c:macro:" "`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: ../../c-api/typeobj.rst:2256 +#: ../../c-api/typeobj.rst:2261 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:2258 ../../c-api/typeobj.rst:2282 +#: ../../c-api/typeobj.rst:2263 ../../c-api/typeobj.rst:2287 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized `." msgstr "" -#: ../../c-api/typeobj.rst:2261 +#: ../../c-api/typeobj.rst:2266 msgid "" "For dynamically created classes, the :c:data:`Py_tp_bases` :c:type:`slot " "` can be used instead of the *bases* argument of :c:func:" "`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:2268 +#: ../../c-api/typeobj.rst:2273 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" -#: ../../c-api/typeobj.rst:2274 ../../c-api/typeobj.rst:2297 -#: ../../c-api/typeobj.rst:2314 ../../c-api/typeobj.rst:2331 -#: ../../c-api/typeobj.rst:2347 +#: ../../c-api/typeobj.rst:2279 ../../c-api/typeobj.rst:2302 +#: ../../c-api/typeobj.rst:2319 ../../c-api/typeobj.rst:2336 +#: ../../c-api/typeobj.rst:2352 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:2279 +#: ../../c-api/typeobj.rst:2284 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: ../../c-api/typeobj.rst:2287 +#: ../../c-api/typeobj.rst:2292 msgid "" "This field is not inherited; it is calculated fresh by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2293 +#: ../../c-api/typeobj.rst:2298 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2302 +#: ../../c-api/typeobj.rst:2307 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: ../../c-api/typeobj.rst:2304 +#: ../../c-api/typeobj.rst:2309 msgid "" "To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__`." msgstr "" -#: ../../c-api/typeobj.rst:2309 +#: ../../c-api/typeobj.rst:2314 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" -#: ../../c-api/typeobj.rst:2319 +#: ../../c-api/typeobj.rst:2324 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2324 +#: ../../c-api/typeobj.rst:2329 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " @@ -3612,27 +3619,27 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: ../../c-api/typeobj.rst:2338 +#: ../../c-api/typeobj.rst:2343 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "此欄位已被棄用。請改用 :c:member:`~PyTypeObject.tp_finalize`。" -#: ../../c-api/typeobj.rst:2343 +#: ../../c-api/typeobj.rst:2348 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2354 +#: ../../c-api/typeobj.rst:2359 msgid "" "An optional pointer to an instance finalization function. This is the C " "implementation of the :meth:`~object.__del__` special method. Its signature " "is::" msgstr "" -#: ../../c-api/typeobj.rst:2358 +#: ../../c-api/typeobj.rst:2363 msgid "void tp_finalize(PyObject *self);" msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2360 +#: ../../c-api/typeobj.rst:2365 msgid "" "The primary purpose of finalization is to perform any non-trivial cleanup " "that must be performed before the object is destroyed, while the object and " @@ -3640,7 +3647,7 @@ msgid "" "consistent state. The finalizer is allowed to execute arbitrary Python code." msgstr "" -#: ../../c-api/typeobj.rst:2366 +#: ../../c-api/typeobj.rst:2371 msgid "" "Before Python automatically finalizes an object, some of the object's direct " "or indirect referents might have themselves been automatically finalized. " @@ -3648,14 +3655,14 @@ msgid "" "member:`~PyTypeObject.tp_clear`) yet." msgstr "" -#: ../../c-api/typeobj.rst:2371 +#: ../../c-api/typeobj.rst:2376 msgid "" "Other non-finalized objects might still be using a finalized object, so the " "finalizer must leave the object in a sane state (e.g., invariants are still " "met)." msgstr "" -#: ../../c-api/typeobj.rst:2377 +#: ../../c-api/typeobj.rst:2382 msgid "" "After Python automatically finalizes an object, Python might start " "automatically clearing (:c:member:`~PyTypeObject.tp_clear`) the object and " @@ -3664,7 +3671,7 @@ msgid "" "cleared referents." msgstr "" -#: ../../c-api/typeobj.rst:2385 +#: ../../c-api/typeobj.rst:2390 msgid "" "An object is not guaranteed to be automatically finalized before its " "destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called. It is " @@ -3673,25 +3680,25 @@ msgid "" "finalized before destruction." msgstr "" -#: ../../c-api/typeobj.rst:2393 +#: ../../c-api/typeobj.rst:2398 msgid "" "The :c:member:`~PyTypeObject.tp_finalize` function can be called from any " "thread, although the :term:`GIL` will be held." msgstr "" -#: ../../c-api/typeobj.rst:2398 +#: ../../c-api/typeobj.rst:2403 msgid "" "The :c:member:`!tp_finalize` function can be called during shutdown, after " "some global variables have been deleted. See the documentation of the :meth:" "`~object.__del__` method for details." msgstr "" -#: ../../c-api/typeobj.rst:2402 +#: ../../c-api/typeobj.rst:2407 msgid "" "When Python finalizes an object, it behaves like the following algorithm:" msgstr "" -#: ../../c-api/typeobj.rst:2404 +#: ../../c-api/typeobj.rst:2409 msgid "" "Python might mark the object as *finalized*. Currently, Python always marks " "objects whose type supports garbage collection (i.e., the :c:macro:" @@ -3699,13 +3706,13 @@ msgid "" "never marks other types of objects; this might change in a future version." msgstr "" -#: ../../c-api/typeobj.rst:2409 +#: ../../c-api/typeobj.rst:2414 msgid "" "If the object is not marked as *finalized* and its :c:member:`!tp_finalize` " "finalizer function is non-``NULL``, the finalizer function is called." msgstr "" -#: ../../c-api/typeobj.rst:2412 +#: ../../c-api/typeobj.rst:2417 msgid "" "If the finalizer function was called and the finalizer made the object " "reachable (i.e., there is a reference to the object and it is not a member " @@ -3715,7 +3722,7 @@ msgid "" "make it reachable, i.e., the object is (still) a member of a cyclic isolate." msgstr "" -#: ../../c-api/typeobj.rst:2419 +#: ../../c-api/typeobj.rst:2424 msgid "" "If the finalizer resurrected the object, the object's pending destruction is " "canceled and the object's *finalized* mark might be removed if present. " @@ -3723,7 +3730,7 @@ msgid "" "future version." msgstr "" -#: ../../c-api/typeobj.rst:2424 +#: ../../c-api/typeobj.rst:2429 msgid "" "*Automatic finalization* refers to any finalization performed by Python " "except via calls to :c:func:`PyObject_CallFinalizer` or :c:func:" @@ -3731,14 +3738,14 @@ msgid "" "or how often an object is automatically finalized, except:" msgstr "" -#: ../../c-api/typeobj.rst:2429 +#: ../../c-api/typeobj.rst:2434 msgid "" "Python will not automatically finalize an object if it is reachable, i.e., " "there is a reference to it and it is not a member of a :term:`cyclic " "isolate`." msgstr "" -#: ../../c-api/typeobj.rst:2432 +#: ../../c-api/typeobj.rst:2437 msgid "" "Python will not automatically finalize an object if finalizing it would not " "mark the object as *finalized*. Currently, this applies to objects whose " @@ -3748,53 +3755,53 @@ msgid "" "`PyObject_CallFinalizerFromDealloc`." msgstr "" -#: ../../c-api/typeobj.rst:2438 +#: ../../c-api/typeobj.rst:2443 msgid "" "Python will not automatically finalize any two members of a :term:`cyclic " "isolate` concurrently." msgstr "" -#: ../../c-api/typeobj.rst:2440 +#: ../../c-api/typeobj.rst:2445 msgid "" "Python will not automatically finalize an object after it has automatically " "cleared (:c:member:`~PyTypeObject.tp_clear`) the object." msgstr "" -#: ../../c-api/typeobj.rst:2442 +#: ../../c-api/typeobj.rst:2447 msgid "" "If an object is a member of a :term:`cyclic isolate`, Python will not " "automatically finalize it after automatically clearing (see :c:member:" "`~PyTypeObject.tp_clear`) any other member." msgstr "" -#: ../../c-api/typeobj.rst:2445 +#: ../../c-api/typeobj.rst:2450 msgid "" "Python will automatically finalize every member of a :term:`cyclic isolate` " "before it automatically clears (see :c:member:`~PyTypeObject.tp_clear`) any " "of them." msgstr "" -#: ../../c-api/typeobj.rst:2448 +#: ../../c-api/typeobj.rst:2453 msgid "" "If Python is going to automatically clear an object (:c:member:" "`~PyTypeObject.tp_clear`), it will automatically finalize the object first." msgstr "" -#: ../../c-api/typeobj.rst:2452 +#: ../../c-api/typeobj.rst:2457 msgid "" "Python currently only automatically finalizes objects that are members of a :" "term:`cyclic isolate`, but future versions might finalize objects regularly " "before their destruction." msgstr "" -#: ../../c-api/typeobj.rst:2456 +#: ../../c-api/typeobj.rst:2461 msgid "" "To manually finalize an object, do not call this function directly; call :c:" "func:`PyObject_CallFinalizer` or :c:func:`PyObject_CallFinalizerFromDealloc` " "instead." msgstr "" -#: ../../c-api/typeobj.rst:2460 +#: ../../c-api/typeobj.rst:2465 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should leave the current exception " "status unchanged. The recommended way to write a non-trivial finalizer is " @@ -3805,7 +3812,7 @@ msgid "" "`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. For example::" msgstr "" -#: ../../c-api/typeobj.rst:2469 +#: ../../c-api/typeobj.rst:2474 msgid "" "static void\n" "foo_finalize(PyObject *self)\n" @@ -3828,26 +3835,26 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:2497 +#: ../../c-api/typeobj.rst:2502 msgid "" "Before version 3.8 it was necessary to set the :c:macro:" "`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " "This is no longer required." msgstr "" -#: ../../c-api/typeobj.rst:2503 +#: ../../c-api/typeobj.rst:2508 msgid ":pep:`442`: \"Safe object finalization\"" msgstr "" -#: ../../c-api/typeobj.rst:2506 +#: ../../c-api/typeobj.rst:2511 msgid ":c:func:`PyObject_CallFinalizer`" msgstr ":c:func:`PyObject_CallFinalizer`" -#: ../../c-api/typeobj.rst:2507 +#: ../../c-api/typeobj.rst:2512 msgid ":c:func:`PyObject_CallFinalizerFromDealloc`" msgstr ":c:func:`PyObject_CallFinalizerFromDealloc`" -#: ../../c-api/typeobj.rst:2514 +#: ../../c-api/typeobj.rst:2519 msgid "" "A :ref:`vectorcall function ` to use for calls of this type " "object (rather than instances). In other words, ``tp_vectorcall`` can be " @@ -3855,13 +3862,13 @@ msgid "" "of *type*." msgstr "" -#: ../../c-api/typeobj.rst:2519 +#: ../../c-api/typeobj.rst:2524 msgid "" "As with any vectorcall function, if ``tp_vectorcall`` is ``NULL``, the " "*tp_call* protocol (``Py_TYPE(type)->tp_call``) is used instead." msgstr "" -#: ../../c-api/typeobj.rst:2524 +#: ../../c-api/typeobj.rst:2529 msgid "" "The :ref:`vectorcall protocol ` requires that the vectorcall " "function has the same behavior as the corresponding ``tp_call``. This means " @@ -3869,27 +3876,27 @@ msgid "" ">tp_call``." msgstr "" -#: ../../c-api/typeobj.rst:2529 +#: ../../c-api/typeobj.rst:2534 msgid "" "Specifically, if *type* uses the default metaclass, ``type->tp_vectorcall`` " "must behave the same as :c:expr:`PyType_Type->tp_call`, which:" msgstr "" -#: ../../c-api/typeobj.rst:2533 +#: ../../c-api/typeobj.rst:2538 msgid "calls ``type->tp_new``," msgstr "呼叫 ``type->tp_new``," -#: ../../c-api/typeobj.rst:2535 +#: ../../c-api/typeobj.rst:2540 msgid "" "if the result is a subclass of *type*, calls ``type->tp_init`` on the result " "of ``tp_new``, and" msgstr "" -#: ../../c-api/typeobj.rst:2538 +#: ../../c-api/typeobj.rst:2543 msgid "returns the result of ``tp_new``." msgstr "回傳 ``tp_new`` 的結果。" -#: ../../c-api/typeobj.rst:2540 +#: ../../c-api/typeobj.rst:2545 msgid "" "Typically, ``tp_vectorcall`` is overridden to optimize this process for " "specific :c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject." @@ -3898,65 +3905,65 @@ msgid "" "__init__`, respectively)." msgstr "" -#: ../../c-api/typeobj.rst:2551 +#: ../../c-api/typeobj.rst:2556 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2553 +#: ../../c-api/typeobj.rst:2558 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2558 +#: ../../c-api/typeobj.rst:2563 msgid "Internal. Do not use." msgstr "" -#: ../../c-api/typeobj.rst:2566 +#: ../../c-api/typeobj.rst:2571 msgid "Static Types" msgstr "靜態型別" -#: ../../c-api/typeobj.rst:2568 +#: ../../c-api/typeobj.rst:2573 msgid "" "Traditionally, types defined in C code are *static*, that is, a static :c:" "type:`PyTypeObject` structure is defined directly in code and initialized " "using :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2572 +#: ../../c-api/typeobj.rst:2577 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2574 +#: ../../c-api/typeobj.rst:2579 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2576 +#: ../../c-api/typeobj.rst:2581 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: ../../c-api/typeobj.rst:2578 +#: ../../c-api/typeobj.rst:2583 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2582 +#: ../../c-api/typeobj.rst:2587 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" -#: ../../c-api/typeobj.rst:2590 +#: ../../c-api/typeobj.rst:2595 msgid "Heap Types" msgstr "堆積型別" -#: ../../c-api/typeobj.rst:2592 +#: ../../c-api/typeobj.rst:2597 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " @@ -3964,29 +3971,29 @@ msgid "" "`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2597 +#: ../../c-api/typeobj.rst:2602 msgid "" "This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" "func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" "`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:2605 +#: ../../c-api/typeobj.rst:2610 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2612 +#: ../../c-api/typeobj.rst:2617 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: ../../c-api/typeobj.rst:2618 ../../c-api/typeobj.rst:3074 +#: ../../c-api/typeobj.rst:2623 ../../c-api/typeobj.rst:3079 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2620 +#: ../../c-api/typeobj.rst:2625 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -4074,7 +4081,7 @@ msgstr "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" -#: ../../c-api/typeobj.rst:2665 +#: ../../c-api/typeobj.rst:2670 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -4084,31 +4091,31 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2674 +#: ../../c-api/typeobj.rst:2679 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" -#: ../../c-api/typeobj.rst:2825 +#: ../../c-api/typeobj.rst:2830 msgid "Mapping Object Structures" msgstr "對映物件結構" -#: ../../c-api/typeobj.rst:2832 +#: ../../c-api/typeobj.rst:2837 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: ../../c-api/typeobj.rst:2839 +#: ../../c-api/typeobj.rst:2844 msgid "" "This function is used by :c:func:`PyMapping_Size` and :c:func:" "`PyObject_Size`, and has the same signature. This slot may be set to " "``NULL`` if the object has no defined length." msgstr "" -#: ../../c-api/typeobj.rst:2847 +#: ../../c-api/typeobj.rst:2852 msgid "" "This function is used by :c:func:`PyObject_GetItem` and :c:func:" "`PySequence_GetSlice`, and has the same signature as :c:func:`!" @@ -4116,7 +4123,7 @@ msgid "" "`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2857 +#: ../../c-api/typeobj.rst:2862 msgid "" "This function is used by :c:func:`PyObject_SetItem`, :c:func:" "`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" @@ -4126,17 +4133,17 @@ msgid "" "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2868 +#: ../../c-api/typeobj.rst:2873 msgid "Sequence Object Structures" msgstr "序列物件結構" -#: ../../c-api/typeobj.rst:2875 +#: ../../c-api/typeobj.rst:2880 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2882 +#: ../../c-api/typeobj.rst:2887 msgid "" "This function is used by :c:func:`PySequence_Size` and :c:func:" "`PyObject_Size`, and has the same signature. It is also used for handling " @@ -4144,21 +4151,21 @@ msgid "" "member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2891 +#: ../../c-api/typeobj.rst:2896 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2899 +#: ../../c-api/typeobj.rst:2904 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2907 +#: ../../c-api/typeobj.rst:2912 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -4167,7 +4174,7 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2913 +#: ../../c-api/typeobj.rst:2918 msgid "" "Negative indexes are handled as follows: if the :c:member:" "`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " @@ -4176,7 +4183,7 @@ msgid "" "index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2922 +#: ../../c-api/typeobj.rst:2927 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " "signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" @@ -4185,14 +4192,14 @@ msgid "" "``NULL`` if the object does not support item assignment and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2933 +#: ../../c-api/typeobj.rst:2938 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: ../../c-api/typeobj.rst:2942 +#: ../../c-api/typeobj.rst:2947 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -4202,7 +4209,7 @@ msgid "" "c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2953 +#: ../../c-api/typeobj.rst:2958 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -4212,76 +4219,76 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2964 +#: ../../c-api/typeobj.rst:2969 msgid "Buffer Object Structures" msgstr "緩衝區物件結構" -#: ../../c-api/typeobj.rst:2972 +#: ../../c-api/typeobj.rst:2977 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol `. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: ../../c-api/typeobj.rst:2980 ../../c-api/typeobj.rst:3031 -#: ../../c-api/typeobj.rst:3087 ../../c-api/typeobj.rst:3100 -#: ../../c-api/typeobj.rst:3114 ../../c-api/typeobj.rst:3126 +#: ../../c-api/typeobj.rst:2985 ../../c-api/typeobj.rst:3036 +#: ../../c-api/typeobj.rst:3092 ../../c-api/typeobj.rst:3105 +#: ../../c-api/typeobj.rst:3119 ../../c-api/typeobj.rst:3131 msgid "The signature of this function is::" msgstr "函式的簽名為: ::" -#: ../../c-api/typeobj.rst:2982 +#: ../../c-api/typeobj.rst:2987 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" -#: ../../c-api/typeobj.rst:2984 +#: ../../c-api/typeobj.rst:2989 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: ../../c-api/typeobj.rst:2988 +#: ../../c-api/typeobj.rst:2993 msgid "" "Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" "expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:2991 +#: ../../c-api/typeobj.rst:2996 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:2993 +#: ../../c-api/typeobj.rst:2998 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2995 +#: ../../c-api/typeobj.rst:3000 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:2997 +#: ../../c-api/typeobj.rst:3002 msgid "Return ``0``." msgstr "回傳 ``0``。" -#: ../../c-api/typeobj.rst:2999 +#: ../../c-api/typeobj.rst:3004 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:3002 +#: ../../c-api/typeobj.rst:3007 msgid "" "Re-export: Each member of the tree acts as the exporting object and sets :c:" "expr:`view->obj` to a new reference to itself." msgstr "" -#: ../../c-api/typeobj.rst:3005 +#: ../../c-api/typeobj.rst:3010 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " "Here, :c:expr:`view->obj` will be a new reference to the root object." msgstr "" -#: ../../c-api/typeobj.rst:3009 +#: ../../c-api/typeobj.rst:3014 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -4289,7 +4296,7 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:3014 +#: ../../c-api/typeobj.rst:3019 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " "exporter and must remain valid until there are no consumers left. :c:member:" @@ -4298,23 +4305,23 @@ msgid "" "internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:3021 +#: ../../c-api/typeobj.rst:3026 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: ../../c-api/typeobj.rst:3024 +#: ../../c-api/typeobj.rst:3029 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:3033 +#: ../../c-api/typeobj.rst:3038 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "void (PyObject *exporter, Py_buffer *view);" -#: ../../c-api/typeobj.rst:3035 +#: ../../c-api/typeobj.rst:3040 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -4322,15 +4329,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:3040 +#: ../../c-api/typeobj.rst:3045 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:3042 +#: ../../c-api/typeobj.rst:3047 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:3044 +#: ../../c-api/typeobj.rst:3049 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -4338,30 +4345,30 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:3050 +#: ../../c-api/typeobj.rst:3055 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: ../../c-api/typeobj.rst:3055 +#: ../../c-api/typeobj.rst:3060 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:3063 +#: ../../c-api/typeobj.rst:3068 msgid "Async Object Structures" msgstr "非同步物件結構" -#: ../../c-api/typeobj.rst:3071 +#: ../../c-api/typeobj.rst:3076 msgid "" "This structure holds pointers to the functions required to implement :term:" "`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:3076 +#: ../../c-api/typeobj.rst:3081 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -4377,62 +4384,62 @@ msgstr "" " sendfunc am_send;\n" "} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:3089 +#: ../../c-api/typeobj.rst:3094 msgid "PyObject *am_await(PyObject *self);" msgstr "PyObject *am_await(PyObject *self);" -#: ../../c-api/typeobj.rst:3091 +#: ../../c-api/typeobj.rst:3096 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: ../../c-api/typeobj.rst:3094 +#: ../../c-api/typeobj.rst:3099 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:3102 +#: ../../c-api/typeobj.rst:3107 msgid "PyObject *am_aiter(PyObject *self);" msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:3104 +#: ../../c-api/typeobj.rst:3109 msgid "" "Must return an :term:`asynchronous iterator` object. See :meth:`~object." "__anext__` for details." msgstr "" -#: ../../c-api/typeobj.rst:3107 +#: ../../c-api/typeobj.rst:3112 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:3116 +#: ../../c-api/typeobj.rst:3121 msgid "PyObject *am_anext(PyObject *self);" msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:3118 +#: ../../c-api/typeobj.rst:3123 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:3128 +#: ../../c-api/typeobj.rst:3133 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:3130 +#: ../../c-api/typeobj.rst:3135 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:3139 +#: ../../c-api/typeobj.rst:3144 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:3143 +#: ../../c-api/typeobj.rst:3148 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " @@ -4446,80 +4453,80 @@ msgid "" "length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:3153 +#: ../../c-api/typeobj.rst:3158 msgid "" "This function should not do any other instance initialization, not even to " "allocate additional memory; that should be done by :c:member:`~PyTypeObject." "tp_new`." msgstr "" -#: ../../c-api/typeobj.rst:3160 +#: ../../c-api/typeobj.rst:3165 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:3164 +#: ../../c-api/typeobj.rst:3169 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:3168 +#: ../../c-api/typeobj.rst:3173 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:3172 +#: ../../c-api/typeobj.rst:3177 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:3176 ../../c-api/typeobj.rst:3185 +#: ../../c-api/typeobj.rst:3181 ../../c-api/typeobj.rst:3190 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:3180 ../../c-api/typeobj.rst:3191 +#: ../../c-api/typeobj.rst:3185 ../../c-api/typeobj.rst:3196 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: ../../c-api/typeobj.rst:3187 +#: ../../c-api/typeobj.rst:3192 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:3194 +#: ../../c-api/typeobj.rst:3199 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:3198 +#: ../../c-api/typeobj.rst:3203 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:3202 +#: ../../c-api/typeobj.rst:3207 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:3206 +#: ../../c-api/typeobj.rst:3211 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:3210 +#: ../../c-api/typeobj.rst:3215 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:3214 +#: ../../c-api/typeobj.rst:3219 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:3218 +#: ../../c-api/typeobj.rst:3223 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:3232 +#: ../../c-api/typeobj.rst:3237 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:3248 +#: ../../c-api/typeobj.rst:3253 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:3250 +#: ../../c-api/typeobj.rst:3255 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -4527,11 +4534,11 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:3255 +#: ../../c-api/typeobj.rst:3260 msgid "A basic :ref:`static type `::" msgstr "" -#: ../../c-api/typeobj.rst:3257 +#: ../../c-api/typeobj.rst:3262 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4563,13 +4570,13 @@ msgstr "" " .tp_repr = (reprfunc)myobj_repr,\n" "};" -#: ../../c-api/typeobj.rst:3272 +#: ../../c-api/typeobj.rst:3277 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:3275 +#: ../../c-api/typeobj.rst:3280 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4653,11 +4660,11 @@ msgstr "" " myobj_new, /* tp_new */\n" "};" -#: ../../c-api/typeobj.rst:3316 +#: ../../c-api/typeobj.rst:3321 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:3318 +#: ../../c-api/typeobj.rst:3323 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4683,14 +4690,14 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:3341 +#: ../../c-api/typeobj.rst:3346 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " "instances (e.g. uses a separate factory func) using :c:macro:" "`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: ../../c-api/typeobj.rst:3345 +#: ../../c-api/typeobj.rst:3350 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4708,12 +4715,12 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:3360 +#: ../../c-api/typeobj.rst:3365 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:3362 +#: ../../c-api/typeobj.rst:3367 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4733,13 +4740,13 @@ msgstr "" " .tp_name = \"mymod.MyObject\",\n" "};" -#: ../../c-api/typeobj.rst:3371 +#: ../../c-api/typeobj.rst:3376 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" -#: ../../c-api/typeobj.rst:3373 +#: ../../c-api/typeobj.rst:3378 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" diff --git a/library/argparse.po b/library/argparse.po index 7e5b91a125..e10bacbe61 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2025-12-12 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -233,7 +233,7 @@ msgstr "新增 *exit_on_error* 參數。" msgid "*suggest_on_error* and *color* parameters were added." msgstr "新增 *suggest_on_error* 和 *color* 參數。" -#: ../../library/argparse.rst:137 ../../library/argparse.rst:689 +#: ../../library/argparse.rst:137 ../../library/argparse.rst:696 msgid "The following sections describe how each of these are used." msgstr "" @@ -1135,81 +1135,88 @@ msgid "" "``FORCE_COLOR`` are set." msgstr "" -#: ../../library/argparse.rst:651 +#: ../../library/argparse.rst:649 +msgid "" +"Error messages will include color codes when redirecting stderr to a file. " +"To avoid this, set the |NO_COLOR|_ or :envvar:`PYTHON_COLORS` environment " +"variable (for example, ``NO_COLOR=1 python script.py 2> errors.txt``)." +msgstr "" + +#: ../../library/argparse.rst:658 msgid "The add_argument() method" msgstr "add_argument() 方法" -#: ../../library/argparse.rst:657 +#: ../../library/argparse.rst:664 msgid "" "Define how a single command-line argument should be parsed. Each parameter " "has its own more detailed description below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:660 +#: ../../library/argparse.rst:667 msgid "" "`name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` " "or ``'-f', '--foo'``." msgstr "" -#: ../../library/argparse.rst:663 +#: ../../library/argparse.rst:670 msgid "" "action_ - The basic type of action to be taken when this argument is " "encountered at the command line." msgstr "" -#: ../../library/argparse.rst:666 +#: ../../library/argparse.rst:673 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "" -#: ../../library/argparse.rst:668 +#: ../../library/argparse.rst:675 msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "" -#: ../../library/argparse.rst:670 +#: ../../library/argparse.rst:677 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "" -#: ../../library/argparse.rst:673 +#: ../../library/argparse.rst:680 msgid "" "type_ - The type to which the command-line argument should be converted." msgstr "" -#: ../../library/argparse.rst:675 +#: ../../library/argparse.rst:682 msgid "choices_ - A sequence of the allowable values for the argument." msgstr "" -#: ../../library/argparse.rst:677 +#: ../../library/argparse.rst:684 msgid "" "required_ - Whether or not the command-line option may be omitted (optionals " "only)." msgstr "" -#: ../../library/argparse.rst:680 +#: ../../library/argparse.rst:687 msgid "help_ - A brief description of what the argument does." msgstr "" -#: ../../library/argparse.rst:682 +#: ../../library/argparse.rst:689 msgid "metavar_ - A name for the argument in usage messages." msgstr "" -#: ../../library/argparse.rst:684 +#: ../../library/argparse.rst:691 msgid "" "dest_ - The name of the attribute to be added to the object returned by :" "meth:`parse_args`." msgstr "" -#: ../../library/argparse.rst:687 +#: ../../library/argparse.rst:694 msgid "deprecated_ - Whether or not use of the argument is deprecated." msgstr "" -#: ../../library/argparse.rst:695 +#: ../../library/argparse.rst:702 msgid "name or flags" msgstr "name or flags" -#: ../../library/argparse.rst:697 +#: ../../library/argparse.rst:704 msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " @@ -1218,30 +1225,30 @@ msgid "" "or a simple argument name." msgstr "" -#: ../../library/argparse.rst:703 +#: ../../library/argparse.rst:710 msgid "For example, an optional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:705 +#: ../../library/argparse.rst:712 msgid ">>> parser.add_argument('-f', '--foo')" msgstr ">>> parser.add_argument('-f', '--foo')" -#: ../../library/argparse.rst:707 +#: ../../library/argparse.rst:714 msgid "while a positional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:709 +#: ../../library/argparse.rst:716 msgid ">>> parser.add_argument('bar')" msgstr ">>> parser.add_argument('bar')" -#: ../../library/argparse.rst:711 +#: ../../library/argparse.rst:718 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " "assumed to be positional::" msgstr "" -#: ../../library/argparse.rst:715 +#: ../../library/argparse.rst:722 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo')\n" @@ -1265,7 +1272,7 @@ msgstr "" "usage: PROG [-h] [-f FOO] bar\n" "PROG: error: the following arguments are required: bar" -#: ../../library/argparse.rst:726 +#: ../../library/argparse.rst:733 msgid "" "By default, :mod:`!argparse` automatically handles the internal naming and " "display names of arguments, simplifying the process without requiring " @@ -1275,7 +1282,7 @@ msgid "" "to the upper-cased name. For example::" msgstr "" -#: ../../library/argparse.rst:734 +#: ../../library/argparse.rst:741 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo-bar')\n" @@ -1299,11 +1306,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo-bar FOO-BAR" -#: ../../library/argparse.rst:749 +#: ../../library/argparse.rst:756 msgid "action" msgstr "action" -#: ../../library/argparse.rst:751 +#: ../../library/argparse.rst:758 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " @@ -1313,13 +1320,13 @@ msgid "" "be handled. The supplied actions are:" msgstr "" -#: ../../library/argparse.rst:757 +#: ../../library/argparse.rst:764 msgid "" "``'store'`` - This just stores the argument's value. This is the default " "action." msgstr "" -#: ../../library/argparse.rst:760 +#: ../../library/argparse.rst:767 msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " "argument; note that the const_ keyword argument defaults to ``None``. The " @@ -1327,7 +1334,7 @@ msgid "" "specify some sort of flag. For example::" msgstr "" -#: ../../library/argparse.rst:765 +#: ../../library/argparse.rst:772 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_const', const=42)\n" @@ -1339,14 +1346,14 @@ msgstr "" ">>> parser.parse_args(['--foo'])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:770 +#: ../../library/argparse.rst:777 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " "``'store_const'`` that respectively store the values ``True`` and ``False`` " "with default values of ``False`` and ``True``::" msgstr "" -#: ../../library/argparse.rst:775 +#: ../../library/argparse.rst:782 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -1362,7 +1369,7 @@ msgstr "" ">>> parser.parse_args('--foo --bar'.split())\n" "Namespace(foo=True, bar=False, baz=True)" -#: ../../library/argparse.rst:782 +#: ../../library/argparse.rst:789 msgid "" "``'append'`` - This appends each argument value to a list. It is useful for " "allowing an option to be specified multiple times. If the default value is a " @@ -1371,7 +1378,7 @@ msgid "" "values. Example usage::" msgstr "" -#: ../../library/argparse.rst:788 +#: ../../library/argparse.rst:795 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='append', default=['0'])\n" @@ -1383,7 +1390,7 @@ msgstr "" ">>> parser.parse_args('--foo 1 --foo 2'.split())\n" "Namespace(foo=['0', '1', '2'])" -#: ../../library/argparse.rst:793 +#: ../../library/argparse.rst:800 msgid "" "``'append_const'`` - This appends the value specified by the const_ keyword " "argument to a list; note that the const_ keyword argument defaults to " @@ -1391,7 +1398,7 @@ msgid "" "arguments need to store constants to the same list. For example::" msgstr "" -#: ../../library/argparse.rst:799 +#: ../../library/argparse.rst:806 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--str', dest='types', action='append_const', " @@ -1409,7 +1416,7 @@ msgstr "" ">>> parser.parse_args('--str --int'.split())\n" "Namespace(types=[, ])" -#: ../../library/argparse.rst:805 +#: ../../library/argparse.rst:812 msgid "" "``'extend'`` - This appends each item from a multi-value argument to a list. " "The ``'extend'`` action is typically used with the nargs_ keyword argument " @@ -1418,7 +1425,7 @@ msgid "" "Example usage::" msgstr "" -#: ../../library/argparse.rst:813 +#: ../../library/argparse.rst:820 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " @@ -1434,13 +1441,13 @@ msgstr "" "\"f4\"])\n" "Namespace(foo=['f1', 'f2', 'f3', 'f4'])" -#: ../../library/argparse.rst:820 +#: ../../library/argparse.rst:827 msgid "" "``'count'`` - This counts the number of times an argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: ../../library/argparse.rst:823 +#: ../../library/argparse.rst:830 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" @@ -1452,11 +1459,11 @@ msgstr "" ">>> parser.parse_args(['-vvv'])\n" "Namespace(verbose=3)" -#: ../../library/argparse.rst:828 +#: ../../library/argparse.rst:835 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: ../../library/argparse.rst:830 +#: ../../library/argparse.rst:837 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -1464,14 +1471,14 @@ msgid "" "output is created." msgstr "" -#: ../../library/argparse.rst:835 +#: ../../library/argparse.rst:842 msgid "" "``'version'`` - This expects a ``version=`` keyword argument in the :meth:" "`~ArgumentParser.add_argument` call, and prints version information and " "exits when invoked::" msgstr "" -#: ../../library/argparse.rst:839 +#: ../../library/argparse.rst:846 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1487,7 +1494,7 @@ msgstr "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" -#: ../../library/argparse.rst:845 +#: ../../library/argparse.rst:852 msgid "" "You may also specify an arbitrary action by passing an :class:`Action` " "subclass (e.g. :class:`BooleanOptionalAction`) or other object that " @@ -1500,7 +1507,7 @@ msgstr "" "action(例如 ``'store'``、``'append'``、``'extend'`` 或 ``nargs`` 不為零的自" "定義 action)可以被用於位置引數。" -#: ../../library/argparse.rst:851 +#: ../../library/argparse.rst:858 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` " @@ -1509,11 +1516,11 @@ msgid "" "their registered name." msgstr "" -#: ../../library/argparse.rst:856 +#: ../../library/argparse.rst:863 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:858 +#: ../../library/argparse.rst:865 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1551,15 +1558,15 @@ msgstr "" ">>> args\n" "Namespace(bar='1', foo='2')" -#: ../../library/argparse.rst:876 +#: ../../library/argparse.rst:883 msgid "For more details, see :class:`Action`." msgstr "更多詳情請見 :class:`Action`。" -#: ../../library/argparse.rst:882 +#: ../../library/argparse.rst:889 msgid "nargs" msgstr "nargs" -#: ../../library/argparse.rst:884 +#: ../../library/argparse.rst:891 msgid "" ":class:`ArgumentParser` objects usually associate a single command-line " "argument with a single action to be taken. The ``nargs`` keyword argument " @@ -1568,13 +1575,13 @@ msgid "" "are:" msgstr "" -#: ../../library/argparse.rst:889 +#: ../../library/argparse.rst:896 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:892 +#: ../../library/argparse.rst:899 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1588,13 +1595,13 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:898 +#: ../../library/argparse.rst:905 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: ../../library/argparse.rst:903 +#: ../../library/argparse.rst:910 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -1604,7 +1611,7 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:910 +#: ../../library/argparse.rst:917 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1626,13 +1633,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:920 +#: ../../library/argparse.rst:927 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:923 +#: ../../library/argparse.rst:930 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?')\n" @@ -1654,7 +1661,7 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(infile=None, outfile=None)" -#: ../../library/argparse.rst:935 +#: ../../library/argparse.rst:942 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -1662,7 +1669,7 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:940 +#: ../../library/argparse.rst:947 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1678,14 +1685,14 @@ msgstr "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" -#: ../../library/argparse.rst:949 +#: ../../library/argparse.rst:956 msgid "" "``'+'``. Just like ``'*'``, all command-line arguments present are gathered " "into a list. Additionally, an error message will be generated if there " "wasn't at least one command-line argument present. For example::" msgstr "" -#: ../../library/argparse.rst:953 +#: ../../library/argparse.rst:960 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1703,7 +1710,7 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:961 +#: ../../library/argparse.rst:968 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1712,11 +1719,11 @@ msgid "" "``'store_const'``) set ``nargs=0``." msgstr "" -#: ../../library/argparse.rst:971 +#: ../../library/argparse.rst:978 msgid "const" msgstr "const" -#: ../../library/argparse.rst:973 +#: ../../library/argparse.rst:980 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1724,7 +1731,7 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:977 +#: ../../library/argparse.rst:984 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " @@ -1734,7 +1741,7 @@ msgid "" "receive a default value of ``None``." msgstr "" -#: ../../library/argparse.rst:985 +#: ../../library/argparse.rst:992 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1744,17 +1751,17 @@ msgid "" "See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:992 +#: ../../library/argparse.rst:999 msgid "" "``const=None`` by default, including when ``action='append_const'`` or " "``action='store_const'``." msgstr "" -#: ../../library/argparse.rst:999 +#: ../../library/argparse.rst:1006 msgid "default" msgstr "default" -#: ../../library/argparse.rst:1001 +#: ../../library/argparse.rst:1008 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -1764,7 +1771,7 @@ msgid "" "command line::" msgstr "" -#: ../../library/argparse.rst:1008 +#: ../../library/argparse.rst:1015 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1780,13 +1787,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:1015 +#: ../../library/argparse.rst:1022 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not overwrite it::" msgstr "" -#: ../../library/argparse.rst:1018 +#: ../../library/argparse.rst:1025 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1798,7 +1805,7 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:1023 +#: ../../library/argparse.rst:1030 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " @@ -1806,7 +1813,7 @@ msgid "" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" -#: ../../library/argparse.rst:1028 +#: ../../library/argparse.rst:1035 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -1820,13 +1827,13 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:1034 +#: ../../library/argparse.rst:1041 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: ../../library/argparse.rst:1037 +#: ../../library/argparse.rst:1044 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -1842,20 +1849,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:1044 +#: ../../library/argparse.rst:1051 msgid "" "For required_ arguments, the ``default`` value is ignored. For example, this " "applies to positional arguments with nargs_ values other than ``?`` or " "``*``, or optional arguments marked as ``required=True``." msgstr "" -#: ../../library/argparse.rst:1048 +#: ../../library/argparse.rst:1055 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:1051 +#: ../../library/argparse.rst:1058 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -1871,11 +1878,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:1062 +#: ../../library/argparse.rst:1069 msgid "type" msgstr "type" -#: ../../library/argparse.rst:1064 +#: ../../library/argparse.rst:1071 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -1884,13 +1891,13 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:1070 +#: ../../library/argparse.rst:1077 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: ../../library/argparse.rst:1073 +#: ../../library/argparse.rst:1080 msgid "" "The argument to ``type`` can be a callable that accepts a single string or " "the name of a registered type (see :meth:`~ArgumentParser.register`) If the " @@ -1899,11 +1906,11 @@ msgid "" "is displayed. Other exception types are not handled." msgstr "" -#: ../../library/argparse.rst:1079 +#: ../../library/argparse.rst:1086 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:1081 +#: ../../library/argparse.rst:1088 msgid "" "import argparse\n" "import pathlib\n" @@ -1925,11 +1932,11 @@ msgstr "" "parser.add_argument('code_point', type=ord)\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:1093 +#: ../../library/argparse.rst:1100 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:1095 +#: ../../library/argparse.rst:1102 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -1947,14 +1954,14 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1105 +#: ../../library/argparse.rst:1112 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: ../../library/argparse.rst:1109 +#: ../../library/argparse.rst:1116 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -1962,7 +1969,7 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1114 +#: ../../library/argparse.rst:1121 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." @@ -1970,7 +1977,7 @@ msgid "" "exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1119 +#: ../../library/argparse.rst:1126 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses :class:`~argparse.FileType` and then " @@ -1980,17 +1987,17 @@ msgid "" "files." msgstr "" -#: ../../library/argparse.rst:1126 +#: ../../library/argparse.rst:1133 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1133 +#: ../../library/argparse.rst:1140 msgid "choices" msgstr "choices" -#: ../../library/argparse.rst:1135 +#: ../../library/argparse.rst:1142 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -1999,7 +2006,7 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1141 +#: ../../library/argparse.rst:1148 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -2019,33 +2026,33 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1150 +#: ../../library/argparse.rst:1157 msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -#: ../../library/argparse.rst:1153 +#: ../../library/argparse.rst:1160 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1156 +#: ../../library/argparse.rst:1163 msgid "" "Note that *choices* are checked after any type_ conversions have been " "performed, so objects in *choices* should match the type_ specified. This " "can make *choices* appear unfamiliar in usage, help, or error messages." msgstr "" -#: ../../library/argparse.rst:1161 +#: ../../library/argparse.rst:1168 msgid "" "To keep *choices* user-friendly, consider a custom type wrapper that " "converts and formats values, or omit type_ and handle conversion in your " "application code." msgstr "" -#: ../../library/argparse.rst:1165 +#: ../../library/argparse.rst:1172 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -2053,11 +2060,11 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1174 +#: ../../library/argparse.rst:1181 msgid "required" msgstr "required" -#: ../../library/argparse.rst:1176 +#: ../../library/argparse.rst:1183 msgid "" "In general, the :mod:`!argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -2065,7 +2072,7 @@ msgid "" "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1181 +#: ../../library/argparse.rst:1188 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -2083,24 +2090,24 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1189 +#: ../../library/argparse.rst:1196 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " "present at the command line." msgstr "" -#: ../../library/argparse.rst:1195 +#: ../../library/argparse.rst:1202 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1202 +#: ../../library/argparse.rst:1209 msgid "help" msgstr "help" -#: ../../library/argparse.rst:1204 +#: ../../library/argparse.rst:1211 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -2108,7 +2115,7 @@ msgid "" "each argument." msgstr "" -#: ../../library/argparse.rst:1209 +#: ../../library/argparse.rst:1216 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -2117,7 +2124,7 @@ msgid "" "``%(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1214 +#: ../../library/argparse.rst:1221 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -2143,19 +2150,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1226 +#: ../../library/argparse.rst:1233 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1229 +#: ../../library/argparse.rst:1236 msgid "" ":mod:`!argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1232 +#: ../../library/argparse.rst:1239 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -2173,11 +2180,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1244 +#: ../../library/argparse.rst:1251 msgid "metavar" msgstr "metavar" -#: ../../library/argparse.rst:1246 +#: ../../library/argparse.rst:1253 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, :class:`!ArgumentParser` " @@ -2189,7 +2196,7 @@ msgid "" "command-line argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1255 +#: ../../library/argparse.rst:1262 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2221,11 +2228,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1270 +#: ../../library/argparse.rst:1277 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1272 +#: ../../library/argparse.rst:1279 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2257,21 +2264,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1287 +#: ../../library/argparse.rst:1294 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1291 +#: ../../library/argparse.rst:1298 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1295 +#: ../../library/argparse.rst:1302 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2295,11 +2302,11 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1310 +#: ../../library/argparse.rst:1317 msgid "dest" msgstr "dest" -#: ../../library/argparse.rst:1312 +#: ../../library/argparse.rst:1319 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -2309,7 +2316,7 @@ msgid "" "add_argument`::" msgstr "" -#: ../../library/argparse.rst:1319 +#: ../../library/argparse.rst:1326 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2321,7 +2328,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1324 +#: ../../library/argparse.rst:1331 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2333,7 +2340,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1333 +#: ../../library/argparse.rst:1340 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2351,11 +2358,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1341 +#: ../../library/argparse.rst:1348 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1343 +#: ../../library/argparse.rst:1350 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2367,11 +2374,11 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1352 +#: ../../library/argparse.rst:1359 msgid "deprecated" msgstr "deprecated" -#: ../../library/argparse.rst:1354 +#: ../../library/argparse.rst:1361 msgid "" "During a project's lifetime, some arguments may need to be removed from the " "command line. Before removing them, you should inform your users that the " @@ -2382,7 +2389,7 @@ msgid "" "will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" -#: ../../library/argparse.rst:1364 +#: ../../library/argparse.rst:1371 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='snake.py')\n" @@ -2402,11 +2409,11 @@ msgstr "" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" -#: ../../library/argparse.rst:1377 +#: ../../library/argparse.rst:1384 msgid "Action classes" msgstr "Action 類別" -#: ../../library/argparse.rst:1379 +#: ../../library/argparse.rst:1386 msgid "" ":class:`!Action` classes implement the Action API, a callable which returns " "a callable which processes arguments from the command-line. Any object which " @@ -2414,7 +2421,7 @@ msgid "" "`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1388 +#: ../../library/argparse.rst:1395 msgid "" ":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " "the information needed to parse a single argument from one or more strings " @@ -2423,7 +2430,7 @@ msgid "" "`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1394 +#: ../../library/argparse.rst:1401 msgid "" "Instances of :class:`!Action` (or return value of any callable to the " "``action`` parameter) should have attributes :attr:`!dest`, :attr:`!" @@ -2432,46 +2439,46 @@ msgid "" "is to call :meth:`!Action.__init__`." msgstr "" -#: ../../library/argparse.rst:1402 +#: ../../library/argparse.rst:1409 msgid "" ":class:`!Action` instances should be callable, so subclasses must override " "the :meth:`!__call__` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1405 +#: ../../library/argparse.rst:1412 msgid "" "*parser* - The :class:`ArgumentParser` object which contains this action." msgstr "" -#: ../../library/argparse.rst:1407 +#: ../../library/argparse.rst:1414 msgid "" "*namespace* - The :class:`Namespace` object that will be returned by :meth:" "`~ArgumentParser.parse_args`. Most actions add an attribute to this object " "using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1411 +#: ../../library/argparse.rst:1418 msgid "" "*values* - The associated command-line arguments, with any type conversions " "applied. Type conversions are specified with the type_ keyword argument to :" "meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1415 +#: ../../library/argparse.rst:1422 msgid "" "*option_string* - The option string that was used to invoke this action. The " "``option_string`` argument is optional, and will be absent if the action is " "associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1419 +#: ../../library/argparse.rst:1426 msgid "" "The :meth:`!__call__` method may perform arbitrary actions, but will " "typically set attributes on the ``namespace`` based on ``dest`` and " "``values``." msgstr "" -#: ../../library/argparse.rst:1424 +#: ../../library/argparse.rst:1431 msgid "" ":class:`!Action` subclasses can define a :meth:`!format_usage` method that " "takes no argument and return a string which will be used when printing the " @@ -2479,7 +2486,7 @@ msgid "" "will be used." msgstr "" -#: ../../library/argparse.rst:1430 +#: ../../library/argparse.rst:1437 msgid "" "A subclass of :class:`Action` for handling boolean flags with positive and " "negative options. Adding a single argument such as ``--foo`` automatically " @@ -2487,7 +2494,7 @@ msgid "" "``False`` respectively::" msgstr "" -#: ../../library/argparse.rst:1435 +#: ../../library/argparse.rst:1442 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -2501,47 +2508,47 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:1445 +#: ../../library/argparse.rst:1452 msgid "The parse_args() method" msgstr "parse_args() 方法" -#: ../../library/argparse.rst:1449 +#: ../../library/argparse.rst:1456 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1452 +#: ../../library/argparse.rst:1459 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:`!" "add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1456 +#: ../../library/argparse.rst:1463 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" -#: ../../library/argparse.rst:1459 +#: ../../library/argparse.rst:1466 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1464 +#: ../../library/argparse.rst:1471 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1466 +#: ../../library/argparse.rst:1473 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1470 +#: ../../library/argparse.rst:1477 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2559,14 +2566,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1478 +#: ../../library/argparse.rst:1485 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1482 +#: ../../library/argparse.rst:1489 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2574,13 +2581,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1485 +#: ../../library/argparse.rst:1492 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1488 +#: ../../library/argparse.rst:1495 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2588,13 +2595,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1491 +#: ../../library/argparse.rst:1498 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1494 +#: ../../library/argparse.rst:1501 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='store_true')\n" @@ -2610,11 +2617,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1503 +#: ../../library/argparse.rst:1510 msgid "Invalid arguments" msgstr "無效引數" -#: ../../library/argparse.rst:1505 +#: ../../library/argparse.rst:1512 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2622,7 +2629,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1510 +#: ../../library/argparse.rst:1517 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2662,11 +2669,11 @@ msgstr "" "usage: PROG [-h] [--foo FOO] [bar]\n" "PROG: error: extra arguments found: badger" -#: ../../library/argparse.rst:1531 +#: ../../library/argparse.rst:1538 msgid "Arguments containing ``-``" msgstr "包含 ``-`` 的引數" -#: ../../library/argparse.rst:1533 +#: ../../library/argparse.rst:1540 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2678,7 +2685,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1541 +#: ../../library/argparse.rst:1548 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2711,7 +2718,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1571 +#: ../../library/argparse.rst:1578 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2719,7 +2726,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1576 +#: ../../library/argparse.rst:1583 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2727,24 +2734,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1579 +#: ../../library/argparse.rst:1586 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: ../../library/argparse.rst:1585 +#: ../../library/argparse.rst:1592 msgid "Argument abbreviations (prefix matching)" msgstr "引數縮寫 (前綴匹配)" -#: ../../library/argparse.rst:1587 +#: ../../library/argparse.rst:1594 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1591 +#: ../../library/argparse.rst:1598 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2768,17 +2775,17 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1602 +#: ../../library/argparse.rst:1609 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1608 +#: ../../library/argparse.rst:1615 msgid "Beyond ``sys.argv``" msgstr "``sys.argv`` 之外" -#: ../../library/argparse.rst:1610 +#: ../../library/argparse.rst:1617 msgid "" "Sometimes it may be useful to have an :class:`ArgumentParser` parse " "arguments other than those of :data:`sys.argv`. This can be accomplished by " @@ -2786,7 +2793,7 @@ msgid "" "useful for testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1615 +#: ../../library/argparse.rst:1622 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -2812,24 +2819,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1630 +#: ../../library/argparse.rst:1637 msgid "The Namespace object" msgstr "命名空間物件" -#: ../../library/argparse.rst:1634 +#: ../../library/argparse.rst:1641 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1637 +#: ../../library/argparse.rst:1644 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1641 +#: ../../library/argparse.rst:1648 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2843,14 +2850,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1647 +#: ../../library/argparse.rst:1654 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1651 +#: ../../library/argparse.rst:1658 msgid "" ">>> class C:\n" "... pass\n" @@ -2872,15 +2879,16 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1663 +#: ../../library/argparse.rst:1670 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1666 -msgid "Sub-commands" +#: ../../library/argparse.rst:1673 +#, fuzzy +msgid "Subcommands" msgstr "子命令" -#: ../../library/argparse.rst:1673 +#: ../../library/argparse.rst:1680 msgid "" "Many programs split up their functionality into a number of subcommands, for " "example, the ``svn`` program can invoke subcommands like ``svn checkout``, " @@ -2895,69 +2903,69 @@ msgid "" "returns an :class:`!ArgumentParser` object that can be modified as usual." msgstr "" -#: ../../library/argparse.rst:1685 +#: ../../library/argparse.rst:1692 msgid "Description of parameters:" msgstr "參數的解釋:" -#: ../../library/argparse.rst:1687 +#: ../../library/argparse.rst:1694 msgid "" "*title* - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1691 +#: ../../library/argparse.rst:1698 msgid "" "*description* - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1694 +#: ../../library/argparse.rst:1701 msgid "" -"*prog* - usage information that will be displayed with sub-command help, by " +"*prog* - usage information that will be displayed with subcommand help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1698 +#: ../../library/argparse.rst:1705 msgid "" "*parser_class* - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. :class:`ArgumentParser`)" msgstr "" -#: ../../library/argparse.rst:1701 +#: ../../library/argparse.rst:1708 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1704 +#: ../../library/argparse.rst:1711 msgid "" -"dest_ - name of the attribute under which sub-command name will be stored; " -"by default ``None`` and no value is stored" +"dest_ - name of the attribute under which subcommand name will be stored; by " +"default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1707 +#: ../../library/argparse.rst:1714 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1710 +#: ../../library/argparse.rst:1717 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1712 +#: ../../library/argparse.rst:1719 msgid "" "metavar_ - string presenting available subcommands in help; by default it is " "``None`` and presents subcommands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1715 +#: ../../library/argparse.rst:1722 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1717 +#: ../../library/argparse.rst:1724 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -2980,7 +2988,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1736 +#: ../../library/argparse.rst:1743 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -2990,7 +2998,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1743 +#: ../../library/argparse.rst:1750 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -2999,7 +3007,7 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1751 +#: ../../library/argparse.rst:1758 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -3057,14 +3065,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1779 +#: ../../library/argparse.rst:1786 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1783 +#: ../../library/argparse.rst:1790 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -3100,7 +3108,7 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1800 +#: ../../library/argparse.rst:1807 msgid "" "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " "*aliases* argument, which allows multiple strings to refer to the same " @@ -3108,7 +3116,7 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1805 +#: ../../library/argparse.rst:1812 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -3124,13 +3132,13 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1812 +#: ../../library/argparse.rst:1819 msgid "" ":meth:`~_SubParsersAction.add_parser` supports also an additional " "*deprecated* argument, which allows to deprecate the subparser." msgstr "" -#: ../../library/argparse.rst:1826 +#: ../../library/argparse.rst:1833 msgid "" "One particularly effective way of handling subcommands is to combine the use " "of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so " @@ -3138,7 +3146,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1831 +#: ../../library/argparse.rst:1838 msgid "" ">>> # subcommand functions\n" ">>> def foo(args):\n" @@ -3173,7 +3181,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1863 +#: ../../library/argparse.rst:1870 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -3183,7 +3191,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1870 +#: ../../library/argparse.rst:1877 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -3203,21 +3211,21 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1879 +#: ../../library/argparse.rst:1886 msgid "New *required* keyword-only parameter." msgstr "" -#: ../../library/argparse.rst:1882 +#: ../../library/argparse.rst:1889 msgid "" "Subparser's *prog* is no longer affected by a custom usage message in the " "main parser." msgstr "" -#: ../../library/argparse.rst:1888 +#: ../../library/argparse.rst:1895 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1892 +#: ../../library/argparse.rst:1899 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -3226,7 +3234,7 @@ msgid "" "the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1898 +#: ../../library/argparse.rst:1905 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -3244,14 +3252,14 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1904 +#: ../../library/argparse.rst:1911 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1908 +#: ../../library/argparse.rst:1915 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -3263,7 +3271,7 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1915 +#: ../../library/argparse.rst:1922 msgid "" "If one argument uses *FileType* and then a subsequent argument fails, an " "error is reported but the file is not automatically closed. This can also " @@ -3272,15 +3280,15 @@ msgid "" "manage the files." msgstr "" -#: ../../library/argparse.rst:1921 +#: ../../library/argparse.rst:1928 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1928 +#: ../../library/argparse.rst:1935 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1933 +#: ../../library/argparse.rst:1940 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3289,7 +3297,7 @@ msgid "" "method::" msgstr "" -#: ../../library/argparse.rst:1939 +#: ../../library/argparse.rst:1946 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3313,7 +3321,7 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:1950 +#: ../../library/argparse.rst:1957 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" @@ -3324,7 +3332,7 @@ msgid "" "this display::" msgstr "" -#: ../../library/argparse.rst:1958 +#: ../../library/argparse.rst:1965 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3362,7 +3370,7 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1976 +#: ../../library/argparse.rst:1983 msgid "" "The optional, keyword-only parameters argument_default_ and " "conflict_handler_ allow for finer-grained control of the behavior of the " @@ -3371,35 +3379,35 @@ msgid "" "rather than the entire parser." msgstr "" -#: ../../library/argparse.rst:1981 +#: ../../library/argparse.rst:1988 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:1984 +#: ../../library/argparse.rst:1991 msgid "" "Calling :meth:`add_argument_group` on an argument group now raises an " "exception. This nesting was never supported, often failed to work correctly, " "and was unintentionally exposed through inheritance." msgstr "" -#: ../../library/argparse.rst:1989 +#: ../../library/argparse.rst:1996 msgid "Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated." msgstr "" -#: ../../library/argparse.rst:1995 +#: ../../library/argparse.rst:2002 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:1999 +#: ../../library/argparse.rst:2006 msgid "" "Create a mutually exclusive group. :mod:`!argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:2003 +#: ../../library/argparse.rst:2010 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3425,14 +3433,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:2015 +#: ../../library/argparse.rst:2022 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:2019 +#: ../../library/argparse.rst:2026 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3450,7 +3458,7 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:2027 +#: ../../library/argparse.rst:2034 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -3458,7 +3466,7 @@ msgid "" "argument group that has a title and description. For example::" msgstr "" -#: ../../library/argparse.rst:2033 +#: ../../library/argparse.rst:2040 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3494,7 +3502,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:2050 +#: ../../library/argparse.rst:2057 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group now raises an exception. This nesting was " @@ -3502,11 +3510,11 @@ msgid "" "exposed through inheritance." msgstr "" -#: ../../library/argparse.rst:2058 +#: ../../library/argparse.rst:2065 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:2062 +#: ../../library/argparse.rst:2069 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -3515,7 +3523,7 @@ msgid "" "command line to be added::" msgstr "" -#: ../../library/argparse.rst:2068 +#: ../../library/argparse.rst:2075 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3529,7 +3537,7 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:2074 +#: ../../library/argparse.rst:2081 msgid "" "Note that defaults can be set at both the parser level using :meth:" "`set_defaults` and at the argument level using :meth:`add_argument`. If both " @@ -3537,7 +3545,7 @@ msgid "" "used::" msgstr "" -#: ../../library/argparse.rst:2078 +#: ../../library/argparse.rst:2085 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3551,20 +3559,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:2084 +#: ../../library/argparse.rst:2091 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:2090 +#: ../../library/argparse.rst:2097 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:2094 +#: ../../library/argparse.rst:2101 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3576,54 +3584,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:2101 +#: ../../library/argparse.rst:2108 msgid "Printing help" msgstr "印出幫助訊息" -#: ../../library/argparse.rst:2103 +#: ../../library/argparse.rst:2110 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:2109 +#: ../../library/argparse.rst:2116 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:2115 +#: ../../library/argparse.rst:2122 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:2119 +#: ../../library/argparse.rst:2126 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:2124 +#: ../../library/argparse.rst:2131 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:2129 +#: ../../library/argparse.rst:2136 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:2134 +#: ../../library/argparse.rst:2141 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:2138 +#: ../../library/argparse.rst:2145 msgid "" "Sometimes a script only needs to handle a specific set of command-line " "arguments, leaving any unrecognized arguments for another script or program. " @@ -3631,7 +3639,7 @@ msgid "" "useful." msgstr "" -#: ../../library/argparse.rst:2143 +#: ../../library/argparse.rst:2150 msgid "" "This method works similarly to :meth:`~ArgumentParser.parse_args`, but it " "does not raise an error for extra, unrecognized arguments. Instead, it " @@ -3639,7 +3647,7 @@ msgid "" "populated namespace and the list of any unrecognized arguments." msgstr "" -#: ../../library/argparse.rst:2150 +#: ../../library/argparse.rst:2157 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -3653,7 +3661,7 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2157 +#: ../../library/argparse.rst:2164 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -3661,11 +3669,11 @@ msgid "" "remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2164 +#: ../../library/argparse.rst:2171 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2168 +#: ../../library/argparse.rst:2175 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3673,20 +3681,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2173 +#: ../../library/argparse.rst:2180 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2177 +#: ../../library/argparse.rst:2184 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2180 +#: ../../library/argparse.rst:2187 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3696,18 +3704,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2186 +#: ../../library/argparse.rst:2193 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2190 +#: ../../library/argparse.rst:2197 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " "can override this method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2194 +#: ../../library/argparse.rst:2201 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3721,17 +3729,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2202 +#: ../../library/argparse.rst:2209 msgid "" "This method prints a usage message, including the *message*, to :data:`sys." "stderr` and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2207 +#: ../../library/argparse.rst:2214 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2212 +#: ../../library/argparse.rst:2219 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3739,7 +3747,7 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2217 +#: ../../library/argparse.rst:2224 msgid "" "These parsers do not support all the :mod:`!argparse` features, and will " "raise exceptions if unsupported features are used. In particular, " @@ -3747,7 +3755,7 @@ msgid "" "positionals are not supported." msgstr "" -#: ../../library/argparse.rst:2222 +#: ../../library/argparse.rst:2229 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -3755,7 +3763,7 @@ msgid "" "collects all the positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2228 +#: ../../library/argparse.rst:2235 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3775,7 +3783,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2237 +#: ../../library/argparse.rst:2244 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3783,11 +3791,11 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2246 +#: ../../library/argparse.rst:2253 msgid "Registering custom types or actions" msgstr "" -#: ../../library/argparse.rst:2250 +#: ../../library/argparse.rst:2257 msgid "" "Sometimes it's desirable to use a custom string in error messages to provide " "more user-friendly output. In these cases, :meth:`!register` can be used to " @@ -3795,7 +3803,7 @@ msgid "" "the type by their registered name instead of their callable name." msgstr "" -#: ../../library/argparse.rst:2255 +#: ../../library/argparse.rst:2262 msgid "" "The :meth:`!register` method accepts three arguments - a *registry_name*, " "specifying the internal registry where the object will be stored (e.g., " @@ -3803,12 +3811,12 @@ msgid "" "be registered, and object, the callable to be registered." msgstr "" -#: ../../library/argparse.rst:2260 +#: ../../library/argparse.rst:2267 msgid "" "The following example shows how to register a custom type with a parser::" msgstr "" -#: ../../library/argparse.rst:2262 +#: ../../library/argparse.rst:2269 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -3836,43 +3844,43 @@ msgstr "" "usage: PROG [-h] [--foo FOO]\n" "PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" -#: ../../library/argparse.rst:2274 +#: ../../library/argparse.rst:2281 msgid "Exceptions" msgstr "例外" -#: ../../library/argparse.rst:2278 +#: ../../library/argparse.rst:2285 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2280 +#: ../../library/argparse.rst:2287 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2285 +#: ../../library/argparse.rst:2292 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:2289 +#: ../../library/argparse.rst:2296 msgid "Guides and Tutorials" msgstr "" -#: ../../library/argparse.rst:901 +#: ../../library/argparse.rst:908 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:901 ../../library/argparse.rst:933 -#: ../../library/argparse.rst:947 +#: ../../library/argparse.rst:908 ../../library/argparse.rst:940 +#: ../../library/argparse.rst:954 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:933 +#: ../../library/argparse.rst:940 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:947 +#: ../../library/argparse.rst:954 msgid "+ (plus)" msgstr "+ (加號)" diff --git a/library/stdtypes.po b/library/stdtypes.po index 65d42784ff..d6283eaf90 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: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2025-12-08 07:22+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -135,8 +135,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:282 #: ../../library/stdtypes.rst:422 ../../library/stdtypes.rst:1005 -#: ../../library/stdtypes.rst:1224 ../../library/stdtypes.rst:2901 -#: ../../library/stdtypes.rst:4161 +#: ../../library/stdtypes.rst:1224 ../../library/stdtypes.rst:2927 +#: ../../library/stdtypes.rst:4187 msgid "Notes" msgstr "註解" @@ -150,7 +150,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:1007 #: ../../library/stdtypes.rst:1010 ../../library/stdtypes.rst:1239 -#: ../../library/stdtypes.rst:2907 ../../library/stdtypes.rst:4167 +#: ../../library/stdtypes.rst:2933 ../../library/stdtypes.rst:4193 msgid "\\(1)" msgstr "\\(1)" @@ -164,8 +164,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:295 #: ../../library/stdtypes.rst:315 ../../library/stdtypes.rst:1250 -#: ../../library/stdtypes.rst:2911 ../../library/stdtypes.rst:2913 -#: ../../library/stdtypes.rst:4171 ../../library/stdtypes.rst:4173 +#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:2939 +#: ../../library/stdtypes.rst:4197 ../../library/stdtypes.rst:4199 msgid "\\(2)" msgstr "\\(2)" @@ -177,18 +177,18 @@ msgstr "``not x``" msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" -#: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:2915 -#: ../../library/stdtypes.rst:2917 ../../library/stdtypes.rst:2919 -#: ../../library/stdtypes.rst:2921 ../../library/stdtypes.rst:4175 -#: ../../library/stdtypes.rst:4177 ../../library/stdtypes.rst:4179 -#: ../../library/stdtypes.rst:4181 +#: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:2941 +#: ../../library/stdtypes.rst:2943 ../../library/stdtypes.rst:2945 +#: ../../library/stdtypes.rst:2947 ../../library/stdtypes.rst:4201 +#: ../../library/stdtypes.rst:4203 ../../library/stdtypes.rst:4205 +#: ../../library/stdtypes.rst:4207 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:326 #: ../../library/stdtypes.rst:440 ../../library/stdtypes.rst:1049 -#: ../../library/stdtypes.rst:1254 ../../library/stdtypes.rst:2947 -#: ../../library/stdtypes.rst:4211 +#: ../../library/stdtypes.rst:1254 ../../library/stdtypes.rst:2973 +#: ../../library/stdtypes.rst:4237 msgid "Notes:" msgstr "註解:" @@ -235,9 +235,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2732 -#: ../../library/stdtypes.rst:2878 ../../library/stdtypes.rst:2901 -#: ../../library/stdtypes.rst:4138 ../../library/stdtypes.rst:4161 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2904 +#: ../../library/stdtypes.rst:2927 ../../library/stdtypes.rst:4164 +#: ../../library/stdtypes.rst:4187 msgid "Meaning" msgstr "含義" @@ -570,8 +570,8 @@ msgid "" "zero." msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" -#: ../../library/stdtypes.rst:308 ../../library/stdtypes.rst:2909 -#: ../../library/stdtypes.rst:4198 +#: ../../library/stdtypes.rst:308 ../../library/stdtypes.rst:2935 +#: ../../library/stdtypes.rst:4224 msgid "\\(6)" msgstr "\\(6)" @@ -608,9 +608,9 @@ msgid "*x* to the power *y*" msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:317 ../../library/stdtypes.rst:319 -#: ../../library/stdtypes.rst:2934 ../../library/stdtypes.rst:2937 -#: ../../library/stdtypes.rst:2940 ../../library/stdtypes.rst:4194 -#: ../../library/stdtypes.rst:4201 +#: ../../library/stdtypes.rst:2960 ../../library/stdtypes.rst:2963 +#: ../../library/stdtypes.rst:2966 ../../library/stdtypes.rst:4220 +#: ../../library/stdtypes.rst:4227 msgid "\\(5)" msgstr "\\(5)" @@ -768,9 +768,9 @@ msgid "bitwise :dfn:`or` of *x* and *y*" msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:427 -#: ../../library/stdtypes.rst:430 ../../library/stdtypes.rst:2923 -#: ../../library/stdtypes.rst:2927 ../../library/stdtypes.rst:4183 -#: ../../library/stdtypes.rst:4187 +#: ../../library/stdtypes.rst:430 ../../library/stdtypes.rst:2949 +#: ../../library/stdtypes.rst:2953 ../../library/stdtypes.rst:4209 +#: ../../library/stdtypes.rst:4213 msgid "\\(4)" msgstr "\\(4)" @@ -3085,7 +3085,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1891 ../../library/stdtypes.rst:3337 +#: ../../library/stdtypes.rst:1891 ../../library/stdtypes.rst:3363 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -3121,11 +3121,11 @@ msgstr "" ">>> encoded_str_to_bytes\n" "b'Python'" -#: ../../library/stdtypes.rst:1914 ../../library/stdtypes.rst:3356 +#: ../../library/stdtypes.rst:1914 ../../library/stdtypes.rst:3382 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1917 ../../library/stdtypes.rst:3359 +#: ../../library/stdtypes.rst:1917 ../../library/stdtypes.rst:3385 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." @@ -3468,7 +3468,7 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:2194 ../../library/stdtypes.rst:2739 +#: ../../library/stdtypes.rst:2194 msgid "For example:" msgstr "舉例來說:" @@ -3754,13 +3754,14 @@ msgstr "" #: ../../library/stdtypes.rst:2415 ../../library/stdtypes.rst:2433 #: ../../library/stdtypes.rst:2445 ../../library/stdtypes.rst:2499 #: ../../library/stdtypes.rst:2567 ../../library/stdtypes.rst:2637 -#: ../../library/stdtypes.rst:3672 ../../library/stdtypes.rst:3690 -#: ../../library/stdtypes.rst:3780 ../../library/stdtypes.rst:3796 -#: ../../library/stdtypes.rst:3821 ../../library/stdtypes.rst:3835 -#: ../../library/stdtypes.rst:3863 ../../library/stdtypes.rst:3877 -#: ../../library/stdtypes.rst:3895 ../../library/stdtypes.rst:3922 -#: ../../library/stdtypes.rst:3945 ../../library/stdtypes.rst:3972 -#: ../../library/stdtypes.rst:4014 ../../library/stdtypes.rst:4038 +#: ../../library/stdtypes.rst:2732 ../../library/stdtypes.rst:3698 +#: ../../library/stdtypes.rst:3716 ../../library/stdtypes.rst:3806 +#: ../../library/stdtypes.rst:3822 ../../library/stdtypes.rst:3847 +#: ../../library/stdtypes.rst:3861 ../../library/stdtypes.rst:3889 +#: ../../library/stdtypes.rst:3903 ../../library/stdtypes.rst:3921 +#: ../../library/stdtypes.rst:3948 ../../library/stdtypes.rst:3971 +#: ../../library/stdtypes.rst:3998 ../../library/stdtypes.rst:4040 +#: ../../library/stdtypes.rst:4064 msgid "For example::" msgstr "舉例來說: ::" @@ -4064,7 +4065,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2572 ../../library/stdtypes.rst:3982 +#: ../../library/stdtypes.rst:2572 ../../library/stdtypes.rst:4008 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 " @@ -4176,240 +4177,251 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2660 +#: ../../library/stdtypes.rst:2662 msgid "Formatted String Literals (f-strings)" msgstr "" -#: ../../library/stdtypes.rst:2663 +#: ../../library/stdtypes.rst:2665 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" -#: ../../library/stdtypes.rst:2666 -msgid "Added the debugging operator (``=``)" +#: ../../library/stdtypes.rst:2668 +msgid "Added the debug specifier (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2668 +#: ../../library/stdtypes.rst:2670 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../library/stdtypes.rst:2672 +#: ../../library/stdtypes.rst:2674 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 " -"allows embedding arbitrary Python expressions within *replacement fields*, " -"which are delimited by curly brackets (``{}``). These expressions are " -"evaluated at runtime, similarly to :meth:`str.format`, and are converted " -"into regular :class:`str` objects. For example:" +"allows embedding the results of arbitrary Python expressions within " +"*replacement fields*, which are delimited by curly brackets (``{}``). Each " +"replacement field must contain an expression, optionally followed by:" msgstr "" -#: ../../library/stdtypes.rst:2680 -msgid "" -">>> who = 'nobody'\n" -">>> nationality = 'Spanish'\n" -">>> f'{who.title()} expects the {nationality} Inquisition!'\n" -"'Nobody expects the Spanish Inquisition!'" +#: ../../library/stdtypes.rst:2681 +msgid "a *debug specifier* -- an equal sign (``=``);" msgstr "" -">>> who = 'nobody'\n" -">>> nationality = 'Spanish'\n" -">>> f'{who.title()} expects the {nationality} Inquisition!'\n" -"'Nobody expects the Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2687 -msgid "It is also possible to use a multi line f-string:" +#: ../../library/stdtypes.rst:2682 +msgid "a *conversion specifier* -- ``!s``, ``!r`` or ``!a``; and/or" msgstr "" -#: ../../library/stdtypes.rst:2689 -msgid "" -">>> f'''This is a string\n" -"... on two lines'''\n" -"'This is a string\\non two lines'" +#: ../../library/stdtypes.rst:2683 +msgid "a *format specifier* prefixed with a colon (``:``)." msgstr "" -">>> f'''This is a string\n" -"... on two lines'''\n" -"'This is a string\\non two lines'" -#: ../../library/stdtypes.rst:2695 +#: ../../library/stdtypes.rst:2685 msgid "" -"A single opening curly bracket, ``'{'``, marks a *replacement field* that " -"can contain any Python expression:" +"See the :ref:`Lexical Analysis section on f-strings ` for details " +"on the syntax of these fields." msgstr "" -#: ../../library/stdtypes.rst:2698 -msgid "" -">>> nationality = 'Spanish'\n" -">>> f'The {nationality} Inquisition!'\n" -"'The Spanish Inquisition!'" +#: ../../library/stdtypes.rst:2689 +msgid "Debug specifier" msgstr "" -">>> nationality = 'Spanish'\n" -">>> f'The {nationality} Inquisition!'\n" -"'The Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2704 -msgid "To include a literal ``{`` or ``}``, use a double bracket:" +#: ../../library/stdtypes.rst:2693 +msgid "" +"If a debug specifier -- an equal sign (``=``) -- appears after the " +"replacement field expression, the resulting f-string will contain the " +"expression's source, the equal sign, and the value of the expression. This " +"is often useful for debugging::" msgstr "" -#: ../../library/stdtypes.rst:2706 +#: ../../library/stdtypes.rst:2698 msgid "" -">>> x = 42\n" -">>> f'{{x}} is {x}'\n" -"'{x} is 42'" +">>> number = 14.3\n" +">>> f'{number=}'\n" +"'number=14.3'" msgstr "" -">>> x = 42\n" -">>> f'{{x}} is {x}'\n" -"'{x} is 42'" -#: ../../library/stdtypes.rst:2712 +#: ../../library/stdtypes.rst:2702 msgid "" -"Functions can also be used, and :ref:`format specifiers `:" +"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:2714 +#: ../../library/stdtypes.rst:2705 msgid "" -">>> from math import sqrt\n" -">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" -"'√2 ≈ 1.41421'" +">>> f'{ number - 4 = }'\n" +"' number - 4 = 10.3'" msgstr "" -">>> from math import sqrt\n" -">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" -"'√2 ≈ 1.41421'" -#: ../../library/stdtypes.rst:2720 -msgid "Any non-string expression is converted using :func:`str`, by default:" +#: ../../library/stdtypes.rst:2710 +#, fuzzy +msgid "Conversion specifier" +msgstr "conversions(轉換)" + +#: ../../library/stdtypes.rst:2712 +msgid "" +"By default, the value of a replacement field expression is converted to a " +"string using :func:`str`::" msgstr "" -#: ../../library/stdtypes.rst:2722 +#: ../../library/stdtypes.rst:2715 +#, fuzzy msgid "" ">>> from fractions import Fraction\n" -">>> f'{Fraction(1, 3)}'\n" +">>> one_third = Fraction(1, 3)\n" +">>> f'{one_third}'\n" "'1/3'" msgstr "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)}'\n" "'1/3'" -#: ../../library/stdtypes.rst:2728 +#: ../../library/stdtypes.rst:2720 msgid "" -"To use an explicit conversion, use the ``!`` (exclamation mark) operator, " -"followed by any of the valid formats, which are:" +"When a debug specifier but no format specifier is used, the default " +"conversion instead uses :func:`repr`::" msgstr "" -#: ../../library/stdtypes.rst:2732 ../../library/stdtypes.rst:2901 -#: ../../library/stdtypes.rst:4161 -msgid "Conversion" +#: ../../library/stdtypes.rst:2723 +msgid "" +">>> f'{one_third = }'\n" +"'one_third = Fraction(1, 3)'" msgstr "" -#: ../../library/stdtypes.rst:2734 -msgid "``!a``" -msgstr "``!a``" - -#: ../../library/stdtypes.rst:2734 -msgid ":func:`ascii`" -msgstr ":func:`ascii`" +#: ../../library/stdtypes.rst:2726 +msgid "" +"The conversion can be specified explicitly using one of these specifiers:" +msgstr "" -#: ../../library/stdtypes.rst:2735 -msgid "``!r``" -msgstr "``!r``" +#: ../../library/stdtypes.rst:2728 +#, fuzzy +msgid "``!s`` for :func:`str`" +msgstr ":func:`str`" -#: ../../library/stdtypes.rst:2735 -msgid ":func:`repr`" +#: ../../library/stdtypes.rst:2729 +#, fuzzy +msgid "``!r`` for :func:`repr`" msgstr ":func:`repr`" -#: ../../library/stdtypes.rst:2736 -msgid "``!s``" -msgstr "``!s``" - -#: ../../library/stdtypes.rst:2736 -msgid ":func:`str`" -msgstr ":func:`str`" +#: ../../library/stdtypes.rst:2730 +#, fuzzy +msgid "``!a`` for :func:`ascii`" +msgstr ":func:`ascii`" -#: ../../library/stdtypes.rst:2741 +#: ../../library/stdtypes.rst:2734 msgid "" -">>> from fractions import Fraction\n" -">>> f'{Fraction(1, 3)!s}'\n" +">>> str(one_third)\n" "'1/3'\n" -">>> f'{Fraction(1, 3)!r}'\n" +">>> repr(one_third)\n" "'Fraction(1, 3)'\n" -">>> question = '¿Dónde está el Presidente?'\n" -">>> print(f'{question!a}')\n" -"'\\xbfD\\xf3nde est\\xe1 el Presidente?'" +"\n" +">>> f'{one_third!s} is {one_third!r}'\n" +"'1/3 is Fraction(1, 3)'\n" +"\n" +">>> string = \"¡kočka 😸!\"\n" +">>> ascii(string)\n" +"\"'\\\\xa1ko\\\\u010dka \\\\U0001f638!'\"\n" +"\n" +">>> f'{string = !a}'\n" +"\"string = '\\\\xa1ko\\\\u010dka \\\\U0001f638!'\"" +msgstr "" + +#: ../../library/stdtypes.rst:2751 +msgid "Format specifier" msgstr "" -">>> from fractions import Fraction\n" -">>> f'{Fraction(1, 3)!s}'\n" -"'1/3'\n" -">>> f'{Fraction(1, 3)!r}'\n" -"'Fraction(1, 3)'\n" -">>> question = '¿Dónde está el Presidente?'\n" -">>> print(f'{question!a}')\n" -"'\\xbfD\\xf3nde est\\xe1 el Presidente?'" -#: ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2753 msgid "" -"While debugging it may be helpful to see both the expression and its value, " -"by using the equals sign (``=``) after the expression. This preserves spaces " -"within the brackets, and can be used with a converter. By default, the " -"debugging operator uses the :func:`repr` (``!r``) conversion. For example:" +"After the expression has been evaluated, and possibly converted using an " +"explicit conversion specifier, it is formatted using the :func:`format` " +"function. If the replacement field includes a *format specifier* introduced " +"by a colon (``:``), the specifier is passed to :func:`!format` as the second " +"argument. The result of :func:`!format` is then used as the final value for " +"the replacement field. For example::" msgstr "" -#: ../../library/stdtypes.rst:2758 +#: ../../library/stdtypes.rst:2760 msgid "" ">>> from fractions import Fraction\n" -">>> calculation = Fraction(1, 3)\n" -">>> f'{calculation=}'\n" -"'calculation=Fraction(1, 3)'\n" -">>> f'{calculation = }'\n" -"'calculation = Fraction(1, 3)'\n" -">>> f'{calculation = !s}'\n" -"'calculation = 1/3'" +">>> one_third = Fraction(1, 3)\n" +">>> f'{one_third:.6f}'\n" +"'0.333333'\n" +">>> f'{one_third:_^+10}'\n" +"'___+1/3___'\n" +">>> >>> f'{one_third!r:_^20}'\n" +"'___Fraction(1, 3)___'\n" +">>> f'{one_third = :~>10}~'\n" +"'one_third = ~~~~~~~1/3~'" +msgstr "" + +#: ../../library/stdtypes.rst:2774 +#, fuzzy +msgid "Template String Literals (t-strings)" +msgstr "interpolated string literal(插值字串常數)" + +#: ../../library/stdtypes.rst:2776 +msgid "" +"An :dfn:`t-string` (formally a :dfn:`template string literal`) is a string " +"literal that is prefixed with ``t`` or ``T``." msgstr "" -">>> from fractions import Fraction\n" -">>> calculation = Fraction(1, 3)\n" -">>> f'{calculation=}'\n" -"'calculation=Fraction(1, 3)'\n" -">>> f'{calculation = }'\n" -"'calculation = Fraction(1, 3)'\n" -">>> f'{calculation = !s}'\n" -"'calculation = 1/3'" -#: ../../library/stdtypes.rst:2769 +#: ../../library/stdtypes.rst:2779 msgid "" -"Once the output has been evaluated, it can be formatted using a :ref:`format " -"specifier ` following a colon (``':'``). After the expression " -"has been evaluated, and possibly converted to a string, the :meth:`!" -"__format__` method of the result is called with the format specifier, or the " -"empty string if no format specifier is given. The formatted result is then " -"used as the final value for the replacement field. For example:" +"These strings follow the same syntax and evaluation rules as :ref:`formatted " +"string literals `, with for the following differences:" msgstr "" -#: ../../library/stdtypes.rst:2777 +#: ../../library/stdtypes.rst:2783 msgid "" -">>> from fractions import Fraction\n" -">>> f'{Fraction(1, 7):.6f}'\n" -"'0.142857'\n" -">>> f'{Fraction(1, 7):_^+10}'\n" -"'___+1/7___'" +"Rather than evaluating to a ``str`` object, template string literals " +"evaluate to a :class:`string.templatelib.Template` object." +msgstr "" + +#: ../../library/stdtypes.rst:2786 +msgid "" +"The :func:`format` protocol is not used. Instead, the format specifier and " +"conversions (if any) are passed to a new :class:`~string.templatelib." +"Interpolation` object that is created for each evaluated expression. It is " +"up to code that processes the resulting :class:`~string.templatelib." +"Template` object to decide how to handle format specifiers and conversions." +msgstr "" + +#: ../../library/stdtypes.rst:2793 +msgid "" +"Format specifiers containing nested replacement fields are evaluated " +"eagerly, prior to being passed to the :class:`~string.templatelib." +"Interpolation` object. For instance, an interpolation of the form ``{amount:." +"{precision}f}`` will evaluate the inner expression ``{precision}`` to " +"determine the value of the ``format_spec`` attribute. If ``precision`` were " +"to be ``2``, the resulting format specifier would be ``'.2f'``." msgstr "" -">>> from fractions import Fraction\n" -">>> f'{Fraction(1, 7):.6f}'\n" -"'0.142857'\n" -">>> f'{Fraction(1, 7):_^+10}'\n" -"'___+1/7___'" -#: ../../library/stdtypes.rst:2789 +#: ../../library/stdtypes.rst:2801 +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 " +"relevant interpolation. This includes the equals sign and any surrounding " +"whitespace. The :class:`!Interpolation` instance for the expression will be " +"created as normal, except that :attr:`~string.templatelib.Interpolation." +"conversion` will be set to '``r``' (:func:`repr`) by default. If an explicit " +"conversion or format specifier are provided, this will override the default " +"behaviour." +msgstr "" + +#: ../../library/stdtypes.rst:2815 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2802 +#: ../../library/stdtypes.rst:2828 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:2806 +#: ../../library/stdtypes.rst:2832 msgid "" "Using :ref:`formatted string literals `, the :meth:`str.format` " "interface, or :class:`string.Template` may help avoid these errors. Each of " @@ -4417,7 +4429,7 @@ msgid "" "flexibility, and/or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2811 +#: ../../library/stdtypes.rst:2837 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -4427,7 +4439,7 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:2818 +#: ../../library/stdtypes.rst:2844 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." @@ -4435,7 +4447,7 @@ msgstr "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." -#: ../../library/stdtypes.rst:2823 +#: ../../library/stdtypes.rst:2849 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 " @@ -4443,36 +4455,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2833 ../../library/stdtypes.rst:4093 +#: ../../library/stdtypes.rst:2859 ../../library/stdtypes.rst:4119 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2836 ../../library/stdtypes.rst:4096 +#: ../../library/stdtypes.rst:2862 ../../library/stdtypes.rst:4122 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2838 ../../library/stdtypes.rst:4098 +#: ../../library/stdtypes.rst:2864 ../../library/stdtypes.rst:4124 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2841 ../../library/stdtypes.rst:4101 +#: ../../library/stdtypes.rst:2867 ../../library/stdtypes.rst:4127 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2844 ../../library/stdtypes.rst:4104 +#: ../../library/stdtypes.rst:2870 ../../library/stdtypes.rst:4130 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:2848 ../../library/stdtypes.rst:4108 +#: ../../library/stdtypes.rst:2874 ../../library/stdtypes.rst:4134 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -4480,15 +4492,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2853 ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:2879 ../../library/stdtypes.rst:4139 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2855 ../../library/stdtypes.rst:4115 +#: ../../library/stdtypes.rst:2881 ../../library/stdtypes.rst:4141 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2857 +#: ../../library/stdtypes.rst:2883 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 " @@ -4496,275 +4508,279 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2866 ../../library/stdtypes.rst:4126 +#: ../../library/stdtypes.rst:2892 ../../library/stdtypes.rst:4152 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2869 ../../library/stdtypes.rst:4129 +#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:4155 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2878 ../../library/stdtypes.rst:4138 +#: ../../library/stdtypes.rst:2904 ../../library/stdtypes.rst:4164 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2880 ../../library/stdtypes.rst:4140 +#: ../../library/stdtypes.rst:2906 ../../library/stdtypes.rst:4166 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2880 ../../library/stdtypes.rst:4140 +#: ../../library/stdtypes.rst:2906 ../../library/stdtypes.rst:4166 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2883 ../../library/stdtypes.rst:4143 +#: ../../library/stdtypes.rst:2909 ../../library/stdtypes.rst:4169 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2883 ../../library/stdtypes.rst:4143 +#: ../../library/stdtypes.rst:2909 ../../library/stdtypes.rst:4169 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2885 ../../library/stdtypes.rst:4145 +#: ../../library/stdtypes.rst:2911 ../../library/stdtypes.rst:4171 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2885 ../../library/stdtypes.rst:4145 +#: ../../library/stdtypes.rst:2911 ../../library/stdtypes.rst:4171 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2888 ../../library/stdtypes.rst:4148 +#: ../../library/stdtypes.rst:2914 ../../library/stdtypes.rst:4174 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2888 ../../library/stdtypes.rst:4148 +#: ../../library/stdtypes.rst:2914 ../../library/stdtypes.rst:4174 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2891 ../../library/stdtypes.rst:4151 +#: ../../library/stdtypes.rst:2917 ../../library/stdtypes.rst:4177 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2891 ../../library/stdtypes.rst:4151 +#: ../../library/stdtypes.rst:2917 ../../library/stdtypes.rst:4177 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:4155 +#: ../../library/stdtypes.rst:2921 ../../library/stdtypes.rst:4181 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:2898 ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:2924 ../../library/stdtypes.rst:4184 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2903 ../../library/stdtypes.rst:4163 +#: ../../library/stdtypes.rst:2927 ../../library/stdtypes.rst:4187 +msgid "Conversion" +msgstr "" + +#: ../../library/stdtypes.rst:2929 ../../library/stdtypes.rst:4189 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2903 ../../library/stdtypes.rst:2905 -#: ../../library/stdtypes.rst:4163 ../../library/stdtypes.rst:4165 +#: ../../library/stdtypes.rst:2929 ../../library/stdtypes.rst:2931 +#: ../../library/stdtypes.rst:4189 ../../library/stdtypes.rst:4191 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2905 ../../library/stdtypes.rst:4165 +#: ../../library/stdtypes.rst:2931 ../../library/stdtypes.rst:4191 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2907 ../../library/stdtypes.rst:4167 +#: ../../library/stdtypes.rst:2933 ../../library/stdtypes.rst:4193 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2907 ../../library/stdtypes.rst:4167 +#: ../../library/stdtypes.rst:2933 ../../library/stdtypes.rst:4193 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2909 ../../library/stdtypes.rst:4169 +#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:4195 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2909 ../../library/stdtypes.rst:4169 +#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:4195 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2911 ../../library/stdtypes.rst:4171 +#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:4197 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2911 ../../library/stdtypes.rst:4171 +#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:4197 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2913 ../../library/stdtypes.rst:4173 +#: ../../library/stdtypes.rst:2939 ../../library/stdtypes.rst:4199 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2913 ../../library/stdtypes.rst:4173 +#: ../../library/stdtypes.rst:2939 ../../library/stdtypes.rst:4199 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2915 ../../library/stdtypes.rst:4175 +#: ../../library/stdtypes.rst:2941 ../../library/stdtypes.rst:4201 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2915 ../../library/stdtypes.rst:4175 +#: ../../library/stdtypes.rst:2941 ../../library/stdtypes.rst:4201 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2917 ../../library/stdtypes.rst:4177 +#: ../../library/stdtypes.rst:2943 ../../library/stdtypes.rst:4203 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2917 ../../library/stdtypes.rst:4177 +#: ../../library/stdtypes.rst:2943 ../../library/stdtypes.rst:4203 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2919 ../../library/stdtypes.rst:4179 +#: ../../library/stdtypes.rst:2945 ../../library/stdtypes.rst:4205 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2919 ../../library/stdtypes.rst:2921 -#: ../../library/stdtypes.rst:4179 ../../library/stdtypes.rst:4181 +#: ../../library/stdtypes.rst:2945 ../../library/stdtypes.rst:2947 +#: ../../library/stdtypes.rst:4205 ../../library/stdtypes.rst:4207 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2921 ../../library/stdtypes.rst:4181 +#: ../../library/stdtypes.rst:2947 ../../library/stdtypes.rst:4207 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2923 ../../library/stdtypes.rst:4183 +#: ../../library/stdtypes.rst:2949 ../../library/stdtypes.rst:4209 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2923 ../../library/stdtypes.rst:4183 +#: ../../library/stdtypes.rst:2949 ../../library/stdtypes.rst:4209 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:2927 ../../library/stdtypes.rst:4187 +#: ../../library/stdtypes.rst:2953 ../../library/stdtypes.rst:4213 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2927 ../../library/stdtypes.rst:4187 +#: ../../library/stdtypes.rst:2953 ../../library/stdtypes.rst:4213 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:2931 ../../library/stdtypes.rst:4191 +#: ../../library/stdtypes.rst:2957 ../../library/stdtypes.rst:4217 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2931 +#: ../../library/stdtypes.rst:2957 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2934 ../../library/stdtypes.rst:4204 +#: ../../library/stdtypes.rst:2960 ../../library/stdtypes.rst:4230 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2934 +#: ../../library/stdtypes.rst:2960 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:4198 +#: ../../library/stdtypes.rst:2963 ../../library/stdtypes.rst:4224 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2937 +#: ../../library/stdtypes.rst:2963 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2940 ../../library/stdtypes.rst:4201 +#: ../../library/stdtypes.rst:2966 ../../library/stdtypes.rst:4227 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2940 +#: ../../library/stdtypes.rst:2966 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2943 ../../library/stdtypes.rst:4207 +#: ../../library/stdtypes.rst:2969 ../../library/stdtypes.rst:4233 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2943 ../../library/stdtypes.rst:4207 +#: ../../library/stdtypes.rst:2969 ../../library/stdtypes.rst:4233 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2950 ../../library/stdtypes.rst:4214 +#: ../../library/stdtypes.rst:2976 ../../library/stdtypes.rst:4240 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2954 ../../library/stdtypes.rst:4218 +#: ../../library/stdtypes.rst:2980 ../../library/stdtypes.rst:4244 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:2958 ../../library/stdtypes.rst:4222 +#: ../../library/stdtypes.rst:2984 ../../library/stdtypes.rst:4248 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2961 ../../library/stdtypes.rst:4225 +#: ../../library/stdtypes.rst:2987 ../../library/stdtypes.rst:4251 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2965 ../../library/stdtypes.rst:4229 +#: ../../library/stdtypes.rst:2991 ../../library/stdtypes.rst:4255 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:2968 ../../library/stdtypes.rst:4232 +#: ../../library/stdtypes.rst:2994 ../../library/stdtypes.rst:4258 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2972 ../../library/stdtypes.rst:4236 +#: ../../library/stdtypes.rst:2998 ../../library/stdtypes.rst:4262 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2975 ../../library/stdtypes.rst:4245 +#: ../../library/stdtypes.rst:3001 ../../library/stdtypes.rst:4271 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2977 +#: ../../library/stdtypes.rst:3003 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:2982 +#: ../../library/stdtypes.rst:3008 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2993 +#: ../../library/stdtypes.rst:3019 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:3001 +#: ../../library/stdtypes.rst:3027 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 :" @@ -4772,17 +4788,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:3006 +#: ../../library/stdtypes.rst:3032 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:3012 +#: ../../library/stdtypes.rst:3038 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:3016 +#: ../../library/stdtypes.rst:3042 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -4790,40 +4806,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:3024 +#: ../../library/stdtypes.rst:3050 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:3027 +#: ../../library/stdtypes.rst:3053 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:3028 +#: ../../library/stdtypes.rst:3054 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:3029 +#: ../../library/stdtypes.rst:3055 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:3031 +#: ../../library/stdtypes.rst:3057 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:3035 +#: ../../library/stdtypes.rst:3061 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:3039 +#: ../../library/stdtypes.rst:3065 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -4836,29 +4852,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:3049 +#: ../../library/stdtypes.rst:3075 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:3052 +#: ../../library/stdtypes.rst:3078 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:3053 +#: ../../library/stdtypes.rst:3079 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:3054 +#: ../../library/stdtypes.rst:3080 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:3056 +#: ../../library/stdtypes.rst:3082 msgid "Also see the :ref:`bytes ` built-in." msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:3058 +#: ../../library/stdtypes.rst:3084 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4866,38 +4882,38 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:3064 +#: ../../library/stdtypes.rst:3090 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:3071 +#: ../../library/stdtypes.rst:3097 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:3075 +#: ../../library/stdtypes.rst:3101 msgid "" ":meth:`bytes.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-like " "objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3079 +#: ../../library/stdtypes.rst:3105 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3085 ../../library/stdtypes.rst:3176 +#: ../../library/stdtypes.rst:3111 ../../library/stdtypes.rst:3202 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:3091 +#: ../../library/stdtypes.rst:3117 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, " @@ -4906,13 +4922,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:3108 +#: ../../library/stdtypes.rst:3134 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:3112 +#: ../../library/stdtypes.rst:3138 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 " @@ -4920,58 +4936,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3117 +#: ../../library/stdtypes.rst:3143 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:3125 +#: ../../library/stdtypes.rst:3151 msgid "Bytearray Objects" msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:3129 +#: ../../library/stdtypes.rst:3155 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:3135 +#: ../../library/stdtypes.rst:3161 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:3138 +#: ../../library/stdtypes.rst:3164 msgid "Creating an empty instance: ``bytearray()``" msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:3139 +#: ../../library/stdtypes.rst:3165 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:3140 +#: ../../library/stdtypes.rst:3166 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:3141 +#: ../../library/stdtypes.rst:3167 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:3143 +#: ../../library/stdtypes.rst:3169 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:3147 +#: ../../library/stdtypes.rst:3173 msgid "Also see the :ref:`bytearray ` built-in." msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:3149 +#: ../../library/stdtypes.rst:3175 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4979,64 +4995,64 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:3155 +#: ../../library/stdtypes.rst:3181 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:3162 +#: ../../library/stdtypes.rst:3188 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:3166 +#: ../../library/stdtypes.rst:3192 msgid "" ":meth:`bytearray.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-" "like objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3170 +#: ../../library/stdtypes.rst:3196 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3184 +#: ../../library/stdtypes.rst:3210 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:3191 +#: ../../library/stdtypes.rst:3217 msgid "" "Resize the :class:`bytearray` to contain *size* bytes. *size* must be " "greater than or equal to 0." msgstr "" -#: ../../library/stdtypes.rst:3194 +#: ../../library/stdtypes.rst:3220 msgid "" "If the :class:`bytearray` needs to shrink, bytes beyond *size* are truncated." msgstr "" -#: ../../library/stdtypes.rst:3196 +#: ../../library/stdtypes.rst:3222 msgid "" "If the :class:`bytearray` needs to grow, all new bytes, those beyond *size*, " "will be set to null bytes." msgstr "" -#: ../../library/stdtypes.rst:3200 +#: ../../library/stdtypes.rst:3226 msgid "This is equivalent to:" msgstr "等同於:" -#: ../../library/stdtypes.rst:3208 +#: ../../library/stdtypes.rst:3234 msgid "Examples:" msgstr "範例:" -#: ../../library/stdtypes.rst:3221 +#: ../../library/stdtypes.rst:3247 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 " @@ -5044,7 +5060,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3226 +#: ../../library/stdtypes.rst:3252 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -5052,11 +5068,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:3235 +#: ../../library/stdtypes.rst:3261 msgid "Bytes and Bytearray Operations" msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:3240 +#: ../../library/stdtypes.rst:3266 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -5065,14 +5081,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:3248 +#: ../../library/stdtypes.rst:3274 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:3252 +#: ../../library/stdtypes.rst:3278 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -5080,11 +5096,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:3255 +#: ../../library/stdtypes.rst:3281 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:3257 +#: ../../library/stdtypes.rst:3283 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -5092,60 +5108,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:3260 +#: ../../library/stdtypes.rst:3286 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:3265 +#: ../../library/stdtypes.rst:3291 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:3268 +#: ../../library/stdtypes.rst:3294 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:3274 +#: ../../library/stdtypes.rst:3300 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:3278 ../../library/stdtypes.rst:3383 -#: ../../library/stdtypes.rst:3405 ../../library/stdtypes.rst:3471 -#: ../../library/stdtypes.rst:3484 +#: ../../library/stdtypes.rst:3304 ../../library/stdtypes.rst:3409 +#: ../../library/stdtypes.rst:3431 ../../library/stdtypes.rst:3497 +#: ../../library/stdtypes.rst:3510 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:3281 +#: ../../library/stdtypes.rst:3307 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:3284 ../../library/stdtypes.rst:3395 -#: ../../library/stdtypes.rst:3408 ../../library/stdtypes.rst:3474 -#: ../../library/stdtypes.rst:3487 +#: ../../library/stdtypes.rst:3310 ../../library/stdtypes.rst:3421 +#: ../../library/stdtypes.rst:3434 ../../library/stdtypes.rst:3500 +#: ../../library/stdtypes.rst:3513 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:3291 +#: ../../library/stdtypes.rst:3317 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:3295 +#: ../../library/stdtypes.rst:3321 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -5157,32 +5173,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:3300 +#: ../../library/stdtypes.rst:3326 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" -#: ../../library/stdtypes.rst:3304 ../../library/stdtypes.rst:3326 -#: ../../library/stdtypes.rst:3459 ../../library/stdtypes.rst:3552 -#: ../../library/stdtypes.rst:3566 ../../library/stdtypes.rst:3596 -#: ../../library/stdtypes.rst:3610 ../../library/stdtypes.rst:3651 -#: ../../library/stdtypes.rst:3721 ../../library/stdtypes.rst:3739 -#: ../../library/stdtypes.rst:3767 ../../library/stdtypes.rst:3906 -#: ../../library/stdtypes.rst:3961 ../../library/stdtypes.rst:4004 -#: ../../library/stdtypes.rst:4025 ../../library/stdtypes.rst:4047 -#: ../../library/stdtypes.rst:4249 +#: ../../library/stdtypes.rst:3330 ../../library/stdtypes.rst:3352 +#: ../../library/stdtypes.rst:3485 ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:3592 ../../library/stdtypes.rst:3622 +#: ../../library/stdtypes.rst:3636 ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:3747 ../../library/stdtypes.rst:3765 +#: ../../library/stdtypes.rst:3793 ../../library/stdtypes.rst:3932 +#: ../../library/stdtypes.rst:3987 ../../library/stdtypes.rst:4030 +#: ../../library/stdtypes.rst:4051 ../../library/stdtypes.rst:4073 +#: ../../library/stdtypes.rst:4275 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:3313 +#: ../../library/stdtypes.rst:3339 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:3317 +#: ../../library/stdtypes.rst:3343 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -5194,15 +5210,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:3322 +#: ../../library/stdtypes.rst:3348 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3335 +#: ../../library/stdtypes.rst:3361 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:3340 +#: ../../library/stdtypes.rst:3366 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -5210,21 +5226,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:3346 +#: ../../library/stdtypes.rst:3372 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:3352 +#: ../../library/stdtypes.rst:3378 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:3367 +#: ../../library/stdtypes.rst:3393 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -5232,11 +5248,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3372 +#: ../../library/stdtypes.rst:3398 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3378 +#: ../../library/stdtypes.rst:3404 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 " @@ -5244,14 +5260,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3388 +#: ../../library/stdtypes.rst:3414 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:3392 +#: ../../library/stdtypes.rst:3418 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -5259,13 +5275,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:3402 +#: ../../library/stdtypes.rst:3428 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:3415 +#: ../../library/stdtypes.rst:3441 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 " @@ -5275,7 +5291,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:3426 +#: ../../library/stdtypes.rst:3452 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 " @@ -5283,7 +5299,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:3437 +#: ../../library/stdtypes.rst:3463 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 " @@ -5292,24 +5308,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:3444 ../../library/stdtypes.rst:3501 +#: ../../library/stdtypes.rst:3470 ../../library/stdtypes.rst:3527 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3450 +#: ../../library/stdtypes.rst:3476 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:3454 +#: ../../library/stdtypes.rst:3480 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3466 +#: ../../library/stdtypes.rst:3492 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -5317,13 +5333,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:3481 +#: ../../library/stdtypes.rst:3507 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3494 +#: ../../library/stdtypes.rst:3520 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 " @@ -5332,7 +5348,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:3507 +#: ../../library/stdtypes.rst:3533 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -5340,11 +5356,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3512 +#: ../../library/stdtypes.rst:3538 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3518 +#: ../../library/stdtypes.rst:3544 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 " @@ -5352,18 +5368,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3523 +#: ../../library/stdtypes.rst:3549 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3526 +#: ../../library/stdtypes.rst:3552 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3529 +#: ../../library/stdtypes.rst:3555 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -5371,11 +5387,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3532 +#: ../../library/stdtypes.rst:3558 msgid "*delete* is now supported as a keyword argument." msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3536 +#: ../../library/stdtypes.rst:3562 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 " @@ -5384,7 +5400,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3545 +#: ../../library/stdtypes.rst:3571 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). " @@ -5392,7 +5408,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3559 +#: ../../library/stdtypes.rst:3585 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). " @@ -5400,7 +5416,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3573 +#: ../../library/stdtypes.rst:3599 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 " @@ -5409,7 +5425,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3579 +#: ../../library/stdtypes.rst:3605 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -5421,14 +5437,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3584 +#: ../../library/stdtypes.rst:3610 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:3589 +#: ../../library/stdtypes.rst:3615 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -5440,7 +5456,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3603 +#: ../../library/stdtypes.rst:3629 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). " @@ -5448,7 +5464,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3617 +#: ../../library/stdtypes.rst:3643 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 " @@ -5458,7 +5474,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3628 +#: ../../library/stdtypes.rst:3654 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 " @@ -5467,7 +5483,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3634 +#: ../../library/stdtypes.rst:3660 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -5479,14 +5495,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3639 +#: ../../library/stdtypes.rst:3665 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:3644 +#: ../../library/stdtypes.rst:3670 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -5498,7 +5514,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3658 +#: ../../library/stdtypes.rst:3684 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 " @@ -5507,7 +5523,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3664 +#: ../../library/stdtypes.rst:3690 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',')`` " @@ -5518,7 +5534,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3674 +#: ../../library/stdtypes.rst:3700 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -5538,7 +5554,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3683 +#: ../../library/stdtypes.rst:3709 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 " @@ -5548,7 +5564,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3693 +#: ../../library/stdtypes.rst:3719 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -5564,7 +5580,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:3730 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 " @@ -5573,7 +5589,7 @@ msgid "" "or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3711 +#: ../../library/stdtypes.rst:3737 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -5585,13 +5601,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3716 +#: ../../library/stdtypes.rst:3742 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3725 +#: ../../library/stdtypes.rst:3751 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 " @@ -5599,14 +5615,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3733 +#: ../../library/stdtypes.rst:3759 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:3746 +#: ../../library/stdtypes.rst:3772 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 " @@ -5622,7 +5638,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3760 +#: ../../library/stdtypes.rst:3786 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -5634,7 +5650,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3774 +#: ../../library/stdtypes.rst:3800 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -5643,7 +5659,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3782 +#: ../../library/stdtypes.rst:3808 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -5655,7 +5671,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:3817 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -5663,7 +5679,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3798 +#: ../../library/stdtypes.rst:3824 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -5675,20 +5691,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3807 +#: ../../library/stdtypes.rst:3833 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:3817 +#: ../../library/stdtypes.rst:3843 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:3823 +#: ../../library/stdtypes.rst:3849 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -5700,13 +5716,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3832 +#: ../../library/stdtypes.rst:3858 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:3837 +#: ../../library/stdtypes.rst:3863 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -5718,16 +5734,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3842 ../../library/stdtypes.rst:3884 -#: ../../library/stdtypes.rst:3900 ../../library/stdtypes.rst:3950 -#: ../../library/stdtypes.rst:4019 +#: ../../library/stdtypes.rst:3868 ../../library/stdtypes.rst:3910 +#: ../../library/stdtypes.rst:3926 ../../library/stdtypes.rst:3976 +#: ../../library/stdtypes.rst:4045 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:3850 +#: ../../library/stdtypes.rst:3876 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -5735,14 +5751,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3859 +#: ../../library/stdtypes.rst:3885 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:3865 +#: ../../library/stdtypes.rst:3891 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -5754,14 +5770,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3874 +#: ../../library/stdtypes.rst:3900 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:3879 +#: ../../library/stdtypes.rst:3905 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -5773,13 +5789,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3892 +#: ../../library/stdtypes.rst:3918 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3897 +#: ../../library/stdtypes.rst:3923 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -5787,7 +5803,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3917 +#: ../../library/stdtypes.rst:3943 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 " @@ -5795,7 +5811,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3924 +#: ../../library/stdtypes.rst:3950 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -5807,14 +5823,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:3929 +#: ../../library/stdtypes.rst:3955 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:3933 +#: ../../library/stdtypes.rst:3959 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -5826,13 +5842,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3942 +#: ../../library/stdtypes.rst:3968 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:3947 +#: ../../library/stdtypes.rst:3973 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -5840,7 +5856,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3954 +#: ../../library/stdtypes.rst:3980 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -5848,14 +5864,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3968 +#: ../../library/stdtypes.rst:3994 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:3974 +#: ../../library/stdtypes.rst:4000 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -5863,7 +5879,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3977 +#: ../../library/stdtypes.rst:4003 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -5871,7 +5887,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3987 +#: ../../library/stdtypes.rst:4013 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -5879,12 +5895,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:3990 +#: ../../library/stdtypes.rst:4016 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3992 +#: ../../library/stdtypes.rst:4018 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -5906,13 +5922,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:4011 +#: ../../library/stdtypes.rst:4037 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:4016 +#: ../../library/stdtypes.rst:4042 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -5920,7 +5936,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:4032 +#: ../../library/stdtypes.rst:4058 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 " @@ -5929,7 +5945,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:4040 +#: ../../library/stdtypes.rst:4066 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5941,11 +5957,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:4054 +#: ../../library/stdtypes.rst:4080 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:4097 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 " @@ -5953,7 +5969,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:4076 +#: ../../library/stdtypes.rst:4102 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -5963,7 +5979,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:4083 +#: ../../library/stdtypes.rst:4109 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 " @@ -5971,7 +5987,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:4117 +#: ../../library/stdtypes.rst:4143 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 " @@ -5979,77 +5995,77 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:4169 +#: ../../library/stdtypes.rst:4195 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/stdtypes.rst:4191 +#: ../../library/stdtypes.rst:4217 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:4194 +#: ../../library/stdtypes.rst:4220 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:4194 +#: ../../library/stdtypes.rst:4220 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:4198 +#: ../../library/stdtypes.rst:4224 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4201 +#: ../../library/stdtypes.rst:4227 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:4204 +#: ../../library/stdtypes.rst:4230 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4204 +#: ../../library/stdtypes.rst:4230 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:4239 +#: ../../library/stdtypes.rst:4265 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4242 +#: ../../library/stdtypes.rst:4268 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4254 +#: ../../library/stdtypes.rst:4280 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:4261 +#: ../../library/stdtypes.rst:4287 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:4263 +#: ../../library/stdtypes.rst:4289 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:4269 +#: ../../library/stdtypes.rst:4295 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:4273 +#: ../../library/stdtypes.rst:4299 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 " @@ -6057,32 +6073,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:4278 +#: ../../library/stdtypes.rst:4304 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:4282 +#: ../../library/stdtypes.rst:4308 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:4285 +#: ../../library/stdtypes.rst:4311 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:4288 +#: ../../library/stdtypes.rst:4314 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:4291 +#: ../../library/stdtypes.rst:4317 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -6104,7 +6120,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:4301 +#: ../../library/stdtypes.rst:4327 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 " @@ -6115,11 +6131,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:4310 +#: ../../library/stdtypes.rst:4336 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:4312 +#: ../../library/stdtypes.rst:4338 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -6141,13 +6157,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:4322 +#: ../../library/stdtypes.rst:4348 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:4325 +#: ../../library/stdtypes.rst:4351 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -6187,14 +6203,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:4343 +#: ../../library/stdtypes.rst:4369 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:4347 +#: ../../library/stdtypes.rst:4373 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -6212,44 +6228,44 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:4355 +#: ../../library/stdtypes.rst:4381 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:4359 +#: ../../library/stdtypes.rst:4385 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:4363 +#: ../../library/stdtypes.rst:4389 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:4366 +#: ../../library/stdtypes.rst:4392 msgid "memoryview is now a :term:`generic type`." msgstr "" -#: ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:4395 msgid ":class:`memoryview` has several methods:" msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:4373 +#: ../../library/stdtypes.rst:4399 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:4377 +#: ../../library/stdtypes.rst:4403 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:4380 +#: ../../library/stdtypes.rst:4406 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -6283,14 +6299,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:4396 +#: ../../library/stdtypes.rst:4422 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:4400 +#: ../../library/stdtypes.rst:4426 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -6316,25 +6332,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:4412 +#: ../../library/stdtypes.rst:4438 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:4415 +#: ../../library/stdtypes.rst:4441 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:4447 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:4424 +#: ../../library/stdtypes.rst:4450 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -6348,7 +6364,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:4430 +#: ../../library/stdtypes.rst:4456 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -6356,7 +6372,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4461 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' " @@ -6365,13 +6381,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:4445 +#: ../../library/stdtypes.rst:4471 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:4448 +#: ../../library/stdtypes.rst:4474 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -6381,18 +6397,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:4454 +#: ../../library/stdtypes.rst:4480 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:4461 +#: ../../library/stdtypes.rst:4487 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:4463 +#: ../../library/stdtypes.rst:4489 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -6410,19 +6426,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:4471 +#: ../../library/stdtypes.rst:4497 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:4478 +#: ../../library/stdtypes.rst:4504 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:4481 +#: ../../library/stdtypes.rst:4507 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -6448,7 +6464,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:4497 +#: ../../library/stdtypes.rst:4523 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 :" @@ -6457,14 +6473,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:4503 +#: ../../library/stdtypes.rst:4529 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:4507 +#: ../../library/stdtypes.rst:4533 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -6480,13 +6496,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4514 +#: ../../library/stdtypes.rst:4540 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4517 +#: ../../library/stdtypes.rst:4543 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -6506,7 +6522,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4531 +#: ../../library/stdtypes.rst:4557 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 " @@ -6515,7 +6531,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4537 +#: ../../library/stdtypes.rst:4563 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 " @@ -6523,11 +6539,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4543 +#: ../../library/stdtypes.rst:4569 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4545 +#: ../../library/stdtypes.rst:4571 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -6571,11 +6587,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4566 +#: ../../library/stdtypes.rst:4592 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4568 +#: ../../library/stdtypes.rst:4594 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -6599,11 +6615,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4579 +#: ../../library/stdtypes.rst:4605 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:4607 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -6653,11 +6669,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4605 +#: ../../library/stdtypes.rst:4631 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4607 +#: ../../library/stdtypes.rst:4633 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -6679,33 +6695,33 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4619 +#: ../../library/stdtypes.rst:4645 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4624 +#: ../../library/stdtypes.rst:4650 msgid "Count the number of occurrences of *value*." msgstr "計算 *value* 的出現次數" -#: ../../library/stdtypes.rst:4630 +#: ../../library/stdtypes.rst:4656 msgid "" "Return the index of the first occurrence of *value* (at or after index " "*start* and before index *stop*)." msgstr "" -#: ../../library/stdtypes.rst:4633 +#: ../../library/stdtypes.rst:4659 msgid "Raises a :exc:`ValueError` if *value* cannot be found." msgstr "在找不到 *value* 時引發 :exc:`ValueError`。" -#: ../../library/stdtypes.rst:4637 +#: ../../library/stdtypes.rst:4663 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4641 +#: ../../library/stdtypes.rst:4667 msgid "The underlying object of the memoryview::" msgstr "memoryview 的底層物件: ::" -#: ../../library/stdtypes.rst:4643 +#: ../../library/stdtypes.rst:4669 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -6717,14 +6733,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4652 +#: ../../library/stdtypes.rst:4678 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:4656 +#: ../../library/stdtypes.rst:4682 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -6756,11 +6772,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4671 +#: ../../library/stdtypes.rst:4697 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4673 +#: ../../library/stdtypes.rst:4699 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -6784,11 +6800,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4688 +#: ../../library/stdtypes.rst:4714 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4692 +#: ../../library/stdtypes.rst:4718 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 " @@ -6796,17 +6812,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4697 +#: ../../library/stdtypes.rst:4723 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:4703 +#: ../../library/stdtypes.rst:4729 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4705 +#: ../../library/stdtypes.rst:4731 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -6826,49 +6842,49 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4716 +#: ../../library/stdtypes.rst:4742 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4721 +#: ../../library/stdtypes.rst:4747 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:4724 ../../library/stdtypes.rst:4732 +#: ../../library/stdtypes.rst:4750 ../../library/stdtypes.rst:4758 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4729 +#: ../../library/stdtypes.rst:4755 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:4737 +#: ../../library/stdtypes.rst:4763 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4741 +#: ../../library/stdtypes.rst:4767 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4747 +#: ../../library/stdtypes.rst:4773 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4753 +#: ../../library/stdtypes.rst:4779 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4761 +#: ../../library/stdtypes.rst:4787 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4765 +#: ../../library/stdtypes.rst:4791 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -6878,7 +6894,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4772 +#: ../../library/stdtypes.rst:4798 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 " @@ -6886,30 +6902,30 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4777 +#: ../../library/stdtypes.rst:4803 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " -"changed using methods like :meth:`add ` and :meth:`remove " -"`. Since it is mutable, it has no hash value and cannot be " -"used as either a dictionary key or as an element of another set. The :class:" -"`frozenset` type is immutable and :term:`hashable` --- its contents cannot " -"be altered after it is created; it can therefore be used as a dictionary key " -"or as an element of another set." +"changed using methods like :meth:`~set.add` and :meth:`~set.remove`. Since " +"it is mutable, it has no hash value and cannot be used as either a " +"dictionary key or as an element of another set. The :class:`frozenset` type " +"is immutable and :term:`hashable` --- its contents cannot be altered after " +"it is created; it can therefore be used as a dictionary key or as an element " +"of another set." msgstr "" -#: ../../library/stdtypes.rst:4786 +#: ../../library/stdtypes.rst:4812 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:4790 +#: ../../library/stdtypes.rst:4816 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4795 +#: ../../library/stdtypes.rst:4821 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 " @@ -6917,102 +6933,103 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4801 +#: ../../library/stdtypes.rst:4827 msgid "Sets can be created by several means:" msgstr "集合可以以多種方式建立:" -#: ../../library/stdtypes.rst:4803 +#: ../../library/stdtypes.rst:4829 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4804 +#: ../../library/stdtypes.rst:4830 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4805 +#: ../../library/stdtypes.rst:4831 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4807 +#: ../../library/stdtypes.rst:4833 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4812 +#: ../../library/stdtypes.rst:4838 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4816 +#: ../../library/stdtypes.rst:4842 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4820 +#: ../../library/stdtypes.rst:4846 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4824 +#: ../../library/stdtypes.rst:4851 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:4830 +#: ../../library/stdtypes.rst:4858 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4834 +#: ../../library/stdtypes.rst:4862 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4840 +#: ../../library/stdtypes.rst:4869 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4844 +#: ../../library/stdtypes.rst:4873 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4850 +#: ../../library/stdtypes.rst:4880 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4855 +#: ../../library/stdtypes.rst:4886 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4860 +#: ../../library/stdtypes.rst:4892 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4865 +#: ../../library/stdtypes.rst:4898 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4869 +#: ../../library/stdtypes.rst:4903 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4872 +#: ../../library/stdtypes.rst:4906 msgid "" -"Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" -"meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" -"`issuperset` methods will accept any iterable as an argument. In contrast, " +"Note, the non-operator versions of :meth:`~frozenset.union`, :meth:" +"`~frozenset.intersection`, :meth:`~frozenset.difference`, :meth:`~frozenset." +"symmetric_difference`, :meth:`~frozenset.issubset`, and :meth:`~frozenset." +"issuperset` methods will accept any iterable as an argument. In contrast, " "their operator based counterparts require their arguments to be sets. This " "precludes error-prone constructions like ``set('abc') & 'cbs'`` in favor of " "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4879 +#: ../../library/stdtypes.rst:4913 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 " @@ -7022,14 +7039,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4886 +#: ../../library/stdtypes.rst:4920 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:4890 +#: ../../library/stdtypes.rst:4924 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 " @@ -7037,90 +7054,90 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4895 +#: ../../library/stdtypes.rst:4929 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:4898 +#: ../../library/stdtypes.rst:4932 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4900 +#: ../../library/stdtypes.rst:4934 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:4904 +#: ../../library/stdtypes.rst:4938 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4910 +#: ../../library/stdtypes.rst:4944 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4915 +#: ../../library/stdtypes.rst:4949 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4920 +#: ../../library/stdtypes.rst:4954 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4925 +#: ../../library/stdtypes.rst:4959 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4929 +#: ../../library/stdtypes.rst:4963 msgid "Add element *elem* to the set." msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:4933 +#: ../../library/stdtypes.rst:4967 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4938 +#: ../../library/stdtypes.rst:4972 msgid "Remove element *elem* from the set if it is present." msgstr "如果 *elem* 存在於集合中則將其移除。" -#: ../../library/stdtypes.rst:4942 +#: ../../library/stdtypes.rst:4976 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4947 +#: ../../library/stdtypes.rst:4981 msgid "Remove all elements from the set." msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:4950 +#: ../../library/stdtypes.rst:4984 msgid "" -"Note, the non-operator versions of the :meth:`update`, :meth:" -"`intersection_update`, :meth:`difference_update`, and :meth:" -"`symmetric_difference_update` methods will accept any iterable as an " -"argument." +"Note, the non-operator versions of the :meth:`~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:4955 +#: ../../library/stdtypes.rst:4989 msgid "" -"Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" -"`remove`, and :meth:`discard` methods may be a set. To support searching " -"for an equivalent frozenset, a temporary one is created from *elem*." +"Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:`~set." +"remove`, and :meth:`~set.discard` methods may be a set. To support " +"searching for an equivalent frozenset, a temporary one is created from " +"*elem*." msgstr "" -#: ../../library/stdtypes.rst:4964 +#: ../../library/stdtypes.rst:4998 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4974 +#: ../../library/stdtypes.rst:5008 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -7129,7 +7146,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4980 +#: ../../library/stdtypes.rst:5014 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -7138,33 +7155,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4991 +#: ../../library/stdtypes.rst:5025 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4994 +#: ../../library/stdtypes.rst:5028 msgid "Dictionaries can be created by several means:" msgstr "字典可以用數種方式建立:" -#: ../../library/stdtypes.rst:4996 +#: ../../library/stdtypes.rst:5030 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:4998 +#: ../../library/stdtypes.rst:5032 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4999 +#: ../../library/stdtypes.rst:5033 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:5002 +#: ../../library/stdtypes.rst:5036 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 " @@ -7177,7 +7194,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:5012 +#: ../../library/stdtypes.rst:5046 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 " @@ -7185,13 +7202,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:5017 ../../library/stdtypes.rst:5035 +#: ../../library/stdtypes.rst:5051 ../../library/stdtypes.rst:5069 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:5020 +#: ../../library/stdtypes.rst:5054 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -7200,7 +7217,7 @@ msgid "" "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:5026 +#: ../../library/stdtypes.rst:5060 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -7220,13 +7237,13 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:5038 +#: ../../library/stdtypes.rst:5072 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:5041 +#: ../../library/stdtypes.rst:5075 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7258,33 +7275,33 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5090 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5094 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5099 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5069 +#: ../../library/stdtypes.rst:5103 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5107 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:5078 +#: ../../library/stdtypes.rst:5112 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 " @@ -7295,7 +7312,7 @@ msgid "" "__missing__` must be a method; it cannot be an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:5086 +#: ../../library/stdtypes.rst:5120 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -7319,51 +7336,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:5097 +#: ../../library/stdtypes.rst:5131 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:5104 +#: ../../library/stdtypes.rst:5138 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:5108 +#: ../../library/stdtypes.rst:5142 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:5113 +#: ../../library/stdtypes.rst:5147 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:5117 +#: ../../library/stdtypes.rst:5151 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:5121 +#: ../../library/stdtypes.rst:5155 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5126 +#: ../../library/stdtypes.rst:5160 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:5130 +#: ../../library/stdtypes.rst:5164 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5134 +#: ../../library/stdtypes.rst:5168 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:5136 +#: ../../library/stdtypes.rst:5170 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 " @@ -7372,70 +7389,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:5144 +#: ../../library/stdtypes.rst:5178 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:5150 +#: ../../library/stdtypes.rst:5184 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5155 +#: ../../library/stdtypes.rst:5189 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:5161 +#: ../../library/stdtypes.rst:5195 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:5167 +#: ../../library/stdtypes.rst:5201 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:5170 +#: ../../library/stdtypes.rst:5204 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:5174 +#: ../../library/stdtypes.rst:5208 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:5180 +#: ../../library/stdtypes.rst:5214 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5187 +#: ../../library/stdtypes.rst:5221 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:5195 +#: ../../library/stdtypes.rst:5229 msgid "" "Update the dictionary with the key/value pairs from *mapping* or *iterable* " "and *kwargs*, overwriting existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:5198 +#: ../../library/stdtypes.rst:5232 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -7444,20 +7461,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:5206 +#: ../../library/stdtypes.rst:5240 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5209 +#: ../../library/stdtypes.rst:5243 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:5213 +#: ../../library/stdtypes.rst:5247 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -7467,25 +7484,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:5219 +#: ../../library/stdtypes.rst:5253 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:5227 +#: ../../library/stdtypes.rst:5261 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:5233 +#: ../../library/stdtypes.rst:5267 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:5235 +#: ../../library/stdtypes.rst:5269 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7507,21 +7524,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:5245 +#: ../../library/stdtypes.rst:5279 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5250 +#: ../../library/stdtypes.rst:5284 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:5257 +#: ../../library/stdtypes.rst:5291 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:5259 +#: ../../library/stdtypes.rst:5293 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 " @@ -7529,23 +7546,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:5264 +#: ../../library/stdtypes.rst:5298 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:5269 +#: ../../library/stdtypes.rst:5303 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5273 +#: ../../library/stdtypes.rst:5307 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5276 +#: ../../library/stdtypes.rst:5310 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -7553,39 +7570,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:5281 +#: ../../library/stdtypes.rst:5315 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:5284 +#: ../../library/stdtypes.rst:5318 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:5289 +#: ../../library/stdtypes.rst:5323 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:5294 +#: ../../library/stdtypes.rst:5328 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:5297 +#: ../../library/stdtypes.rst:5331 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5302 +#: ../../library/stdtypes.rst:5336 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:5307 +#: ../../library/stdtypes.rst:5341 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 " @@ -7599,11 +7616,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:5319 +#: ../../library/stdtypes.rst:5353 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:5321 +#: ../../library/stdtypes.rst:5355 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -7644,11 +7661,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:5363 +#: ../../library/stdtypes.rst:5397 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:5370 +#: ../../library/stdtypes.rst:5404 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 " @@ -7659,7 +7676,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:5378 +#: ../../library/stdtypes.rst:5412 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 " @@ -7670,7 +7687,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:5417 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -7679,7 +7696,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:5387 +#: ../../library/stdtypes.rst:5421 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 " @@ -7693,7 +7710,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5397 +#: ../../library/stdtypes.rst:5431 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -7705,7 +7722,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5402 +#: ../../library/stdtypes.rst:5436 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -7720,7 +7737,7 @@ msgstr "" "(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" "的任何例外。" -#: ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:5443 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -7729,10 +7746,10 @@ msgid "" "__exit__` method has actually failed." msgstr "" "傳入的例外不應明確重新引發 - 取而代之的是,此方法應回傳 false 值以指示該方法" -"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:`~object." -"__exit__` 方法是否曾實際失敗過。" +"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" +"`~object.__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5415 +#: ../../library/stdtypes.rst:5449 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -7744,7 +7761,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5421 +#: ../../library/stdtypes.rst:5455 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -7759,7 +7776,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5428 +#: ../../library/stdtypes.rst:5462 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 " @@ -7771,7 +7788,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5436 +#: ../../library/stdtypes.rst:5470 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -7779,7 +7796,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5441 +#: ../../library/stdtypes.rst:5475 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -7787,11 +7804,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5448 +#: ../../library/stdtypes.rst:5482 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5454 +#: ../../library/stdtypes.rst:5488 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -7807,7 +7824,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5464 +#: ../../library/stdtypes.rst:5498 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -7815,7 +7832,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5467 +#: ../../library/stdtypes.rst:5501 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -7823,7 +7840,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5470 +#: ../../library/stdtypes.rst:5504 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 " @@ -7835,7 +7852,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5476 +#: ../../library/stdtypes.rst:5510 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 " @@ -7847,7 +7864,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5482 +#: ../../library/stdtypes.rst:5516 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 " @@ -7859,7 +7876,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5488 +#: ../../library/stdtypes.rst:5522 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." @@ -7872,7 +7889,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5494 +#: ../../library/stdtypes.rst:5528 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -7881,7 +7898,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:5500 +#: ../../library/stdtypes.rst:5534 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -7891,7 +7908,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:5505 +#: ../../library/stdtypes.rst:5539 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -7899,7 +7916,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5508 +#: ../../library/stdtypes.rst:5542 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 " @@ -7910,7 +7927,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5513 +#: ../../library/stdtypes.rst:5547 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -7918,7 +7935,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5516 +#: ../../library/stdtypes.rst:5550 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -7926,7 +7943,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5519 +#: ../../library/stdtypes.rst:5553 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -7938,7 +7955,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5524 +#: ../../library/stdtypes.rst:5558 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7950,7 +7967,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5530 +#: ../../library/stdtypes.rst:5564 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7960,13 +7977,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5534 +#: ../../library/stdtypes.rst:5568 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5537 +#: ../../library/stdtypes.rst:5571 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7984,13 +8001,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5545 +#: ../../library/stdtypes.rst:5579 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5547 +#: ../../library/stdtypes.rst:5581 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -8004,7 +8021,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5553 +#: ../../library/stdtypes.rst:5587 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -8012,7 +8029,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5556 +#: ../../library/stdtypes.rst:5590 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -8024,7 +8041,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5561 +#: ../../library/stdtypes.rst:5595 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -8034,7 +8051,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5565 +#: ../../library/stdtypes.rst:5599 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -8046,253 +8063,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5572 +#: ../../library/stdtypes.rst:5606 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5574 +#: ../../library/stdtypes.rst:5608 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5577 +#: ../../library/stdtypes.rst:5611 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5578 +#: ../../library/stdtypes.rst:5612 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5579 +#: ../../library/stdtypes.rst:5613 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5580 +#: ../../library/stdtypes.rst:5614 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5581 +#: ../../library/stdtypes.rst:5615 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5582 +#: ../../library/stdtypes.rst:5616 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5583 +#: ../../library/stdtypes.rst:5617 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5584 +#: ../../library/stdtypes.rst:5618 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5585 +#: ../../library/stdtypes.rst:5619 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5586 +#: ../../library/stdtypes.rst:5620 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5587 +#: ../../library/stdtypes.rst:5621 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5588 +#: ../../library/stdtypes.rst:5622 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5589 +#: ../../library/stdtypes.rst:5623 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5590 +#: ../../library/stdtypes.rst:5624 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5591 +#: ../../library/stdtypes.rst:5625 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5592 +#: ../../library/stdtypes.rst:5626 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5593 +#: ../../library/stdtypes.rst:5627 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5594 +#: ../../library/stdtypes.rst:5628 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5595 +#: ../../library/stdtypes.rst:5629 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5596 +#: ../../library/stdtypes.rst:5630 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5597 +#: ../../library/stdtypes.rst:5631 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5598 +#: ../../library/stdtypes.rst:5632 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5599 +#: ../../library/stdtypes.rst:5633 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5600 +#: ../../library/stdtypes.rst:5634 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5601 +#: ../../library/stdtypes.rst:5635 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5602 +#: ../../library/stdtypes.rst:5636 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5603 +#: ../../library/stdtypes.rst:5637 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5638 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5605 +#: ../../library/stdtypes.rst:5639 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5606 +#: ../../library/stdtypes.rst:5640 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5607 +#: ../../library/stdtypes.rst:5641 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5608 +#: ../../library/stdtypes.rst:5642 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5609 +#: ../../library/stdtypes.rst:5643 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5610 +#: ../../library/stdtypes.rst:5644 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5611 +#: ../../library/stdtypes.rst:5645 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5612 +#: ../../library/stdtypes.rst:5646 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5613 +#: ../../library/stdtypes.rst:5647 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5614 +#: ../../library/stdtypes.rst:5648 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5615 +#: ../../library/stdtypes.rst:5649 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5616 +#: ../../library/stdtypes.rst:5650 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5617 +#: ../../library/stdtypes.rst:5651 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5618 +#: ../../library/stdtypes.rst:5652 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5619 +#: ../../library/stdtypes.rst:5653 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5620 +#: ../../library/stdtypes.rst:5654 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5621 +#: ../../library/stdtypes.rst:5655 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5622 +#: ../../library/stdtypes.rst:5656 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5623 +#: ../../library/stdtypes.rst:5657 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5624 +#: ../../library/stdtypes.rst:5658 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5625 +#: ../../library/stdtypes.rst:5659 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:5660 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5627 +#: ../../library/stdtypes.rst:5661 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5662 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5629 +#: ../../library/stdtypes.rst:5663 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5630 +#: ../../library/stdtypes.rst:5664 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5631 +#: ../../library/stdtypes.rst:5665 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5632 +#: ../../library/stdtypes.rst:5666 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5637 +#: ../../library/stdtypes.rst:5671 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5639 +#: ../../library/stdtypes.rst:5673 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5643 +#: ../../library/stdtypes.rst:5677 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5645 +#: ../../library/stdtypes.rst:5679 msgid "" ">>> list[int].__origin__\n" "" @@ -8300,7 +8317,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5651 +#: ../../library/stdtypes.rst:5685 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 " @@ -8309,7 +8326,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5655 +#: ../../library/stdtypes.rst:5689 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -8317,7 +8334,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5661 +#: ../../library/stdtypes.rst:5695 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -8325,7 +8342,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5664 +#: ../../library/stdtypes.rst:5698 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -8339,7 +8356,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5672 +#: ../../library/stdtypes.rst:5706 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -8349,7 +8366,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5679 +#: ../../library/stdtypes.rst:5713 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -8357,19 +8374,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5687 +#: ../../library/stdtypes.rst:5721 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5688 +#: ../../library/stdtypes.rst:5722 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5690 +#: ../../library/stdtypes.rst:5724 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5725 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -8378,7 +8395,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5695 +#: ../../library/stdtypes.rst:5729 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -8386,18 +8403,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5696 +#: ../../library/stdtypes.rst:5730 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:5705 +#: ../../library/stdtypes.rst:5739 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5711 +#: ../../library/stdtypes.rst:5745 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -8410,7 +8427,7 @@ msgstr "" "釋 (type annotation) `。與下標 :data:`typing.Union` 相比,聯合型" "別運算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5718 +#: ../../library/stdtypes.rst:5752 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 " @@ -8421,7 +8438,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5723 +#: ../../library/stdtypes.rst:5757 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -8429,7 +8446,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5728 +#: ../../library/stdtypes.rst:5762 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 " @@ -8442,40 +8459,40 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5736 +#: ../../library/stdtypes.rst:5770 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5738 +#: ../../library/stdtypes.rst:5772 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5740 +#: ../../library/stdtypes.rst:5774 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5742 +#: ../../library/stdtypes.rst:5776 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5744 +#: ../../library/stdtypes.rst:5778 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5746 +#: ../../library/stdtypes.rst:5780 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5748 +#: ../../library/stdtypes.rst:5782 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5750 +#: ../../library/stdtypes.rst:5784 msgid "It creates instances of :class:`typing.Union`::" msgstr "它會建立 :class:`typing.Union` 的實例: ::" -#: ../../library/stdtypes.rst:5752 +#: ../../library/stdtypes.rst:5786 msgid "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" @@ -8483,21 +8500,21 @@ msgstr "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" -#: ../../library/stdtypes.rst:5755 +#: ../../library/stdtypes.rst:5789 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5757 +#: ../../library/stdtypes.rst:5791 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5762 +#: ../../library/stdtypes.rst:5796 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5765 +#: ../../library/stdtypes.rst:5799 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -8505,14 +8522,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5768 +#: ../../library/stdtypes.rst:5802 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5771 +#: ../../library/stdtypes.rst:5805 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -8522,7 +8539,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5778 +#: ../../library/stdtypes.rst:5812 msgid "" "The user-exposed type for the union object can be accessed from :class:" "`typing.Union` and used for :func:`isinstance` checks::" @@ -8530,7 +8547,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`typing." "Union` 存取並用於 :func:`isinstance` 檢查: ::" -#: ../../library/stdtypes.rst:5781 +#: ../../library/stdtypes.rst:5815 msgid "" ">>> import typing\n" ">>> isinstance(int | str, typing.Union)\n" @@ -8548,7 +8565,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'typing.Union' instances" -#: ../../library/stdtypes.rst:5790 +#: ../../library/stdtypes.rst:5824 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 " @@ -8557,7 +8574,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5794 +#: ../../library/stdtypes.rst:5828 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -8583,32 +8600,32 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5810 +#: ../../library/stdtypes.rst:5844 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5816 +#: ../../library/stdtypes.rst:5850 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:5823 +#: ../../library/stdtypes.rst:5857 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:5825 +#: ../../library/stdtypes.rst:5859 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5832 +#: ../../library/stdtypes.rst:5866 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5834 +#: ../../library/stdtypes.rst:5868 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 " @@ -8619,7 +8636,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5841 +#: ../../library/stdtypes.rst:5875 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -8630,32 +8647,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5849 +#: ../../library/stdtypes.rst:5883 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5857 +#: ../../library/stdtypes.rst:5891 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:5859 +#: ../../library/stdtypes.rst:5893 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:5865 +#: ../../library/stdtypes.rst:5899 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5867 +#: ../../library/stdtypes.rst:5901 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:5870 +#: ../../library/stdtypes.rst:5904 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -8663,15 +8680,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5874 +#: ../../library/stdtypes.rst:5908 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5880 +#: ../../library/stdtypes.rst:5914 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:5884 +#: ../../library/stdtypes.rst:5918 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -8679,7 +8696,7 @@ msgid "" "methods>`. Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5890 +#: ../../library/stdtypes.rst:5924 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:" @@ -8692,7 +8709,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5901 +#: ../../library/stdtypes.rst:5935 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -8703,7 +8720,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5909 +#: ../../library/stdtypes.rst:5943 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -8731,15 +8748,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5924 +#: ../../library/stdtypes.rst:5958 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5932 +#: ../../library/stdtypes.rst:5966 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5938 +#: ../../library/stdtypes.rst:5972 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -8749,7 +8766,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5945 +#: ../../library/stdtypes.rst:5979 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -8758,21 +8775,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5952 +#: ../../library/stdtypes.rst:5986 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:5955 +#: ../../library/stdtypes.rst:5989 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5961 +#: ../../library/stdtypes.rst:5995 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5967 +#: ../../library/stdtypes.rst:6001 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 " @@ -8780,30 +8797,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5972 +#: ../../library/stdtypes.rst:6006 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5978 +#: ../../library/stdtypes.rst:6012 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5980 +#: ../../library/stdtypes.rst:6014 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:5984 +#: ../../library/stdtypes.rst:6018 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5991 +#: ../../library/stdtypes.rst:6025 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5993 +#: ../../library/stdtypes.rst:6027 msgid "" "This object is commonly used to indicate that something is omitted. It " "supports no special operations. There is exactly one ellipsis object, " @@ -8811,63 +8828,63 @@ msgid "" "the :const:`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5998 +#: ../../library/stdtypes.rst:6032 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:6000 +#: ../../library/stdtypes.rst:6034 msgid "" "In typical use, ``...`` as the ``Ellipsis`` object appears in a few " "different places, for instance:" msgstr "" -#: ../../library/stdtypes.rst:6003 +#: ../../library/stdtypes.rst:6037 msgid "" "In type annotations, such as :ref:`callable arguments ` or :ref:`tuple elements `." msgstr "" -#: ../../library/stdtypes.rst:6006 +#: ../../library/stdtypes.rst:6040 msgid "" "As the body of a function instead of a :ref:`pass statement `." msgstr "" -#: ../../library/stdtypes.rst:6008 +#: ../../library/stdtypes.rst:6042 msgid "" "In third-party libraries, such as `Numpy's slicing and striding `_." msgstr "" -#: ../../library/stdtypes.rst:6011 +#: ../../library/stdtypes.rst:6045 msgid "" "Python also uses three dots in ways that are not ``Ellipsis`` objects, for " "instance:" msgstr "" -#: ../../library/stdtypes.rst:6013 +#: ../../library/stdtypes.rst:6047 msgid "" "Doctest's :const:`ELLIPSIS `, as a pattern for missing " "content." msgstr "" -#: ../../library/stdtypes.rst:6015 +#: ../../library/stdtypes.rst:6049 msgid "" "The default Python prompt of the :term:`interactive` shell when partial " "input is incomplete." msgstr "" -#: ../../library/stdtypes.rst:6017 +#: ../../library/stdtypes.rst:6051 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:6025 +#: ../../library/stdtypes.rst:6059 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:6027 +#: ../../library/stdtypes.rst:6061 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 " @@ -8875,64 +8892,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:6032 +#: ../../library/stdtypes.rst:6066 msgid "It is written as :code:`NotImplemented`." msgstr "它被寫為 :code:`NotImplemented`。" -#: ../../library/stdtypes.rst:6038 +#: ../../library/stdtypes.rst:6072 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:6040 +#: ../../library/stdtypes.rst:6074 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:6048 +#: ../../library/stdtypes.rst:6082 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:6050 +#: ../../library/stdtypes.rst:6084 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:6057 +#: ../../library/stdtypes.rst:6091 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:6063 +#: ../../library/stdtypes.rst:6097 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:6071 +#: ../../library/stdtypes.rst:6105 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:6076 +#: ../../library/stdtypes.rst:6110 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:6081 +#: ../../library/stdtypes.rst:6115 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:6091 +#: ../../library/stdtypes.rst:6125 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:6093 +#: ../../library/stdtypes.rst:6127 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 " @@ -8940,7 +8957,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:6098 +#: ../../library/stdtypes.rst:6132 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 " @@ -8950,24 +8967,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:6105 +#: ../../library/stdtypes.rst:6139 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:6107 +#: ../../library/stdtypes.rst:6141 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:6111 +#: ../../library/stdtypes.rst:6145 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:6113 +#: ../../library/stdtypes.rst:6147 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8991,7 +9008,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:6133 +#: ../../library/stdtypes.rst:6167 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -8999,11 +9016,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:6138 +#: ../../library/stdtypes.rst:6172 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:6140 +#: ../../library/stdtypes.rst:6174 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -9021,84 +9038,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:6153 +#: ../../library/stdtypes.rst:6187 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:6155 +#: ../../library/stdtypes.rst:6189 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:6158 +#: ../../library/stdtypes.rst:6192 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:6159 +#: ../../library/stdtypes.rst:6193 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:6160 +#: ../../library/stdtypes.rst:6194 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:6161 +#: ../../library/stdtypes.rst:6195 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:6162 +#: ../../library/stdtypes.rst:6196 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:6165 +#: ../../library/stdtypes.rst:6199 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:6167 +#: ../../library/stdtypes.rst:6201 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:6168 +#: ../../library/stdtypes.rst:6202 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:6169 +#: ../../library/stdtypes.rst:6203 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:6170 +#: ../../library/stdtypes.rst:6204 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:6171 +#: ../../library/stdtypes.rst:6205 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:6172 +#: ../../library/stdtypes.rst:6206 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:6175 +#: ../../library/stdtypes.rst:6209 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:6177 +#: ../../library/stdtypes.rst:6211 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:6180 +#: ../../library/stdtypes.rst:6214 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:6183 +#: ../../library/stdtypes.rst:6217 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -9106,7 +9123,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:6185 +#: ../../library/stdtypes.rst:6219 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 " @@ -9115,38 +9132,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:6191 +#: ../../library/stdtypes.rst:6225 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:6194 +#: ../../library/stdtypes.rst:6228 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:6198 +#: ../../library/stdtypes.rst:6232 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:6200 +#: ../../library/stdtypes.rst:6234 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:6202 +#: ../../library/stdtypes.rst:6236 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:6209 +#: ../../library/stdtypes.rst:6243 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 " @@ -9158,7 +9175,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:6218 +#: ../../library/stdtypes.rst:6252 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 " @@ -9166,11 +9183,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:6224 +#: ../../library/stdtypes.rst:6258 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:6226 +#: ../../library/stdtypes.rst:6260 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 " @@ -9178,11 +9195,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:6231 +#: ../../library/stdtypes.rst:6265 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:6233 +#: ../../library/stdtypes.rst:6267 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -9204,38 +9221,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:6243 +#: ../../library/stdtypes.rst:6277 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:6247 +#: ../../library/stdtypes.rst:6281 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:6248 +#: ../../library/stdtypes.rst:6282 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:6251 +#: ../../library/stdtypes.rst:6285 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:6254 +#: ../../library/stdtypes.rst:6288 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:6256 +#: ../../library/stdtypes.rst:6290 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:6259 +#: ../../library/stdtypes.rst:6293 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -9248,13 +9265,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:322 #: ../../library/stdtypes.rst:399 ../../library/stdtypes.rst:992 #: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:1201 -#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4966 -#: ../../library/stdtypes.rst:5963 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:5000 +#: ../../library/stdtypes.rst:5997 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:5000 msgid "statement" msgstr "statement(陳述式)" @@ -9376,11 +9393,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:1366 #: ../../library/stdtypes.rst:1445 ../../library/stdtypes.rst:1489 #: ../../library/stdtypes.rst:1610 ../../library/stdtypes.rst:1740 -#: ../../library/stdtypes.rst:2995 ../../library/stdtypes.rst:3014 -#: ../../library/stdtypes.rst:3127 ../../library/stdtypes.rst:4763 -#: ../../library/stdtypes.rst:4966 ../../library/stdtypes.rst:5450 -#: ../../library/stdtypes.rst:5707 ../../library/stdtypes.rst:5882 -#: ../../library/stdtypes.rst:5927 +#: ../../library/stdtypes.rst:3021 ../../library/stdtypes.rst:3040 +#: ../../library/stdtypes.rst:3153 ../../library/stdtypes.rst:4789 +#: ../../library/stdtypes.rst:5000 ../../library/stdtypes.rst:5484 +#: ../../library/stdtypes.rst:5741 ../../library/stdtypes.rst:5916 +#: ../../library/stdtypes.rst:5961 msgid "object" msgstr "object(物件)" @@ -9472,9 +9489,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:992 -#: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:4966 -#: ../../library/stdtypes.rst:5934 ../../library/stdtypes.rst:5948 -#: ../../library/stdtypes.rst:5963 +#: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:5000 +#: ../../library/stdtypes.rst:5968 ../../library/stdtypes.rst:5982 +#: ../../library/stdtypes.rst:5997 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -9490,8 +9507,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2871 -#: ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2897 +#: ../../library/stdtypes.rst:4157 msgid "+ (plus)" msgstr "+ (加號)" @@ -9503,13 +9520,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2871 -#: ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2897 +#: ../../library/stdtypes.rst:4157 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2828 -#: ../../library/stdtypes.rst:4088 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2854 +#: ../../library/stdtypes.rst:4114 msgid "* (asterisk)" msgstr "* (星號)" @@ -9521,8 +9538,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2791 -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2817 +#: ../../library/stdtypes.rst:4082 msgid "% (percent)" msgstr "% (百分號)" @@ -9532,7 +9549,7 @@ msgstr "**" #: ../../library/stdtypes.rst:322 ../../library/stdtypes.rst:399 #: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:5000 msgid "operations on" msgstr "operations on(操作於)" @@ -9541,7 +9558,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:341 ../../library/stdtypes.rst:1808 -#: ../../library/stdtypes.rst:2995 ../../library/stdtypes.rst:5963 +#: ../../library/stdtypes.rst:3021 ../../library/stdtypes.rst:5997 msgid "module" msgstr "模組" @@ -9609,7 +9626,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:889 ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:889 ../../library/stdtypes.rst:5399 msgid "protocol" msgstr "protocol(協定)" @@ -9635,7 +9652,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:5000 msgid "len" msgstr "len" @@ -9704,14 +9721,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:2995 -#: ../../library/stdtypes.rst:3127 ../../library/stdtypes.rst:3237 -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:3021 +#: ../../library/stdtypes.rst:3153 ../../library/stdtypes.rst:3263 +#: ../../library/stdtypes.rst:4082 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4966 -#: ../../library/stdtypes.rst:5707 ../../library/stdtypes.rst:5963 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:5000 +#: ../../library/stdtypes.rst:5741 ../../library/stdtypes.rst:5997 msgid "type" msgstr "type(型別)" @@ -9719,7 +9736,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:5000 msgid "del" msgstr "del" @@ -9729,7 +9746,7 @@ msgstr "range" #: ../../library/stdtypes.rst:1610 ../../library/stdtypes.rst:1753 #: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:2645 -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2817 msgid "string" msgstr "string(字串)" @@ -9750,17 +9767,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2987 +#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:3013 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2995 -#: ../../library/stdtypes.rst:3014 ../../library/stdtypes.rst:3237 -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:3021 +#: ../../library/stdtypes.rst:3040 ../../library/stdtypes.rst:3263 +#: ../../library/stdtypes.rst:4082 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:3237 +#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:3263 msgid "methods" msgstr "methods(方法)" @@ -9768,7 +9785,7 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2457 ../../library/stdtypes.rst:3910 +#: ../../library/stdtypes.rst:2457 ../../library/stdtypes.rst:3936 msgid "universal newlines" msgstr "universal newlines" @@ -9832,175 +9849,282 @@ msgstr "= (等號)" msgid "for help in debugging using string literals" msgstr "" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2817 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2817 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2817 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2817 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2791 ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:2817 ../../library/stdtypes.rst:4082 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2791 ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:2817 ../../library/stdtypes.rst:4082 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2828 ../../library/stdtypes.rst:4088 +#: ../../library/stdtypes.rst:2854 ../../library/stdtypes.rst:4114 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2828 ../../library/stdtypes.rst:2871 -#: ../../library/stdtypes.rst:4088 ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:2854 ../../library/stdtypes.rst:2897 +#: ../../library/stdtypes.rst:4114 ../../library/stdtypes.rst:4157 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2828 ../../library/stdtypes.rst:4088 +#: ../../library/stdtypes.rst:2854 ../../library/stdtypes.rst:4114 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2871 ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:2897 ../../library/stdtypes.rst:4157 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2871 ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:2897 ../../library/stdtypes.rst:4157 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2987 +#: ../../library/stdtypes.rst:3013 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2995 +#: ../../library/stdtypes.rst:3021 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2995 +#: ../../library/stdtypes.rst:3021 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3910 +#: ../../library/stdtypes.rst:3936 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3910 +#: ../../library/stdtypes.rst:3936 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:4082 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:4082 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:4082 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:4082 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4763 +#: ../../library/stdtypes.rst:4789 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:5000 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:5000 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:5076 +#: ../../library/stdtypes.rst:5110 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5399 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5399 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5399 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5438 +#: ../../library/stdtypes.rst:5472 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5438 +#: ../../library/stdtypes.rst:5472 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5450 +#: ../../library/stdtypes.rst:5484 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5450 +#: ../../library/stdtypes.rst:5484 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5450 +#: ../../library/stdtypes.rst:5484 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5707 +#: ../../library/stdtypes.rst:5741 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5707 +#: ../../library/stdtypes.rst:5741 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5882 +#: ../../library/stdtypes.rst:5916 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5927 +#: ../../library/stdtypes.rst:5961 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5927 +#: ../../library/stdtypes.rst:5961 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5934 +#: ../../library/stdtypes.rst:5968 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5934 +#: ../../library/stdtypes.rst:5968 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5948 +#: ../../library/stdtypes.rst:5982 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5948 +#: ../../library/stdtypes.rst:5982 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5987 +#: ../../library/stdtypes.rst:6021 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5987 +#: ../../library/stdtypes.rst:6021 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號字面值)" + +#~ msgid "" +#~ ">>> who = 'nobody'\n" +#~ ">>> nationality = 'Spanish'\n" +#~ ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" +#~ "'Nobody expects the Spanish Inquisition!'" +#~ msgstr "" +#~ ">>> who = 'nobody'\n" +#~ ">>> nationality = 'Spanish'\n" +#~ ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" +#~ "'Nobody expects the Spanish Inquisition!'" + +#~ msgid "" +#~ ">>> f'''This is a string\n" +#~ "... on two lines'''\n" +#~ "'This is a string\\non two lines'" +#~ msgstr "" +#~ ">>> f'''This is a string\n" +#~ "... on two lines'''\n" +#~ "'This is a string\\non two lines'" + +#~ msgid "" +#~ ">>> nationality = 'Spanish'\n" +#~ ">>> f'The {nationality} Inquisition!'\n" +#~ "'The Spanish Inquisition!'" +#~ msgstr "" +#~ ">>> nationality = 'Spanish'\n" +#~ ">>> f'The {nationality} Inquisition!'\n" +#~ "'The Spanish Inquisition!'" + +#~ msgid "" +#~ ">>> x = 42\n" +#~ ">>> f'{{x}} is {x}'\n" +#~ "'{x} is 42'" +#~ msgstr "" +#~ ">>> x = 42\n" +#~ ">>> f'{{x}} is {x}'\n" +#~ "'{x} is 42'" + +#~ msgid "" +#~ ">>> from math import sqrt\n" +#~ ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" +#~ "'√2 ≈ 1.41421'" +#~ msgstr "" +#~ ">>> from math import sqrt\n" +#~ ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" +#~ "'√2 ≈ 1.41421'" + +#~ msgid "``!a``" +#~ msgstr "``!a``" + +#~ msgid "``!r``" +#~ msgstr "``!r``" + +#~ msgid "``!s``" +#~ msgstr "``!s``" + +#~ msgid "" +#~ ">>> from fractions import Fraction\n" +#~ ">>> f'{Fraction(1, 3)!s}'\n" +#~ "'1/3'\n" +#~ ">>> f'{Fraction(1, 3)!r}'\n" +#~ "'Fraction(1, 3)'\n" +#~ ">>> question = '¿Dónde está el Presidente?'\n" +#~ ">>> print(f'{question!a}')\n" +#~ "'\\xbfD\\xf3nde est\\xe1 el Presidente?'" +#~ msgstr "" +#~ ">>> from fractions import Fraction\n" +#~ ">>> f'{Fraction(1, 3)!s}'\n" +#~ "'1/3'\n" +#~ ">>> f'{Fraction(1, 3)!r}'\n" +#~ "'Fraction(1, 3)'\n" +#~ ">>> question = '¿Dónde está el Presidente?'\n" +#~ ">>> print(f'{question!a}')\n" +#~ "'\\xbfD\\xf3nde est\\xe1 el Presidente?'" + +#~ msgid "" +#~ ">>> from fractions import Fraction\n" +#~ ">>> calculation = Fraction(1, 3)\n" +#~ ">>> f'{calculation=}'\n" +#~ "'calculation=Fraction(1, 3)'\n" +#~ ">>> f'{calculation = }'\n" +#~ "'calculation = Fraction(1, 3)'\n" +#~ ">>> f'{calculation = !s}'\n" +#~ "'calculation = 1/3'" +#~ msgstr "" +#~ ">>> from fractions import Fraction\n" +#~ ">>> calculation = Fraction(1, 3)\n" +#~ ">>> f'{calculation=}'\n" +#~ "'calculation=Fraction(1, 3)'\n" +#~ ">>> f'{calculation = }'\n" +#~ "'calculation = Fraction(1, 3)'\n" +#~ ">>> f'{calculation = !s}'\n" +#~ "'calculation = 1/3'" + +#~ msgid "" +#~ ">>> from fractions import Fraction\n" +#~ ">>> f'{Fraction(1, 7):.6f}'\n" +#~ "'0.142857'\n" +#~ ">>> f'{Fraction(1, 7):_^+10}'\n" +#~ "'___+1/7___'" +#~ msgstr "" +#~ ">>> from fractions import Fraction\n" +#~ ">>> f'{Fraction(1, 7):.6f}'\n" +#~ "'0.142857'\n" +#~ ">>> f'{Fraction(1, 7):_^+10}'\n" +#~ "'___+1/7___'" diff --git a/reference/datamodel.po b/reference/datamodel.po index d55c173a7f..110fd9fc4a 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-11-06 00:14+0000\n" +"POT-Creation-Date: 2025-12-08 07:22+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-" @@ -575,7 +575,7 @@ msgstr "Set(集合)" 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:" -"`add `." +"`~set.add`." msgstr "" #: ../../reference/datamodel.rst:455 diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index 25fe4cdb65..44338dc094 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-04 00:14+0000\n" +"POT-Creation-Date: 2025-12-08 07:22+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-" @@ -516,28 +516,32 @@ msgstr "" msgid "" "Except at the beginning of a logical line or in string literals, the " "whitespace characters space, tab and formfeed can be used interchangeably to " -"separate tokens. Whitespace is needed between two tokens only if their " -"concatenation could otherwise be interpreted as a different token. For " -"example, ``ab`` is one token, but ``a b`` is two tokens. However, ``+a`` and " -"``+ a`` both produce two tokens, ``+`` and ``a``, as ``+a`` is not a valid " -"token." +"separate tokens:" msgstr "" -#: ../../reference/lexical_analysis.rst:357 +#: ../../reference/lexical_analysis.rst:356 +msgid "" +"Whitespace is needed between two tokens only if their concatenation could " +"otherwise be interpreted as a different token. For example, ``ab`` is one " +"token, but ``a b`` is two tokens. However, ``+a`` and ``+ a`` both produce " +"two tokens, ``+`` and ``a``, as ``+a`` is not a valid token." +msgstr "" + +#: ../../reference/lexical_analysis.rst:365 msgid "End marker" msgstr "" -#: ../../reference/lexical_analysis.rst:359 +#: ../../reference/lexical_analysis.rst:367 msgid "" "At the end of non-interactive input, the lexical analyzer generates an :data:" "`~token.ENDMARKER` token." msgstr "" -#: ../../reference/lexical_analysis.rst:366 +#: ../../reference/lexical_analysis.rst:374 msgid "Other tokens" msgstr "" -#: ../../reference/lexical_analysis.rst:368 +#: ../../reference/lexical_analysis.rst:376 msgid "" "Besides :data:`~token.NEWLINE`, :data:`~token.INDENT` and :data:`~token." "DEDENT`, the following categories of tokens exist: *identifiers* and " @@ -549,67 +553,67 @@ msgid "" "string that forms a legal token, when read from left to right." msgstr "" -#: ../../reference/lexical_analysis.rst:382 +#: ../../reference/lexical_analysis.rst:390 msgid "Names (identifiers and keywords)" msgstr "" -#: ../../reference/lexical_analysis.rst:386 +#: ../../reference/lexical_analysis.rst:394 msgid "" ":data:`~token.NAME` tokens represent *identifiers*, *keywords*, and *soft " "keywords*." msgstr "" -#: ../../reference/lexical_analysis.rst:389 +#: ../../reference/lexical_analysis.rst:397 msgid "Names are composed of the following characters:" msgstr "" -#: ../../reference/lexical_analysis.rst:391 +#: ../../reference/lexical_analysis.rst:399 msgid "uppercase and lowercase letters (``A-Z`` and ``a-z``)," msgstr "" -#: ../../reference/lexical_analysis.rst:392 +#: ../../reference/lexical_analysis.rst:400 msgid "the underscore (``_``)," msgstr "底線 (``_``)," -#: ../../reference/lexical_analysis.rst:393 +#: ../../reference/lexical_analysis.rst:401 msgid "" "digits (``0`` through ``9``), which cannot appear as the first character, and" msgstr "" -#: ../../reference/lexical_analysis.rst:394 +#: ../../reference/lexical_analysis.rst:402 msgid "" "non-ASCII characters. Valid names may only contain \"letter-like\" and " "\"digit-like\" characters; see :ref:`lexical-names-nonascii` for details." msgstr "" -#: ../../reference/lexical_analysis.rst:397 +#: ../../reference/lexical_analysis.rst:405 msgid "" "Names must contain at least one character, but have no upper length limit. " "Case is significant." msgstr "" -#: ../../reference/lexical_analysis.rst:400 +#: ../../reference/lexical_analysis.rst:408 msgid "Formally, names are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:410 +#: ../../reference/lexical_analysis.rst:418 msgid "" "Note that not all names matched by this grammar are valid; see :ref:`lexical-" "names-nonascii` for details." msgstr "" -#: ../../reference/lexical_analysis.rst:417 +#: ../../reference/lexical_analysis.rst:425 msgid "Keywords" msgstr "關鍵字" -#: ../../reference/lexical_analysis.rst:423 +#: ../../reference/lexical_analysis.rst:431 msgid "" "The following names are used as reserved words, or *keywords* of the " "language, and cannot be used as ordinary identifiers. They must be spelled " "exactly as written here:" msgstr "" -#: ../../reference/lexical_analysis.rst:427 +#: ../../reference/lexical_analysis.rst:435 msgid "" "False await else import pass\n" "None break except in raise\n" @@ -627,101 +631,101 @@ msgstr "" "assert del global not with\n" "async elif if or yield" -#: ../../reference/lexical_analysis.rst:441 +#: ../../reference/lexical_analysis.rst:449 msgid "Soft Keywords" msgstr "軟關鍵字" -#: ../../reference/lexical_analysis.rst:447 +#: ../../reference/lexical_analysis.rst:455 msgid "" "Some names are only reserved under specific contexts. These are known as " "*soft keywords*:" msgstr "" -#: ../../reference/lexical_analysis.rst:450 +#: ../../reference/lexical_analysis.rst:458 msgid "" "``match``, ``case``, and ``_``, when used in the :keyword:`match` statement." msgstr "" -#: ../../reference/lexical_analysis.rst:451 +#: ../../reference/lexical_analysis.rst:459 msgid "``type``, when used in the :keyword:`type` statement." msgstr "" -#: ../../reference/lexical_analysis.rst:453 +#: ../../reference/lexical_analysis.rst:461 msgid "" "These syntactically act as keywords in their specific contexts, but this " "distinction is done at the parser level, not when tokenizing." msgstr "" -#: ../../reference/lexical_analysis.rst:456 +#: ../../reference/lexical_analysis.rst:464 msgid "" "As soft keywords, their use in the grammar is possible while still " "preserving compatibility with existing code that uses these names as " "identifier names." msgstr "" -#: ../../reference/lexical_analysis.rst:460 +#: ../../reference/lexical_analysis.rst:468 msgid "``type`` is now a soft keyword." msgstr "``type`` 現在是軟關鍵字。" -#: ../../reference/lexical_analysis.rst:469 +#: ../../reference/lexical_analysis.rst:477 msgid "Reserved classes of identifiers" msgstr "" -#: ../../reference/lexical_analysis.rst:471 +#: ../../reference/lexical_analysis.rst:479 msgid "" "Certain classes of identifiers (besides keywords) have special meanings. " "These classes are identified by the patterns of leading and trailing " "underscore characters:" msgstr "" -#: ../../reference/lexical_analysis.rst:475 +#: ../../reference/lexical_analysis.rst:483 msgid "``_*``" msgstr "``_*``" -#: ../../reference/lexical_analysis.rst:476 +#: ../../reference/lexical_analysis.rst:484 msgid "Not imported by ``from module import *``." msgstr "" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:486 msgid "``_``" msgstr "``_``" -#: ../../reference/lexical_analysis.rst:479 +#: ../../reference/lexical_analysis.rst:487 msgid "" "In a ``case`` pattern within a :keyword:`match` statement, ``_`` is a :ref:" "`soft keyword ` that denotes a :ref:`wildcard `." msgstr "" -#: ../../reference/lexical_analysis.rst:483 +#: ../../reference/lexical_analysis.rst:491 msgid "" "Separately, the interactive interpreter makes the result of the last " "evaluation available in the variable ``_``. (It is stored in the :mod:" "`builtins` module, alongside built-in functions like ``print``.)" msgstr "" -#: ../../reference/lexical_analysis.rst:488 +#: ../../reference/lexical_analysis.rst:496 msgid "" "Elsewhere, ``_`` is a regular identifier. It is often used to name " "\"special\" items, but it is not special to Python itself." msgstr "" -#: ../../reference/lexical_analysis.rst:493 +#: ../../reference/lexical_analysis.rst:501 msgid "" "The name ``_`` is often used in conjunction with internationalization; refer " "to the documentation for the :mod:`gettext` module for more information on " "this convention." msgstr "" -#: ../../reference/lexical_analysis.rst:497 +#: ../../reference/lexical_analysis.rst:505 msgid "It is also commonly used for unused variables." msgstr "" -#: ../../reference/lexical_analysis.rst:499 +#: ../../reference/lexical_analysis.rst:507 msgid "``__*__``" msgstr "``__*__``" -#: ../../reference/lexical_analysis.rst:500 +#: ../../reference/lexical_analysis.rst:508 msgid "" "System-defined names, informally known as \"dunder\" names. These names are " "defined by the interpreter and its implementation (including the standard " @@ -731,11 +735,11 @@ msgid "" "explicitly documented use, is subject to breakage without warning." msgstr "" -#: ../../reference/lexical_analysis.rst:507 +#: ../../reference/lexical_analysis.rst:515 msgid "``__*``" msgstr "``__*``" -#: ../../reference/lexical_analysis.rst:508 +#: ../../reference/lexical_analysis.rst:516 msgid "" "Class-private names. Names in this category, when used within the context " "of a class definition, are re-written to use a mangled form to help avoid " @@ -743,11 +747,11 @@ msgid "" "section :ref:`atom-identifiers`." msgstr "" -#: ../../reference/lexical_analysis.rst:517 +#: ../../reference/lexical_analysis.rst:525 msgid "Non-ASCII characters in names" msgstr "名稱中的非 ASCII 字元" -#: ../../reference/lexical_analysis.rst:519 +#: ../../reference/lexical_analysis.rst:527 msgid "" "Names that contain non-ASCII characters need additional normalization and " "validation beyond the rules and grammar explained :ref:`above " @@ -755,11 +759,11 @@ msgid "" "but ``r〰2``, ``€``, or ``🐍`` are not." msgstr "" -#: ../../reference/lexical_analysis.rst:525 +#: ../../reference/lexical_analysis.rst:533 msgid "This section explains the exact rules." msgstr "" -#: ../../reference/lexical_analysis.rst:527 +#: ../../reference/lexical_analysis.rst:535 msgid "" "All names are converted into the `normalization form`_ NFKC while parsing. " "This means that, for example, some typographic variants of characters are " @@ -767,14 +771,14 @@ msgid "" "to ``finalization``, so Python treats them as the same name::" msgstr "" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:540 msgid "" ">>> fiⁿₐˡᵢᶻₐᵗᵢᵒₙ = 3\n" ">>> finalization\n" "3" msgstr "" -#: ../../reference/lexical_analysis.rst:538 +#: ../../reference/lexical_analysis.rst:546 msgid "" "Normalization is done at the lexical level only. Run-time functions that " "take names as *strings* generally do not normalize their arguments. For " @@ -783,7 +787,7 @@ msgid "" "[\"fiⁿₐˡᵢᶻₐᵗᵢᵒₙ\"]``." msgstr "" -#: ../../reference/lexical_analysis.rst:545 +#: ../../reference/lexical_analysis.rst:553 msgid "" "Similarly to how ASCII-only names must contain only letters, digits and the " "underscore, and cannot start with a digit, a valid name must start with a " @@ -791,7 +795,7 @@ msgid "" "characters must be in the \"letter- and digit-like\" set ``xid_continue``." msgstr "" -#: ../../reference/lexical_analysis.rst:551 +#: ../../reference/lexical_analysis.rst:559 msgid "" "These sets based on the *XID_Start* and *XID_Continue* sets as defined by " "the Unicode standard annex `UAX-31`_. Python's ``xid_start`` additionally " @@ -799,7 +803,7 @@ msgid "" "conform to `UAX-31`_." msgstr "" -#: ../../reference/lexical_analysis.rst:556 +#: ../../reference/lexical_analysis.rst:564 msgid "" "A non-normative listing of characters in the *XID_Start* and *XID_Continue* " "sets as defined by Unicode is available in the `DerivedCoreProperties.txt`_ " @@ -807,131 +811,131 @@ msgid "" "rules for the ``xid_*`` sets are given below." msgstr "" -#: ../../reference/lexical_analysis.rst:561 +#: ../../reference/lexical_analysis.rst:569 msgid "The set ``id_start`` is defined as the union of:" msgstr "" -#: ../../reference/lexical_analysis.rst:563 +#: ../../reference/lexical_analysis.rst:571 msgid "Unicode category ```` - uppercase letters (includes ``A`` to ``Z``)" msgstr "" -#: ../../reference/lexical_analysis.rst:564 +#: ../../reference/lexical_analysis.rst:572 msgid "Unicode category ```` - lowercase letters (includes ``a`` to ``z``)" msgstr "" -#: ../../reference/lexical_analysis.rst:565 +#: ../../reference/lexical_analysis.rst:573 msgid "Unicode category ```` - titlecase letters" msgstr "" -#: ../../reference/lexical_analysis.rst:566 +#: ../../reference/lexical_analysis.rst:574 msgid "Unicode category ```` - modifier letters" msgstr "" -#: ../../reference/lexical_analysis.rst:567 +#: ../../reference/lexical_analysis.rst:575 msgid "Unicode category ```` - other letters" msgstr "" -#: ../../reference/lexical_analysis.rst:568 +#: ../../reference/lexical_analysis.rst:576 msgid "Unicode category ```` - letter numbers" msgstr "" -#: ../../reference/lexical_analysis.rst:569 +#: ../../reference/lexical_analysis.rst:577 msgid "{``\"_\"``} - the underscore" msgstr "{``\"_\"``} - 底線" -#: ../../reference/lexical_analysis.rst:570 +#: ../../reference/lexical_analysis.rst:578 msgid "" "```` - an explicit set of characters in `PropList.txt`_ to " "support backwards compatibility" msgstr "" -#: ../../reference/lexical_analysis.rst:573 +#: ../../reference/lexical_analysis.rst:581 msgid "" "The set ``xid_start`` then closes this set under NFKC normalization, by " "removing all characters whose normalization is not of the form ``id_start " "id_continue*``." msgstr "" -#: ../../reference/lexical_analysis.rst:577 +#: ../../reference/lexical_analysis.rst:585 msgid "The set ``id_continue`` is defined as the union of:" msgstr "" -#: ../../reference/lexical_analysis.rst:579 +#: ../../reference/lexical_analysis.rst:587 msgid "``id_start`` (see above)" msgstr "" -#: ../../reference/lexical_analysis.rst:580 +#: ../../reference/lexical_analysis.rst:588 msgid "Unicode category ```` - decimal numbers (includes ``0`` to ``9``)" msgstr "" -#: ../../reference/lexical_analysis.rst:581 +#: ../../reference/lexical_analysis.rst:589 msgid "Unicode category ```` - connector punctuations" msgstr "" -#: ../../reference/lexical_analysis.rst:582 +#: ../../reference/lexical_analysis.rst:590 msgid "Unicode category ```` - nonspacing marks" msgstr "" -#: ../../reference/lexical_analysis.rst:583 +#: ../../reference/lexical_analysis.rst:591 msgid "Unicode category ```` - spacing combining marks" msgstr "" -#: ../../reference/lexical_analysis.rst:584 +#: ../../reference/lexical_analysis.rst:592 msgid "" "```` - another explicit set of characters in `PropList." "txt`_ to support backwards compatibility" msgstr "" -#: ../../reference/lexical_analysis.rst:587 +#: ../../reference/lexical_analysis.rst:595 msgid "Again, ``xid_continue`` closes this set under NFKC normalization." msgstr "" -#: ../../reference/lexical_analysis.rst:589 +#: ../../reference/lexical_analysis.rst:597 msgid "" "Unicode categories use the version of the Unicode Character Database as " "included in the :mod:`unicodedata` module." msgstr "" -#: ../../reference/lexical_analysis.rst:599 +#: ../../reference/lexical_analysis.rst:607 msgid ":pep:`3131` -- Supporting Non-ASCII Identifiers" msgstr "" -#: ../../reference/lexical_analysis.rst:600 +#: ../../reference/lexical_analysis.rst:608 msgid ":pep:`672` -- Unicode-related Security Considerations for Python" msgstr "" -#: ../../reference/lexical_analysis.rst:606 +#: ../../reference/lexical_analysis.rst:614 msgid "Literals" msgstr "" -#: ../../reference/lexical_analysis.rst:610 +#: ../../reference/lexical_analysis.rst:618 msgid "Literals are notations for constant values of some built-in types." msgstr "" -#: ../../reference/lexical_analysis.rst:612 +#: ../../reference/lexical_analysis.rst:620 msgid "" "In terms of lexical analysis, Python has :ref:`string, bytes ` and :" "ref:`numeric ` literals." msgstr "" -#: ../../reference/lexical_analysis.rst:615 +#: ../../reference/lexical_analysis.rst:623 msgid "" "Other \"literals\" are lexically denoted using :ref:`keywords ` " "(``None``, ``True``, ``False``) and the special :ref:`ellipsis token " "` (``...``)." msgstr "" -#: ../../reference/lexical_analysis.rst:626 +#: ../../reference/lexical_analysis.rst:634 msgid "String and Bytes literals" msgstr "" -#: ../../reference/lexical_analysis.rst:628 +#: ../../reference/lexical_analysis.rst:636 msgid "" "String literals are text enclosed in single quotes (``'``) or double quotes " "(``\"``). For example:" msgstr "" -#: ../../reference/lexical_analysis.rst:631 +#: ../../reference/lexical_analysis.rst:639 msgid "" "\"spam\"\n" "'eggs'" @@ -939,14 +943,14 @@ msgstr "" "\"spam\"\n" "'eggs'" -#: ../../reference/lexical_analysis.rst:636 +#: ../../reference/lexical_analysis.rst:644 msgid "" "The quote used to start the literal also terminates it, so a string literal " "can only contain the other quote (except with escape sequences, see below). " "For example:" msgstr "" -#: ../../reference/lexical_analysis.rst:640 +#: ../../reference/lexical_analysis.rst:648 msgid "" "'Say \"Hello\", please.'\n" "\"Don't do that!\"" @@ -954,13 +958,13 @@ msgstr "" "'Say \"Hello\", please.'\n" "\"Don't do that!\"" -#: ../../reference/lexical_analysis.rst:645 +#: ../../reference/lexical_analysis.rst:653 msgid "" "Except for this limitation, the choice of quote character (``'`` or ``\"``) " "does not affect how the literal is parsed." msgstr "" -#: ../../reference/lexical_analysis.rst:648 +#: ../../reference/lexical_analysis.rst:656 msgid "" "Inside a string literal, the backslash (``\\``) character introduces an :dfn:" "`escape sequence`, which has special meaning depending on the character " @@ -968,7 +972,7 @@ msgid "" "character, and does *not* end the string:" msgstr "" -#: ../../reference/lexical_analysis.rst:654 +#: ../../reference/lexical_analysis.rst:662 msgid "" ">>> print(\"Say \\\"Hello\\\" to everyone!\")\n" "Say \"Hello\" to everyone!" @@ -976,58 +980,58 @@ msgstr "" ">>> print(\"Say \\\"Hello\\\" to everyone!\")\n" "Say \"Hello\" to everyone!" -#: ../../reference/lexical_analysis.rst:659 +#: ../../reference/lexical_analysis.rst:667 msgid "" "See :ref:`escape sequences ` below for a full list of such " "sequences, and more details." msgstr "" -#: ../../reference/lexical_analysis.rst:668 +#: ../../reference/lexical_analysis.rst:676 msgid "Triple-quoted strings" msgstr "三引號字串" -#: ../../reference/lexical_analysis.rst:670 +#: ../../reference/lexical_analysis.rst:678 msgid "" "Strings can also be enclosed in matching groups of three single or double " "quotes. These are generally referred to as :dfn:`triple-quoted strings`::" msgstr "" -#: ../../reference/lexical_analysis.rst:674 +#: ../../reference/lexical_analysis.rst:682 msgid "\"\"\"This is a triple-quoted string.\"\"\"" msgstr "\"\"\"這是一個三引號字串。\"\"\"" -#: ../../reference/lexical_analysis.rst:676 +#: ../../reference/lexical_analysis.rst:684 msgid "" "In triple-quoted literals, unescaped quotes are allowed (and are retained), " "except that three unescaped quotes in a row terminate the literal, if they " "are of the same kind (``'`` or ``\"``) used at the start::" msgstr "" -#: ../../reference/lexical_analysis.rst:680 +#: ../../reference/lexical_analysis.rst:688 msgid "\"\"\"This string has \"quotes\" inside.\"\"\"" msgstr "\"\"\"這個字串裡面有 \"引號\"。\"\"\"" -#: ../../reference/lexical_analysis.rst:682 +#: ../../reference/lexical_analysis.rst:690 msgid "Unescaped newlines are also allowed and retained::" msgstr "" -#: ../../reference/lexical_analysis.rst:684 +#: ../../reference/lexical_analysis.rst:692 msgid "" "'''This triple-quoted string\n" "continues on the next line.'''" msgstr "" -#: ../../reference/lexical_analysis.rst:693 +#: ../../reference/lexical_analysis.rst:701 msgid "String prefixes" msgstr "" -#: ../../reference/lexical_analysis.rst:695 +#: ../../reference/lexical_analysis.rst:703 msgid "" "String literals can have an optional :dfn:`prefix` that influences how the " "content of the literal is parsed, for example:" msgstr "" -#: ../../reference/lexical_analysis.rst:698 +#: ../../reference/lexical_analysis.rst:706 msgid "" "b\"data\"\n" "f'{result=}'" @@ -1035,35 +1039,35 @@ msgstr "" "b\"data\"\n" "f'{result=}'" -#: ../../reference/lexical_analysis.rst:703 +#: ../../reference/lexical_analysis.rst:711 msgid "The allowed prefixes are:" msgstr "" -#: ../../reference/lexical_analysis.rst:705 +#: ../../reference/lexical_analysis.rst:713 msgid "``b``: :ref:`Bytes literal `" msgstr "" -#: ../../reference/lexical_analysis.rst:706 +#: ../../reference/lexical_analysis.rst:714 msgid "``r``: :ref:`Raw string `" msgstr "" -#: ../../reference/lexical_analysis.rst:707 +#: ../../reference/lexical_analysis.rst:715 msgid "``f``: :ref:`Formatted string literal ` (\"f-string\")" msgstr "" -#: ../../reference/lexical_analysis.rst:708 +#: ../../reference/lexical_analysis.rst:716 msgid "``t``: :ref:`Template string literal ` (\"t-string\")" msgstr "" -#: ../../reference/lexical_analysis.rst:709 +#: ../../reference/lexical_analysis.rst:717 msgid "``u``: No effect (allowed for backwards compatibility)" msgstr "" -#: ../../reference/lexical_analysis.rst:711 +#: ../../reference/lexical_analysis.rst:719 msgid "See the linked sections for details on each type." msgstr "" -#: ../../reference/lexical_analysis.rst:713 +#: ../../reference/lexical_analysis.rst:721 msgid "" "Prefixes are case-insensitive (for example, '``B``' works the same as " "'``b``'). The '``r``' prefix can be combined with '``f``', '``t``' or " @@ -1071,220 +1075,220 @@ msgid "" "are also valid prefixes." msgstr "" -#: ../../reference/lexical_analysis.rst:717 +#: ../../reference/lexical_analysis.rst:725 msgid "" "The ``'rb'`` prefix of raw bytes literals has been added as a synonym of " "``'br'``." msgstr "" -#: ../../reference/lexical_analysis.rst:721 +#: ../../reference/lexical_analysis.rst:729 msgid "" "Support for the unicode legacy literal (``u'value'``) was reintroduced to " "simplify the maintenance of dual Python 2.x and 3.x codebases. See :pep:" "`414` for more information." msgstr "" -#: ../../reference/lexical_analysis.rst:727 +#: ../../reference/lexical_analysis.rst:735 msgid "Formal grammar" msgstr "" -#: ../../reference/lexical_analysis.rst:729 +#: ../../reference/lexical_analysis.rst:737 msgid "" "String literals, except :ref:`\"f-strings\" ` and :ref:`\"t-" "strings\" `, are described by the following lexical definitions." msgstr "" -#: ../../reference/lexical_analysis.rst:733 +#: ../../reference/lexical_analysis.rst:741 msgid "" "These definitions use :ref:`negative lookaheads ` (``!" "``) to indicate that an ending quote ends the literal." msgstr "" -#: ../../reference/lexical_analysis.rst:751 +#: ../../reference/lexical_analysis.rst:759 msgid "" "Note that as in all lexical definitions, whitespace is significant. In " "particular, the prefix (if any) must be immediately followed by the starting " "quote." msgstr "" -#: ../../reference/lexical_analysis.rst:773 +#: ../../reference/lexical_analysis.rst:781 msgid "Escape sequences" msgstr "跳脫序列" -#: ../../reference/lexical_analysis.rst:775 +#: ../../reference/lexical_analysis.rst:783 msgid "" "Unless an '``r``' or '``R``' prefix is present, escape sequences in string " "and bytes literals are interpreted according to rules similar to those used " "by Standard C. The recognized escape sequences are:" msgstr "" -#: ../../reference/lexical_analysis.rst:783 +#: ../../reference/lexical_analysis.rst:791 msgid "Escape Sequence" msgstr "" -#: ../../reference/lexical_analysis.rst:784 +#: ../../reference/lexical_analysis.rst:792 msgid "Meaning" msgstr "含義" -#: ../../reference/lexical_analysis.rst:785 +#: ../../reference/lexical_analysis.rst:793 msgid "``\\``\\ " msgstr "``\\``\\ " -#: ../../reference/lexical_analysis.rst:786 +#: ../../reference/lexical_analysis.rst:794 msgid ":ref:`string-escape-ignore`" msgstr ":ref:`string-escape-ignore`" -#: ../../reference/lexical_analysis.rst:787 +#: ../../reference/lexical_analysis.rst:795 msgid "``\\\\``" msgstr "``\\\\``" -#: ../../reference/lexical_analysis.rst:788 +#: ../../reference/lexical_analysis.rst:796 msgid ":ref:`Backslash `" msgstr "" -#: ../../reference/lexical_analysis.rst:789 +#: ../../reference/lexical_analysis.rst:797 msgid "``\\'``" msgstr "``\\'``" -#: ../../reference/lexical_analysis.rst:790 +#: ../../reference/lexical_analysis.rst:798 msgid ":ref:`Single quote `" msgstr "" -#: ../../reference/lexical_analysis.rst:791 +#: ../../reference/lexical_analysis.rst:799 msgid "``\\\"``" msgstr "``\\\"``" -#: ../../reference/lexical_analysis.rst:792 +#: ../../reference/lexical_analysis.rst:800 msgid ":ref:`Double quote `" msgstr "" -#: ../../reference/lexical_analysis.rst:793 +#: ../../reference/lexical_analysis.rst:801 msgid "``\\a``" msgstr "``\\a``" -#: ../../reference/lexical_analysis.rst:794 +#: ../../reference/lexical_analysis.rst:802 msgid "ASCII Bell (BEL)" msgstr "" -#: ../../reference/lexical_analysis.rst:795 +#: ../../reference/lexical_analysis.rst:803 msgid "``\\b``" msgstr "``\\b``" -#: ../../reference/lexical_analysis.rst:796 +#: ../../reference/lexical_analysis.rst:804 msgid "ASCII Backspace (BS)" msgstr "" -#: ../../reference/lexical_analysis.rst:797 +#: ../../reference/lexical_analysis.rst:805 msgid "``\\f``" msgstr "``\\f``" -#: ../../reference/lexical_analysis.rst:798 +#: ../../reference/lexical_analysis.rst:806 msgid "ASCII Formfeed (FF)" msgstr "" -#: ../../reference/lexical_analysis.rst:799 +#: ../../reference/lexical_analysis.rst:807 msgid "``\\n``" msgstr "``\\n``" -#: ../../reference/lexical_analysis.rst:800 +#: ../../reference/lexical_analysis.rst:808 msgid "ASCII Linefeed (LF)" msgstr "" -#: ../../reference/lexical_analysis.rst:801 +#: ../../reference/lexical_analysis.rst:809 msgid "``\\r``" msgstr "``\\r``" -#: ../../reference/lexical_analysis.rst:802 +#: ../../reference/lexical_analysis.rst:810 msgid "ASCII Carriage Return (CR)" msgstr "" -#: ../../reference/lexical_analysis.rst:803 +#: ../../reference/lexical_analysis.rst:811 msgid "``\\t``" msgstr "``\\t``" -#: ../../reference/lexical_analysis.rst:804 +#: ../../reference/lexical_analysis.rst:812 msgid "ASCII Horizontal Tab (TAB)" msgstr "" -#: ../../reference/lexical_analysis.rst:805 +#: ../../reference/lexical_analysis.rst:813 msgid "``\\v``" msgstr "``\\v``" -#: ../../reference/lexical_analysis.rst:806 +#: ../../reference/lexical_analysis.rst:814 msgid "ASCII Vertical Tab (VT)" msgstr "" -#: ../../reference/lexical_analysis.rst:807 +#: ../../reference/lexical_analysis.rst:815 msgid ":samp:`\\\\\\\\{ooo}`" msgstr ":samp:`\\\\\\\\{ooo}`" -#: ../../reference/lexical_analysis.rst:808 +#: ../../reference/lexical_analysis.rst:816 msgid ":ref:`string-escape-oct`" msgstr ":ref:`string-escape-oct`" -#: ../../reference/lexical_analysis.rst:809 +#: ../../reference/lexical_analysis.rst:817 msgid ":samp:`\\\\x{hh}`" msgstr ":samp:`\\\\x{hh}`" -#: ../../reference/lexical_analysis.rst:810 +#: ../../reference/lexical_analysis.rst:818 msgid ":ref:`string-escape-hex`" msgstr ":ref:`string-escape-hex`" -#: ../../reference/lexical_analysis.rst:811 +#: ../../reference/lexical_analysis.rst:819 msgid ":samp:`\\\\N\\\\{{name}\\\\}`" msgstr ":samp:`\\\\N\\\\{{name}\\\\}`" -#: ../../reference/lexical_analysis.rst:812 +#: ../../reference/lexical_analysis.rst:820 msgid ":ref:`string-escape-named`" msgstr ":ref:`string-escape-named`" -#: ../../reference/lexical_analysis.rst:813 +#: ../../reference/lexical_analysis.rst:821 msgid ":samp:`\\\\u{xxxx}`" msgstr ":samp:`\\\\u{xxxx}`" -#: ../../reference/lexical_analysis.rst:814 -#: ../../reference/lexical_analysis.rst:816 +#: ../../reference/lexical_analysis.rst:822 +#: ../../reference/lexical_analysis.rst:824 msgid ":ref:`Hexadecimal Unicode character `" msgstr "" -#: ../../reference/lexical_analysis.rst:815 +#: ../../reference/lexical_analysis.rst:823 msgid ":samp:`\\\\U{xxxxxxxx}`" msgstr ":samp:`\\\\U{xxxxxxxx}`" -#: ../../reference/lexical_analysis.rst:821 +#: ../../reference/lexical_analysis.rst:829 msgid "Ignored end of line" msgstr "" -#: ../../reference/lexical_analysis.rst:823 +#: ../../reference/lexical_analysis.rst:831 msgid "A backslash can be added at the end of a line to ignore the newline::" msgstr "" -#: ../../reference/lexical_analysis.rst:825 +#: ../../reference/lexical_analysis.rst:833 msgid "" ">>> 'This string will not include \\\n" "... backslashes or newline characters.'\n" "'This string will not include backslashes or newline characters.'" msgstr "" -#: ../../reference/lexical_analysis.rst:829 +#: ../../reference/lexical_analysis.rst:837 msgid "" "The same result can be achieved using :ref:`triple-quoted strings " "`, or parentheses and :ref:`string literal concatenation `." msgstr "" -#: ../../reference/lexical_analysis.rst:835 +#: ../../reference/lexical_analysis.rst:843 msgid "Escaped characters" msgstr "跳脫字元" -#: ../../reference/lexical_analysis.rst:837 +#: ../../reference/lexical_analysis.rst:845 msgid "" "To include a backslash in a non-:ref:`raw ` Python string " "literal, it must be doubled. The ``\\\\`` escape sequence denotes a single " "backslash character::" msgstr "" -#: ../../reference/lexical_analysis.rst:841 +#: ../../reference/lexical_analysis.rst:849 msgid "" ">>> print('C:\\\\Program Files')\n" "C:\\Program Files" @@ -1292,13 +1296,13 @@ msgstr "" ">>> print('C:\\\\Program Files')\n" "C:\\Program Files" -#: ../../reference/lexical_analysis.rst:844 +#: ../../reference/lexical_analysis.rst:852 msgid "" "Similarly, the ``\\'`` and ``\\\"`` sequences denote the single and double " "quote character, respectively::" msgstr "" -#: ../../reference/lexical_analysis.rst:847 +#: ../../reference/lexical_analysis.rst:855 msgid "" ">>> print('\\' and \\\"')\n" "' and \"" @@ -1306,17 +1310,17 @@ msgstr "" ">>> print('\\' and \\\"')\n" "' and \"" -#: ../../reference/lexical_analysis.rst:853 +#: ../../reference/lexical_analysis.rst:861 msgid "Octal character" msgstr "八進位字元" -#: ../../reference/lexical_analysis.rst:855 +#: ../../reference/lexical_analysis.rst:863 msgid "" "The sequence :samp:`\\\\\\\\{ooo}` denotes a *character* with the octal " "(base 8) value *ooo*::" msgstr "" -#: ../../reference/lexical_analysis.rst:858 +#: ../../reference/lexical_analysis.rst:866 msgid "" ">>> '\\120'\n" "'P'" @@ -1324,41 +1328,41 @@ msgstr "" ">>> '\\120'\n" "'P'" -#: ../../reference/lexical_analysis.rst:861 +#: ../../reference/lexical_analysis.rst:869 msgid "Up to three octal digits (0 through 7) are accepted." msgstr "" -#: ../../reference/lexical_analysis.rst:863 -#: ../../reference/lexical_analysis.rst:888 +#: ../../reference/lexical_analysis.rst:871 +#: ../../reference/lexical_analysis.rst:896 msgid "" "In a bytes literal, *character* means a *byte* with the given value. In a " "string literal, it means a Unicode character with the given value." msgstr "" -#: ../../reference/lexical_analysis.rst:866 +#: ../../reference/lexical_analysis.rst:874 msgid "" "Octal escapes with value larger than ``0o377`` (255) produce a :exc:" "`DeprecationWarning`." msgstr "" -#: ../../reference/lexical_analysis.rst:870 +#: ../../reference/lexical_analysis.rst:878 msgid "" "Octal escapes with value larger than ``0o377`` (255) produce a :exc:" "`SyntaxWarning`. In a future Python version they will raise a :exc:" "`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:878 +#: ../../reference/lexical_analysis.rst:886 msgid "Hexadecimal character" msgstr "十六進位字元" -#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:888 msgid "" "The sequence :samp:`\\\\x{hh}` denotes a *character* with the hex (base 16) " "value *hh*::" msgstr "" -#: ../../reference/lexical_analysis.rst:883 +#: ../../reference/lexical_analysis.rst:891 msgid "" ">>> '\\x50'\n" "'P'" @@ -1366,21 +1370,21 @@ msgstr "" ">>> '\\x50'\n" "'P'" -#: ../../reference/lexical_analysis.rst:886 +#: ../../reference/lexical_analysis.rst:894 msgid "Unlike in Standard C, exactly two hex digits are required." msgstr "與標準 C 不同,這裡需要剛好兩個十六進位數字。" -#: ../../reference/lexical_analysis.rst:894 +#: ../../reference/lexical_analysis.rst:902 msgid "Named Unicode character" msgstr "" -#: ../../reference/lexical_analysis.rst:896 +#: ../../reference/lexical_analysis.rst:904 msgid "" "The sequence :samp:`\\\\N\\\\{{name}\\\\}` denotes a Unicode character with " "the given *name*::" msgstr "" -#: ../../reference/lexical_analysis.rst:899 +#: ../../reference/lexical_analysis.rst:907 msgid "" ">>> '\\N{LATIN CAPITAL LETTER P}'\n" "'P'\n" @@ -1392,11 +1396,11 @@ msgstr "" ">>> '\\N{SNAKE}'\n" "'🐍'" -#: ../../reference/lexical_analysis.rst:904 +#: ../../reference/lexical_analysis.rst:912 msgid "This sequence cannot appear in :ref:`bytes literals `." msgstr "" -#: ../../reference/lexical_analysis.rst:906 +#: ../../reference/lexical_analysis.rst:914 msgid "" "Support for `name aliases `__ has been added." @@ -1404,11 +1408,11 @@ msgstr "" "已新增對\\ `名稱別名 (name alias) `__\\ 的支援。" -#: ../../reference/lexical_analysis.rst:913 +#: ../../reference/lexical_analysis.rst:921 msgid "Hexadecimal Unicode characters" msgstr "十六進位 Unicode 字元" -#: ../../reference/lexical_analysis.rst:915 +#: ../../reference/lexical_analysis.rst:923 msgid "" "These sequences :samp:`\\\\u{xxxx}` and :samp:`\\\\U{xxxxxxxx}` denote the " "Unicode character with the given hex (base 16) value. Exactly four digits " @@ -1416,7 +1420,7 @@ msgid "" "latter can encode any Unicode character." msgstr "" -#: ../../reference/lexical_analysis.rst:921 +#: ../../reference/lexical_analysis.rst:929 msgid "" ">>> '\\u1234'\n" "'ሴ'\n" @@ -1428,21 +1432,21 @@ msgstr "" ">>> '\\U0001f40d'\n" "'🐍'" -#: ../../reference/lexical_analysis.rst:928 +#: ../../reference/lexical_analysis.rst:936 msgid "These sequences cannot appear in :ref:`bytes literals `." msgstr "" -#: ../../reference/lexical_analysis.rst:934 +#: ../../reference/lexical_analysis.rst:942 msgid "Unrecognized escape sequences" msgstr "無法辨識的跳脫序列" -#: ../../reference/lexical_analysis.rst:936 +#: ../../reference/lexical_analysis.rst:944 msgid "" "Unlike in Standard C, all unrecognized escape sequences are left in the " "string unchanged, that is, *the backslash is left in the result*::" msgstr "" -#: ../../reference/lexical_analysis.rst:939 +#: ../../reference/lexical_analysis.rst:947 msgid "" ">>> print('\\q')\n" "\\q\n" @@ -1454,28 +1458,28 @@ msgstr "" ">>> list('\\q')\n" "['\\\\', 'q']" -#: ../../reference/lexical_analysis.rst:944 +#: ../../reference/lexical_analysis.rst:952 msgid "" "Note that for bytes literals, the escape sequences only recognized in string " "literals (``\\N...``, ``\\u...``, ``\\U...``) fall into the category of " "unrecognized escapes." msgstr "" -#: ../../reference/lexical_analysis.rst:948 +#: ../../reference/lexical_analysis.rst:956 msgid "Unrecognized escape sequences produce a :exc:`DeprecationWarning`." msgstr "" -#: ../../reference/lexical_analysis.rst:951 +#: ../../reference/lexical_analysis.rst:959 msgid "" "Unrecognized escape sequences produce a :exc:`SyntaxWarning`. In a future " "Python version they will raise a :exc:`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:964 +#: ../../reference/lexical_analysis.rst:972 msgid "Bytes literals" msgstr "位元組常數" -#: ../../reference/lexical_analysis.rst:966 +#: ../../reference/lexical_analysis.rst:974 msgid "" ":dfn:`Bytes literals` are always prefixed with '``b``' or '``B``'; they " "produce an instance of the :class:`bytes` type instead of the :class:`str` " @@ -1484,7 +1488,7 @@ msgid "" "`string-escape-hex` or :ref:`string-escape-oct`):" msgstr "" -#: ../../reference/lexical_analysis.rst:972 +#: ../../reference/lexical_analysis.rst:980 msgid "" ">>> b'\\x89PNG\\r\\n\\x1a\\n'\n" "b'\\x89PNG\\r\\n\\x1a\\n'\n" @@ -1496,17 +1500,17 @@ msgstr "" ">>> list(b'\\x89PNG\\r\\n\\x1a\\n')\n" "[137, 80, 78, 71, 13, 10, 26, 10]" -#: ../../reference/lexical_analysis.rst:979 +#: ../../reference/lexical_analysis.rst:987 msgid "" "Similarly, a zero byte must be expressed using an escape sequence (typically " "``\\0`` or ``\\x00``)." msgstr "" -#: ../../reference/lexical_analysis.rst:990 +#: ../../reference/lexical_analysis.rst:998 msgid "Raw string literals" msgstr "原始字串常數" -#: ../../reference/lexical_analysis.rst:992 +#: ../../reference/lexical_analysis.rst:1000 msgid "" "Both string and bytes literals may optionally be prefixed with a letter " "'``r``' or '``R``'; such constructs are called :dfn:`raw string literals` " @@ -1515,7 +1519,7 @@ msgid "" "` are not treated specially:" msgstr "" -#: ../../reference/lexical_analysis.rst:999 +#: ../../reference/lexical_analysis.rst:1007 msgid "" ">>> r'\\d{4}-\\d{2}-\\d{2}'\n" "'\\\\d{4}-\\\\d{2}-\\\\d{2}'" @@ -1523,7 +1527,7 @@ msgstr "" ">>> r'\\d{4}-\\d{2}-\\d{2}'\n" "'\\\\d{4}-\\\\d{2}-\\\\d{2}'" -#: ../../reference/lexical_analysis.rst:1004 +#: ../../reference/lexical_analysis.rst:1012 msgid "" "Even in a raw literal, quotes can be escaped with a backslash, but the " "backslash remains in the result; for example, ``r\"\\\"\"`` is a valid " @@ -1536,165 +1540,99 @@ msgid "" "continuation." msgstr "" -#: ../../reference/lexical_analysis.rst:1032 +#: ../../reference/lexical_analysis.rst:1040 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../reference/lexical_analysis.rst:1036 -msgid "" -"A :dfn:`formatted string literal` or :dfn:`f-string` is a string literal " -"that is prefixed with '``f``' or '``F``'. These strings may contain " -"replacement fields, which are expressions delimited by curly braces ``{}``. " -"While other string literals always have a constant value, formatted strings " -"are really expressions evaluated at run time." -msgstr "" - -#: ../../reference/lexical_analysis.rst:1042 +#: ../../reference/lexical_analysis.rst:1043 msgid "" -"Escape sequences are decoded like in ordinary string literals (except when a " -"literal is also marked as a raw string). After decoding, the grammar for " -"the contents of the string is:" +"The :keyword:`await` and :keyword:`async for` can be used in expressions " +"within f-strings." msgstr "" -#: ../../reference/lexical_analysis.rst:1056 -msgid "" -"The parts of the string outside curly braces are treated literally, except " -"that any doubled curly braces ``'{{'`` or ``'}}'`` are replaced with the " -"corresponding single curly brace. A single opening curly bracket ``'{'`` " -"marks a replacement field, which starts with a Python expression. To display " -"both the expression text and its value after evaluation, (useful in " -"debugging), an equal sign ``'='`` may be added after the expression. A " -"conversion field, introduced by an exclamation point ``'!'`` may follow. A " -"format specifier may also be appended, introduced by a colon ``':'``. A " -"replacement field ends with a closing curly bracket ``'}'``." +#: ../../reference/lexical_analysis.rst:1046 +msgid "Added the debug specifier (``=``)" msgstr "" -#: ../../reference/lexical_analysis.rst:1066 +#: ../../reference/lexical_analysis.rst:1048 msgid "" -"Expressions in formatted string literals are treated like regular Python " -"expressions surrounded by parentheses, with a few exceptions. An empty " -"expression is not allowed, and both :keyword:`lambda` and assignment " -"expressions ``:=`` must be surrounded by explicit parentheses. Each " -"expression is evaluated in the context where the formatted string literal " -"appears, in order from left to right. Replacement expressions can contain " -"newlines in both single-quoted and triple-quoted f-strings and they can " -"contain comments. Everything that comes after a ``#`` inside a replacement " -"field is a comment (even closing braces and quotes). In that case, " -"replacement fields must be closed in a different line." +"Many restrictions on expressions within f-strings have been removed. " +"Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../reference/lexical_analysis.rst:1077 +#: ../../reference/lexical_analysis.rst:1052 msgid "" -">>> f\"abc{a # This is a comment }\"\n" -"... + 3}\"\n" -"'abc5'" +"A :dfn:`formatted string literal` or :dfn:`f-string` is a string literal " +"that is prefixed with '``f``' or '``F``'. Unlike other string literals, f-" +"strings do not have a constant value. They may contain *replacement fields* " +"delimited by curly braces ``{}``. Replacement fields contain expressions " +"which are evaluated at run time. For example::" msgstr "" -">>> f\"abc{a # This is a comment }\"\n" -"... + 3}\"\n" -"'abc5'" -#: ../../reference/lexical_analysis.rst:1083 +#: ../../reference/lexical_analysis.rst:1059 msgid "" -"Prior to Python 3.7, an :keyword:`await` expression and comprehensions " -"containing an :keyword:`async for` clause were illegal in the expressions in " -"formatted string literals due to a problem with the implementation." +">>> who = 'nobody'\n" +">>> nationality = 'Spanish'\n" +">>> f'{who.title()} expects the {nationality} Inquisition!'\n" +"'Nobody expects the Spanish Inquisition!'" msgstr "" -#: ../../reference/lexical_analysis.rst:1088 +#: ../../reference/lexical_analysis.rst:1064 msgid "" -"Prior to Python 3.12, comments were not allowed inside f-string replacement " -"fields." +"Any doubled curly braces (``{{`` or ``}}``) outside replacement fields are " +"replaced with the corresponding single curly brace::" msgstr "" -#: ../../reference/lexical_analysis.rst:1092 +#: ../../reference/lexical_analysis.rst:1067 msgid "" -"When the equal sign ``'='`` is provided, the output will have the expression " -"text, the ``'='`` and the evaluated value. Spaces after the opening brace " -"``'{'``, within the expression and after the ``'='`` are all retained in the " -"output. By default, the ``'='`` causes the :func:`repr` of the expression to " -"be provided, unless there is a format specified. When a format is specified " -"it defaults to the :func:`str` of the expression unless a conversion ``'!" -"r'`` is declared." +">>> print(f'{{...}}')\n" +"{...}" msgstr "" -#: ../../reference/lexical_analysis.rst:1100 -msgid "The equal sign ``'='``." -msgstr "等號 ``'='``。" - -#: ../../reference/lexical_analysis.rst:1103 +#: ../../reference/lexical_analysis.rst:1070 msgid "" -"If a conversion is specified, the result of evaluating the expression is " -"converted before formatting. Conversion ``'!s'`` calls :func:`str` on the " -"result, ``'!r'`` calls :func:`repr`, and ``'!a'`` calls :func:`ascii`." +"Other characters outside replacement fields are treated like in ordinary " +"string literals. This means that escape sequences are decoded (except when a " +"literal is also marked as a raw string), and newlines are possible in triple-" +"quoted f-strings::" msgstr "" -#: ../../reference/lexical_analysis.rst:1107 +#: ../../reference/lexical_analysis.rst:1076 msgid "" -"The result is then formatted using the :func:`format` protocol. The format " -"specifier is passed to the :meth:`~object.__format__` method of the " -"expression or conversion result. An empty string is passed when the format " -"specifier is omitted. The formatted result is then included in the final " -"value of the whole string." +">>> name = 'Galahad'\n" +">>> favorite_color = 'blue'\n" +">>> print(f'{name}:\\t{favorite_color}')\n" +"Galahad: blue\n" +">>> print(rf\"C:\\Users\\{name}\")\n" +"C:\\Users\\Galahad\n" +">>> print(f'''Three shall be the number of the counting\n" +"... and the number of the counting shall be three.''')\n" +"Three shall be the number of the counting\n" +"and the number of the counting shall be three." msgstr "" -#: ../../reference/lexical_analysis.rst:1113 +#: ../../reference/lexical_analysis.rst:1087 msgid "" -"Top-level format specifiers may include nested replacement fields. These " -"nested fields may include their own conversion fields and :ref:`format " -"specifiers `, but may not include more deeply nested replacement " -"fields. The :ref:`format specifier mini-language ` is the same " -"as that used by the :meth:`str.format` method." +"Expressions in formatted string literals are treated like regular Python " +"expressions. Each expression is evaluated in the context where the formatted " +"string literal appears, in order from left to right. An empty expression is " +"not allowed, and both :keyword:`lambda` and assignment expressions ``:=`` " +"must be surrounded by explicit parentheses::" msgstr "" -#: ../../reference/lexical_analysis.rst:1119 +#: ../../reference/lexical_analysis.rst:1094 msgid "" -"Formatted string literals may be concatenated, but replacement fields cannot " -"be split across literals." -msgstr "" - -#: ../../reference/lexical_analysis.rst:1122 -msgid "Some examples of formatted string literals::" +">>> f'{(half := 1/2)}, {half * 42}'\n" +"'0.5, 21.0'" msgstr "" -#: ../../reference/lexical_analysis.rst:1124 -msgid "" -">>> name = \"Fred\"\n" -">>> f\"He said his name is {name!r}.\"\n" -"\"He said his name is 'Fred'.\"\n" -">>> f\"He said his name is {repr(name)}.\" # repr() is equivalent to !r\n" -"\"He said his name is 'Fred'.\"\n" -">>> width = 10\n" -">>> precision = 4\n" -">>> value = decimal.Decimal(\"12.34567\")\n" -">>> f\"result: {value:{width}.{precision}}\" # nested fields\n" -"'result: 12.35'\n" -">>> today = datetime(year=2017, month=1, day=27)\n" -">>> f\"{today:%B %d, %Y}\" # using date format specifier\n" -"'January 27, 2017'\n" -">>> f\"{today=:%B %d, %Y}\" # using date format specifier and debugging\n" -"'today=January 27, 2017'\n" -">>> number = 1024\n" -">>> f\"{number:#0x}\" # using integer format specifier\n" -"'0x400'\n" -">>> foo = \"bar\"\n" -">>> f\"{ foo = }\" # preserves whitespace\n" -"\" foo = 'bar'\"\n" -">>> line = \"The mill's closed\"\n" -">>> f\"{line = }\"\n" -"'line = \"The mill\\'s closed\"'\n" -">>> f\"{line = :20}\"\n" -"\"line = The mill's closed \"\n" -">>> f\"{line = !r:20}\"\n" -"'line = \"The mill\\'s closed\" '" -msgstr "" - -#: ../../reference/lexical_analysis.rst:1154 +#: ../../reference/lexical_analysis.rst:1097 msgid "" "Reusing the outer f-string quoting type inside a replacement field is " "permitted::" msgstr "" -#: ../../reference/lexical_analysis.rst:1157 +#: ../../reference/lexical_analysis.rst:1100 msgid "" ">>> a = dict(x=2)\n" ">>> f\"abc {a[\"x\"]} def\"\n" @@ -1704,19 +1642,13 @@ msgstr "" ">>> f\"abc {a[\"x\"]} def\"\n" "'abc 2 def'" -#: ../../reference/lexical_analysis.rst:1161 -msgid "" -"Prior to Python 3.12, reuse of the same quoting type of the outer f-string " -"inside a replacement field was not possible." -msgstr "" - -#: ../../reference/lexical_analysis.rst:1165 +#: ../../reference/lexical_analysis.rst:1104 msgid "" "Backslashes are also allowed in replacement fields and are evaluated the " "same way as in any other context::" msgstr "" -#: ../../reference/lexical_analysis.rst:1168 +#: ../../reference/lexical_analysis.rst:1107 msgid "" ">>> a = [\"a\", \"b\", \"c\"]\n" ">>> print(f\"List a contains:\\n{\"\\n\".join(a)}\")\n" @@ -1732,25 +1664,132 @@ msgstr "" "b\n" "c" +#: ../../reference/lexical_analysis.rst:1114 +msgid "It is possible to nest f-strings::" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1116 +msgid "" +">>> name = 'world'\n" +">>> f'Repeated:{f' hello {name}' * 3}'\n" +"'Repeated: hello world hello world hello world'" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1120 +msgid "Portable Python programs should not use more than 5 levels of nesting." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1124 +msgid "CPython does not limit nesting of f-strings." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1126 +msgid "" +"Replacement expressions can contain newlines in both single-quoted and " +"triple-quoted f-strings and they can contain comments. Everything that comes " +"after a ``#`` inside a replacement field is a comment (even closing braces " +"and quotes). This means that replacement fields with comments must be closed " +"in a different line:" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1133 +#, fuzzy +msgid "" +">>> a = 2\n" +">>> f\"abc{a # This comment }\" continues until the end of the line\n" +"... + 3}\"\n" +"'abc5'" +msgstr "" +">>> f\"abc{a # This is a comment }\"\n" +"... + 3}\"\n" +"'abc5'" + +#: ../../reference/lexical_analysis.rst:1140 +msgid "After the expression, replacement fields may optionally contain:" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1142 +msgid "" +"a *debug specifier* -- an equal sign (``=``), optionally surrounded by " +"whitespace on one or both sides;" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1144 +msgid "a *conversion specifier* -- ``!s``, ``!r`` or ``!a``; and/or" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1145 +msgid "a *format specifier* prefixed with a colon (``:``)." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1147 +msgid "" +"See the :ref:`Standard Library section on f-strings ` for " +"details on how these fields are evaluated." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1150 +msgid "" +"As that section explains, *format specifiers* are passed as the second " +"argument to the :func:`format` function to format a replacement field value. " +"For example, they can be used to specify a field width and padding " +"characters using the :ref:`Format Specification Mini-Language `::" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1155 +msgid "" +">>> number = 14.3\n" +">>> f'{number:20.7f}'\n" +"' 14.3000000'" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1159 +msgid "Top-level format specifiers may include nested replacement fields::" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1161 +msgid "" +">>> field_size = 20\n" +">>> precision = 7\n" +">>> f'{number:{field_size}.{precision}f}'\n" +"' 14.3000000'" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1166 +msgid "" +"These nested fields may include their own conversion fields and :ref:`format " +"specifiers `::" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1169 +msgid "" +">>> number = 3\n" +">>> f'{number:{field_size}}'\n" +"' 3'\n" +">>> f'{number:{field_size:05}}'\n" +"'00000000000000000003'" +msgstr "" + #: ../../reference/lexical_analysis.rst:1175 msgid "" -"Prior to Python 3.12, backslashes were not permitted inside an f-string " -"replacement field." +"However, these nested fields may not include more deeply nested replacement " +"fields." msgstr "" -#: ../../reference/lexical_analysis.rst:1179 +#: ../../reference/lexical_analysis.rst:1178 msgid "" -"Formatted string literals cannot be used as docstrings, even if they do not " -"include expressions." +"Formatted string literals cannot be used as :term:`docstrings `, " +"even if they do not include expressions::" msgstr "" -#: ../../reference/lexical_analysis.rst:1184 +#: ../../reference/lexical_analysis.rst:1181 +#, fuzzy msgid "" ">>> def foo():\n" "... f\"Not a docstring\"\n" "...\n" -">>> foo.__doc__ is None\n" -"True" +">>> print(foo.__doc__)\n" +"None" msgstr "" ">>> def foo():\n" "... f\"Not a docstring\"\n" @@ -1758,10 +1797,16 @@ msgstr "" ">>> foo.__doc__ is None\n" "True" +#: ../../reference/lexical_analysis.rst:1189 +msgid ":pep:`498` -- Literal String Interpolation" +msgstr "" + #: ../../reference/lexical_analysis.rst:1190 -msgid "" -"See also :pep:`498` for the proposal that added formatted string literals, " -"and :meth:`str.format`, which uses a related format string mechanism." +msgid ":pep:`701` -- Syntactic formalization of f-strings" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1191 +msgid ":meth:`str.format`, which uses a related format string mechanism." msgstr "" #: ../../reference/lexical_analysis.rst:1198 @@ -1772,58 +1817,98 @@ msgstr "t-string(t 字串)" msgid "" "A :dfn:`template string literal` or :dfn:`t-string` is a string literal that " "is prefixed with '``t``' or '``T``'. These strings follow the same syntax " -"and evaluation rules as :ref:`formatted string literals `, with " -"the following differences:" +"rules as :ref:`formatted string literals `. For differences in " +"evaluation rules, see the :ref:`Standard Library section on t-strings " +"`" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1211 +msgid "Formal grammar for f-strings" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1213 +msgid "" +"F-strings are handled partly by the :term:`lexical analyzer`, which produces " +"the tokens :py:data:`~token.FSTRING_START`, :py:data:`~token.FSTRING_MIDDLE` " +"and :py:data:`~token.FSTRING_END`, and partly by the parser, which handles " +"expressions in the replacement field. The exact way the work is split is a " +"CPython implementation detail." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1219 +msgid "" +"Correspondingly, the f-string grammar is a mix of :ref:`lexical and " +"syntactic definitions `." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1222 +msgid "Whitespace is significant in these situations:" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1224 +msgid "" +"There may be no whitespace in :py:data:`~token.FSTRING_START` (between the " +"prefix and quote)." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1226 +msgid "" +"Whitespace in :py:data:`~token.FSTRING_MIDDLE` is part of the literal string " +"contents." msgstr "" -#: ../../reference/lexical_analysis.rst:1207 +#: ../../reference/lexical_analysis.rst:1228 msgid "" -"Rather than evaluating to a ``str`` object, template string literals " -"evaluate to a :class:`string.templatelib.Template` object." +"In ``fstring_replacement_field``, if ``f_debug_specifier`` is present, all " +"whitespace after the opening brace until the ``f_debug_specifier``, as well " +"as whitespace immediatelly following ``f_debug_specifier``, is retained as " +"part of the expression." msgstr "" -#: ../../reference/lexical_analysis.rst:1210 +#: ../../reference/lexical_analysis.rst:1235 msgid "" -"The :func:`format` protocol is not used. Instead, the format specifier and " -"conversions (if any) are passed to a new :class:`~string.templatelib." -"Interpolation` object that is created for each evaluated expression. It is " -"up to code that processes the resulting :class:`~string.templatelib." -"Template` object to decide how to handle format specifiers and conversions." +"The expression is not handled in the tokenization phase; it is retrieved " +"from the source code using locations of the ``{`` token and the token after " +"``=``." msgstr "" -#: ../../reference/lexical_analysis.rst:1217 +#: ../../reference/lexical_analysis.rst:1240 msgid "" -"Format specifiers containing nested replacement fields are evaluated " -"eagerly, prior to being passed to the :class:`~string.templatelib." -"Interpolation` object. For instance, an interpolation of the form ``{amount:." -"{precision}f}`` will evaluate the inner expression ``{precision}`` to " -"determine the value of the ``format_spec`` attribute. If ``precision`` were " -"to be ``2``, the resulting format specifier would be ``'.2f'``." +"The ``FSTRING_MIDDLE`` definition uses :ref:`negative lookaheads ` (``!``) to indicate special characters (backslash, newline, " +"``{``, ``}``) and sequences (``f_quote``)." msgstr "" -#: ../../reference/lexical_analysis.rst:1225 +#: ../../reference/lexical_analysis.rst:1281 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 " -"relevant interpolation. This includes the equals sign and any surrounding " -"whitespace. The :class:`!Interpolation` instance for the expression will be " -"created as normal, except that :attr:`~string.templatelib.Interpolation." -"conversion` will be set to '``r``' (:func:`repr`) by default. If an explicit " -"conversion or format specifier are provided, this will override the default " -"behaviour." +"In the above grammar snippet, the ``f_quote`` and ``FSTRING_MIDDLE`` rules " +"are context-sensitive -- they depend on the contents of ``FSTRING_START`` of " +"the nearest enclosing ``fstring``." msgstr "" -#: ../../reference/lexical_analysis.rst:1239 +#: ../../reference/lexical_analysis.rst:1285 +msgid "" +"Constructing a more traditional formal grammar from this template is left as " +"an exercise for the reader." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1288 +msgid "" +"The grammar for t-strings is identical to the one for f-strings, with *t* " +"instead of *f* at the beginning of rule and token names and in the prefix." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1302 msgid "Numeric literals" msgstr "" -#: ../../reference/lexical_analysis.rst:1245 +#: ../../reference/lexical_analysis.rst:1308 msgid "" ":data:`~token.NUMBER` tokens represent numeric literals, of which there are " "three types: integers, floating-point numbers, and imaginary numbers." msgstr "" -#: ../../reference/lexical_analysis.rst:1253 +#: ../../reference/lexical_analysis.rst:1316 msgid "" "The numeric value of a numeric literal is the same as if it were passed as a " "string to the :class:`int`, :class:`float` or :class:`complex` class " @@ -1831,21 +1916,21 @@ msgid "" "constructors are also valid literals." msgstr "" -#: ../../reference/lexical_analysis.rst:1258 +#: ../../reference/lexical_analysis.rst:1321 msgid "" "Numeric literals do not include a sign; a phrase like ``-1`` is actually an " "expression composed of the unary operator '``-``' and the literal ``1``." msgstr "" -#: ../../reference/lexical_analysis.rst:1272 +#: ../../reference/lexical_analysis.rst:1335 msgid "Integer literals" msgstr "" -#: ../../reference/lexical_analysis.rst:1274 +#: ../../reference/lexical_analysis.rst:1337 msgid "Integer literals denote whole numbers. For example::" msgstr "" -#: ../../reference/lexical_analysis.rst:1276 +#: ../../reference/lexical_analysis.rst:1339 msgid "" "7\n" "3\n" @@ -1855,24 +1940,24 @@ msgstr "" "3\n" "2147483647" -#: ../../reference/lexical_analysis.rst:1280 +#: ../../reference/lexical_analysis.rst:1343 msgid "" "There is no limit for the length of integer literals apart from what can be " "stored in available memory::" msgstr "" -#: ../../reference/lexical_analysis.rst:1283 +#: ../../reference/lexical_analysis.rst:1346 msgid "7922816251426433759354395033679228162514264337593543950336" msgstr "7922816251426433759354395033679228162514264337593543950336" -#: ../../reference/lexical_analysis.rst:1285 +#: ../../reference/lexical_analysis.rst:1348 msgid "" "Underscores can be used to group digits for enhanced readability, and are " "ignored for determining the numeric value of the literal. For example, the " "following literals are equivalent::" msgstr "" -#: ../../reference/lexical_analysis.rst:1289 +#: ../../reference/lexical_analysis.rst:1352 msgid "" "100_000_000_000\n" "100000000000\n" @@ -1882,13 +1967,13 @@ msgstr "" "100000000000\n" "1_00_00_00_00_000" -#: ../../reference/lexical_analysis.rst:1293 +#: ../../reference/lexical_analysis.rst:1356 msgid "" "Underscores can only occur between digits. For example, ``_123``, ``321_``, " "and ``123__321`` are *not* valid literals." msgstr "" -#: ../../reference/lexical_analysis.rst:1296 +#: ../../reference/lexical_analysis.rst:1359 msgid "" "Integers can be specified in binary (base 2), octal (base 8), or hexadecimal " "(base 16) using the prefixes ``0b``, ``0o`` and ``0x``, respectively. " @@ -1896,7 +1981,7 @@ msgid "" "case-insensitive. For example::" msgstr "" -#: ../../reference/lexical_analysis.rst:1301 +#: ../../reference/lexical_analysis.rst:1364 msgid "" "0b100110111\n" "0b_1110_0101\n" @@ -1912,47 +1997,47 @@ msgstr "" "0xdeadbeef\n" "0xDead_Beef" -#: ../../reference/lexical_analysis.rst:1308 +#: ../../reference/lexical_analysis.rst:1371 msgid "" "An underscore can follow the base specifier. For example, ``0x_1f`` is a " "valid literal, but ``0_x1f`` and ``0x__1f`` are not." msgstr "" -#: ../../reference/lexical_analysis.rst:1312 +#: ../../reference/lexical_analysis.rst:1375 msgid "" "Leading zeros in a non-zero decimal number are not allowed. For example, " "``0123`` is not a valid literal. This is for disambiguation with C-style " "octal literals, which Python used before version 3.0." msgstr "" -#: ../../reference/lexical_analysis.rst:1317 +#: ../../reference/lexical_analysis.rst:1380 msgid "" "Formally, integer literals are described by the following lexical " "definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:1334 -#: ../../reference/lexical_analysis.rst:1398 +#: ../../reference/lexical_analysis.rst:1397 +#: ../../reference/lexical_analysis.rst:1461 msgid "Underscores are now allowed for grouping purposes in literals." msgstr "" -#: ../../reference/lexical_analysis.rst:1345 +#: ../../reference/lexical_analysis.rst:1408 msgid "Floating-point literals" msgstr "浮點數常數 (Floating-point literals)" -#: ../../reference/lexical_analysis.rst:1347 +#: ../../reference/lexical_analysis.rst:1410 msgid "" "Floating-point (float) literals, such as ``3.14`` or ``1.5``, denote :ref:" "`approximations of real numbers `." msgstr "" -#: ../../reference/lexical_analysis.rst:1350 +#: ../../reference/lexical_analysis.rst:1413 msgid "" "They consist of *integer* and *fraction* parts, each composed of decimal " "digits. The parts are separated by a decimal point, ``.``::" msgstr "" -#: ../../reference/lexical_analysis.rst:1353 +#: ../../reference/lexical_analysis.rst:1416 msgid "" "2.71828\n" "4.0" @@ -1960,19 +2045,19 @@ msgstr "" "2.71828\n" "4.0" -#: ../../reference/lexical_analysis.rst:1356 +#: ../../reference/lexical_analysis.rst:1419 msgid "" "Unlike in integer literals, leading zeros are allowed. For example, " "``077.010`` is legal, and denotes the same number as ``77.01``." msgstr "" -#: ../../reference/lexical_analysis.rst:1359 +#: ../../reference/lexical_analysis.rst:1422 msgid "" "As in integer literals, single underscores may occur between digits to help " "readability::" msgstr "" -#: ../../reference/lexical_analysis.rst:1362 +#: ../../reference/lexical_analysis.rst:1425 msgid "" "96_485.332_123\n" "3.14_15_93" @@ -1980,11 +2065,11 @@ msgstr "" "96_485.332_123\n" "3.14_15_93" -#: ../../reference/lexical_analysis.rst:1365 +#: ../../reference/lexical_analysis.rst:1428 msgid "Either of these parts, but not both, can be empty. For example::" msgstr "" -#: ../../reference/lexical_analysis.rst:1367 +#: ../../reference/lexical_analysis.rst:1430 msgid "" "10. # (equivalent to 10.0)\n" ".001 # (equivalent to 0.001)" @@ -1992,7 +2077,7 @@ msgstr "" "10. # (相當於 10.0)\n" ".001 # (相當於 0.001)" -#: ../../reference/lexical_analysis.rst:1370 +#: ../../reference/lexical_analysis.rst:1433 msgid "" "Optionally, the integer and fraction may be followed by an *exponent*: the " "letter ``e`` or ``E``, followed by an optional sign, ``+`` or ``-``, and a " @@ -2000,20 +2085,20 @@ msgid "" "``E`` represents \"times ten raised to the power of\"::" msgstr "" -#: ../../reference/lexical_analysis.rst:1375 +#: ../../reference/lexical_analysis.rst:1438 msgid "" "1.0e3 # (represents 1.0×10³, or 1000.0)\n" "1.166e-5 # (represents 1.166×10⁻⁵, or 0.00001166)\n" "6.02214076e+23 # (represents 6.02214076×10²³, or 602214076000000000000000.)" msgstr "" -#: ../../reference/lexical_analysis.rst:1379 +#: ../../reference/lexical_analysis.rst:1442 msgid "" "In floats with only integer and exponent parts, the decimal point may be " "omitted::" msgstr "" -#: ../../reference/lexical_analysis.rst:1382 +#: ../../reference/lexical_analysis.rst:1445 msgid "" "1e3 # (equivalent to 1.e3 and 1.0e3)\n" "0e0 # (equivalent to 0.)" @@ -2021,35 +2106,35 @@ msgstr "" "1e3 # (相當於 1.e3 和 1.0e3)\n" "0e0 # (相當於 0.)" -#: ../../reference/lexical_analysis.rst:1385 +#: ../../reference/lexical_analysis.rst:1448 msgid "" "Formally, floating-point literals are described by the following lexical " "definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:1407 +#: ../../reference/lexical_analysis.rst:1470 msgid "Imaginary literals" msgstr "" -#: ../../reference/lexical_analysis.rst:1409 +#: ../../reference/lexical_analysis.rst:1472 msgid "" "Python has :ref:`complex number ` objects, but no complex " "literals. Instead, *imaginary literals* denote complex numbers with a zero " "real part." msgstr "" -#: ../../reference/lexical_analysis.rst:1414 +#: ../../reference/lexical_analysis.rst:1477 msgid "" "For example, in math, the complex number 3+4.2\\ *i* is written as the real " "number 3 added to the imaginary number 4.2\\ *i*. Python uses a similar " "syntax, except the imaginary unit is written as ``j`` rather than *i*::" msgstr "" -#: ../../reference/lexical_analysis.rst:1419 +#: ../../reference/lexical_analysis.rst:1482 msgid "3+4.2j" msgstr "3+4.2j" -#: ../../reference/lexical_analysis.rst:1421 +#: ../../reference/lexical_analysis.rst:1484 msgid "" "This is an expression composed of the :ref:`integer literal ` " "``3``, the :ref:`operator ` '``+``', and the :ref:`imaginary " @@ -2057,23 +2142,23 @@ msgid "" "whitespace is allowed between them::" msgstr "" -#: ../../reference/lexical_analysis.rst:1427 +#: ../../reference/lexical_analysis.rst:1490 msgid "3 + 4.2j" msgstr "3 + 4.2j" -#: ../../reference/lexical_analysis.rst:1429 +#: ../../reference/lexical_analysis.rst:1492 msgid "" "No whitespace is allowed *within* each token. In particular, the ``j`` " "suffix, may not be separated from the number before it." msgstr "" -#: ../../reference/lexical_analysis.rst:1433 +#: ../../reference/lexical_analysis.rst:1496 msgid "" "The number before the ``j`` has the same syntax as a floating-point literal. " "Thus, the following are valid imaginary literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:1436 +#: ../../reference/lexical_analysis.rst:1499 msgid "" "4.2j\n" "3.14j\n" @@ -2091,14 +2176,14 @@ msgstr "" "3.14e-10j\n" "3.14_15_93j" -#: ../../reference/lexical_analysis.rst:1444 +#: ../../reference/lexical_analysis.rst:1507 msgid "" "Unlike in a floating-point literal the decimal point can be omitted if the " "imaginary number only has an integer part. The number is still evaluated as " "a floating-point number, not an integer::" msgstr "" -#: ../../reference/lexical_analysis.rst:1448 +#: ../../reference/lexical_analysis.rst:1511 msgid "" "10j\n" "0j\n" @@ -2108,26 +2193,26 @@ msgstr "" "0j\n" "1000000000000000000000000j # 相當於 1e+24j" -#: ../../reference/lexical_analysis.rst:1452 +#: ../../reference/lexical_analysis.rst:1515 msgid "" "The ``j`` suffix is case-insensitive. That means you can use ``J`` instead::" msgstr "" -#: ../../reference/lexical_analysis.rst:1455 +#: ../../reference/lexical_analysis.rst:1518 msgid "3.14J # equivalent to 3.14j" msgstr "" -#: ../../reference/lexical_analysis.rst:1457 +#: ../../reference/lexical_analysis.rst:1520 msgid "" "Formally, imaginary literals are described by the following lexical " "definition:" msgstr "" -#: ../../reference/lexical_analysis.rst:1470 +#: ../../reference/lexical_analysis.rst:1533 msgid "Operators and delimiters" msgstr "" -#: ../../reference/lexical_analysis.rst:1476 +#: ../../reference/lexical_analysis.rst:1539 msgid "" "The following grammar defines :dfn:`operator` and :dfn:`delimiter` tokens, " "that is, the generic :data:`~token.OP` token type. A :ref:`list of these " @@ -2135,14 +2220,14 @@ msgid "" "the :mod:`!token` module documentation." msgstr "" -#: ../../reference/lexical_analysis.rst:1505 +#: ../../reference/lexical_analysis.rst:1568 msgid "" "Generally, *operators* are used to combine :ref:`expressions `, " "while *delimiters* serve other purposes. However, there is no clear, formal " "distinction between the two categories." msgstr "" -#: ../../reference/lexical_analysis.rst:1509 +#: ../../reference/lexical_analysis.rst:1572 msgid "" "Some tokens can serve as either operators or delimiters, depending on usage. " "For example, ``*`` is both the multiplication operator and a delimiter used " @@ -2150,20 +2235,20 @@ msgid "" "delimiter that introduces decorators." msgstr "" -#: ../../reference/lexical_analysis.rst:1514 +#: ../../reference/lexical_analysis.rst:1577 msgid "" "For some tokens, the distinction is unclear. For example, some people " "consider ``.``, ``(``, and ``)`` to be delimiters, while others see the :py:" "func:`getattr` operator and the function call operator(s)." msgstr "" -#: ../../reference/lexical_analysis.rst:1518 +#: ../../reference/lexical_analysis.rst:1581 msgid "" "Some of Python's operators, like ``and``, ``or``, and ``not in``, use :ref:" "`keyword ` tokens rather than \"symbols\" (operator tokens)." msgstr "" -#: ../../reference/lexical_analysis.rst:1521 +#: ../../reference/lexical_analysis.rst:1584 msgid "" "A sequence of three consecutive periods (``...``) has a special meaning as " "an :py:data:`Ellipsis` literal." @@ -2191,7 +2276,7 @@ msgstr "logical line(邏輯列)" #: ../../reference/lexical_analysis.rst:100 #: ../../reference/lexical_analysis.rst:205 -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "physical line" msgstr "physical line(物理列)" @@ -2265,314 +2350,317 @@ msgstr "INDENT token(縮排標誌)" msgid "DEDENT token" msgstr "DEDENT token(縮排標誌)" -#: ../../reference/lexical_analysis.rst:384 +#: ../../reference/lexical_analysis.rst:392 msgid "identifier" msgstr "identifier(識別器)" -#: ../../reference/lexical_analysis.rst:384 +#: ../../reference/lexical_analysis.rst:392 msgid "name" msgstr "name(名稱)" -#: ../../reference/lexical_analysis.rst:419 -#: ../../reference/lexical_analysis.rst:443 +#: ../../reference/lexical_analysis.rst:427 +#: ../../reference/lexical_analysis.rst:451 msgid "keyword" msgstr "keyword(關鍵字)" -#: ../../reference/lexical_analysis.rst:419 +#: ../../reference/lexical_analysis.rst:427 msgid "reserved word" msgstr "reserved word(保留字)" -#: ../../reference/lexical_analysis.rst:443 +#: ../../reference/lexical_analysis.rst:451 msgid "soft keyword" msgstr "soft keyword(軟關鍵字)" -#: ../../reference/lexical_analysis.rst:463 +#: ../../reference/lexical_analysis.rst:471 msgid "_, identifiers" msgstr "_, identifiers(識別器)" -#: ../../reference/lexical_analysis.rst:463 +#: ../../reference/lexical_analysis.rst:471 msgid "__, identifiers" msgstr "__, identifiers(識別器)" -#: ../../reference/lexical_analysis.rst:608 +#: ../../reference/lexical_analysis.rst:616 msgid "literal" msgstr "literal(常數)" -#: ../../reference/lexical_analysis.rst:608 +#: ../../reference/lexical_analysis.rst:616 msgid "constant" msgstr "constant(常數)" -#: ../../reference/lexical_analysis.rst:620 -#: ../../reference/lexical_analysis.rst:663 -#: ../../reference/lexical_analysis.rst:688 +#: ../../reference/lexical_analysis.rst:628 +#: ../../reference/lexical_analysis.rst:671 +#: ../../reference/lexical_analysis.rst:696 msgid "string literal" msgstr "string literal(字串常數)" -#: ../../reference/lexical_analysis.rst:620 -#: ../../reference/lexical_analysis.rst:956 +#: ../../reference/lexical_analysis.rst:628 +#: ../../reference/lexical_analysis.rst:964 msgid "bytes literal" msgstr "bytes literal(位元組常數)" -#: ../../reference/lexical_analysis.rst:620 +#: ../../reference/lexical_analysis.rst:628 msgid "ASCII" msgstr "ASCII" -#: ../../reference/lexical_analysis.rst:620 +#: ../../reference/lexical_analysis.rst:628 msgid "' (single quote)" msgstr "' (單引號)" -#: ../../reference/lexical_analysis.rst:620 +#: ../../reference/lexical_analysis.rst:628 msgid "\" (double quote)" msgstr "\" (雙引號)" -#: ../../reference/lexical_analysis.rst:663 +#: ../../reference/lexical_analysis.rst:671 msgid "triple-quoted string" msgstr "triple-quoted string(三引號字串)" -#: ../../reference/lexical_analysis.rst:663 +#: ../../reference/lexical_analysis.rst:671 msgid "\"\"\"" msgstr "\"\"\"" -#: ../../reference/lexical_analysis.rst:663 +#: ../../reference/lexical_analysis.rst:671 msgid "'''" msgstr "'''" -#: ../../reference/lexical_analysis.rst:688 +#: ../../reference/lexical_analysis.rst:696 msgid "u'" msgstr "u'" -#: ../../reference/lexical_analysis.rst:688 +#: ../../reference/lexical_analysis.rst:696 msgid "u\"" msgstr "u\"" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "escape sequence" msgstr "escape sequence(跳脫序列)" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "Standard C" msgstr "Standard C(標準 C)" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "C" msgstr "C" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\\\" msgstr "\\\\" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\a" msgstr "\\a" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\b" msgstr "\\b" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\f" msgstr "\\f" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\n" msgstr "\\n" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\r" msgstr "\\r" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\t" msgstr "\\t" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\v" msgstr "\\v" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\x" msgstr "\\x" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\N" msgstr "\\N" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\u" msgstr "\\u" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\U" msgstr "\\U" -#: ../../reference/lexical_analysis.rst:931 +#: ../../reference/lexical_analysis.rst:939 msgid "unrecognized escape sequence" msgstr "unrecognized escape sequence(無法辨識的跳脫序列)" -#: ../../reference/lexical_analysis.rst:956 +#: ../../reference/lexical_analysis.rst:964 msgid "b'" msgstr "b'" -#: ../../reference/lexical_analysis.rst:956 +#: ../../reference/lexical_analysis.rst:964 msgid "b\"" msgstr "b\"" -#: ../../reference/lexical_analysis.rst:983 +#: ../../reference/lexical_analysis.rst:991 msgid "r'" msgstr "r'" -#: ../../reference/lexical_analysis.rst:983 +#: ../../reference/lexical_analysis.rst:991 msgid "raw string literal" msgstr "raw string literal(原始字串常數)" -#: ../../reference/lexical_analysis.rst:983 +#: ../../reference/lexical_analysis.rst:991 msgid "r\"" msgstr "r\"" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "formatted string literal" msgstr "formatted string literal(格式化字串常數)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "string" msgstr "string(字串)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "f'" msgstr "f'" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "f\"" msgstr "f\"" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid ": (colon)" msgstr ": (冒號)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "= (equals)" msgstr "= (等號)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "for help in debugging using string literals" msgstr "for help in debugging using string literals(使用字串常數進行除錯)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "number" msgstr "number(數字)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "numeric literal" msgstr "numeric literal(數值常數)" -#: ../../reference/lexical_analysis.rst:1241 -#: ../../reference/lexical_analysis.rst:1263 +#: ../../reference/lexical_analysis.rst:1304 +#: ../../reference/lexical_analysis.rst:1326 msgid "integer literal" msgstr "integer literal(整數常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "floating-point literal" msgstr "floating-point literal(浮點數常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "hexadecimal literal" msgstr "hexadecimal literal(十六進位常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "octal literal" msgstr "octal literal(八進位常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "binary literal" msgstr "binary literal(二進位常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "decimal literal" msgstr "decimal literal(十進位常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "imaginary literal" msgstr "imaginary literal(虛數常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "complex literal" msgstr "complex literal(複數常數)" -#: ../../reference/lexical_analysis.rst:1263 +#: ../../reference/lexical_analysis.rst:1326 msgid "0b" msgstr "0b" -#: ../../reference/lexical_analysis.rst:1263 +#: ../../reference/lexical_analysis.rst:1326 msgid "0o" msgstr "0o" -#: ../../reference/lexical_analysis.rst:1263 +#: ../../reference/lexical_analysis.rst:1326 msgid "0x" msgstr "0x" -#: ../../reference/lexical_analysis.rst:1263 -#: ../../reference/lexical_analysis.rst:1338 +#: ../../reference/lexical_analysis.rst:1326 +#: ../../reference/lexical_analysis.rst:1401 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../reference/lexical_analysis.rst:1263 -#: ../../reference/lexical_analysis.rst:1338 -#: ../../reference/lexical_analysis.rst:1402 +#: ../../reference/lexical_analysis.rst:1326 +#: ../../reference/lexical_analysis.rst:1401 +#: ../../reference/lexical_analysis.rst:1465 msgid "in numeric literal" msgstr "於數值常數中" -#: ../../reference/lexical_analysis.rst:1338 +#: ../../reference/lexical_analysis.rst:1401 msgid ". (dot)" msgstr ". (點)" -#: ../../reference/lexical_analysis.rst:1338 +#: ../../reference/lexical_analysis.rst:1401 msgid "e" msgstr "e" -#: ../../reference/lexical_analysis.rst:1402 +#: ../../reference/lexical_analysis.rst:1465 msgid "j" msgstr "j" -#: ../../reference/lexical_analysis.rst:1472 +#: ../../reference/lexical_analysis.rst:1535 msgid "operators" msgstr "operators(運算子)" -#: ../../reference/lexical_analysis.rst:1472 +#: ../../reference/lexical_analysis.rst:1535 msgid "delimiters" msgstr "delimiters(分隔符號)" + +#~ msgid "The equal sign ``'='``." +#~ msgstr "等號 ``'='``。" diff --git a/using/windows.po b/using/windows.po index c3d55265db..4ccb68d515 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: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2025-12-10 00:15+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-" @@ -450,28 +450,32 @@ msgstr "" msgid "" "In addition to the above options, the ``--target`` option will extract the " "runtime to the specified directory instead of doing a normal install. This " -"is useful for embedding runtimes into larger applications." +"is useful for embedding runtimes into larger applications. Unlike a normal " +"install, ``py`` will not be aware of the extracted runtime, and no Start " +"menu or other shortcuts will be created. To launch the runtime, directly " +"execute the main executable (typically ``python.exe``) in the target " +"directory." msgstr "" -#: ../../using/windows.rst:296 +#: ../../using/windows.rst:300 msgid "$> py install ... [-t=|--target=] " msgstr "$> py install ... [-t=|--target=] " -#: ../../using/windows.rst:304 +#: ../../using/windows.rst:308 msgid "Offline installs" msgstr "離線安裝" -#: ../../using/windows.rst:306 +#: ../../using/windows.rst:310 msgid "" "To perform offline installs of Python, you will need to first create an " "offline index on a machine that has network access." msgstr "" -#: ../../using/windows.rst:309 +#: ../../using/windows.rst:313 msgid "$> py install --download= ... ..." msgstr "$> py install --download= ... ..." -#: ../../using/windows.rst:313 +#: ../../using/windows.rst:317 msgid "" "The ``--download=`` option will download the packages for the listed " "tags and create a directory containing them and an ``index.json`` file " @@ -479,17 +483,17 @@ msgid "" "offline machine and used to install one or more of the bundled runtimes:" msgstr "" -#: ../../using/windows.rst:318 +#: ../../using/windows.rst:322 msgid "$> py install --source=\"\\index.json\" ..." msgstr "$> py install --source=\"\\index.json\" ..." -#: ../../using/windows.rst:322 +#: ../../using/windows.rst:326 msgid "" "The Python install manager can be installed by downloading its installer and " "moving it to another machine before installing." msgstr "" -#: ../../using/windows.rst:325 +#: ../../using/windows.rst:329 msgid "" "Alternatively, the ZIP files in an offline index directory can simply be " "transferred to another machine and extracted. This will not register the " @@ -499,32 +503,32 @@ msgid "" "possible or convenient." msgstr "" -#: ../../using/windows.rst:331 +#: ../../using/windows.rst:335 msgid "" "In this way, Python runtimes can be installed and managed on a machine " "without access to the internet." msgstr "" -#: ../../using/windows.rst:336 +#: ../../using/windows.rst:340 msgid "Uninstalling runtimes" msgstr "解除安裝 runtimes" -#: ../../using/windows.rst:338 +#: ../../using/windows.rst:342 msgid "$> py uninstall [-y|--yes] ..." msgstr "$> py uninstall [-y|--yes] ..." -#: ../../using/windows.rst:342 +#: ../../using/windows.rst:346 msgid "" "Runtimes may be removed using the ``py uninstall`` command. One or more tags " "must be specified. Ranges are not supported here." msgstr "" -#: ../../using/windows.rst:345 +#: ../../using/windows.rst:349 msgid "" "The ``--yes`` option bypasses the confirmation prompt before uninstalling." msgstr "" -#: ../../using/windows.rst:347 +#: ../../using/windows.rst:351 msgid "" "Instead of passing tags individually, the ``--purge`` option may be " "specified. This will remove all runtimes managed by the Python install " @@ -533,11 +537,11 @@ msgid "" "not be impacted, and neither will manually created configuration files." msgstr "" -#: ../../using/windows.rst:353 +#: ../../using/windows.rst:357 msgid "$> py uninstall [-y|--yes] --purge" msgstr "" -#: ../../using/windows.rst:357 +#: ../../using/windows.rst:361 msgid "" "The Python install manager can be uninstalled through the Windows " "\"Installed apps\" settings page. This does not remove any runtimes, and " @@ -547,11 +551,11 @@ msgid "" "with ``--purge`` before uninstalling the Python install manager." msgstr "" -#: ../../using/windows.rst:367 +#: ../../using/windows.rst:371 msgid "Configuration" msgstr "設定" -#: ../../using/windows.rst:369 +#: ../../using/windows.rst:373 msgid "" "Python install manager is configured with a hierarchy of configuration " "files, environment variables, command-line options, and registry settings. " @@ -561,66 +565,68 @@ msgid "" "options override all other settings, but not every option is available." msgstr "" -#: ../../using/windows.rst:376 +#: ../../using/windows.rst:380 msgid "" "This section will describe the defaults, but be aware that modified or " "overridden installs may resolve settings differently." msgstr "" -#: ../../using/windows.rst:379 +#: ../../using/windows.rst:383 msgid "" "A global configuration file may be configured by an administrator, and would " "be read first. The user configuration file is stored at :file:`%AppData%\\" -"\\Python\\\\pymanager.json` (by default) and is read next, overwriting any " -"settings from earlier files. An additional configuration file may be " -"specified as the ``PYTHON_MANAGER_CONFIG`` environment variable or the ``--" -"config`` command line option (but not both)." +"\\Python\\\\pymanager.json` (note that this location is under ``Roaming``, " +"not ``Local``) and is read next, overwriting any settings from earlier " +"files. An additional configuration file may be specified as the " +"``PYTHON_MANAGER_CONFIG`` environment variable or the ``--config`` command " +"line option (but not both). These locations may be modified by " +"administrative customization options listed later." msgstr "" -#: ../../using/windows.rst:386 +#: ../../using/windows.rst:393 msgid "" "The following settings are those that are considered likely to be modified " "in normal use. Later sections list those that are intended for " "administrative customization." msgstr "" -#: ../../using/windows.rst:394 +#: ../../using/windows.rst:401 msgid "Standard configuration options" msgstr "" -#: ../../using/windows.rst:398 ../../using/windows.rst:694 +#: ../../using/windows.rst:405 ../../using/windows.rst:701 msgid "Config Key" msgstr "" -#: ../../using/windows.rst:399 +#: ../../using/windows.rst:406 msgid "Environment Variable" msgstr "" -#: ../../using/windows.rst:400 ../../using/windows.rst:695 -#: ../../using/windows.rst:1384 ../../using/windows.rst:1404 -#: ../../using/windows.rst:1994 +#: ../../using/windows.rst:407 ../../using/windows.rst:702 +#: ../../using/windows.rst:1417 ../../using/windows.rst:1437 +#: ../../using/windows.rst:2027 msgid "Description" msgstr "描述" -#: ../../using/windows.rst:402 +#: ../../using/windows.rst:409 msgid "``default_tag``" msgstr "``default_tag``" -#: ../../using/windows.rst:404 +#: ../../using/windows.rst:411 msgid "" "The preferred default version to launch or install. By default, this is " "interpreted as the most recent non-prerelease version from the CPython team." msgstr "" -#: ../../using/windows.rst:408 +#: ../../using/windows.rst:415 msgid "``default_platform``" msgstr "``default_platform``" -#: ../../using/windows.rst:409 +#: ../../using/windows.rst:416 msgid "``PYTHON_MANAGER_DEFAULT_PLATFORM``" msgstr "``PYTHON_MANAGER_DEFAULT_PLATFORM``" -#: ../../using/windows.rst:410 +#: ../../using/windows.rst:417 msgid "" "The preferred default platform to launch or install. This is treated as a " "suffix to the specified tag, such that ``py -V:3.14`` would prefer an " @@ -628,69 +634,69 @@ msgid "" "but will use ``3.14`` if no tagged install exists." msgstr "" -#: ../../using/windows.rst:416 +#: ../../using/windows.rst:423 msgid "``logs_dir``" msgstr "``logs_dir``" -#: ../../using/windows.rst:417 +#: ../../using/windows.rst:424 msgid "``PYTHON_MANAGER_LOGS``" msgstr "``PYTHON_MANAGER_LOGS``" -#: ../../using/windows.rst:418 +#: ../../using/windows.rst:425 msgid "The location where log files are written. By default, :file:`%TEMP%`." msgstr "" -#: ../../using/windows.rst:421 +#: ../../using/windows.rst:428 msgid "``automatic_install``" msgstr "``automatic_install``" -#: ../../using/windows.rst:422 +#: ../../using/windows.rst:429 msgid "``PYTHON_MANAGER_AUTOMATIC_INSTALL``" msgstr "``PYTHON_MANAGER_AUTOMATIC_INSTALL``" -#: ../../using/windows.rst:423 +#: ../../using/windows.rst:430 msgid "" -"True to allow automatic installs when specifying a particular runtime to " -"launch. By default, true." +"True to allow automatic installs when using ``py exec`` to launch. Other " +"commands will not automatically install. By default, true." msgstr "" -#: ../../using/windows.rst:427 +#: ../../using/windows.rst:434 msgid "``include_unmanaged``" msgstr "``include_unmanaged``" -#: ../../using/windows.rst:428 +#: ../../using/windows.rst:435 msgid "``PYTHON_MANAGER_INCLUDE_UNMANAGED``" msgstr "``PYTHON_MANAGER_INCLUDE_UNMANAGED``" -#: ../../using/windows.rst:429 +#: ../../using/windows.rst:436 msgid "" "True to allow listing and launching runtimes that were not installed by the " "Python install manager, or false to exclude them. By default, true." msgstr "" -#: ../../using/windows.rst:433 +#: ../../using/windows.rst:440 msgid "``shebang_can_run_anything``" msgstr "``shebang_can_run_anything``" -#: ../../using/windows.rst:434 +#: ../../using/windows.rst:441 msgid "``PYTHON_MANAGER_SHEBANG_CAN_RUN_ANYTHING``" msgstr "``PYTHON_MANAGER_SHEBANG_CAN_RUN_ANYTHING``" -#: ../../using/windows.rst:435 +#: ../../using/windows.rst:442 msgid "" "True to allow shebangs in ``.py`` files to launch applications other than " "Python runtimes, or false to prevent it. By default, true." msgstr "" -#: ../../using/windows.rst:439 +#: ../../using/windows.rst:446 msgid "``log_level``" msgstr "``log_level``" -#: ../../using/windows.rst:440 +#: ../../using/windows.rst:447 msgid "``PYMANAGER_VERBOSE``, ``PYMANAGER_DEBUG``" msgstr "``PYMANAGER_VERBOSE``、``PYMANAGER_DEBUG``" -#: ../../using/windows.rst:441 +#: ../../using/windows.rst:448 msgid "" "Set the default level of output (0-50). By default, 20. Lower values produce " "more output. The environment variables are boolean, and may produce " @@ -698,94 +704,94 @@ msgid "" "configuration." msgstr "" -#: ../../using/windows.rst:447 +#: ../../using/windows.rst:454 msgid "``confirm``" msgstr "``confirm``" -#: ../../using/windows.rst:448 +#: ../../using/windows.rst:455 msgid "``PYTHON_MANAGER_CONFIRM``" msgstr "``PYTHON_MANAGER_CONFIRM``" -#: ../../using/windows.rst:449 +#: ../../using/windows.rst:456 msgid "" "True to confirm certain actions before taking them (such as uninstall), or " "false to skip the confirmation. By default, true." msgstr "" -#: ../../using/windows.rst:453 +#: ../../using/windows.rst:460 msgid "``install.source``" msgstr "``install.source``" -#: ../../using/windows.rst:454 +#: ../../using/windows.rst:461 msgid "``PYTHON_MANAGER_SOURCE_URL``" msgstr "``PYTHON_MANAGER_SOURCE_URL``" -#: ../../using/windows.rst:455 +#: ../../using/windows.rst:462 msgid "Override the index feed to obtain new installs from." msgstr "" -#: ../../using/windows.rst:457 +#: ../../using/windows.rst:464 msgid "``list.format``" msgstr "``list.format``" -#: ../../using/windows.rst:458 +#: ../../using/windows.rst:465 msgid "``PYTHON_MANAGER_LIST_FORMAT``" msgstr "``PYTHON_MANAGER_LIST_FORMAT``" -#: ../../using/windows.rst:459 +#: ../../using/windows.rst:466 msgid "" "Specify the default format used by the ``py list`` command. By default, " "``table``." msgstr "" -#: ../../using/windows.rst:462 +#: ../../using/windows.rst:469 msgid "``install_dir``" msgstr "``install_dir``" -#: ../../using/windows.rst:463 ../../using/windows.rst:469 -#: ../../using/windows.rst:476 +#: ../../using/windows.rst:470 ../../using/windows.rst:476 +#: ../../using/windows.rst:483 msgid "(none)" msgstr "" -#: ../../using/windows.rst:464 +#: ../../using/windows.rst:471 msgid "" "Specify the root directory that runtimes will be installed into. If you " "change this setting, previously installed runtimes will not be usable unless " "you move them to the new location." msgstr "" -#: ../../using/windows.rst:468 +#: ../../using/windows.rst:475 msgid "``global_dir``" msgstr "``global_dir``" -#: ../../using/windows.rst:470 +#: ../../using/windows.rst:477 msgid "" "Specify the directory where global commands (such as ``python3.14.exe``) are " "stored. This directory should be added to your :envvar:`PATH` to make the " "commands available from your terminal." msgstr "" -#: ../../using/windows.rst:475 +#: ../../using/windows.rst:482 msgid "``download_dir``" msgstr "``download_dir``" -#: ../../using/windows.rst:477 +#: ../../using/windows.rst:484 msgid "" "Specify the directory where downloaded files are stored. This directory is a " "temporary cache, and can be cleaned up from time to time." msgstr "" -#: ../../using/windows.rst:481 +#: ../../using/windows.rst:488 msgid "" "Dotted names should be nested inside JSON objects, for example, ``list." "format`` would be specified as ``{\"list\": {\"format\": \"table\"}}``." msgstr "" -#: ../../using/windows.rst:487 ../../using/windows.rst:1750 +#: ../../using/windows.rst:494 ../../using/windows.rst:1783 msgid "Shebang lines" msgstr "" -#: ../../using/windows.rst:489 +#: ../../using/windows.rst:496 msgid "" "If the first line of a script file starts with ``#!``, it is known as a " "\"shebang\" line. Linux and other Unix like operating systems have native " @@ -794,42 +800,42 @@ msgid "" "allow the same facilities to be used with Python scripts on Windows." msgstr "" -#: ../../using/windows.rst:495 +#: ../../using/windows.rst:502 msgid "" "To allow shebang lines in Python scripts to be portable between Unix and " "Windows, a number of 'virtual' commands are supported to specify which " "interpreter to use. The supported virtual commands are:" msgstr "" -#: ../../using/windows.rst:499 +#: ../../using/windows.rst:506 msgid "``/usr/bin/env ``" msgstr "``/usr/bin/env ``" -#: ../../using/windows.rst:500 +#: ../../using/windows.rst:507 msgid "``/usr/bin/env -S ``" msgstr "``/usr/bin/env -S ``" -#: ../../using/windows.rst:501 +#: ../../using/windows.rst:508 msgid "``/usr/bin/``" msgstr "``/usr/bin/``" -#: ../../using/windows.rst:502 +#: ../../using/windows.rst:509 msgid "``/usr/local/bin/``" msgstr "``/usr/local/bin/``" -#: ../../using/windows.rst:503 +#: ../../using/windows.rst:510 msgid "````" msgstr "````" -#: ../../using/windows.rst:505 ../../using/windows.rst:1768 +#: ../../using/windows.rst:512 ../../using/windows.rst:1801 msgid "For example, if the first line of your script starts with" msgstr "" -#: ../../using/windows.rst:507 ../../using/windows.rst:1770 +#: ../../using/windows.rst:514 ../../using/windows.rst:1803 msgid "#! /usr/bin/python" msgstr "#! /usr/bin/python" -#: ../../using/windows.rst:511 ../../using/windows.rst:1774 +#: ../../using/windows.rst:518 ../../using/windows.rst:1807 msgid "" "The default Python or an active virtual environment will be located and " "used. As many Python scripts written to work on Unix will already have this " @@ -839,7 +845,7 @@ msgid "" "usr``." msgstr "" -#: ../../using/windows.rst:517 +#: ../../using/windows.rst:524 msgid "" "Any of the above virtual commands can have ```` replaced by an alias " "from an installed runtime. That is, any command generated in the global " @@ -849,14 +855,14 @@ msgid "" "to select a particular runtime." msgstr "" -#: ../../using/windows.rst:523 +#: ../../using/windows.rst:530 msgid "" "If no runtimes are installed, or if automatic installation is enabled, the " "requested runtime will be installed if necessary. See :ref:`pymanager-" "config` for information about configuration settings." msgstr "" -#: ../../using/windows.rst:527 +#: ../../using/windows.rst:534 msgid "" "The ``/usr/bin/env`` form of shebang line will also search the :envvar:" "`PATH` environment variable for unrecognized commands. This corresponds to " @@ -866,7 +872,7 @@ msgid "" "``shebang_can_run_anything`` configuration option." msgstr "" -#: ../../using/windows.rst:534 +#: ../../using/windows.rst:541 msgid "" "Shebang lines that do not match any of patterns are treated as *Windows* " "executable paths that are absolute or relative to the directory containing " @@ -878,7 +884,7 @@ msgid "" "``shebang_can_run_anything`` configuration option." msgstr "" -#: ../../using/windows.rst:545 +#: ../../using/windows.rst:552 msgid "" "The behaviour of shebangs in the Python install manager is subtly different " "from the previous ``py.exe`` launcher, and the old configuration options no " @@ -888,11 +894,11 @@ msgid "" "will need to use ``pymanager`` commands for installing and uninstalling." msgstr "" -#: ../../using/windows.rst:563 +#: ../../using/windows.rst:570 msgid "Advanced installation" msgstr "進階安裝" -#: ../../using/windows.rst:565 +#: ../../using/windows.rst:572 msgid "" "For situations where an MSIX cannot be installed, such as some older " "administrative distribution platforms, there is an MSI available from the " @@ -903,13 +909,13 @@ msgid "" "configuration." msgstr "" -#: ../../using/windows.rst:574 +#: ../../using/windows.rst:581 msgid "" "Windows Server 2019 is the only version of Windows that CPython supports " "that does not support MSIX. For Windows Server 2019, you should use the MSI." msgstr "" -#: ../../using/windows.rst:577 +#: ../../using/windows.rst:584 msgid "" "Be aware that the MSI package does not bundle any runtimes, and so is not " "suitable for installs into offline environments without also creating an " @@ -917,7 +923,7 @@ msgid "" "admin-config` for information on handling these scenarios." msgstr "" -#: ../../using/windows.rst:582 +#: ../../using/windows.rst:589 msgid "" "Runtimes installed by the MSI are shared with those installed by the MSIX, " "and are all per-user only. The Python install manager does not support " @@ -927,7 +933,7 @@ msgid "" "menu." msgstr "" -#: ../../using/windows.rst:588 +#: ../../using/windows.rst:595 msgid "" "When the MSIX is installed, but commands are not available in the :envvar:" "`PATH` environment variable, they can be found under :file:`%LocalAppData%\\" @@ -939,13 +945,13 @@ msgid "" "recommended." msgstr "" -#: ../../using/windows.rst:597 +#: ../../using/windows.rst:604 msgid "" "To programmatically install the Python install manager, it is easiest to use " "WinGet, which is included with all supported versions of Windows:" msgstr "" -#: ../../using/windows.rst:600 +#: ../../using/windows.rst:607 msgid "" "$> winget install 9NQ7512CXL7T -e --accept-package-agreements --disable-" "interactivity\n" @@ -954,7 +960,7 @@ msgid "" "$> py install --configure -y" msgstr "" -#: ../../using/windows.rst:607 +#: ../../using/windows.rst:614 msgid "" "To download the Python install manager and install on another machine, the " "following WinGet command will download the required files from the Store to " @@ -964,20 +970,20 @@ msgid "" "below." msgstr "" -#: ../../using/windows.rst:613 +#: ../../using/windows.rst:620 msgid "" "$> winget download 9NQ7512CXL7T -e --skip-license --accept-package-" "agreements --accept-source-agreements" msgstr "" -#: ../../using/windows.rst:617 +#: ../../using/windows.rst:624 msgid "" "To programmatically install or uninstall an MSIX using only PowerShell, the " "`Add-AppxPackage`_ and `Remove-AppxPackage`_ PowerShell cmdlets are " "recommended:" msgstr "" -#: ../../using/windows.rst:620 +#: ../../using/windows.rst:627 msgid "" "$> Add-AppxPackage C:\\Downloads\\python-manager-25.0.msix\n" "...\n" @@ -989,7 +995,7 @@ msgstr "" "$> Get-AppxPackage PythonSoftwareFoundation.PythonManager | Remove-" "AppxPackage" -#: ../../using/windows.rst:626 +#: ../../using/windows.rst:633 msgid "" "The latest release can be downloaded and installed by Windows by passing the " "AppInstaller file to the Add-AppxPackage command. This installs using the " @@ -997,7 +1003,7 @@ msgid "" "the Store (interactively or using WinGet) is not possible." msgstr "" -#: ../../using/windows.rst:631 +#: ../../using/windows.rst:638 msgid "" "$> Add-AppxPackage -AppInstallerFile https://www.python.org/ftp/python/" "pymanager/pymanager.appinstaller" @@ -1005,7 +1011,7 @@ msgstr "" "$> Add-AppxPackage -AppInstallerFile https://www.python.org/ftp/python/" "pymanager/pymanager.appinstaller" -#: ../../using/windows.rst:635 +#: ../../using/windows.rst:642 msgid "" "Other tools and APIs may also be used to provision an MSIX package for all " "users on a machine, but Python does not consider this a supported scenario. " @@ -1014,7 +1020,7 @@ msgid "" "for your deployment tool." msgstr "" -#: ../../using/windows.rst:641 +#: ../../using/windows.rst:648 msgid "" "Regardless of the install method, users will still need to install their own " "copies of Python itself, as there is no way to trigger those installs " @@ -1022,7 +1028,7 @@ msgid "" "Python will be available for all users to install without network access." msgstr "" -#: ../../using/windows.rst:646 +#: ../../using/windows.rst:653 msgid "" "Note that the MSIX downloadable from the Store and from the Python website " "are subtly different and cannot be installed at the same time. Wherever " @@ -1032,11 +1038,11 @@ msgid "" "prevent using the Store package in this way." msgstr "" -#: ../../using/windows.rst:657 +#: ../../using/windows.rst:664 msgid "Administrative configuration" msgstr "" -#: ../../using/windows.rst:659 +#: ../../using/windows.rst:666 msgid "" "There are a number of options that may be useful for administrators to " "override configuration of the Python install manager. These can be used to " @@ -1045,7 +1051,7 @@ msgid "" "below." msgstr "" -#: ../../using/windows.rst:664 +#: ../../using/windows.rst:671 msgid "" "Configuration options may be overridden in the registry by setting values " "under :file:`HKEY_LOCAL_MACHINE\\\\Software\\\\Policies\\\\Python\\" @@ -1058,7 +1064,7 @@ msgid "" "``base_config`` allows users to further modify settings they may need." msgstr "" -#: ../../using/windows.rst:674 +#: ../../using/windows.rst:681 msgid "" "Note that most settings with environment variables support those variables " "because their default setting specifies the variable. If you override them, " @@ -1070,141 +1076,141 @@ msgid "" "environment variable will be used instead." msgstr "" -#: ../../using/windows.rst:683 +#: ../../using/windows.rst:690 msgid "" "Configuration settings that are paths are interpreted as relative to the " "directory containing the configuration file that specified them." msgstr "" -#: ../../using/windows.rst:690 +#: ../../using/windows.rst:697 msgid "Administrative configuration options" msgstr "" -#: ../../using/windows.rst:697 +#: ../../using/windows.rst:704 msgid "``base_config``" msgstr "``base_config``" -#: ../../using/windows.rst:698 +#: ../../using/windows.rst:705 msgid "" "The highest priority configuration file to read. Note that only the built-in " "configuration file and the registry can modify this setting." msgstr "" -#: ../../using/windows.rst:702 +#: ../../using/windows.rst:709 msgid "``user_config``" msgstr "``user_config``" -#: ../../using/windows.rst:703 +#: ../../using/windows.rst:710 msgid "The second configuration file to read." msgstr "" -#: ../../using/windows.rst:705 +#: ../../using/windows.rst:712 msgid "``additional_config``" msgstr "``additional_config``" -#: ../../using/windows.rst:706 +#: ../../using/windows.rst:713 msgid "The third configuration file to read." msgstr "" -#: ../../using/windows.rst:708 +#: ../../using/windows.rst:715 msgid "``registry_override_key``" msgstr "``registry_override_key``" -#: ../../using/windows.rst:709 +#: ../../using/windows.rst:716 msgid "" "Registry location to check for overrides. Note that only the built-in " "configuration file can modify this setting." msgstr "" -#: ../../using/windows.rst:712 +#: ../../using/windows.rst:719 msgid "``bundled_dir``" msgstr "``bundled_dir``" -#: ../../using/windows.rst:713 +#: ../../using/windows.rst:720 msgid "Read-only directory containing locally cached files." msgstr "" -#: ../../using/windows.rst:715 +#: ../../using/windows.rst:722 msgid "``install.fallback_source``" msgstr "``install.fallback_source``" -#: ../../using/windows.rst:716 +#: ../../using/windows.rst:723 msgid "" "Path or URL to an index to consult when the main index cannot be accessed." msgstr "" -#: ../../using/windows.rst:718 +#: ../../using/windows.rst:725 msgid "``install.enable_shortcut_kinds``" msgstr "``install.enable_shortcut_kinds``" -#: ../../using/windows.rst:719 +#: ../../using/windows.rst:726 msgid "" "Comma-separated list of shortcut kinds to allow (e.g. ``\"pep514,start\"``). " "Enabled shortcuts may still be disabled by ``disable_shortcut_kinds``." msgstr "" -#: ../../using/windows.rst:722 +#: ../../using/windows.rst:729 msgid "``install.disable_shortcut_kinds``" msgstr "``install.disable_shortcut_kinds``" -#: ../../using/windows.rst:723 +#: ../../using/windows.rst:730 msgid "" "Comma-separated list of shortcut kinds to exclude (e.g. ``\"pep514," "start\"``). Disabled shortcuts are not reactivated by " "``enable_shortcut_kinds``." msgstr "" -#: ../../using/windows.rst:727 +#: ../../using/windows.rst:734 msgid "``pep514_root``" msgstr "``pep514_root``" -#: ../../using/windows.rst:728 +#: ../../using/windows.rst:735 msgid "" "Registry location to read and write PEP 514 entries into. By default, :file:" "`HKEY_CURRENT_USER\\\\Software\\\\Python`." msgstr "" -#: ../../using/windows.rst:731 +#: ../../using/windows.rst:738 msgid "``start_folder``" msgstr "``start_folder``" -#: ../../using/windows.rst:732 +#: ../../using/windows.rst:739 msgid "" "Start menu folder to write shortcuts into. By default, ``Python``. This path " "is relative to the user's Programs folder." msgstr "" -#: ../../using/windows.rst:736 +#: ../../using/windows.rst:743 msgid "``virtual_env``" msgstr "``virtual_env``" -#: ../../using/windows.rst:737 +#: ../../using/windows.rst:744 msgid "" "Path to the active virtual environment. By default, this is " "``%VIRTUAL_ENV%``, but may be set empty to disable venv detection." msgstr "" -#: ../../using/windows.rst:741 +#: ../../using/windows.rst:748 msgid "``shebang_can_run_anything_silently``" msgstr "``shebang_can_run_anything_silently``" -#: ../../using/windows.rst:742 +#: ../../using/windows.rst:749 msgid "" "True to suppress visible warnings when a shebang launches an application " "other than a Python runtime." msgstr "" -#: ../../using/windows.rst:748 ../../using/windows.rst:1563 +#: ../../using/windows.rst:755 ../../using/windows.rst:1596 msgid "Installing free-threaded binaries" msgstr "" -#: ../../using/windows.rst:752 +#: ../../using/windows.rst:759 msgid "" "Pre-built distributions of the free-threaded build are available by " "installing tags with the ``t`` suffix." msgstr "" -#: ../../using/windows.rst:755 +#: ../../using/windows.rst:762 msgid "" "$> py install 3.14t\n" "$> py install 3.14t-arm64\n" @@ -1214,7 +1220,7 @@ msgstr "" "$> py install 3.14t-arm64\n" "$> py install 3.14t-32" -#: ../../using/windows.rst:761 +#: ../../using/windows.rst:768 msgid "" "This will install and register as normal. If you have no other runtimes " "installed, then ``python`` will launch this one. Otherwise, you will need to " @@ -1223,11 +1229,11 @@ msgid "" "commands." msgstr "" -#: ../../using/windows.rst:769 ../../using/windows.rst:781 +#: ../../using/windows.rst:776 ../../using/windows.rst:788 msgid "Troubleshooting" msgstr "" -#: ../../using/windows.rst:771 +#: ../../using/windows.rst:778 msgid "" "If your Python install manager does not seem to be working correctly, please " "work through these tests and fixes to see if it helps. If not, please report " @@ -1236,25 +1242,25 @@ msgid "" "by default)." msgstr "" -#: ../../using/windows.rst:785 +#: ../../using/windows.rst:792 msgid "Symptom" msgstr "" -#: ../../using/windows.rst:786 +#: ../../using/windows.rst:793 msgid "Things to try" msgstr "" -#: ../../using/windows.rst:788 +#: ../../using/windows.rst:795 msgid "" "``python`` gives me a \"command not found\" error or opens the Store app " "when I type it in my terminal." msgstr "" -#: ../../using/windows.rst:790 ../../using/windows.rst:803 +#: ../../using/windows.rst:797 ../../using/windows.rst:816 msgid "Did you :ref:`install the Python install manager `?" msgstr "" -#: ../../using/windows.rst:793 ../../using/windows.rst:806 +#: ../../using/windows.rst:800 ../../using/windows.rst:819 msgid "" "Click Start, open \"Manage app execution aliases\", and check that the " "aliases for \"Python (default)\" are enabled. If they already are, try " @@ -1262,93 +1268,101 @@ msgid "" "windowed)\" and \"Python install manager\" commands may also need refreshing." msgstr "" -#: ../../using/windows.rst:800 +#: ../../using/windows.rst:807 msgid "Check that the ``py`` and ``pymanager`` commands work." msgstr "" -#: ../../using/windows.rst:802 +#: ../../using/windows.rst:810 ../../using/windows.rst:826 +msgid "" +"Ensure your :envvar:`PATH` variable contains the entry for ``%UserProfile%" +"\\AppData\\Local\\Microsoft\\WindowsApps``. The operating system includes " +"this entry once by default, after other user paths. If removed, shortcuts " +"will not be found." +msgstr "" + +#: ../../using/windows.rst:815 msgid "" "``py`` gives me a \"command not found\" error when I type it in my terminal." msgstr "" -#: ../../using/windows.rst:812 +#: ../../using/windows.rst:831 msgid "" "``py`` gives me a \"can't open file\" error when I type commands in my " "terminal." msgstr "" -#: ../../using/windows.rst:814 +#: ../../using/windows.rst:833 msgid "" "This usually means you have the legacy launcher installed and it has " "priority over the Python install manager. To remove, click Start, open " "\"Installed apps\", search for \"Python launcher\" and uninstall it." msgstr "" -#: ../../using/windows.rst:819 +#: ../../using/windows.rst:838 msgid "``python`` doesn't launch the same runtime as ``py``" msgstr "" -#: ../../using/windows.rst:820 +#: ../../using/windows.rst:839 msgid "" "Click Start, open \"Installed apps\", look for any existing Python runtimes, " "and either remove them or Modify and disable the :envvar:`PATH` options." msgstr "" -#: ../../using/windows.rst:824 +#: ../../using/windows.rst:843 msgid "" "Click Start, open \"Manage app execution aliases\", and check that your " "``python.exe`` alias is set to \"Python (default)\"" msgstr "" -#: ../../using/windows.rst:827 +#: ../../using/windows.rst:846 msgid "``python`` and ``py`` don't launch the runtime I expect" msgstr "" -#: ../../using/windows.rst:828 +#: ../../using/windows.rst:847 msgid "" "Check your :envvar:`PYTHON_MANAGER_DEFAULT` environment variable or " "``default_tag`` configuration. The ``py list`` command will show your " "default based on these settings." msgstr "" -#: ../../using/windows.rst:833 +#: ../../using/windows.rst:852 msgid "" "Installs that are managed by the Python install manager will be chosen ahead " "of unmanaged installs. Use ``py install`` to install the runtime you expect, " "or configure your default tag." msgstr "" -#: ../../using/windows.rst:839 +#: ../../using/windows.rst:858 msgid "" "Prerelease and experimental installs that are not managed by the Python " "install manager may be chosen ahead of stable releases. Configure your " -"default tag or uninstall the prerelease runtime and reinstall using ``py " +"default tag or uninstall the prerelease runtime and reinstall it using ``py " "install``." msgstr "" -#: ../../using/windows.rst:844 +#: ../../using/windows.rst:863 msgid "" "``pythonw`` or ``pyw`` don't launch the same runtime as ``python`` or ``py``" msgstr "" -#: ../../using/windows.rst:845 +#: ../../using/windows.rst:864 msgid "" "Click Start, open \"Manage app execution aliases\", and check that your " "``pythonw.exe`` and ``pyw.exe`` aliases are consistent with your others." msgstr "" -#: ../../using/windows.rst:848 +#: ../../using/windows.rst:867 msgid "" "``pip`` gives me a \"command not found\" error when I type it in my terminal." msgstr "" -#: ../../using/windows.rst:849 +#: ../../using/windows.rst:868 msgid "" "Have you activated a virtual environment? Run the ``." "venv\\Scripts\\activate`` script in your terminal to activate." msgstr "" -#: ../../using/windows.rst:853 +#: ../../using/windows.rst:872 msgid "" "The package may be available but missing the generated executable. We " "recommend using the ``python -m pip`` command instead, or alternatively the " @@ -1357,11 +1371,11 @@ msgid "" "for each runtime, and so you may need to add multiple paths." msgstr "" -#: ../../using/windows.rst:861 +#: ../../using/windows.rst:880 msgid "Typing ``script-name.py`` in the terminal opens in a new window." msgstr "" -#: ../../using/windows.rst:862 +#: ../../using/windows.rst:881 msgid "" "This is a known limitation of the operating system. Either specify ``py`` " "before the script name, create a batch file containing ``@py \"%~dpn0.py\" " @@ -1369,39 +1383,69 @@ msgid "" "select it as the association for scripts." msgstr "" -#: ../../using/windows.rst:867 +#: ../../using/windows.rst:886 msgid "Drag-dropping files onto a script doesn't work" msgstr "" -#: ../../using/windows.rst:868 +#: ../../using/windows.rst:887 msgid "" "This is a known limitation of the operating system. It is supported with the " "`legacy launcher`_, or with the Python install manager when installed from " "the MSI." msgstr "" -#: ../../using/windows.rst:876 +#: ../../using/windows.rst:891 +msgid "I have installed the Python install manager multiple times." +msgstr "" + +#: ../../using/windows.rst:892 +msgid "" +"It is possible to install from the Store or WinGet, from the MSIX on the " +"Python website, and from the MSI, all at once. They are all compatible and " +"will share configuration and runtimes." +msgstr "" + +#: ../../using/windows.rst:897 +msgid "" +"See the earlier :ref:`pymanager-advancedinstall` section for ways to " +"uninstall the install manager other than the typical Installed Apps (Add and " +"Remove Programs) settings page." +msgstr "" + +#: ../../using/windows.rst:901 +msgid "My old ``py.ini`` settings no longer work." +msgstr "" + +#: ../../using/windows.rst:902 +msgid "" +"The new Python install manager no longer supports this configuration file or " +"its settings, and so it will be ignored. See :ref:`pymanager-config` for " +"information about configuration settings." +msgstr "" + +#: ../../using/windows.rst:909 msgid "The embeddable package" msgstr "" -#: ../../using/windows.rst:880 +#: ../../using/windows.rst:913 msgid "" "The embedded distribution is a ZIP file containing a minimal Python " "environment. It is intended for acting as part of another application, " "rather than being directly accessed by end-users." msgstr "" -#: ../../using/windows.rst:884 +#: ../../using/windows.rst:917 msgid "" "To install an embedded distribution, we recommend using ``py install`` with " "the ``--target`` option:" msgstr "" -#: ../../using/windows.rst:887 -msgid "$> py install 3.14-embed --target=runtime" +#: ../../using/windows.rst:920 +#, fuzzy +msgid "$> py install 3.14-embed --target=" msgstr "$> py install 3.14-embed --target=runtime" -#: ../../using/windows.rst:891 +#: ../../using/windows.rst:924 msgid "" "When extracted, the embedded distribution is (almost) fully isolated from " "the user's system, including environment variables, system registry " @@ -1412,14 +1456,14 @@ msgid "" "documentation are not included." msgstr "" -#: ../../using/windows.rst:898 +#: ../../using/windows.rst:931 msgid "" "A default ``._pth`` file is included, which further restricts the default " "search paths (as described below in :ref:`windows_finding_modules`). This " "file is intended for embedders to modify as necessary." msgstr "" -#: ../../using/windows.rst:902 +#: ../../using/windows.rst:935 msgid "" "Third-party packages should be installed by the application installer " "alongside the embedded distribution. Using pip to manage dependencies as for " @@ -1430,16 +1474,16 @@ msgid "" "compatibility with newer versions before providing updates to users." msgstr "" -#: ../../using/windows.rst:910 +#: ../../using/windows.rst:943 msgid "" "The two recommended use cases for this distribution are described below." msgstr "" -#: ../../using/windows.rst:913 +#: ../../using/windows.rst:946 msgid "Python application" msgstr "Python 應用程式" -#: ../../using/windows.rst:915 +#: ../../using/windows.rst:948 msgid "" "An application written in Python does not necessarily require users to be " "aware of that fact. The embedded distribution may be used in this case to " @@ -1448,7 +1492,7 @@ msgid "" "there are two options." msgstr "" -#: ../../using/windows.rst:921 +#: ../../using/windows.rst:954 msgid "" "Using a specialized executable as a launcher requires some coding, but " "provides the most transparent experience for users. With a customized " @@ -1459,7 +1503,7 @@ msgid "" "line." msgstr "" -#: ../../using/windows.rst:928 +#: ../../using/windows.rst:961 msgid "" "The simpler approach is to provide a batch file or generated shortcut that " "directly calls the ``python.exe`` or ``pythonw.exe`` with the required " @@ -1468,7 +1512,7 @@ msgid "" "from other running Python processes or file associations." msgstr "" -#: ../../using/windows.rst:934 +#: ../../using/windows.rst:967 msgid "" "With the latter approach, packages should be installed as directories " "alongside the Python executable to ensure they are available on the path. " @@ -1477,11 +1521,11 @@ msgid "" "application." msgstr "" -#: ../../using/windows.rst:940 +#: ../../using/windows.rst:973 msgid "Embedding Python" msgstr "嵌入 Python" -#: ../../using/windows.rst:942 +#: ../../using/windows.rst:975 msgid "" "Applications written in native code often require some form of scripting " "language, and the embedded Python distribution can be used for this purpose. " @@ -1492,7 +1536,7 @@ msgid "" "interpreter." msgstr "" -#: ../../using/windows.rst:949 +#: ../../using/windows.rst:982 msgid "" "As with the application use, packages can be installed to any location as " "there is an opportunity to specify search paths before initializing the " @@ -1500,11 +1544,11 @@ msgid "" "the embedded distribution and a regular installation." msgstr "" -#: ../../using/windows.rst:958 +#: ../../using/windows.rst:991 msgid "The nuget.org packages" msgstr "nuget.org 套件" -#: ../../using/windows.rst:962 +#: ../../using/windows.rst:995 msgid "" "The nuget.org package is a reduced size Python environment intended for use " "on continuous integration and build systems that do not have a system-wide " @@ -1512,14 +1556,14 @@ msgid "" "works perfectly fine for packages containing build-time tools." msgstr "" -#: ../../using/windows.rst:967 +#: ../../using/windows.rst:1000 msgid "" "Visit `nuget.org `_ for the most up-to-date " "information on using nuget. What follows is a summary that is sufficient for " "Python developers." msgstr "" -#: ../../using/windows.rst:971 +#: ../../using/windows.rst:1004 msgid "" "The ``nuget.exe`` command line tool may be downloaded directly from " "``https://aka.ms/nugetclidl``, for example, using curl or PowerShell. With " @@ -1527,7 +1571,7 @@ msgid "" "installed using::" msgstr "" -#: ../../using/windows.rst:976 +#: ../../using/windows.rst:1009 msgid "" "nuget.exe install python -ExcludeVersion -OutputDirectory .\n" "nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory ." @@ -1535,7 +1579,7 @@ msgstr "" "nuget.exe install python -ExcludeVersion -OutputDirectory .\n" "nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory ." -#: ../../using/windows.rst:979 +#: ../../using/windows.rst:1012 msgid "" "To select a particular version, add a ``-Version 3.x.y``. The output " "directory may be changed from ``.``, and the package will be installed into " @@ -1545,7 +1589,7 @@ msgid "" "directory that contains the Python installation:" msgstr "" -#: ../../using/windows.rst:986 +#: ../../using/windows.rst:1019 msgid "" "# Without -ExcludeVersion\n" "> .\\python.3.5.2\\tools\\python.exe -V\n" @@ -1563,7 +1607,7 @@ msgstr "" "> .\\python\\tools\\python.exe -V\n" "Python 3.5.2" -#: ../../using/windows.rst:996 +#: ../../using/windows.rst:1029 msgid "" "In general, nuget packages are not upgradeable, and newer versions should be " "installed side-by-side and referenced using the full path. Alternatively, " @@ -1571,7 +1615,7 @@ msgid "" "will do this automatically if they do not preserve files between builds." msgstr "" -#: ../../using/windows.rst:1001 +#: ../../using/windows.rst:1034 msgid "" "Alongside the ``tools`` directory is a ``build\\native`` directory. This " "contains a MSBuild properties file ``python.props`` that can be used in a C+" @@ -1579,7 +1623,7 @@ msgid "" "automatically use the headers and import libraries in your build." msgstr "" -#: ../../using/windows.rst:1006 +#: ../../using/windows.rst:1039 msgid "" "The package information pages on nuget.org are `www.nuget.org/packages/" "python `_ for the 64-bit version, " @@ -1588,11 +1632,11 @@ msgid "" "`_ for the ARM64 version" msgstr "" -#: ../../using/windows.rst:1014 +#: ../../using/windows.rst:1047 msgid "Free-threaded packages" msgstr "" -#: ../../using/windows.rst:1018 +#: ../../using/windows.rst:1051 msgid "" "Packages containing free-threaded binaries are named `python-freethreaded " "`_ for the 64-bit " @@ -1603,46 +1647,46 @@ msgid "" "exe`` entry points, both of which run free threaded." msgstr "" -#: ../../using/windows.rst:1029 +#: ../../using/windows.rst:1062 msgid "Alternative bundles" msgstr "" -#: ../../using/windows.rst:1031 +#: ../../using/windows.rst:1064 msgid "" "Besides the standard CPython distribution, there are modified packages " "including additional functionality. The following is a list of popular " "versions and their key features:" msgstr "" -#: ../../using/windows.rst:1035 +#: ../../using/windows.rst:1068 msgid "`ActivePython `_" msgstr "`ActivePython `_" -#: ../../using/windows.rst:1036 +#: ../../using/windows.rst:1069 msgid "Installer with multi-platform compatibility, documentation, PyWin32" msgstr "" -#: ../../using/windows.rst:1038 +#: ../../using/windows.rst:1071 msgid "`Anaconda `_" msgstr "`Anaconda `_" -#: ../../using/windows.rst:1039 +#: ../../using/windows.rst:1072 msgid "" "Popular scientific modules (such as numpy, scipy and pandas) and the " "``conda`` package manager." msgstr "" -#: ../../using/windows.rst:1042 +#: ../../using/windows.rst:1075 msgid "" "`Enthought Deployment Manager `_" msgstr "" "`Enthought Deployment Manager `_" -#: ../../using/windows.rst:1043 +#: ../../using/windows.rst:1076 msgid "\"The Next Generation Python Environment and Package Manager\"." msgstr "" -#: ../../using/windows.rst:1045 +#: ../../using/windows.rst:1078 msgid "" "Previously Enthought provided Canopy, but it `reached end of life in 2016 " "`_." msgstr "" -#: ../../using/windows.rst:1048 +#: ../../using/windows.rst:1081 msgid "`WinPython `_" msgstr "`WinPython `_" -#: ../../using/windows.rst:1049 +#: ../../using/windows.rst:1082 msgid "" "Windows-specific distribution with prebuilt scientific packages and tools " "for building packages." msgstr "" -#: ../../using/windows.rst:1052 +#: ../../using/windows.rst:1085 msgid "" "Note that these packages may not include the latest versions of Python or " "other libraries, and are not maintained or supported by the core Python team." msgstr "" -#: ../../using/windows.rst:1057 +#: ../../using/windows.rst:1090 msgid "Supported Windows versions" msgstr "" -#: ../../using/windows.rst:1059 +#: ../../using/windows.rst:1092 msgid "" "As specified in :pep:`11`, a Python release only supports a Windows platform " "while Microsoft considers the platform under extended support. This means " @@ -1679,17 +1723,17 @@ msgid "" "please install Python 3.12." msgstr "" -#: ../../using/windows.rst:1069 ../../using/windows.rst:1350 +#: ../../using/windows.rst:1102 ../../using/windows.rst:1383 msgid "Removing the MAX_PATH limitation" msgstr "" -#: ../../using/windows.rst:1071 ../../using/windows.rst:1352 +#: ../../using/windows.rst:1104 ../../using/windows.rst:1385 msgid "" "Windows historically has limited path lengths to 260 characters. This meant " "that paths longer than this would not resolve and errors would result." msgstr "" -#: ../../using/windows.rst:1074 +#: ../../using/windows.rst:1107 msgid "" "In the latest versions of Windows, this limitation can be expanded to over " "32,000 characters. Your administrator will need to activate the \"Enable " @@ -1698,36 +1742,36 @@ msgid "" "``HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem``." msgstr "" -#: ../../using/windows.rst:1079 ../../using/windows.rst:1361 +#: ../../using/windows.rst:1112 ../../using/windows.rst:1394 msgid "" "This allows the :func:`open` function, the :mod:`os` module and most other " "path functionality to accept and return paths longer than 260 characters." msgstr "" -#: ../../using/windows.rst:1082 +#: ../../using/windows.rst:1115 msgid "" "After changing the above option and rebooting, no further configuration is " "required." msgstr "" -#: ../../using/windows.rst:1089 +#: ../../using/windows.rst:1122 msgid "UTF-8 mode" msgstr "UTF-8 模式" -#: ../../using/windows.rst:1093 +#: ../../using/windows.rst:1126 msgid "" "Windows still uses legacy encodings for the system encoding (the ANSI Code " "Page). Python uses it for the default encoding of text files (e.g. :func:" "`locale.getencoding`)." msgstr "" -#: ../../using/windows.rst:1097 +#: ../../using/windows.rst:1130 msgid "" "This may cause issues because UTF-8 is widely used on the internet and most " "Unix systems, including WSL (Windows Subsystem for Linux)." msgstr "" -#: ../../using/windows.rst:1100 +#: ../../using/windows.rst:1133 msgid "" "You can use the :ref:`Python UTF-8 Mode ` to change the default " "text encoding to UTF-8. You can enable the :ref:`Python UTF-8 Mode ` is enabled, you can still use " "the system encoding (the ANSI Code Page) via the \"mbcs\" codec." msgstr "" -#: ../../using/windows.rst:1109 +#: ../../using/windows.rst:1142 msgid "" "Note that adding ``PYTHONUTF8=1`` to the default environment variables will " "affect all Python 3.7+ applications on your system. If you have any Python " @@ -1751,45 +1795,45 @@ msgid "" "utf8`` command line option." msgstr "" -#: ../../using/windows.rst:1116 +#: ../../using/windows.rst:1149 msgid "" "Even when UTF-8 mode is disabled, Python uses UTF-8 by default on Windows " "for:" msgstr "" -#: ../../using/windows.rst:1119 +#: ../../using/windows.rst:1152 msgid "Console I/O including standard I/O (see :pep:`528` for details)." msgstr "" -#: ../../using/windows.rst:1120 +#: ../../using/windows.rst:1153 msgid "" "The :term:`filesystem encoding ` " "(see :pep:`529` for details)." msgstr "" -#: ../../using/windows.rst:1127 +#: ../../using/windows.rst:1160 msgid "Finding modules" msgstr "找尋模組" -#: ../../using/windows.rst:1129 +#: ../../using/windows.rst:1162 msgid "" "These notes supplement the description at :ref:`sys-path-init` with detailed " "Windows notes." msgstr "" -#: ../../using/windows.rst:1132 +#: ../../using/windows.rst:1165 msgid "" "When no ``._pth`` file is found, this is how :data:`sys.path` is populated " "on Windows:" msgstr "" -#: ../../using/windows.rst:1135 +#: ../../using/windows.rst:1168 msgid "" "An empty entry is added at the start, which corresponds to the current " "directory." msgstr "" -#: ../../using/windows.rst:1138 +#: ../../using/windows.rst:1171 msgid "" "If the environment variable :envvar:`PYTHONPATH` exists, as described in :" "ref:`using-on-envvars`, its entries are added next. Note that on Windows, " @@ -1797,7 +1841,7 @@ msgid "" "from the colon used in drive identifiers (``C:\\`` etc.)." msgstr "" -#: ../../using/windows.rst:1143 +#: ../../using/windows.rst:1176 msgid "" "Additional \"application paths\" can be added in the registry as subkeys of :" "samp:`\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\{version}\\\\PythonPath` under " @@ -1807,7 +1851,7 @@ msgid "" "installers only use HKLM, so HKCU is typically empty.)" msgstr "" -#: ../../using/windows.rst:1150 +#: ../../using/windows.rst:1183 msgid "" "If the environment variable :envvar:`PYTHONHOME` is set, it is assumed as " "\"Python Home\". Otherwise, the path of the main Python executable is used " @@ -1818,31 +1862,31 @@ msgid "" "PythonPath stored in the registry." msgstr "" -#: ../../using/windows.rst:1158 +#: ../../using/windows.rst:1191 msgid "" "If the Python Home cannot be located, no :envvar:`PYTHONPATH` is specified " "in the environment, and no registry entries can be found, a default path " "with relative entries is used (e.g. ``.\\Lib;.\\plat-win``, etc)." msgstr "" -#: ../../using/windows.rst:1162 +#: ../../using/windows.rst:1195 msgid "" "If a ``pyvenv.cfg`` file is found alongside the main executable or in the " "directory one level above the executable, the following variations apply:" msgstr "" -#: ../../using/windows.rst:1165 +#: ../../using/windows.rst:1198 msgid "" "If ``home`` is an absolute path and :envvar:`PYTHONHOME` is not set, this " "path is used instead of the path to the main executable when deducing the " "home location." msgstr "" -#: ../../using/windows.rst:1169 +#: ../../using/windows.rst:1202 msgid "The end result of all this is:" msgstr "最終這所有的結果為:" -#: ../../using/windows.rst:1171 +#: ../../using/windows.rst:1204 msgid "" "When running :file:`python.exe`, or any other .exe in the main Python " "directory (either an installed version, or directly from the PCbuild " @@ -1850,7 +1894,7 @@ msgid "" "ignored. Other \"application paths\" in the registry are always read." msgstr "" -#: ../../using/windows.rst:1176 +#: ../../using/windows.rst:1209 msgid "" "When Python is hosted in another .exe (different directory, embedded via " "COM, etc), the \"Python Home\" will not be deduced, so the core path from " @@ -1858,20 +1902,20 @@ msgid "" "always read." msgstr "" -#: ../../using/windows.rst:1180 +#: ../../using/windows.rst:1213 msgid "" "If Python can't find its home and there are no registry value (frozen .exe, " "some very strange installation setup) you get a path with some default, but " "relative, paths." msgstr "" -#: ../../using/windows.rst:1184 +#: ../../using/windows.rst:1217 msgid "" "For those who want to bundle Python into their application or distribution, " "the following advice will prevent conflicts with other installations:" msgstr "" -#: ../../using/windows.rst:1187 +#: ../../using/windows.rst:1220 msgid "" "Include a ``._pth`` file alongside your executable containing the " "directories to include. This will ignore paths listed in the registry and " @@ -1879,20 +1923,20 @@ msgid "" "listed." msgstr "" -#: ../../using/windows.rst:1192 +#: ../../using/windows.rst:1225 msgid "" "If you are loading :file:`python3.dll` or :file:`python37.dll` in your own " "executable, explicitly set :c:member:`PyConfig.module_search_paths` before :" "c:func:`Py_InitializeFromConfig`." msgstr "" -#: ../../using/windows.rst:1196 +#: ../../using/windows.rst:1229 msgid "" "Clear and/or overwrite :envvar:`PYTHONPATH` and set :envvar:`PYTHONHOME` " "before launching :file:`python.exe` from your application." msgstr "" -#: ../../using/windows.rst:1199 +#: ../../using/windows.rst:1232 msgid "" "If you cannot use the previous suggestions (for example, you are a " "distribution that allows people to run :file:`python.exe` directly), ensure " @@ -1901,7 +1945,7 @@ msgid "" "correctly named ZIP file will be detected instead.)" msgstr "" -#: ../../using/windows.rst:1205 +#: ../../using/windows.rst:1238 msgid "" "These will ensure that the files in a system-wide installation will not take " "precedence over the copy of the standard library bundled with your " @@ -1911,19 +1955,19 @@ msgid "" "packages." msgstr "" -#: ../../using/windows.rst:1213 +#: ../../using/windows.rst:1246 msgid "" "Add ``._pth`` file support and removes ``applocal`` option from ``pyvenv." "cfg``." msgstr "" -#: ../../using/windows.rst:1218 +#: ../../using/windows.rst:1251 msgid "" "Add :file:`python{XX}.zip` as a potential landmark when directly adjacent to " "the executable." msgstr "" -#: ../../using/windows.rst:1223 +#: ../../using/windows.rst:1256 msgid "" "Modules specified in the registry under ``Modules`` (not ``PythonPath``) may " "be imported by :class:`importlib.machinery.WindowsRegistryFinder`. This " @@ -1931,87 +1975,87 @@ msgid "" "explicitly added to :data:`sys.meta_path` in the future." msgstr "" -#: ../../using/windows.rst:1229 +#: ../../using/windows.rst:1262 msgid "Additional modules" msgstr "額外的模組" -#: ../../using/windows.rst:1231 +#: ../../using/windows.rst:1264 msgid "" "Even though Python aims to be portable among all platforms, there are " "features that are unique to Windows. A couple of modules, both in the " "standard library and external, and snippets exist to use these features." msgstr "" -#: ../../using/windows.rst:1235 +#: ../../using/windows.rst:1268 msgid "" "The Windows-specific standard modules are documented in :ref:`mswin-specific-" "services`." msgstr "" -#: ../../using/windows.rst:1239 +#: ../../using/windows.rst:1272 msgid "PyWin32" msgstr "PyWin32" -#: ../../using/windows.rst:1241 +#: ../../using/windows.rst:1274 msgid "" "The :pypi:`PyWin32` module by Mark Hammond is a collection of modules for " "advanced Windows-specific support. This includes utilities for:" msgstr "" -#: ../../using/windows.rst:1245 +#: ../../using/windows.rst:1278 msgid "" "`Component Object Model `_ (COM)" msgstr "" -#: ../../using/windows.rst:1248 +#: ../../using/windows.rst:1281 msgid "Win32 API calls" msgstr "Win32 API 呼叫" -#: ../../using/windows.rst:1249 +#: ../../using/windows.rst:1282 msgid "Registry" msgstr "登錄檔(Registry)" -#: ../../using/windows.rst:1250 +#: ../../using/windows.rst:1283 msgid "Event log" msgstr "事件日誌(Event log)" -#: ../../using/windows.rst:1251 +#: ../../using/windows.rst:1284 msgid "" "`Microsoft Foundation Classes `_ (MFC) user interfaces" msgstr "" -#: ../../using/windows.rst:1255 +#: ../../using/windows.rst:1288 msgid "" "`PythonWin `_ is a sample MFC application shipped with PyWin32. " "It is an embeddable IDE with a built-in debugger." msgstr "" -#: ../../using/windows.rst:1261 +#: ../../using/windows.rst:1294 msgid "" "`Win32 How Do I...? `_" msgstr "" "`Win32 How Do I...? `_" -#: ../../using/windows.rst:1262 +#: ../../using/windows.rst:1295 msgid "by Tim Golden" msgstr "由 Tim Golden 所著" -#: ../../using/windows.rst:1264 +#: ../../using/windows.rst:1297 msgid "`Python and COM `_" msgstr "`Python and COM `_" -#: ../../using/windows.rst:1265 +#: ../../using/windows.rst:1298 msgid "by David and Paul Boddie" msgstr "由 David 與 Paul Boddie 所著" -#: ../../using/windows.rst:1269 +#: ../../using/windows.rst:1302 msgid "cx_Freeze" msgstr "cx_Freeze" -#: ../../using/windows.rst:1271 +#: ../../using/windows.rst:1304 msgid "" "`cx_Freeze `_ wraps Python " "scripts into executable Windows programs (:file:`{*}.exe` files). When you " @@ -2019,11 +2063,11 @@ msgid "" "users to install Python." msgstr "" -#: ../../using/windows.rst:1278 +#: ../../using/windows.rst:1311 msgid "Compiling Python on Windows" msgstr "編譯 Python 在 Windows" -#: ../../using/windows.rst:1280 +#: ../../using/windows.rst:1313 msgid "" "If you want to compile CPython yourself, first thing you should do is get " "the `source `_. You can download " @@ -2031,38 +2075,38 @@ msgid "" "devguide.python.org/setup/#get-the-source-code>`_." msgstr "" -#: ../../using/windows.rst:1285 +#: ../../using/windows.rst:1318 msgid "" "The source tree contains a build solution and project files for Microsoft " "Visual Studio, which is the compiler used to build the official Python " "releases. These files are in the :file:`PCbuild` directory." msgstr "" -#: ../../using/windows.rst:1289 +#: ../../using/windows.rst:1322 msgid "" "Check :file:`PCbuild/readme.txt` for general information on the build " "process." msgstr "" -#: ../../using/windows.rst:1291 +#: ../../using/windows.rst:1324 msgid "For extension modules, consult :ref:`building-on-windows`." msgstr "" -#: ../../using/windows.rst:1298 +#: ../../using/windows.rst:1331 msgid "The full installer (deprecated)" msgstr "" -#: ../../using/windows.rst:1302 +#: ../../using/windows.rst:1335 msgid "" "This installer is deprecated since 3.14 and will not be produced for Python " "3.16 or later. See :ref:`pymanager` for the modern installer." msgstr "" -#: ../../using/windows.rst:1307 +#: ../../using/windows.rst:1340 msgid "Installation steps" msgstr "安裝步驟" -#: ../../using/windows.rst:1309 +#: ../../using/windows.rst:1342 msgid "" "Four Python |version| installers are available for download - two each for " "the 32-bit and 64-bit versions of the interpreter. The *web installer* is a " @@ -2073,43 +2117,43 @@ msgid "" "ways to avoid downloading during installation." msgstr "" -#: ../../using/windows.rst:1317 +#: ../../using/windows.rst:1350 msgid "After starting the installer, one of two options may be selected:" msgstr "" -#: ../../using/windows.rst:1321 +#: ../../using/windows.rst:1354 msgid "If you select \"Install Now\":" msgstr "如果你選擇「馬上安裝」:" -#: ../../using/windows.rst:1323 +#: ../../using/windows.rst:1356 msgid "" "You will *not* need to be an administrator (unless a system update for the C " "Runtime Library is required or you install the :ref:`launcher` for all users)" msgstr "" -#: ../../using/windows.rst:1326 +#: ../../using/windows.rst:1359 msgid "Python will be installed into your user directory" msgstr "" -#: ../../using/windows.rst:1327 +#: ../../using/windows.rst:1360 msgid "" "The :ref:`launcher` will be installed according to the option at the bottom " "of the first page" msgstr "" -#: ../../using/windows.rst:1329 +#: ../../using/windows.rst:1362 msgid "The standard library, test suite, launcher and pip will be installed" msgstr "" -#: ../../using/windows.rst:1330 +#: ../../using/windows.rst:1363 msgid "If selected, the install directory will be added to your :envvar:`PATH`" msgstr "如果選擇,安裝目錄將被加入到你的 :envvar:`PATH`" -#: ../../using/windows.rst:1331 +#: ../../using/windows.rst:1364 msgid "Shortcuts will only be visible for the current user" msgstr "安裝捷徑將只能被目前使用者所看見" -#: ../../using/windows.rst:1333 +#: ../../using/windows.rst:1366 msgid "" "Selecting \"Customize installation\" will allow you to select the features " "to install, the installation location and other options or post-install " @@ -2119,42 +2163,42 @@ msgstr "" "選擇「客製化安裝」將允許你選擇所需的項目進行安裝,安裝位置與其他選擇或安裝後" "的所需進行的動作。你將需要使用此選項「除錯特徵」或「二進位方式」進行安裝。" -#: ../../using/windows.rst:1337 +#: ../../using/windows.rst:1370 msgid "" "To perform an all-users installation, you should select \"Customize " "installation\". In this case:" msgstr "" -#: ../../using/windows.rst:1340 +#: ../../using/windows.rst:1373 msgid "You may be required to provide administrative credentials or approval" msgstr "" -#: ../../using/windows.rst:1341 +#: ../../using/windows.rst:1374 msgid "Python will be installed into the Program Files directory" msgstr "" -#: ../../using/windows.rst:1342 +#: ../../using/windows.rst:1375 msgid "The :ref:`launcher` will be installed into the Windows directory" msgstr "" -#: ../../using/windows.rst:1343 +#: ../../using/windows.rst:1376 msgid "Optional features may be selected during installation" msgstr "" -#: ../../using/windows.rst:1344 +#: ../../using/windows.rst:1377 msgid "The standard library can be pre-compiled to bytecode" msgstr "" -#: ../../using/windows.rst:1345 +#: ../../using/windows.rst:1378 msgid "" "If selected, the install directory will be added to the system :envvar:`PATH`" msgstr "" -#: ../../using/windows.rst:1346 +#: ../../using/windows.rst:1379 msgid "Shortcuts are available for all users" msgstr "捷徑將被所有使用者所見" -#: ../../using/windows.rst:1355 +#: ../../using/windows.rst:1388 msgid "" "In the latest versions of Windows, this limitation can be expanded to " "approximately 32,000 characters. Your administrator will need to activate " @@ -2163,19 +2207,19 @@ msgid "" "``HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem``." msgstr "" -#: ../../using/windows.rst:1364 +#: ../../using/windows.rst:1397 msgid "After changing the above option, no further configuration is required." msgstr "" -#: ../../using/windows.rst:1368 +#: ../../using/windows.rst:1401 msgid "Support for long paths was enabled in Python." msgstr "" -#: ../../using/windows.rst:1373 +#: ../../using/windows.rst:1406 msgid "Installing without UI" msgstr "無使用者介面安裝" -#: ../../using/windows.rst:1375 +#: ../../using/windows.rst:1408 msgid "" "All of the options available in the installer UI can also be specified from " "the command line, allowing scripted installers to replicate an installation " @@ -2183,112 +2227,112 @@ msgid "" "without suppressing the UI in order to change some of the defaults." msgstr "" -#: ../../using/windows.rst:1380 +#: ../../using/windows.rst:1413 msgid "" "The following options (found by executing the installer with ``/?``) can be " "passed into the installer:" msgstr "" -#: ../../using/windows.rst:1384 ../../using/windows.rst:1404 -#: ../../using/windows.rst:1994 +#: ../../using/windows.rst:1417 ../../using/windows.rst:1437 +#: ../../using/windows.rst:2027 msgid "Name" msgstr "名稱" -#: ../../using/windows.rst:1386 +#: ../../using/windows.rst:1419 msgid "/passive" msgstr "/passive" -#: ../../using/windows.rst:1386 +#: ../../using/windows.rst:1419 msgid "to display progress without requiring user interaction" msgstr "" -#: ../../using/windows.rst:1388 +#: ../../using/windows.rst:1421 msgid "/quiet" msgstr "/quiet" -#: ../../using/windows.rst:1388 +#: ../../using/windows.rst:1421 msgid "to install/uninstall without displaying any UI" msgstr "" -#: ../../using/windows.rst:1390 +#: ../../using/windows.rst:1423 msgid "/simple" msgstr "/simple" -#: ../../using/windows.rst:1390 +#: ../../using/windows.rst:1423 msgid "to prevent user customization" msgstr "" -#: ../../using/windows.rst:1392 +#: ../../using/windows.rst:1425 msgid "/uninstall" msgstr "/uninstall" -#: ../../using/windows.rst:1392 +#: ../../using/windows.rst:1425 msgid "to remove Python (without confirmation)" msgstr "" -#: ../../using/windows.rst:1394 +#: ../../using/windows.rst:1427 msgid "/layout [directory]" msgstr "/layout [directory]" -#: ../../using/windows.rst:1394 +#: ../../using/windows.rst:1427 msgid "to pre-download all components" msgstr "" -#: ../../using/windows.rst:1396 +#: ../../using/windows.rst:1429 msgid "/log [filename]" msgstr "/log [filename]" -#: ../../using/windows.rst:1396 +#: ../../using/windows.rst:1429 msgid "to specify log files location" msgstr "" -#: ../../using/windows.rst:1399 +#: ../../using/windows.rst:1432 msgid "" "All other options are passed as ``name=value``, where the value is usually " "``0`` to disable a feature, ``1`` to enable a feature, or a path. The full " "list of available options is shown below." msgstr "" -#: ../../using/windows.rst:1404 +#: ../../using/windows.rst:1437 msgid "Default" msgstr "預設" -#: ../../using/windows.rst:1406 +#: ../../using/windows.rst:1439 msgid "InstallAllUsers" msgstr "InstallAllUsers" -#: ../../using/windows.rst:1406 +#: ../../using/windows.rst:1439 msgid "Perform a system-wide installation." msgstr "" -#: ../../using/windows.rst:1406 ../../using/windows.rst:1432 -#: ../../using/windows.rst:1435 ../../using/windows.rst:1439 -#: ../../using/windows.rst:1448 ../../using/windows.rst:1470 -#: ../../using/windows.rst:1478 ../../using/windows.rst:1481 +#: ../../using/windows.rst:1439 ../../using/windows.rst:1465 +#: ../../using/windows.rst:1468 ../../using/windows.rst:1472 +#: ../../using/windows.rst:1481 ../../using/windows.rst:1503 +#: ../../using/windows.rst:1511 ../../using/windows.rst:1514 msgid "0" msgstr "0" -#: ../../using/windows.rst:1408 +#: ../../using/windows.rst:1441 msgid "TargetDir" msgstr "TargetDir" -#: ../../using/windows.rst:1408 +#: ../../using/windows.rst:1441 msgid "The installation directory" msgstr "安裝目錄" -#: ../../using/windows.rst:1408 +#: ../../using/windows.rst:1441 msgid "Selected based on InstallAllUsers" msgstr "" -#: ../../using/windows.rst:1411 +#: ../../using/windows.rst:1444 msgid "DefaultAllUsersTargetDir" msgstr "DefaultAllUsersTargetDir" -#: ../../using/windows.rst:1411 +#: ../../using/windows.rst:1444 msgid "The default installation directory for all-user installs" msgstr "" -#: ../../using/windows.rst:1411 +#: ../../using/windows.rst:1444 msgid "" ":file:`%ProgramFiles%\\\\ Python X.Y` or :file:` %ProgramFiles(x86)%\\\\ " "Python X.Y`" @@ -2296,15 +2340,15 @@ msgstr "" ":file:`%ProgramFiles%\\\\ Python X.Y` or :file:` %ProgramFiles(x86)%\\\\ " "Python X.Y`" -#: ../../using/windows.rst:1416 +#: ../../using/windows.rst:1449 msgid "DefaultJustForMeTargetDir" msgstr "DefaultJustForMeTargetDir" -#: ../../using/windows.rst:1416 +#: ../../using/windows.rst:1449 msgid "The default install directory for just-for-me installs" msgstr "" -#: ../../using/windows.rst:1416 +#: ../../using/windows.rst:1449 msgid "" ":file:`%LocalAppData%\\\\ Programs\\\\Python\\\\ PythonXY` or :file:" "`%LocalAppData%\\\\ Programs\\\\Python\\\\ PythonXY-32` or :file:" @@ -2314,218 +2358,218 @@ msgstr "" "`%LocalAppData%\\\\ Programs\\\\Python\\\\ PythonXY-32` 或 :file:" "`%LocalAppData%\\\\ Programs\\\\Python\\\\ PythonXY-64`" -#: ../../using/windows.rst:1426 +#: ../../using/windows.rst:1459 msgid "DefaultCustomTargetDir" msgstr "DefaultCustomTargetDir" -#: ../../using/windows.rst:1426 +#: ../../using/windows.rst:1459 msgid "The default custom install directory displayed in the UI" msgstr "" -#: ../../using/windows.rst:1426 ../../using/windows.rst:1483 +#: ../../using/windows.rst:1459 ../../using/windows.rst:1516 msgid "(empty)" msgstr "(empty)" -#: ../../using/windows.rst:1429 +#: ../../using/windows.rst:1462 msgid "AssociateFiles" msgstr "AssociateFiles" -#: ../../using/windows.rst:1429 +#: ../../using/windows.rst:1462 msgid "Create file associations if the launcher is also installed." msgstr "如果啟動器也被安裝,建立檔案關聯。" -#: ../../using/windows.rst:1429 ../../using/windows.rst:1443 -#: ../../using/windows.rst:1446 ../../using/windows.rst:1450 -#: ../../using/windows.rst:1454 ../../using/windows.rst:1458 -#: ../../using/windows.rst:1460 ../../using/windows.rst:1464 -#: ../../using/windows.rst:1468 ../../using/windows.rst:1472 -#: ../../using/windows.rst:1474 ../../using/windows.rst:1476 +#: ../../using/windows.rst:1462 ../../using/windows.rst:1476 +#: ../../using/windows.rst:1479 ../../using/windows.rst:1483 +#: ../../using/windows.rst:1487 ../../using/windows.rst:1491 +#: ../../using/windows.rst:1493 ../../using/windows.rst:1497 +#: ../../using/windows.rst:1501 ../../using/windows.rst:1505 +#: ../../using/windows.rst:1507 ../../using/windows.rst:1509 msgid "1" msgstr "1" -#: ../../using/windows.rst:1432 +#: ../../using/windows.rst:1465 msgid "CompileAll" msgstr "CompileAll" -#: ../../using/windows.rst:1432 +#: ../../using/windows.rst:1465 msgid "Compile all ``.py`` files to ``.pyc``." msgstr "編譯所有 ``.py`` 檔案為 ``.pyc``。" -#: ../../using/windows.rst:1435 +#: ../../using/windows.rst:1468 msgid "PrependPath" msgstr "PrependPath" -#: ../../using/windows.rst:1435 +#: ../../using/windows.rst:1468 msgid "" "Prepend install and Scripts directories to :envvar:`PATH` and add ``.PY`` " "to :envvar:`PATHEXT`" msgstr "" -#: ../../using/windows.rst:1439 +#: ../../using/windows.rst:1472 msgid "AppendPath" msgstr "AppendPath" -#: ../../using/windows.rst:1439 +#: ../../using/windows.rst:1472 msgid "" "Append install and Scripts directories to :envvar:`PATH` and add ``.PY`` " "to :envvar:`PATHEXT`" msgstr "" -#: ../../using/windows.rst:1443 +#: ../../using/windows.rst:1476 msgid "Shortcuts" msgstr "Shortcuts" -#: ../../using/windows.rst:1443 +#: ../../using/windows.rst:1476 msgid "" "Create shortcuts for the interpreter, documentation and IDLE if installed." msgstr "" -#: ../../using/windows.rst:1446 +#: ../../using/windows.rst:1479 msgid "Include_doc" msgstr "Include_doc" -#: ../../using/windows.rst:1446 +#: ../../using/windows.rst:1479 msgid "Install Python manual" msgstr "安裝Python文件" -#: ../../using/windows.rst:1448 +#: ../../using/windows.rst:1481 msgid "Include_debug" msgstr "Include_debug" -#: ../../using/windows.rst:1448 +#: ../../using/windows.rst:1481 msgid "Install debug binaries" msgstr "" -#: ../../using/windows.rst:1450 +#: ../../using/windows.rst:1483 msgid "Include_dev" msgstr "Include_dev" -#: ../../using/windows.rst:1450 +#: ../../using/windows.rst:1483 msgid "" "Install developer headers and libraries. Omitting this may lead to an " "unusable installation." msgstr "" -#: ../../using/windows.rst:1454 +#: ../../using/windows.rst:1487 msgid "Include_exe" msgstr "Include_exe" -#: ../../using/windows.rst:1454 +#: ../../using/windows.rst:1487 msgid "" "Install :file:`python.exe` and related files. Omitting this may lead to an " "unusable installation." msgstr "" -#: ../../using/windows.rst:1458 +#: ../../using/windows.rst:1491 msgid "Include_launcher" msgstr "Include_launcher" -#: ../../using/windows.rst:1458 +#: ../../using/windows.rst:1491 msgid "Install :ref:`launcher`." msgstr "安裝 :ref:`launcher`。" -#: ../../using/windows.rst:1460 +#: ../../using/windows.rst:1493 msgid "InstallLauncherAllUsers" msgstr "InstallLauncherAllUsers" -#: ../../using/windows.rst:1460 +#: ../../using/windows.rst:1493 msgid "" "Installs the launcher for all users. Also requires ``Include_launcher`` to " "be set to 1" msgstr "" -#: ../../using/windows.rst:1464 +#: ../../using/windows.rst:1497 msgid "Include_lib" msgstr "Include_lib" -#: ../../using/windows.rst:1464 +#: ../../using/windows.rst:1497 msgid "" "Install standard library and extension modules. Omitting this may lead to an " "unusable installation." msgstr "" -#: ../../using/windows.rst:1468 +#: ../../using/windows.rst:1501 msgid "Include_pip" msgstr "Include_pip" -#: ../../using/windows.rst:1468 +#: ../../using/windows.rst:1501 msgid "Install bundled pip and setuptools" msgstr "" -#: ../../using/windows.rst:1470 +#: ../../using/windows.rst:1503 msgid "Include_symbols" msgstr "Include_symbols" -#: ../../using/windows.rst:1470 +#: ../../using/windows.rst:1503 msgid "Install debugging symbols (``*.pdb``)" msgstr "" -#: ../../using/windows.rst:1472 +#: ../../using/windows.rst:1505 msgid "Include_tcltk" msgstr "Include_tcltk" -#: ../../using/windows.rst:1472 +#: ../../using/windows.rst:1505 msgid "Install Tcl/Tk support and IDLE" msgstr "" -#: ../../using/windows.rst:1474 +#: ../../using/windows.rst:1507 msgid "Include_test" msgstr "Include_test" -#: ../../using/windows.rst:1474 +#: ../../using/windows.rst:1507 msgid "Install standard library test suite" msgstr "" -#: ../../using/windows.rst:1476 +#: ../../using/windows.rst:1509 msgid "Include_tools" msgstr "Include_tools" -#: ../../using/windows.rst:1476 +#: ../../using/windows.rst:1509 msgid "Install utility scripts" msgstr "" -#: ../../using/windows.rst:1478 +#: ../../using/windows.rst:1511 msgid "LauncherOnly" msgstr "LauncherOnly" -#: ../../using/windows.rst:1478 +#: ../../using/windows.rst:1511 msgid "Only installs the launcher. This will override most other options." msgstr "" -#: ../../using/windows.rst:1481 +#: ../../using/windows.rst:1514 msgid "SimpleInstall" msgstr "SimpleInstall" -#: ../../using/windows.rst:1481 +#: ../../using/windows.rst:1514 msgid "Disable most install UI" msgstr "" -#: ../../using/windows.rst:1483 +#: ../../using/windows.rst:1516 msgid "SimpleInstallDescription" msgstr "SimpleInstallDescription" -#: ../../using/windows.rst:1483 +#: ../../using/windows.rst:1516 msgid "A custom message to display when the simplified install UI is used." msgstr "" -#: ../../using/windows.rst:1487 +#: ../../using/windows.rst:1520 msgid "" "For example, to silently install a default, system-wide Python installation, " "you could use the following command (from an elevated command prompt)::" msgstr "" -#: ../../using/windows.rst:1490 +#: ../../using/windows.rst:1523 msgid "python-3.9.0.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0" msgstr "python-3.9.0.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0" -#: ../../using/windows.rst:1492 +#: ../../using/windows.rst:1525 msgid "" "To allow users to easily install a personal copy of Python without the test " "suite, you could provide a shortcut with the following command. This will " "display a simplified initial page and disallow customization::" msgstr "" -#: ../../using/windows.rst:1496 +#: ../../using/windows.rst:1529 msgid "" "python-3.9.0.exe InstallAllUsers=0 Include_launcher=0 Include_test=0\n" " SimpleInstall=1 SimpleInstallDescription=\"Just for me, no test suite.\"" @@ -2533,14 +2577,14 @@ msgstr "" "python-3.9.0.exe InstallAllUsers=0 Include_launcher=0 Include_test=0\n" " SimpleInstall=1 SimpleInstallDescription=\"Just for me, no test suite.\"" -#: ../../using/windows.rst:1499 +#: ../../using/windows.rst:1532 msgid "" "(Note that omitting the launcher also omits file associations, and is only " "recommended for per-user installs when there is also a system-wide " "installation that included the launcher.)" msgstr "" -#: ../../using/windows.rst:1503 +#: ../../using/windows.rst:1536 msgid "" "The options listed above can also be provided in a file named ``unattend." "xml`` alongside the executable. This file specifies a list of options and " @@ -2549,7 +2593,7 @@ msgid "" "strings. This example file sets the same options as the previous example:" msgstr "" -#: ../../using/windows.rst:1509 +#: ../../using/windows.rst:1542 msgid "" "\n" " " -#: ../../using/windows.rst:1522 +#: ../../using/windows.rst:1555 msgid "Installing without downloading" msgstr "無下載安裝" -#: ../../using/windows.rst:1524 +#: ../../using/windows.rst:1557 msgid "" "As some features of Python are not included in the initial installer " "download, selecting those features may require an internet connection. To " @@ -2584,7 +2628,7 @@ msgid "" "to be performed it is very useful to have a locally cached copy." msgstr "" -#: ../../using/windows.rst:1532 +#: ../../using/windows.rst:1565 msgid "" "Execute the following command from Command Prompt to download all possible " "required files. Remember to substitute ``python-3.9.0.exe`` for the actual " @@ -2592,27 +2636,27 @@ msgid "" "avoid collisions between files with the same name." msgstr "" -#: ../../using/windows.rst:1539 +#: ../../using/windows.rst:1572 msgid "python-3.9.0.exe /layout [optional target directory]" msgstr "python-3.9.0.exe /layout [optional target directory]" -#: ../../using/windows.rst:1541 +#: ../../using/windows.rst:1574 msgid "" "You may also specify the ``/quiet`` option to hide the progress display." msgstr "" -#: ../../using/windows.rst:1544 +#: ../../using/windows.rst:1577 msgid "Modifying an install" msgstr "" -#: ../../using/windows.rst:1546 +#: ../../using/windows.rst:1579 msgid "" "Once Python has been installed, you can add or remove features through the " "Programs and Features tool that is part of Windows. Select the Python entry " "and choose \"Uninstall/Change\" to open the installer in maintenance mode." msgstr "" -#: ../../using/windows.rst:1550 +#: ../../using/windows.rst:1583 msgid "" "\"Modify\" allows you to add or remove features by modifying the checkboxes " "- unchanged checkboxes will not install or remove anything. Some options " @@ -2620,26 +2664,26 @@ msgid "" "these, you will need to remove and then reinstall Python completely." msgstr "" -#: ../../using/windows.rst:1555 +#: ../../using/windows.rst:1588 msgid "" "\"Repair\" will verify all the files that should be installed using the " "current settings and replace any that have been removed or modified." msgstr "" -#: ../../using/windows.rst:1558 +#: ../../using/windows.rst:1591 msgid "" "\"Uninstall\" will remove Python entirely, with the exception of the :ref:" "`launcher`, which has its own entry in Programs and Features." msgstr "" -#: ../../using/windows.rst:1567 +#: ../../using/windows.rst:1600 msgid "" "To install pre-built binaries with free-threading enabled (see :pep:`703`), " "you should select \"Customize installation\". The second page of options " "includes the \"Download free-threaded binaries\" checkbox." msgstr "" -#: ../../using/windows.rst:1573 +#: ../../using/windows.rst:1606 msgid "" "Selecting this option will download and install additional binaries to the " "same location as the main Python install. The main executable is called " @@ -2648,7 +2692,7 @@ msgid "" "are shared with the main install." msgstr "" -#: ../../using/windows.rst:1579 +#: ../../using/windows.rst:1612 msgid "" "The free-threaded version is registered as a regular Python install with the " "tag ``3.13t`` (with a ``-32`` or ``-arm64`` suffix as normal for those " @@ -2660,7 +2704,7 @@ msgid "" "not install the free-threaded binaries at this time." msgstr "" -#: ../../using/windows.rst:1588 +#: ../../using/windows.rst:1621 msgid "" "To specify the install option at the command line, use " "``Include_freethreaded=1``. See :ref:`install-layout-option` for " @@ -2669,24 +2713,24 @@ msgid "" "apply to the free-threaded builds." msgstr "" -#: ../../using/windows.rst:1594 +#: ../../using/windows.rst:1627 msgid "" "Free-threaded binaries are also available :ref:`on nuget.org `." msgstr "" -#: ../../using/windows.rst:1598 +#: ../../using/windows.rst:1631 msgid "Python launcher for Windows (deprecated)" msgstr "" -#: ../../using/windows.rst:1602 +#: ../../using/windows.rst:1635 msgid "" "The launcher and this documentation have been superseded by the Python " "Install Manager described above. This is preserved temporarily for " "historical interest." msgstr "" -#: ../../using/windows.rst:1608 +#: ../../using/windows.rst:1641 msgid "" "The Python launcher for Windows is a utility which aids in locating and " "executing of different Python versions. It allows scripts (or the command-" @@ -2694,7 +2738,7 @@ msgid "" "locate and execute that version." msgstr "" -#: ../../using/windows.rst:1613 +#: ../../using/windows.rst:1646 msgid "" "Unlike the :envvar:`PATH` variable, the launcher will correctly select the " "most appropriate version of Python. It will prefer per-user installations " @@ -2702,19 +2746,19 @@ msgid "" "most recently installed version." msgstr "" -#: ../../using/windows.rst:1618 +#: ../../using/windows.rst:1651 msgid "The launcher was originally specified in :pep:`397`." msgstr "" -#: ../../using/windows.rst:1621 +#: ../../using/windows.rst:1654 msgid "Getting started" msgstr "開始" -#: ../../using/windows.rst:1624 +#: ../../using/windows.rst:1657 msgid "From the command-line" msgstr "" -#: ../../using/windows.rst:1628 +#: ../../using/windows.rst:1661 msgid "" "System-wide installations of Python 3.3 and later will put the launcher on " "your :envvar:`PATH`. The launcher is compatible with all available versions " @@ -2722,62 +2766,62 @@ msgid "" "the launcher is available, execute the following command in Command Prompt::" msgstr "" -#: ../../using/windows.rst:1633 +#: ../../using/windows.rst:1666 msgid "py" msgstr "py" -#: ../../using/windows.rst:1635 +#: ../../using/windows.rst:1668 msgid "" "You should find that the latest version of Python you have installed is " "started - it can be exited as normal, and any additional command-line " "arguments specified will be sent directly to Python." msgstr "" -#: ../../using/windows.rst:1639 +#: ../../using/windows.rst:1672 msgid "" "If you have multiple versions of Python installed (e.g., 3.7 and |version|) " "you will have noticed that Python |version| was started - to launch Python " "3.7, try the command::" msgstr "" -#: ../../using/windows.rst:1643 +#: ../../using/windows.rst:1676 msgid "py -3.7" msgstr "py -3.7" -#: ../../using/windows.rst:1645 +#: ../../using/windows.rst:1678 msgid "" "If you want the latest version of Python 2 you have installed, try the " "command::" msgstr "" -#: ../../using/windows.rst:1648 +#: ../../using/windows.rst:1681 msgid "py -2" msgstr "py -2" -#: ../../using/windows.rst:1650 +#: ../../using/windows.rst:1683 msgid "" "If you see the following error, you do not have the launcher installed::" msgstr "" -#: ../../using/windows.rst:1652 +#: ../../using/windows.rst:1685 msgid "" "'py' is not recognized as an internal or external command,\n" "operable program or batch file." msgstr "" -#: ../../using/windows.rst:1655 +#: ../../using/windows.rst:1688 msgid "The command::" msgstr "指令: ::" -#: ../../using/windows.rst:1657 +#: ../../using/windows.rst:1690 msgid "py --list" msgstr "py --list" -#: ../../using/windows.rst:1659 +#: ../../using/windows.rst:1692 msgid "displays the currently installed version(s) of Python." msgstr "" -#: ../../using/windows.rst:1661 +#: ../../using/windows.rst:1694 msgid "" "The ``-x.y`` argument is the short form of the ``-V:Company/Tag`` argument, " "which allows selecting a specific Python runtime, including those that may " @@ -2786,14 +2830,14 @@ msgid "" "available runtimes using the ``-V:`` format." msgstr "" -#: ../../using/windows.rst:1667 +#: ../../using/windows.rst:1700 msgid "" "When using the ``-V:`` argument, specifying the Company will limit selection " "to runtimes from that provider, while specifying only the Tag will select " "from all providers. Note that omitting the slash implies a tag::" msgstr "" -#: ../../using/windows.rst:1671 +#: ../../using/windows.rst:1704 msgid "" "# Select any '3.*' tagged runtime\n" "py -V:3\n" @@ -2805,14 +2849,14 @@ msgid "" "py -V:PythonCore/3" msgstr "" -#: ../../using/windows.rst:1680 +#: ../../using/windows.rst:1713 msgid "" "The short form of the argument (``-3``) only ever selects from core Python " "releases, and not other distributions. However, the longer form (``-V:3``) " "will select from any." msgstr "" -#: ../../using/windows.rst:1684 +#: ../../using/windows.rst:1717 msgid "" "The Company is matched on the full string, case-insensitive. The Tag is " "matched on either the full string, or a prefix, provided the next character " @@ -2821,11 +2865,11 @@ msgid "" "``3.1``), but are compared using text (``-V:3.01`` does not match ``3.1``)." msgstr "" -#: ../../using/windows.rst:1692 +#: ../../using/windows.rst:1725 msgid "Virtual environments" msgstr "虛擬環境(Virtual environment)" -#: ../../using/windows.rst:1696 +#: ../../using/windows.rst:1729 msgid "" "If the launcher is run with no explicit Python version specification, and a " "virtual environment (created with the standard library :mod:`venv` module or " @@ -2835,17 +2879,17 @@ msgid "" "specify the global Python version." msgstr "" -#: ../../using/windows.rst:1704 +#: ../../using/windows.rst:1737 msgid "From a script" msgstr "" -#: ../../using/windows.rst:1706 +#: ../../using/windows.rst:1739 msgid "" "Let's create a test Python script - create a file called ``hello.py`` with " "the following contents" msgstr "" -#: ../../using/windows.rst:1709 +#: ../../using/windows.rst:1742 msgid "" "#! python\n" "import sys\n" @@ -2855,25 +2899,25 @@ msgstr "" "import sys\n" "sys.stdout.write(\"hello from Python %s\\n\" % (sys.version,))" -#: ../../using/windows.rst:1715 +#: ../../using/windows.rst:1748 msgid "From the directory in which hello.py lives, execute the command::" msgstr "" -#: ../../using/windows.rst:1717 +#: ../../using/windows.rst:1750 msgid "py hello.py" msgstr "py hello.py" -#: ../../using/windows.rst:1719 +#: ../../using/windows.rst:1752 msgid "" "You should notice the version number of your latest Python 2.x installation " "is printed. Now try changing the first line to be:" msgstr "" -#: ../../using/windows.rst:1722 +#: ../../using/windows.rst:1755 msgid "#! python3" msgstr "#! python3" -#: ../../using/windows.rst:1726 +#: ../../using/windows.rst:1759 msgid "" "Re-executing the command should now print the latest Python 3.x information. " "As with the above command-line examples, you can specify a more explicit " @@ -2882,7 +2926,7 @@ msgid "" "information printed." msgstr "" -#: ../../using/windows.rst:1732 +#: ../../using/windows.rst:1765 msgid "" "Note that unlike interactive use, a bare \"python\" will use the latest " "version of Python 2.x that you have installed. This is for backward " @@ -2890,11 +2934,11 @@ msgid "" "typically refers to Python 2." msgstr "" -#: ../../using/windows.rst:1738 +#: ../../using/windows.rst:1771 msgid "From file associations" msgstr "從檔案關聯" -#: ../../using/windows.rst:1740 +#: ../../using/windows.rst:1773 msgid "" "The launcher should have been associated with Python files (i.e. ``.py``, ``." "pyw``, ``.pyc`` files) when it was installed. This means that when you " @@ -2903,13 +2947,13 @@ msgid "" "have the script specify the version which should be used." msgstr "" -#: ../../using/windows.rst:1746 +#: ../../using/windows.rst:1779 msgid "" "The key benefit of this is that a single launcher can support multiple " "Python versions at the same time depending on the contents of the first line." msgstr "" -#: ../../using/windows.rst:1752 +#: ../../using/windows.rst:1785 msgid "" "If the first line of a script file starts with ``#!``, it is known as a " "\"shebang\" line. Linux and other Unix like operating systems have native " @@ -2919,30 +2963,30 @@ msgid "" "demonstrate their use." msgstr "" -#: ../../using/windows.rst:1759 +#: ../../using/windows.rst:1792 msgid "" "To allow shebang lines in Python scripts to be portable between Unix and " "Windows, this launcher supports a number of 'virtual' commands to specify " "which interpreter to use. The supported virtual commands are:" msgstr "" -#: ../../using/windows.rst:1763 +#: ../../using/windows.rst:1796 msgid "``/usr/bin/env``" msgstr "``/usr/bin/env``" -#: ../../using/windows.rst:1764 +#: ../../using/windows.rst:1797 msgid "``/usr/bin/python``" msgstr "``/usr/bin/python``" -#: ../../using/windows.rst:1765 +#: ../../using/windows.rst:1798 msgid "``/usr/local/bin/python``" msgstr "``/usr/local/bin/python``" -#: ../../using/windows.rst:1766 +#: ../../using/windows.rst:1799 msgid "``python``" msgstr "``python``" -#: ../../using/windows.rst:1780 +#: ../../using/windows.rst:1813 msgid "" "Any of the above virtual commands can be suffixed with an explicit version " "(either just the major version, or the major and minor version). Furthermore " @@ -2952,21 +2996,21 @@ msgid "" "and the environment will be used." msgstr "" -#: ../../using/windows.rst:1789 +#: ../../using/windows.rst:1822 msgid "" "Beginning with python launcher 3.7 it is possible to request 64-bit version " "by the \"-64\" suffix. Furthermore it is possible to specify a major and " "architecture without minor (i.e. ``/usr/bin/python3-64``)." msgstr "" -#: ../../using/windows.rst:1795 +#: ../../using/windows.rst:1828 msgid "" "The \"-64\" suffix is deprecated, and now implies \"any architecture that is " "not provably i386/32-bit\". To request a specific environment, use the new :" "samp:`-V:{TAG}` argument with the complete tag." msgstr "" -#: ../../using/windows.rst:1801 +#: ../../using/windows.rst:1834 msgid "" "Virtual commands referencing ``python`` now prefer an active virtual " "environment rather than searching :envvar:`PATH`. This handles cases where " @@ -2974,7 +3018,7 @@ msgid "" "not present in the active environment." msgstr "" -#: ../../using/windows.rst:1806 +#: ../../using/windows.rst:1839 msgid "" "The ``/usr/bin/env`` form of shebang line has one further special property. " "Before looking for installed Python interpreters, this form will search the " @@ -2988,7 +3032,7 @@ msgid "" "envvar:`PATH`." msgstr "" -#: ../../using/windows.rst:1817 +#: ../../using/windows.rst:1850 msgid "" "Shebang lines that do not match any of these patterns are looked up in the " "``[commands]`` section of the launcher's :ref:`.INI file `. " @@ -2999,7 +3043,7 @@ msgid "" "part of the filename)." msgstr "" -#: ../../using/windows.rst:1825 +#: ../../using/windows.rst:1858 msgid "" "[commands]\n" "/bin/xpython=C:\\Program Files\\XPython\\python.exe" @@ -3007,7 +3051,7 @@ msgstr "" "[commands]\n" "/bin/xpython=C:\\Program Files\\XPython\\python.exe" -#: ../../using/windows.rst:1830 +#: ../../using/windows.rst:1863 msgid "" "Any commands not found in the .INI file are treated as **Windows** " "executable paths that are absolute or relative to the directory containing " @@ -3018,33 +3062,33 @@ msgid "" "will be appended." msgstr "" -#: ../../using/windows.rst:1839 +#: ../../using/windows.rst:1872 msgid "Arguments in shebang lines" msgstr "" -#: ../../using/windows.rst:1841 +#: ../../using/windows.rst:1874 msgid "" "The shebang lines can also specify additional options to be passed to the " "Python interpreter. For example, if you have a shebang line:" msgstr "" -#: ../../using/windows.rst:1844 +#: ../../using/windows.rst:1877 msgid "#! /usr/bin/python -v" msgstr "#! /usr/bin/python -v" -#: ../../using/windows.rst:1848 +#: ../../using/windows.rst:1881 msgid "Then Python will be started with the ``-v`` option" msgstr "" -#: ../../using/windows.rst:1851 +#: ../../using/windows.rst:1884 msgid "Customization" msgstr "" -#: ../../using/windows.rst:1856 +#: ../../using/windows.rst:1889 msgid "Customization via INI files" msgstr "" -#: ../../using/windows.rst:1858 +#: ../../using/windows.rst:1891 msgid "" "Two .ini files will be searched by the launcher - ``py.ini`` in the current " "user's application data directory (``%LOCALAPPDATA%`` or ``$env:" @@ -3053,7 +3097,7 @@ msgid "" "e. py.exe) and for the 'windows' version (i.e. pyw.exe)." msgstr "" -#: ../../using/windows.rst:1864 +#: ../../using/windows.rst:1897 msgid "" "Customization specified in the \"application directory\" will have " "precedence over the one next to the executable, so a user, who may not have " @@ -3061,11 +3105,11 @@ msgid "" "that global .ini file." msgstr "" -#: ../../using/windows.rst:1869 +#: ../../using/windows.rst:1902 msgid "Customizing default Python versions" msgstr "" -#: ../../using/windows.rst:1871 +#: ../../using/windows.rst:1904 msgid "" "In some cases, a version qualifier can be included in a command to dictate " "which version of Python will be used by the command. A version qualifier " @@ -3075,13 +3119,13 @@ msgid "" "\"-32\" or \"-64\"." msgstr "" -#: ../../using/windows.rst:1877 +#: ../../using/windows.rst:1910 msgid "" "For example, a shebang line of ``#!python`` has no version qualifier, while " "``#!python3`` has a version qualifier which specifies only a major version." msgstr "" -#: ../../using/windows.rst:1880 +#: ../../using/windows.rst:1913 msgid "" "If no version qualifiers are found in a command, the environment variable :" "envvar:`!PY_PYTHON` can be set to specify the default version qualifier. If " @@ -3091,7 +3135,7 @@ msgid "" "launcher included with Python 3.7 or newer.)" msgstr "" -#: ../../using/windows.rst:1887 +#: ../../using/windows.rst:1920 msgid "" "If no minor version qualifiers are found, the environment variable " "``PY_PYTHON{major}`` (where ``{major}`` is the current major version " @@ -3102,7 +3146,7 @@ msgid "" "version in that family." msgstr "" -#: ../../using/windows.rst:1895 +#: ../../using/windows.rst:1928 msgid "" "On 64-bit Windows with both 32-bit and 64-bit implementations of the same " "(major.minor) Python version installed, the 64-bit version will always be " @@ -3116,30 +3160,30 @@ msgid "" "suffix can be used on a version specifier to change this behaviour." msgstr "" -#: ../../using/windows.rst:1906 +#: ../../using/windows.rst:1939 msgid "Examples:" msgstr "範例:" -#: ../../using/windows.rst:1908 +#: ../../using/windows.rst:1941 msgid "" "If no relevant options are set, the commands ``python`` and ``python2`` will " "use the latest Python 2.x version installed and the command ``python3`` will " "use the latest Python 3.x installed." msgstr "" -#: ../../using/windows.rst:1912 +#: ../../using/windows.rst:1945 msgid "" "The command ``python3.7`` will not consult any options at all as the " "versions are fully specified." msgstr "" -#: ../../using/windows.rst:1915 +#: ../../using/windows.rst:1948 msgid "" "If ``PY_PYTHON=3``, the commands ``python`` and ``python3`` will both use " "the latest installed Python 3 version." msgstr "" -#: ../../using/windows.rst:1918 +#: ../../using/windows.rst:1951 msgid "" "If ``PY_PYTHON=3.7-32``, the command ``python`` will use the 32-bit " "implementation of 3.7 whereas the command ``python3`` will use the latest " @@ -3147,13 +3191,13 @@ msgid "" "specified.)" msgstr "" -#: ../../using/windows.rst:1923 +#: ../../using/windows.rst:1956 msgid "" "If ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7``, the commands ``python`` and " "``python3`` will both use specifically 3.7" msgstr "" -#: ../../using/windows.rst:1926 +#: ../../using/windows.rst:1959 msgid "" "In addition to environment variables, the same settings can be configured in " "the .INI file used by the launcher. The section in the INI file is called " @@ -3163,15 +3207,15 @@ msgid "" "will override things specified in the INI file." msgstr "" -#: ../../using/windows.rst:1933 +#: ../../using/windows.rst:1966 msgid "For example:" msgstr "舉例來說:" -#: ../../using/windows.rst:1935 +#: ../../using/windows.rst:1968 msgid "Setting ``PY_PYTHON=3.7`` is equivalent to the INI file containing:" msgstr "" -#: ../../using/windows.rst:1937 +#: ../../using/windows.rst:1970 msgid "" "[defaults]\n" "python=3.7" @@ -3179,13 +3223,13 @@ msgstr "" "[defaults]\n" "python=3.7" -#: ../../using/windows.rst:1942 +#: ../../using/windows.rst:1975 msgid "" "Setting ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7`` is equivalent to the INI file " "containing:" msgstr "" -#: ../../using/windows.rst:1945 +#: ../../using/windows.rst:1978 msgid "" "[defaults]\n" "python=3\n" @@ -3195,11 +3239,11 @@ msgstr "" "python=3\n" "python3=3.7" -#: ../../using/windows.rst:1952 +#: ../../using/windows.rst:1985 msgid "Diagnostics" msgstr "" -#: ../../using/windows.rst:1954 +#: ../../using/windows.rst:1987 msgid "" "If an environment variable :envvar:`!PYLAUNCHER_DEBUG` is set (to any " "value), the launcher will print diagnostic information to stderr (i.e. to " @@ -3210,11 +3254,11 @@ msgid "" "debugging." msgstr "" -#: ../../using/windows.rst:1962 +#: ../../using/windows.rst:1995 msgid "Dry run" msgstr "" -#: ../../using/windows.rst:1964 +#: ../../using/windows.rst:1997 msgid "" "If an environment variable :envvar:`!PYLAUNCHER_DRYRUN` is set (to any " "value), the launcher will output the command it would have run, but will not " @@ -3224,11 +3268,11 @@ msgid "" "correctly in the console." msgstr "" -#: ../../using/windows.rst:1972 +#: ../../using/windows.rst:2005 msgid "Install on demand" msgstr "安裝隨選" -#: ../../using/windows.rst:1974 +#: ../../using/windows.rst:2007 msgid "" "If an environment variable :envvar:`!PYLAUNCHER_ALLOW_INSTALL` is set (to " "any value), and the requested Python version is not installed but is " @@ -3237,7 +3281,7 @@ msgid "" "command again." msgstr "" -#: ../../using/windows.rst:1979 +#: ../../using/windows.rst:2012 msgid "" "An additional :envvar:`!PYLAUNCHER_ALWAYS_INSTALL` variable causes the " "launcher to always try to install Python, even if it is detected. This is " @@ -3245,110 +3289,110 @@ msgid "" "PYLAUNCHER_DRYRUN`)." msgstr "" -#: ../../using/windows.rst:1984 +#: ../../using/windows.rst:2017 msgid "Return codes" msgstr "" -#: ../../using/windows.rst:1986 +#: ../../using/windows.rst:2019 msgid "" "The following exit codes may be returned by the Python launcher. " "Unfortunately, there is no way to distinguish these from the exit code of " "Python itself." msgstr "" -#: ../../using/windows.rst:1989 +#: ../../using/windows.rst:2022 msgid "" "The names of codes are as used in the sources, and are only for reference. " "There is no way to access or resolve them apart from reading this page. " "Entries are listed in alphabetical order of names." msgstr "" -#: ../../using/windows.rst:1994 +#: ../../using/windows.rst:2027 msgid "Value" msgstr "" -#: ../../using/windows.rst:1996 +#: ../../using/windows.rst:2029 msgid "RC_BAD_VENV_CFG" msgstr "RC_BAD_VENV_CFG" -#: ../../using/windows.rst:1996 +#: ../../using/windows.rst:2029 msgid "107" msgstr "107" -#: ../../using/windows.rst:1996 +#: ../../using/windows.rst:2029 msgid "A :file:`pyvenv.cfg` was found but is corrupt." msgstr "" -#: ../../using/windows.rst:1998 +#: ../../using/windows.rst:2031 msgid "RC_CREATE_PROCESS" msgstr "RC_CREATE_PROCESS" -#: ../../using/windows.rst:1998 +#: ../../using/windows.rst:2031 msgid "101" msgstr "101" -#: ../../using/windows.rst:1998 +#: ../../using/windows.rst:2031 msgid "Failed to launch Python." msgstr "" -#: ../../using/windows.rst:2000 +#: ../../using/windows.rst:2033 msgid "RC_INSTALLING" msgstr "RC_INSTALLING" -#: ../../using/windows.rst:2000 +#: ../../using/windows.rst:2033 msgid "111" msgstr "111" -#: ../../using/windows.rst:2000 +#: ../../using/windows.rst:2033 msgid "" "An install was started, but the command will need to be re-run after it " "completes." msgstr "" -#: ../../using/windows.rst:2003 +#: ../../using/windows.rst:2036 msgid "RC_INTERNAL_ERROR" msgstr "RC_INTERNAL_ERROR" -#: ../../using/windows.rst:2003 +#: ../../using/windows.rst:2036 msgid "109" msgstr "109" -#: ../../using/windows.rst:2003 +#: ../../using/windows.rst:2036 msgid "Unexpected error. Please report a bug." msgstr "" -#: ../../using/windows.rst:2005 +#: ../../using/windows.rst:2038 msgid "RC_NO_COMMANDLINE" msgstr "RC_NO_COMMANDLINE" -#: ../../using/windows.rst:2005 +#: ../../using/windows.rst:2038 msgid "108" msgstr "108" -#: ../../using/windows.rst:2005 +#: ../../using/windows.rst:2038 msgid "Unable to obtain command line from the operating system." msgstr "" -#: ../../using/windows.rst:2008 +#: ../../using/windows.rst:2041 msgid "RC_NO_PYTHON" msgstr "RC_NO_PYTHON" -#: ../../using/windows.rst:2008 +#: ../../using/windows.rst:2041 msgid "103" msgstr "103" -#: ../../using/windows.rst:2008 +#: ../../using/windows.rst:2041 msgid "Unable to locate the requested version." msgstr "" -#: ../../using/windows.rst:2010 +#: ../../using/windows.rst:2043 msgid "RC_NO_VENV_CFG" msgstr "RC_NO_VENV_CFG" -#: ../../using/windows.rst:2010 +#: ../../using/windows.rst:2043 msgid "106" msgstr "106" -#: ../../using/windows.rst:2010 +#: ../../using/windows.rst:2043 msgid "A :file:`pyvenv.cfg` was required but not found." msgstr "" diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index 4093dc2283..89d874a27c 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-12-08 07:22+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-" @@ -117,11 +117,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:66 msgid "" -"The union and intersection of sets can be computed with " -"the :meth:`~frozenset.union` and :meth:`~frozenset.intersection` methods; an " +"The union and intersection of sets can be computed with the :meth:" +"`~frozenset.union` and :meth:`~frozenset.intersection` methods; an " "alternative notation uses the bitwise operators ``&`` and ``|``. Mutable " "sets also have in-place versions of these methods, :meth:`!union_update` " -"and :meth:`~frozenset.intersection_update`. ::" +"and :meth:`~set.intersection_update`. ::" msgstr "" #: ../../whatsnew/2.3.rst:71 @@ -162,8 +162,8 @@ msgid "" "the set of all elements in the union that aren't in the intersection. " "Another way of putting it is that the symmetric difference contains all " "elements that are in exactly one set. Again, there's an alternative " -"notation (``^``), and an in-place version with the ungainly " -"name :meth:`~frozenset.symmetric_difference_update`. ::" +"notation (``^``), and an in-place version with the ungainly name :meth:`~set." +"symmetric_difference_update`. ::" msgstr "" #: ../../whatsnew/2.3.rst:92 @@ -280,13 +280,12 @@ msgid "" "of ``i``, similar to a :keyword:`return` statement. The big difference " "between :keyword:`!yield` and a :keyword:`!return` statement is that on " "reaching a :keyword:`!yield` the generator's state of execution is suspended " -"and local variables are preserved. On the next call to the generator's " -"``.next()`` method, the function will resume executing immediately after " -"the :keyword:`!yield` statement. (For complicated reasons, the :keyword:`!" -"yield` statement isn't allowed inside the :keyword:`try` block of " -"a :keyword:`!try`...\\ :keyword:`!finally` statement; read :pep:`255` for a " -"full explanation of the interaction between :keyword:`!yield` and " -"exceptions.)" +"and local variables are preserved. On the next call to the generator's ``." +"next()`` method, the function will resume executing immediately after the :" +"keyword:`!yield` statement. (For complicated reasons, the :keyword:`!yield` " +"statement isn't allowed inside the :keyword:`try` block of a :keyword:`!" +"try`...\\ :keyword:`!finally` statement; read :pep:`255` for a full " +"explanation of the interaction between :keyword:`!yield` and exceptions.)" msgstr "" #: ../../whatsnew/2.3.rst:169 @@ -448,9 +447,9 @@ msgstr "" msgid "" "Without such an encoding declaration, the default encoding used is 7-bit " "ASCII. Executing or importing modules that contain string literals with 8-" -"bit characters and have no encoding declaration will result in " -"a :exc:`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will " -"be a syntax error." +"bit characters and have no encoding declaration will result in a :exc:" +"`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will be a " +"syntax error." msgstr "" #: ../../whatsnew/2.3.rst:273 @@ -479,8 +478,8 @@ msgstr "" msgid "" "The new :mod:`zipimport` module adds support for importing modules from a " "ZIP-format archive. You don't need to import the module explicitly; it will " -"be automatically imported if a ZIP archive's filename is added to " -"``sys.path``. For example:" +"be automatically imported if a ZIP archive's filename is added to ``sys." +"path``. For example:" msgstr "" #: ../../whatsnew/2.3.rst:296 @@ -506,12 +505,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:314 msgid "" "An entry in ``sys.path`` can now be the filename of a ZIP archive. The ZIP " -"archive can contain any kind of files, but only files " -"named :file:`\\*.py`, :file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. " -"If an archive only contains :file:`\\*.py` files, Python will not attempt to " -"modify the archive by adding the corresponding :file:`\\*.pyc` file, meaning " -"that if a ZIP archive doesn't contain :file:`\\*.pyc` files, importing may " -"be rather slow." +"archive can contain any kind of files, but only files named :file:`\\*.py`, :" +"file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. If an archive only " +"contains :file:`\\*.py` files, Python will not attempt to modify the archive " +"by adding the corresponding :file:`\\*.pyc` file, meaning that if a ZIP " +"archive doesn't contain :file:`\\*.pyc` files, importing may be rather slow." msgstr "" #: ../../whatsnew/2.3.rst:321 @@ -529,9 +527,9 @@ msgstr "" msgid "" "Written by James C. Ahlstrom, who also provided an implementation. Python " "2.3 follows the specification in :pep:`273`, but uses an implementation " -"written by Just van Rossum that uses the import hooks described " -"in :pep:`302`. See section :ref:`section-pep302` for a description of the " -"new import hooks." +"written by Just van Rossum that uses the import hooks described in :pep:" +"`302`. See section :ref:`section-pep302` for a description of the new import " +"hooks." msgstr "" #: ../../whatsnew/2.3.rst:338 @@ -548,11 +546,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:344 msgid "" "Python now allows using arbitrary Unicode strings (within the limitations of " -"the file system) for all functions that expect file names, most notably " -"the :func:`open` built-in function. If a Unicode string is passed " -"to :func:`os.listdir`, Python now returns a list of Unicode strings. A new " -"function, :func:`!os.getcwdu`, returns the current directory as a Unicode " -"string." +"the file system) for all functions that expect file names, most notably the :" +"func:`open` built-in function. If a Unicode string is passed to :func:`os." +"listdir`, Python now returns a list of Unicode strings. A new function, :" +"func:`!os.getcwdu`, returns the current directory as a Unicode string." msgstr "" #: ../../whatsnew/2.3.rst:350 @@ -564,10 +561,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:353 msgid "" "Other systems also allow Unicode strings as file names but convert them to " -"byte strings before passing them to the system, which can cause " -"a :exc:`UnicodeError` to be raised. Applications can test whether arbitrary " -"Unicode strings are supported as file names by " -"checking :const:`os.path.supports_unicode_filenames`, a Boolean value." +"byte strings before passing them to the system, which can cause a :exc:" +"`UnicodeError` to be raised. Applications can test whether arbitrary Unicode " +"strings are supported as file names by checking :const:`os.path." +"supports_unicode_filenames`, a Boolean value." msgstr "" #: ../../whatsnew/2.3.rst:359 @@ -602,9 +599,9 @@ msgstr "" msgid "" "Python's file objects can now support end of line conventions other than the " "one followed by the platform on which Python is running. Opening a file with " -"the mode ``'U'`` or ``'rU'`` will open a file for reading " -"in :term:`universal newlines` mode. All three line ending conventions will " -"be translated to a ``'\\n'`` in the strings returned by the various file " +"the mode ``'U'`` or ``'rU'`` will open a file for reading in :term:" +"`universal newlines` mode. All three line ending conventions will be " +"translated to a ``'\\n'`` in the strings returned by the various file " "methods such as :meth:`!read` and :meth:`!readline`." msgstr "" @@ -618,9 +615,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:396 msgid "" -"This feature can be disabled when compiling Python by specifying " -"the :option:`!--without-universal-newlines` switch when running " -"Python's :program:`configure` script." +"This feature can be disabled when compiling Python by specifying the :option:" +"`!--without-universal-newlines` switch when running Python's :program:" +"`configure` script." msgstr "" #: ../../whatsnew/2.3.rst:403 @@ -694,16 +691,15 @@ msgstr "" msgid "" "The :class:`~logging.Logger` class is the primary class. Most application " "code will deal with one or more :class:`~logging.Logger` objects, each one " -"used by a particular subsystem of the application. " -"Each :class:`~logging.Logger` is identified by a name, and names are " -"organized into a hierarchy using ``.`` as the component separator. For " -"example, you might have :class:`~logging.Logger` instances named ``server``, " -"``server.auth`` and ``server.network``. The latter two instances are below " -"``server`` in the hierarchy. This means that if you turn up the verbosity " -"for ``server`` or direct ``server`` messages to a different handler, the " -"changes will also apply to records logged to ``server.auth`` and " -"``server.network``. There's also a root :class:`~logging.Logger` that's the " -"parent of all other loggers." +"used by a particular subsystem of the application. Each :class:`~logging." +"Logger` is identified by a name, and names are organized into a hierarchy " +"using ``.`` as the component separator. For example, you might have :class:" +"`~logging.Logger` instances named ``server``, ``server.auth`` and ``server." +"network``. The latter two instances are below ``server`` in the hierarchy. " +"This means that if you turn up the verbosity for ``server`` or direct " +"``server`` messages to a different handler, the changes will also apply to " +"records logged to ``server.auth`` and ``server.network``. There's also a " +"root :class:`~logging.Logger` that's the parent of all other loggers." msgstr "" #: ../../whatsnew/2.3.rst:464 @@ -745,8 +741,8 @@ msgstr "" msgid "" "In the default configuration, informational and debugging messages are " "suppressed and the output is sent to standard error. You can enable the " -"display of informational and debugging messages by calling " -"the :meth:`~logging.Logger.setLevel` method on the root logger." +"display of informational and debugging messages by calling the :meth:" +"`~logging.Logger.setLevel` method on the root logger." msgstr "" #: ../../whatsnew/2.3.rst:486 @@ -819,9 +815,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:519 msgid "" "Log records are usually propagated up the hierarchy, so a message logged to " -"``server.auth`` is also seen by ``server`` and ``root``, but " -"a :class:`~logging.Logger` can prevent this by setting " -"its :attr:`~logging.Logger.propagate` attribute to :const:`False`." +"``server.auth`` is also seen by ``server`` and ``root``, but a :class:" +"`~logging.Logger` can prevent this by setting its :attr:`~logging.Logger." +"propagate` attribute to :const:`False`." msgstr "" #: ../../whatsnew/2.3.rst:523 @@ -832,10 +828,10 @@ msgid "" "any number of different :class:`~logging.Handler` instances. Loggers and " "handlers can also have an attached list of filters, and each filter can " "cause the :class:`~logging.LogRecord` to be ignored or can modify the record " -"before passing it along. When they're finally " -"output, :class:`~logging.LogRecord` instances are converted to text by " -"a :class:`~logging.Formatter` class. All of these classes can be replaced " -"by your own specially written classes." +"before passing it along. When they're finally output, :class:`~logging." +"LogRecord` instances are converted to text by a :class:`~logging.Formatter` " +"class. All of these classes can be replaced by your own specially written " +"classes." msgstr "" #: ../../whatsnew/2.3.rst:533 @@ -862,17 +858,17 @@ msgstr "PEP 285:布林型別" #: ../../whatsnew/2.3.rst:552 msgid "" "A Boolean type was added to Python 2.3. Two new constants were added to " -"the :mod:`!__builtin__` module, :const:`True` and :const:`False`. " -"(:const:`True` and :const:`False` constants were added to the built-ins in " -"Python 2.2.1, but the 2.2.1 versions are simply set to integer values of 1 " -"and 0 and aren't a different type.)" +"the :mod:`!__builtin__` module, :const:`True` and :const:`False`. (:const:" +"`True` and :const:`False` constants were added to the built-ins in Python " +"2.2.1, but the 2.2.1 versions are simply set to integer values of 1 and 0 " +"and aren't a different type.)" msgstr "" #: ../../whatsnew/2.3.rst:558 msgid "" "The type object for this new type is named :class:`bool`; the constructor " -"for it takes any Python value and converts it to :const:`True` " -"or :const:`False`. ::" +"for it takes any Python value and converts it to :const:`True` or :const:" +"`False`. ::" msgstr "" #: ../../whatsnew/2.3.rst:561 @@ -933,13 +929,13 @@ msgstr "" msgid "" "Python's Booleans were *not* added for the sake of strict type-checking. A " "very strict language such as Pascal would also prevent you performing " -"arithmetic with Booleans, and would require that the expression in " -"an :keyword:`if` statement always evaluate to a Boolean result. Python is " -"not this strict and never will be, as :pep:`285` explicitly says. This " -"means you can still use any expression in an :keyword:`!if` statement, even " -"ones that evaluate to a list or tuple or some random object. The Boolean " -"type is a subclass of the :class:`int` class so that arithmetic using a " -"Boolean still works. ::" +"arithmetic with Booleans, and would require that the expression in an :" +"keyword:`if` statement always evaluate to a Boolean result. Python is not " +"this strict and never will be, as :pep:`285` explicitly says. This means " +"you can still use any expression in an :keyword:`!if` statement, even ones " +"that evaluate to a list or tuple or some random object. The Boolean type is " +"a subclass of the :class:`int` class so that arithmetic using a Boolean " +"still works. ::" msgstr "" #: ../../whatsnew/2.3.rst:596 @@ -986,9 +982,9 @@ msgstr "" msgid "" "When encoding a Unicode string into a byte string, unencodable characters " "may be encountered. So far, Python has allowed specifying the error " -"processing as either \"strict\" (raising :exc:`UnicodeError`), \"ignore\" " -"(skipping the character), or \"replace\" (using a question mark in the " -"output string), with \"strict\" being the default behavior. It may be " +"processing as either \"strict\" (raising :exc:`UnicodeError`), " +"\"ignore\" (skipping the character), or \"replace\" (using a question mark " +"in the output string), with \"strict\" being the default behavior. It may be " "desirable to specify alternative processing of such errors, such as " "inserting an XML character reference or HTML entity reference into the " "converted string." @@ -1112,14 +1108,14 @@ msgstr "" msgid "" "``sys.path_hooks`` is a list of callable objects; most often they'll be " "classes. Each callable takes a string containing a path and either returns " -"an importer object that will handle imports from this path or raises " -"an :exc:`ImportError` exception if it can't handle this path." +"an importer object that will handle imports from this path or raises an :exc:" +"`ImportError` exception if it can't handle this path." msgstr "" #: ../../whatsnew/2.3.rst:721 msgid "" -"``sys.path_importer_cache`` caches importer objects for each path, so " -"``sys.path_hooks`` will only need to be traversed once for each path." +"``sys.path_importer_cache`` caches importer objects for each path, so ``sys." +"path_hooks`` will only need to be traversed once for each path." msgstr "" #: ../../whatsnew/2.3.rst:724 @@ -1237,9 +1233,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:797 msgid "" "Different dialects of comma-separated files can be defined and registered; " -"currently there are two dialects, both used by Microsoft Excel. A " -"separate :class:`csv.writer` class will generate comma-separated files from " -"a succession of tuples or lists, quoting strings that contain the delimiter." +"currently there are two dialects, both used by Microsoft Excel. A separate :" +"class:`csv.writer` class will generate comma-separated files from a " +"succession of tuples or lists, quoting strings that contain the delimiter." msgstr "" #: ../../whatsnew/2.3.rst:805 @@ -1287,10 +1283,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:836 msgid "" "To reduce the pickling overhead for new-style classes, a new interface for " -"customizing pickling was added using three special " -"methods: :meth:`~object.__getstate__`, :meth:`~object.__setstate__`, " -"and :meth:`~object.__getnewargs__`. Consult :pep:`307` for the full " -"semantics of these methods." +"customizing pickling was added using three special methods: :meth:`~object." +"__getstate__`, :meth:`~object.__setstate__`, and :meth:`~object." +"__getnewargs__`. Consult :pep:`307` for the full semantics of these " +"methods." msgstr "" #: ../../whatsnew/2.3.rst:841 @@ -1674,10 +1670,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:1044 msgid "" "Most type objects are now callable, so you can use them to create new " -"objects such as functions, classes, and modules. (This means that " -"the :mod:`!new` module can be deprecated in a future Python version, because " -"you can now use the type objects available in the :mod:`types` module.) For " -"example, you can create a new module object with the following code:" +"objects such as functions, classes, and modules. (This means that the :mod:" +"`!new` module can be deprecated in a future Python version, because you can " +"now use the type objects available in the :mod:`types` module.) For example, " +"you can create a new module object with the following code:" msgstr "" #: ../../whatsnew/2.3.rst:1052 @@ -1701,16 +1697,16 @@ msgid "" "A new warning, :exc:`PendingDeprecationWarning` was added to indicate " "features which are in the process of being deprecated. The warning will " "*not* be printed by default. To check for use of features that will be " -"deprecated in the future, supply :option:`-" -"Walways::PendingDeprecationWarning:: <-W>` on the command line or " -"use :func:`warnings.filterwarnings`." +"deprecated in the future, supply :option:`-Walways::" +"PendingDeprecationWarning:: <-W>` on the command line or use :func:`warnings." +"filterwarnings`." msgstr "" #: ../../whatsnew/2.3.rst:1065 msgid "" "The process of deprecating string-based exceptions, as in ``raise \"Error " -"occurred\"``, has begun. Raising a string will now " -"trigger :exc:`PendingDeprecationWarning`." +"occurred\"``, has begun. Raising a string will now trigger :exc:" +"`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/2.3.rst:1069 @@ -1790,8 +1786,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1115 msgid "" "One of the noted incompatibilities between old- and new-style classes has " -"been removed: you can now assign to the :attr:`~type.__name__` " -"and :attr:`~type.__bases__` attributes of new-style classes. There are some " +"been removed: you can now assign to the :attr:`~type.__name__` and :attr:" +"`~type.__bases__` attributes of new-style classes. There are some " "restrictions on what can be assigned to :attr:`!__bases__` along the lines " "of those relating to assigning to an instance's :attr:`~object.__class__` " "attribute." @@ -1942,9 +1938,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1202 msgid "" "The ``SET_LINENO`` opcode is now gone. This may provide a small speed " -"increase, depending on your compiler's idiosyncrasies. See " -"section :ref:`23section-other` for a longer explanation. (Removed by Michael " -"Hudson.)" +"increase, depending on your compiler's idiosyncrasies. See section :ref:" +"`23section-other` for a longer explanation. (Removed by Michael Hudson.)" msgstr "" #: ../../whatsnew/2.3.rst:1206 @@ -2005,19 +2000,18 @@ msgid "" "incompatibilities. When upgrading to Python 2.3, if the new interpreter is " "compiled with a new version of the underlying BerkeleyDB library, you will " "almost certainly have to convert your database files to the new version. " -"You can do this fairly easily with the new scripts :file:`db2pickle.py` " -"and :file:`pickle2db.py` which you will find in the " -"distribution's :file:`Tools/scripts` directory. If you've already been " -"using the PyBSDDB package and importing it as :mod:`!bsddb3`, you will have " -"to change your ``import`` statements to import it as :mod:`!bsddb`." +"You can do this fairly easily with the new scripts :file:`db2pickle.py` and :" +"file:`pickle2db.py` which you will find in the distribution's :file:`Tools/" +"scripts` directory. If you've already been using the PyBSDDB package and " +"importing it as :mod:`!bsddb3`, you will have to change your ``import`` " +"statements to import it as :mod:`!bsddb`." msgstr "" #: ../../whatsnew/2.3.rst:1249 msgid "" "The new :mod:`bz2` module is an interface to the bz2 data compression " -"library. bz2-compressed data is usually smaller than " -"corresponding :mod:`zlib`\\ -compressed data. (Contributed by Gustavo " -"Niemeyer.)" +"library. bz2-compressed data is usually smaller than corresponding :mod:" +"`zlib`\\ -compressed data. (Contributed by Gustavo Niemeyer.)" msgstr "" #: ../../whatsnew/2.3.rst:1253 @@ -2051,18 +2045,18 @@ msgstr "" #: ../../whatsnew/2.3.rst:1270 msgid "" -"Other minor changes to Distutils: it now checks for " -"the :envvar:`CC`, :envvar:`CFLAGS`, :envvar:`!CPP`, :envvar:`LDFLAGS`, " -"and :envvar:`CPPFLAGS` environment variables, using them to override the " -"settings in Python's configuration (contributed by Robert Weber)." +"Other minor changes to Distutils: it now checks for the :envvar:`CC`, :" +"envvar:`CFLAGS`, :envvar:`!CPP`, :envvar:`LDFLAGS`, and :envvar:`CPPFLAGS` " +"environment variables, using them to override the settings in Python's " +"configuration (contributed by Robert Weber)." msgstr "" #: ../../whatsnew/2.3.rst:1275 msgid "" "Previously the :mod:`doctest` module would only search the docstrings of " "public methods and functions for test cases, but it now also examines " -"private ones as well. The :func:`~doctest.DocTestSuite` function creates " -"a :class:`unittest.TestSuite` object from a set of :mod:`doctest` tests." +"private ones as well. The :func:`~doctest.DocTestSuite` function creates a :" +"class:`unittest.TestSuite` object from a set of :mod:`doctest` tests." msgstr "" #: ../../whatsnew/2.3.rst:1280 @@ -2075,10 +2069,10 @@ msgstr "" msgid "" "The :mod:`getopt` module gained a new function, :func:`~getopt.gnu_getopt`, " "that supports the same arguments as the existing :func:`~getopt.getopt` " -"function but uses GNU-style scanning mode. The " -"existing :func:`~getopt.getopt` stops processing options as soon as a non-" -"option argument is encountered, but in GNU-style mode processing continues, " -"meaning that options and arguments can be mixed. For example::" +"function but uses GNU-style scanning mode. The existing :func:`~getopt." +"getopt` stops processing options as soon as a non-option argument is " +"encountered, but in GNU-style mode processing continues, meaning that " +"options and arguments can be mixed. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1289 @@ -2133,10 +2127,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:1314 msgid "" -"The :mod:`heapq` module provides :func:`~heapq.heappush` " -"and :func:`~heapq.heappop` functions for adding and removing items while " -"maintaining the heap property on top of some other mutable Python sequence " -"type. Here's an example that uses a Python list::" +"The :mod:`heapq` module provides :func:`~heapq.heappush` and :func:`~heapq." +"heappop` functions for adding and removing items while maintaining the heap " +"property on top of some other mutable Python sequence type. Here's an " +"example that uses a Python list::" msgstr "" #: ../../whatsnew/2.3.rst:1318 @@ -2234,8 +2228,8 @@ msgid "" "stamps are floats. For compatibility, when using the tuple interface of " "the :class:`~os.stat_result` time stamps will be represented as integers. " "When using named fields (a feature first introduced in Python 2.2), time " -"stamps are still represented as integers, unless :func:`!" -"os.stat_float_times` is invoked to enable float return values::" +"stamps are still represented as integers, unless :func:`!os." +"stat_float_times` is invoked to enable float return values::" msgstr "" #: ../../whatsnew/2.3.rst:1376 @@ -2294,8 +2288,8 @@ msgid "" "The parser objects provided by the :mod:`pyexpat ` module " "can now optionally buffer character data, resulting in fewer calls to your " "character data handler and therefore faster performance. Setting the parser " -"object's :attr:`~xml.parsers.expat.xmlparser.buffer_text` attribute " -"to :const:`True` will enable buffering." +"object's :attr:`~xml.parsers.expat.xmlparser.buffer_text` attribute to :" +"const:`True` will enable buffering." msgstr "" #: ../../whatsnew/2.3.rst:1410 @@ -2340,8 +2334,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1438 msgid "" -"The :mod:`readline` module also gained a number of new " -"functions: :func:`~readline.get_history_item`, :func:`~readline.get_current_history_length`, " +"The :mod:`readline` module also gained a number of new functions: :func:" +"`~readline.get_history_item`, :func:`~readline.get_current_history_length`, " "and :func:`~readline.redisplay`." msgstr "" @@ -2377,9 +2371,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1459 msgid "" -"Support for more advanced POSIX signal handling was added to " -"the :mod:`signal` but then removed again as it proved impossible to make it " -"work reliably across platforms." +"Support for more advanced POSIX signal handling was added to the :mod:" +"`signal` but then removed again as it proved impossible to make it work " +"reliably across platforms." msgstr "" #: ../../whatsnew/2.3.rst:1463 @@ -2414,8 +2408,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1481 msgid "" -"The new :mod:`tarfile` module allows reading from and writing " -"to :program:`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)" +"The new :mod:`tarfile` module allows reading from and writing to :program:" +"`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)" msgstr "" #: ../../whatsnew/2.3.rst:1484 @@ -2425,8 +2419,8 @@ msgid "" "string and returns a list containing the text split into lines of no more " "than the chosen width. The ``fill(text, width)`` function returns a single " "string, reformatted to fit into lines no longer than the chosen width. (As " -"you can guess, :func:`~textwrap.fill` is built on top " -"of :func:`~textwrap.wrap`. For example::" +"you can guess, :func:`~textwrap.fill` is built on top of :func:`~textwrap." +"wrap`. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1491 @@ -2464,21 +2458,21 @@ msgstr "" #: ../../whatsnew/2.3.rst:1506 msgid "" "The module also contains a :class:`~textwrap.TextWrapper` class that " -"actually implements the text wrapping strategy. Both " -"the :class:`~textwrap.TextWrapper` class and the :func:`~textwrap.wrap` " -"and :func:`~textwrap.fill` functions support a number of additional keyword " -"arguments for fine-tuning the formatting; consult the module's documentation " -"for details. (Contributed by Greg Ward.)" +"actually implements the text wrapping strategy. Both the :class:`~textwrap." +"TextWrapper` class and the :func:`~textwrap.wrap` and :func:`~textwrap.fill` " +"functions support a number of additional keyword arguments for fine-tuning " +"the formatting; consult the module's documentation for details. (Contributed " +"by Greg Ward.)" msgstr "" #: ../../whatsnew/2.3.rst:1512 msgid "" -"The :mod:`!thread` and :mod:`threading` modules now have companion " -"modules, :mod:`!dummy_thread` and :mod:`!dummy_threading`, that provide a do-" -"nothing implementation of the :mod:`!thread` module's interface for " -"platforms where threads are not supported. The intention is to simplify " -"thread-aware modules (ones that *don't* rely on threads to run) by putting " -"the following code at the top::" +"The :mod:`!thread` and :mod:`threading` modules now have companion modules, :" +"mod:`!dummy_thread` and :mod:`!dummy_threading`, that provide a do-nothing " +"implementation of the :mod:`!thread` module's interface for platforms where " +"threads are not supported. The intention is to simplify thread-aware " +"modules (ones that *don't* rely on threads to run) by putting the following " +"code at the top::" msgstr "" #: ../../whatsnew/2.3.rst:1519 @@ -2492,13 +2486,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:1524 msgid "" "In this example, :mod:`!_threading` is used as the module name to make it " -"clear that the module being used is not necessarily the " -"actual :mod:`threading` module. Code can call functions and use classes " -"in :mod:`!_threading` whether or not threads are supported, avoiding " -"an :keyword:`if` statement and making the code slightly clearer. This " -"module will not magically make multithreaded code run without threads; code " -"that waits for another thread to return or to do something will simply hang " -"forever." +"clear that the module being used is not necessarily the actual :mod:" +"`threading` module. Code can call functions and use classes in :mod:`!" +"_threading` whether or not threads are supported, avoiding an :keyword:`if` " +"statement and making the code slightly clearer. This module will not " +"magically make multithreaded code run without threads; code that waits for " +"another thread to return or to do something will simply hang forever." msgstr "" #: ../../whatsnew/2.3.rst:1532 @@ -2552,9 +2545,9 @@ msgid "" "a command, passing it to the correct thread, and waiting for the results. " "Other interfaces can't be handled automatically but :mod:`!Tkinter` will now " "raise an exception on such an access so that you can at least find out about " -"the problem. See https://mail.python.org/pipermail/python-dev/2002-December/" -"031107.html for a more detailed explanation of this change. (Implemented by " -"Martin von Löwis.)" +"the problem. See https://mail.python.org/pipermail/python-dev/2002-" +"December/031107.html for a more detailed explanation of this change. " +"(Implemented by Martin von Löwis.)" msgstr "" #: ../../whatsnew/2.3.rst:1572 @@ -2606,9 +2599,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1598 msgid "" "Adding the mix-in as a superclass provides the full dictionary interface " -"whenever the class " -"defines :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, " -"and :meth:`!keys`. For example::" +"whenever the class defines :meth:`~object.__getitem__`, :meth:`~object." +"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1602 @@ -2658,9 +2650,9 @@ msgstr "(由 Raymond Hettinger 所貢獻。)" #: ../../whatsnew/2.3.rst:1641 msgid "" "The DOM implementation in :mod:`xml.dom.minidom` can now generate XML output " -"in a particular encoding by providing an optional encoding argument to " -"the :meth:`~xml.dom.minidom.Node.toxml` " -"and :meth:`~xml.dom.minidom.Node.toprettyxml` methods of DOM nodes." +"in a particular encoding by providing an optional encoding argument to the :" +"meth:`~xml.dom.minidom.Node.toxml` and :meth:`~xml.dom.minidom.Node." +"toprettyxml` methods of DOM nodes." msgstr "" #: ../../whatsnew/2.3.rst:1645 @@ -2717,9 +2709,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1681 msgid "" -"Date and time types suitable for expressing timestamps were added as " -"the :mod:`datetime` module. The types don't support different calendars or " -"many fancy features, and just stick to the basics of representing time." +"Date and time types suitable for expressing timestamps were added as the :" +"mod:`datetime` module. The types don't support different calendars or many " +"fancy features, and just stick to the basics of representing time." msgstr "" #: ../../whatsnew/2.3.rst:1685 @@ -2727,19 +2719,19 @@ msgid "" "The three primary types are: :class:`~datetime.date`, representing a day, " "month, and year; :class:`~datetime.time`, consisting of hour, minute, and " "second; and :class:`~datetime.datetime`, which contains all the attributes " -"of both :class:`~datetime.date` and :class:`~datetime.time`. There's also " -"a :class:`~datetime.timedelta` class representing differences between two " +"of both :class:`~datetime.date` and :class:`~datetime.time`. There's also a :" +"class:`~datetime.timedelta` class representing differences between two " "points in time, and time zone logic is implemented by classes inheriting " "from the abstract :class:`~datetime.tzinfo` class." msgstr "" #: ../../whatsnew/2.3.rst:1692 msgid "" -"You can create instances of :class:`~datetime.date` " -"and :class:`~datetime.time` by either supplying keyword arguments to the " -"appropriate constructor, e.g. ``datetime.date(year=1972, month=10, " -"day=15)``, or by using one of a number of class methods. For example, " -"the :meth:`~datetime.date.today` class method returns the current local date." +"You can create instances of :class:`~datetime.date` and :class:`~datetime." +"time` by either supplying keyword arguments to the appropriate constructor, " +"e.g. ``datetime.date(year=1972, month=10, day=15)``, or by using one of a " +"number of class methods. For example, the :meth:`~datetime.date.today` " +"class method returns the current local date." msgstr "" #: ../../whatsnew/2.3.rst:1698 @@ -2786,12 +2778,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:1720 msgid "" "Instances can be compared, hashed, and converted to strings (the result is " -"the same as that " -"of :meth:`~datetime.datetime.isoformat`). :class:`~datetime.date` " -"and :class:`~datetime.datetime` instances can be subtracted from each other, " -"and added to :class:`~datetime.timedelta` instances. The largest missing " -"feature is that there's no standard library support for parsing strings and " -"getting back a :class:`~datetime.date` or :class:`~datetime.datetime`." +"the same as that of :meth:`~datetime.datetime.isoformat`). :class:" +"`~datetime.date` and :class:`~datetime.datetime` instances can be subtracted " +"from each other, and added to :class:`~datetime.timedelta` instances. The " +"largest missing feature is that there's no standard library support for " +"parsing strings and getting back a :class:`~datetime.date` or :class:" +"`~datetime.datetime`." msgstr "" #: ../../whatsnew/2.3.rst:1727 @@ -2845,8 +2837,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1756 msgid "" -"Parsing a command line is then done by calling " -"the :meth:`~optparse.OptionParser.parse_args` method. ::" +"Parsing a command line is then done by calling the :meth:`~optparse." +"OptionParser.parse_args` method. ::" msgstr "" #: ../../whatsnew/2.3.rst:1758 @@ -2965,23 +2957,22 @@ msgstr "" #: ../../whatsnew/2.3.rst:1842 msgid "" "To allocate and free an undistinguished chunk of memory use the \"raw " -"memory\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, " -"and :c:func:`PyMem_Free`." +"memory\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:" +"func:`PyMem_Free`." msgstr "" #: ../../whatsnew/2.3.rst:1845 msgid "" "The \"object memory\" family is the interface to the pymalloc facility " "described above and is biased towards a large number of \"small\" " -"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, " -"and :c:func:`PyObject_Free`." +"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, and :c:" +"func:`PyObject_Free`." msgstr "" #: ../../whatsnew/2.3.rst:1849 msgid "" -"To allocate and free Python objects, use the \"object\" " -"family :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, " -"and :c:func:`PyObject_Del`." +"To allocate and free Python objects, use the \"object\" family :c:macro:" +"`PyObject_New`, :c:macro:`PyObject_NewVar`, and :c:func:`PyObject_Del`." msgstr "" #: ../../whatsnew/2.3.rst:1852 @@ -2989,8 +2980,8 @@ msgid "" "Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides " "debugging features to catch memory overwrites and doubled frees in both " "extension modules and in the interpreter itself. To enable this support, " -"compile a debugging version of the Python interpreter by " -"running :program:`configure` with :option:`!--with-pydebug`." +"compile a debugging version of the Python interpreter by running :program:" +"`configure` with :option:`!--with-pydebug`." msgstr "" #: ../../whatsnew/2.3.rst:1858 @@ -3025,16 +3016,15 @@ msgstr "Python 建置程序和 C API 的變更包括:" msgid "" "The cycle detection implementation used by the garbage collection has proven " "to be stable, so it's now been made mandatory. You can no longer compile " -"Python without it, and the :option:`!--with-cycle-gc` switch " -"to :program:`configure` has been removed." +"Python without it, and the :option:`!--with-cycle-gc` switch to :program:" +"`configure` has been removed." msgstr "" #: ../../whatsnew/2.3.rst:1885 msgid "" -"Python can now optionally be built as a shared library " -"(:file:`libpython2.3.so`) by supplying :option:`!--enable-shared` when " -"running Python's :program:`configure` script. (Contributed by Ondrej " -"Palkovsky.)" +"Python can now optionally be built as a shared library (:file:`libpython2.3." +"so`) by supplying :option:`!--enable-shared` when running Python's :program:" +"`configure` script. (Contributed by Ondrej Palkovsky.)" msgstr "" #: ../../whatsnew/2.3.rst:1889 @@ -3049,8 +3039,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1894 msgid "" "The interpreter can be compiled without any docstrings for the built-in " -"functions and modules by supplying :option:`!--without-doc-strings` to " -"the :program:`configure` script. This makes the Python executable about 10% " +"functions and modules by supplying :option:`!--without-doc-strings` to the :" +"program:`configure` script. This makes the Python executable about 10% " "smaller, but will also mean that you can't get help for Python's built-ins. " "(Contributed by Gustavo Niemeyer.)" msgstr "" @@ -3069,9 +3059,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1907 msgid "" ":c:func:`PyArg_ParseTuple` accepts new format characters for various sizes " -"of unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` " -"for :c:expr:`unsigned short int`, ``I`` for :c:expr:`unsigned int`, and " -"``K`` for :c:expr:`unsigned long long`." +"of unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` for :c:expr:" +"`unsigned short int`, ``I`` for :c:expr:`unsigned int`, and ``K`` for :c:" +"expr:`unsigned long long`." msgstr "" #: ../../whatsnew/2.3.rst:1912 @@ -3083,9 +3073,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1915 msgid "" "File objects now manage their internal string buffer differently, increasing " -"it exponentially when needed. This results in the benchmark tests " -"in :file:`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds " -"to 1.7 seconds, according to one measurement)." +"it exponentially when needed. This results in the benchmark tests in :file:" +"`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds to 1.7 " +"seconds, according to one measurement)." msgstr "" #: ../../whatsnew/2.3.rst:1920 @@ -3104,12 +3094,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:1927 msgid "" "If you dynamically allocate type objects in your extension, you should be " -"aware of a change in the rules relating to the :attr:`~type.__module__` " -"and :attr:`~type.__name__` attributes. In summary, you will want to ensure " -"the type's dictionary contains a ``'__module__'`` key; making the module " -"name the part of the type name leading up to the final period will no longer " -"have the desired effect. For more detail, read the API reference " -"documentation or the source." +"aware of a change in the rules relating to the :attr:`~type.__module__` and :" +"attr:`~type.__name__` attributes. In summary, you will want to ensure the " +"type's dictionary contains a ``'__module__'`` key; making the module name " +"the part of the type name leading up to the final period will no longer have " +"the desired effect. For more detail, read the API reference documentation " +"or the source." msgstr "" #: ../../whatsnew/2.3.rst:1938 @@ -3121,11 +3111,11 @@ msgid "" "Support for a port to IBM's OS/2 using the EMX runtime environment was " "merged into the main Python source tree. EMX is a POSIX emulation layer " "over the OS/2 system APIs. The Python port for EMX tries to support all the " -"POSIX-like capability exposed by the EMX runtime, and mostly " -"succeeds; :func:`!fork` and :func:`fcntl` are restricted by the limitations " -"of the underlying emulation layer. The standard OS/2 port, which uses IBM's " -"Visual Age compiler, also gained support for case-sensitive import semantics " -"as part of the integration of the EMX port into CVS. (Contributed by Andrew " +"POSIX-like capability exposed by the EMX runtime, and mostly succeeds; :func:" +"`!fork` and :func:`fcntl` are restricted by the limitations of the " +"underlying emulation layer. The standard OS/2 port, which uses IBM's Visual " +"Age compiler, also gained support for case-sensitive import semantics as " +"part of the integration of the EMX port into CVS. (Contributed by Andrew " "MacIntyre.)" msgstr "" @@ -3146,8 +3136,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1957 msgid "" -"Other new platforms now supported by Python include AtheOS (http://" -"www.atheos.cx/), GNU/Hurd, and OpenVMS." +"Other new platforms now supported by Python include AtheOS (http://www." +"atheos.cx/), GNU/Hurd, and OpenVMS." msgstr "" #: ../../whatsnew/2.3.rst:1966 @@ -3217,11 +3207,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:2006 msgid "" -"A nifty new feature is that trace functions can now assign to " -"the :attr:`~frame.f_lineno` attribute of frame objects, changing the line " -"that will be executed next. A ``jump`` command has been added to " -"the :mod:`pdb` debugger taking advantage of this new feature. (Implemented " -"by Richie Hindle.)" +"A nifty new feature is that trace functions can now assign to the :attr:" +"`~frame.f_lineno` attribute of frame objects, changing the line that will be " +"executed next. A ``jump`` command has been added to the :mod:`pdb` debugger " +"taking advantage of this new feature. (Implemented by Richie Hindle.)" msgstr "" #: ../../whatsnew/2.3.rst:2015 @@ -3270,10 +3259,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:2039 msgid "" -"Large octal and hex literals such as ``0xffffffff`` now trigger " -"a :exc:`FutureWarning`. Currently they're stored as 32-bit numbers and " -"result in a negative value, but in Python 2.4 they'll become positive long " -"integers." +"Large octal and hex literals such as ``0xffffffff`` now trigger a :exc:" +"`FutureWarning`. Currently they're stored as 32-bit numbers and result in a " +"negative value, but in Python 2.4 they'll become positive long integers." msgstr "" #: ../../whatsnew/2.3.rst:2043